/* ==========================================================================
   Rahmen und App zum Ausprobieren (.frame): links das Tablet mit Diashow und
   Menü, rechts das Handy, dazwischen das WLAN. Auf schmalen Seiten untereinander.

   Auf dem Display gelten Farben und Aufbau des echten Rahmens (warm, dunkel,
   Serifen für Zahlen). Maße in cqw: Anteile der Displaybreite.
   ========================================================================== */

/* Die Bühne gibt ein Seitenverhältnis vor; der Rahmen bestimmt seine Höhe selbst */
.case-stage .project-visual:has(> .frame) { grid-template-columns: minmax(0, 1fr); aspect-ratio: auto; place-items: stretch; }

.frame { width: 100%; min-width: 0; margin: 0; border: 0; border-radius: 0; background: none; }
.frame p { margin: 0; }
.frame .demo-head,
.frame-info { background: var(--c-dark); }
.frame .demo-title { font-size: 1.15rem; line-height: 1.3; }
.frame-run { display: flex; align-items: center; gap: 0.85rem; }
.frame-next { font: 400 0.74rem/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--d-ink-3); }
.frame.is-held .frame-next { opacity: 0.5; }

.frame-board {
  --air: 14rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--air) 12.5rem;
  align-items: center;
  padding: clamp(1.25rem, 3vw, 2.5rem) clamp(1rem, 3vw, 2.25rem);
}

/* ---- Tablet: schwarzes Glas, Standfuß als Zylinder --------------------------- */
.frame-tablet { position: relative; z-index: 1; filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.5)); }
.frame-tablet .screen {
  container-type: inline-size;
  position: relative;
  border: solid #0b0e12;
  border-width: clamp(10px, 2.4vw, 26px) clamp(10px, 2.2vw, 24px) clamp(14px, 3vw, 32px);
  border-radius: 16px 16px 0 0;
  background: #000;
  background-clip: padding-box;
  outline: 1.5px solid #c6ccd3;
  outline-offset: -1px;
  overflow: hidden;
}
/* 16:10 ohne den Rand (aspect-ratio würde ihn mitzählen) */
.frame-tablet .screen::before { content: ""; display: block; padding-top: 62.5%; }
.frame-tablet .screen > * { position: absolute; }
.frame-foot {
  position: relative;
  height: clamp(18px, 3.6vw, 40px);
  margin-inline: -3px;
  border-radius: 4px 4px 999px 999px / 4px 4px 60% 60%;
  background: linear-gradient(180deg, #7f868e 0%, #e9ecef 16%, #cdd2d8 38%, #a2a9b1 72%, #5e656d 100%);
}
/* Lautsprecher links und rechts, dazwischen die Fuge des Standfußes */
.frame-foot::before {
  content: "";
  position: absolute;
  inset: 24% 2.5% 40%;
  background:
    radial-gradient(circle, #4a5159 0.8px, transparent 1.1px) left / 4px 4px,
    radial-gradient(circle, #4a5159 0.8px, transparent 1.1px) right / 4px 4px;
  -webkit-mask: linear-gradient(90deg, #000 7%, transparent 0 93%, #000 0);
  mask: linear-gradient(90deg, #000 7%, transparent 0 93%, #000 0);
}
.frame-foot::after { content: ""; position: absolute; inset: 20% 12% auto; height: 1px; background: #6b727a; }

/* ---- Diashow ------------------------------------------------------------------ */
.frame-slides { inset: 0; isolation: isolate; }
/* Das neue Bild blendet über dem alten ein; das bleibt so lange stehen */
.frame-slide { --fade: 1.1s; position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transition: opacity 0s var(--fade); }
.frame-slide.is-on { z-index: 1; opacity: 1; transition: opacity var(--fade) ease-in-out; }
.frame-slide picture { display: contents; }
.frame-slide > *, .frame-slide img { grid-area: 1 / 1; }
.frame-slide img { display: block; height: 100%; width: auto; max-width: none; min-height: 0; }
.frame-bars { width: 100%; height: 100%; }
/* Die Bildkante läuft wie auf dem Rahmen über 12 Pixel (von 1280) in den Rand aus */
.frame-bars ~ picture img {
  --edge: 0.94cqw;
  -webkit-mask: linear-gradient(90deg, transparent, #000 var(--edge) calc(100% - var(--edge)), transparent);
  mask: linear-gradient(90deg, transparent, #000 var(--edge) calc(100% - var(--edge)), transparent);
}

.frame-hud { left: 3.1cqw; top: 2.6cqw; color: #fff; text-shadow: 0 0.16cqw 1.1cqw rgba(0, 0, 0, 0.75); pointer-events: none; }
.frame-hud span { display: block; }
.frame-hud .frame-clock { font: 400 8.4cqw/1 Georgia, "Times New Roman", serif; }
.frame-hud .frame-date { margin-top: 0.6cqw; font: 400 2.2cqw/1.2 Georgia, "Times New Roman", serif; }
.is-clockless .frame-hud { visibility: hidden; }
.frame-cap {
  right: 3.1cqw; bottom: 2.8cqw;
  padding: 0.7cqw 1.4cqw;
  border-radius: 0.8cqw;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font: 400 max(2cqw, 0.7rem)/1.3 Georgia, "Times New Roman", serif;
  transition: opacity 0.8s ease;
}
.js .frame-cap:not(.is-on),
.is-touched .frame-cap,
.is-open .frame-cap { opacity: 0; }

/* Tippen blendet die Knöpfe ein */
.frame-touch { inset: 0; width: 100%; height: 100%; border: 0; background: none; cursor: pointer; }
.frame-touch:disabled { cursor: default; }
.frame-touch:focus-visible { outline: 3px solid #e4c27a; outline-offset: -6px; }
.frame-key {
  min-width: 2.1rem;
  min-height: 2.1rem;
  padding: 0.9cqw 1.7cqw;
  border: 1px solid #e4c27a;
  border-radius: 0;
  background: #1c1916;
  color: #e4c27a;
  font: 400 max(2.2cqw, 0.82rem)/1 Georgia, "Times New Roman", serif;
  cursor: pointer;
}
.frame-key:hover, .frame-key[aria-pressed="true"] { background: #e4c27a; color: #1c1916; }
.frame-key:active { background: #f3dca6; color: #1c1916; }
.frame :is(.frame-key, .fu-tile, .fs-switch, .frame-wake):focus-visible { outline: 3px solid #f3efe6; outline-offset: 2px; }
.frame-reveal {
  inset: auto 2.8cqw 2.4cqw;
  display: flex;
  gap: 1.2cqw;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.frame-reveal [data-open] { margin-right: auto; }
.is-touched .frame-reveal { opacity: 1; pointer-events: auto; }
.is-open .frame-reveal, html:not(.js) .frame-reveal { display: none; }

/* ---- Seiten auf dem Display --------------------------------------------------- */
.frame-page {
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 3.4cqw 4.4cqw 2.4cqw;
  background: #141210;
  color: #f3efe6;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.4cqw;
}
.frame-page[hidden] { display: none; }
.frame-page ol, .frame-page ul { list-style: none; margin: 0; padding: 0; }
.frame-page small { display: block; color: #bdb3a6; }
.frame-bar { display: flex; align-items: center; justify-content: space-between; gap: 2cqw; margin-top: auto !important; padding-top: 1.4cqw; color: #9a9186; font-size: max(1.7cqw, 0.62rem); }
.frame-dark { place-content: center; align-items: center; background: #000; color: #8d857a; }
.frame-wake { padding: 2cqw; border: 0; background: none; color: inherit; font: inherit; font-size: max(2.4cqw, 0.8rem); cursor: pointer; }

/* Menü: Uhr, Wetter und Kacheln */
.fu-head { display: flex; justify-content: space-between; align-items: flex-end; padding-bottom: 2.4cqw; }
.fu-clock { display: block; font-size: 11cqw; line-height: 0.9; color: #e4c27a; }
.fu-date { display: block; margin-top: 1cqw; font-size: 2.6cqw; }
.fu-wx { display: flex; align-items: center; gap: 1.4cqw; font-size: 2.4cqw; color: #e7e0d6; }
.fu-wx svg { width: 5cqw; height: 5cqw; color: #e4c27a; }
.fu-wx b { font-weight: 400; font-size: 5cqw; color: #f3efe6; line-height: 1; }
.fu-grid { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 1.6cqw; }
.fu-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6cqw;
  border: 1px solid #4a4239;
  border-radius: 0.8cqw;
  background: none;
  color: inherit;
  font: 400 max(2.4cqw, 0.66rem)/1.25 Georgia, "Times New Roman", serif;
  text-align: center;
  cursor: pointer;
}
.fu-tile:hover { background: #1e1a16; border-color: #e4c27a; }
.fu-tile small { font-size: max(1.9cqw, 0.58rem); }
.fu-tile svg { width: 5.6cqw; height: 5.6cqw; margin-bottom: 0.4cqw; fill: none; stroke: #e4c27a; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fu-tile svg .fill { fill: #e4c27a; stroke: none; }
.fu-foot { padding-top: 1.6cqw; text-align: center; font-size: 2.1cqw; color: #bdb3a6; }
.fu-foot b { color: #c4a574; font-weight: 400; }

.frame-off.is-armed { border-color: #6a4038; background: #241614; color: #f0b0a4; }
.frame-off.is-armed svg { stroke: #f0b0a4; }

/* Wetter */
.fw-now { display: flex; align-items: center; gap: 2cqw; }
.fw-now svg { width: 8cqw; color: #e4c27a; }
.fw-now b { font-size: 7.4cqw; font-weight: 400; line-height: 1; }
.fw-now p { line-height: 1.35; }
.fw-now small { font-size: 0.85em; }
.fw-hours { position: relative; margin-top: 1.6cqw; border-block: 1px solid #5c5348; }
.fw-hours svg { display: block; width: 100%; height: 16cqw; }
.fw-line { fill: none; stroke: #e4c27a; stroke-width: 2; vector-effect: non-scaling-stroke; }
.fw-area { fill: rgba(228, 194, 122, 0.13); }
.frame-page .fw-hours ol, .frame-page .fw-days { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; text-align: center; padding-block: 1cqw; }
.fw-hours span, .fw-days span { display: block; color: #bdb3a6; font-size: 0.82em; }
.fw-days li:first-child span { color: #e4c27a; }
.fw-days li { color: #bdb3a6; }
.fw-days b { margin-right: 0.8cqw; color: #f3efe6; font-weight: 400; }

/* Rezept und Einstellungen */
.fr-title { font-size: 4.4cqw; line-height: 1.2; color: #e4c27a; }
.fr-title small { margin-top: 0.4cqw; font-size: 2.1cqw; }
.fr-portions { display: flex; align-items: center; gap: 2cqw; padding-block: 1.2cqw !important; }
.fr-portions span { min-width: 18cqw; text-align: center; }
.fr-portions b { color: #e4c27a; font-weight: 400; font-size: 1.3em; font-variant-numeric: tabular-nums; }
.fr-list li { display: grid; grid-template-columns: 11cqw 1fr; gap: 2cqw; padding-block: 0.6cqw; border-top: 1px solid #3a342c; }
.fr-list b { color: #e4c27a; font-weight: 400; text-align: right; font-variant-numeric: tabular-nums; }
.fs-row { display: flex; align-items: center; justify-content: space-between; gap: 2cqw; margin-top: 2cqw; padding-block: 1.6cqw; border-top: 1px solid #5c5348; }
.fs-row .frame-key + .frame-key { margin-left: 1cqw; }
.fs-switch { position: relative; width: 3.4rem; height: 1.9rem; border: 1px solid #e4c27a; border-radius: 999px; background: #1c1916; cursor: pointer; }
.fs-switch::before { content: ""; position: absolute; top: 4px; left: 5px; width: 1.25rem; height: 1.25rem; border-radius: 50%; background: #9a9186; transition: transform 0.25s var(--ease); }
.fs-switch[aria-checked="true"] { background: #e4c27a; }
.fs-switch[aria-checked="true"]::before { background: #1c1916; transform: translateX(1.4rem); }

/* Akkustand */
.frame-page[data-page="battery"] { align-items: center; text-align: center; }
.frame-page[data-page="battery"] .frame-bar { align-self: stretch; }
.fb-label { margin-top: 1cqw !important; color: #e7e0d6; }
.fb-level { font-size: 11.5cqw; line-height: 1.05; }
.fb-cell { position: relative; width: 27cqw; height: 3.6cqw; margin-top: 1.2cqw !important; border: 2px solid #e7e0d6; }
.fb-cell::after { content: ""; position: absolute; top: 25%; right: -1.1cqw; width: 0.7cqw; height: 50%; background: #e7e0d6; }
.fb-cell span { position: absolute; inset: 3px auto 3px 3px; width: 33%; background: #e4c27a; }
.fb-state { margin-top: 1.6cqw !important; }
.fb-limit { margin-top: 1cqw !important; color: #bdb3a6; }
.fb-limit b { color: #e4c27a; font-weight: 400; }

/* ---- WLAN und Pakete ---------------------------------------------------------- */
.frame-air {
  position: relative;
  align-self: stretch;
  background: repeating-linear-gradient(90deg, var(--d-line-2) 0 5px, transparent 5px 11px) center / 100% 1.5px no-repeat;
  color: var(--d-ink-3);
}
.frame-air.is-live { color: var(--d-signal); }
.frame-wifi { position: absolute; left: 0; right: 0; bottom: calc(50% + 2rem); display: grid; justify-items: center; gap: 0.3rem; font: 400 0.74rem/1 var(--font-mono); transition: color 0.3s var(--ease); }
.frame-wifi svg { width: 1.9rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.is-offline .frame-air { background-image: repeating-linear-gradient(90deg, var(--d-line) 0 2px, transparent 2px 11px); }
.is-offline .frame-wifi { color: var(--d-no); text-decoration: line-through; }
.is-offline .frame-wifi svg { opacity: 0.35; }
.frame-packet {
  --_k: var(--d-accent);
  position: absolute;
  left: calc(var(--p) * 100%);
  top: 50%;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.6rem;
  border-radius: 2px;
  background: var(--_k);
  color: var(--c-dark);
  font: 600 0.82rem/1 var(--font-mono);
  white-space: nowrap;
  transform: translate(-50%, -50%);
}
.frame-packet[data-kind="photo"] { --_k: #f3efe6; padding: 0.25rem 0.6rem 0.25rem 0.25rem; }
.frame-packet[data-kind="yes"], .frame-packet[data-kind="saved"] { --_k: var(--d-ok); }
.frame-packet[data-kind="no"] { --_k: var(--d-signal); }
.frame-packet img { display: block; width: 2.9rem; height: 1.9rem; object-fit: cover; }

/* ---- Handy -------------------------------------------------------------------- */
.frame .frame-phone { z-index: 1; width: 100%; max-width: none; aspect-ratio: auto; transform: none; padding: 7px; border-radius: 28px; background: #1b222c; box-shadow: 0 0 0 1px rgba(230, 237, 245, 0.16); }
.frame-phone .screen { gap: 0.6rem; padding: 1.9rem 0.6rem 0.8rem; border-radius: 22px; background: #f7f8fa; color: #0a0f17; }
.fp-bar { padding-inline: 0.2rem; font: 600 1.05rem/1.2 var(--font-sans); letter-spacing: -0.01em; }
.fp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.3rem; list-style: none; margin: 0; padding: 0; }
.fp-grid button { position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; border-radius: 6px; background: #dfe4ea; overflow: hidden; cursor: pointer; }
.fp-grid button:disabled { cursor: default; }
.fp-grid img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s var(--ease); }
@media (hover: hover) { .fp-grid button:not(:disabled):hover img { transform: scale(1.06); } }
.frame .fp-grid button:focus-visible { outline: 3px solid #1167b1; outline-offset: 1px; }
.fp-state { position: absolute; inset: auto 0 0; padding: 0.28rem 0.2rem; background: rgba(10, 15, 23, 0.8); color: #fff; font: 500 0.68rem/1.1 var(--font-sans); text-align: center; }
.fp-state:empty { display: none; }
[data-state="stored"] .fp-state { background: #0b7a5e; }
[data-state="known"] .fp-state { background: #1167b1; }
[data-state="wait"] .fp-state { background: #8a5a00; }
.fp-app { padding: 0.5rem 0.2rem 0; border-top: 1px solid rgba(10, 15, 23, 0.12); color: #465262; font-size: 0.74rem; line-height: 1.4; }
.fp-app b { display: block; color: #0a0f17; font-weight: 600; }

/* ---- Weg eines Fotos, Erklärung, Knöpfe ----------------------------------------- */
.frame-info {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.9rem 1.5rem;
  align-items: center;
  padding: 1rem 1.1rem 1.1rem;
  border-top: 1px solid var(--d-line);
}
.frame-steps { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.4rem; list-style: none; margin: 0; padding: 0; }
.frame-steps li { --_c: var(--d-line-2); padding-top: 0.55rem; border-top: 3px solid var(--_c); font-size: 0.82rem; line-height: 1.3; color: var(--d-ink-3); transition: color 0.3s var(--ease), border-color 0.3s var(--ease); }
.frame-steps .is-now { --_c: var(--d-accent); color: var(--c-dark-ink); font-weight: 600; }
.frame-steps .is-done { --_c: var(--d-ok); color: var(--c-dark-ink-2); }
.frame-steps .is-wait { --_c: var(--d-wait); color: var(--d-wait); }
.frame-steps .is-skip { border-top-style: dashed; text-decoration: line-through; }
.frame-say { min-height: 3.1em; max-width: 46rem; font-size: 1rem; line-height: 1.55; color: var(--c-dark-ink); }
.frame-controls { display: none; gap: 0.4rem; }
.js .frame-controls { display: flex; }
.frame-controls [data-act="toggle"] { min-width: 6rem; }
.frame-controls [data-act="wifi"] { min-width: 10rem; }

@media (max-width: 1080px) {
  .frame-board { --air: 10.5rem; grid-template-columns: minmax(0, 1fr) var(--air) 10.5rem; }
}
/* Untereinander: das WLAN läuft jetzt senkrecht */
@media (max-width: 860px) {
  .frame-board { grid-template-columns: minmax(0, 1fr); padding-inline: 0.85rem; }
  .frame-air {
    height: 10rem;
    background: repeating-linear-gradient(180deg, var(--d-line-2) 0 5px, transparent 5px 11px) center / 1.5px 100% no-repeat;
  }
  .is-offline .frame-air { background-image: repeating-linear-gradient(180deg, var(--d-line) 0 2px, transparent 2px 11px); }
  .frame-wifi { left: calc(50% + 4rem); right: auto; bottom: 50%; transform: translateY(50%); }
  .frame-packet { left: 50%; top: calc(var(--p) * 100%); }
  .frame .frame-phone { width: min(100%, 24rem); justify-self: center; }
  .fp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .frame-info { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .frame-info { padding-inline: 0.85rem; }
  .frame-next { display: none; }
  .frame-steps li { font-size: 0.68rem; overflow-wrap: anywhere; hyphens: auto; }
  .frame-say { min-height: 6.2em; }
  .frame-controls .demo-btn { flex: 1 1 auto; min-width: 0; }
  /* Offene Seiten brauchen Höhe, damit Schrift und Tasten groß genug bleiben */
  .frame-tablet .screen.is-open::before { min-height: 15.5rem; }
  .frame-page { padding: 2.6cqw 3.4cqw 2cqw; font-size: max(2.6cqw, 0.6rem); }
}
