@charset "UTF-8";
/* ==========================================================================
   Preview Studio — page chrome
   Loaded only on studio.html and preview.html.
   ========================================================================== */

@layer components {

  .studio {
    /* A fixed height, not a min-height. The stage measures itself to size the
       device frame, so if the stage were free to grow with its contents the
       two would chase each other upwards on every resize. */
    --panel-w: 23rem;
    display: grid;
    grid-template-columns: var(--panel-w) 1fr;
    gap: 0;
    height: calc(100svh - var(--header-h));
    min-height: 38rem;
    margin-top: var(--header-h);
  }
  @media (max-width: 1000px) {
    .studio { grid-template-columns: 1fr; height: auto; min-height: 0; }
  }

  /* ------------------------------------------------------------------ *
   * Control panel
   * ------------------------------------------------------------------ */
  .panel {
    border-inline-end: 1px solid var(--line);
    background: var(--surface);
    padding: var(--space-m) clamp(1.1rem, 2vw, 1.6rem) var(--space-l);
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
    overscroll-behavior: contain;
  }
  @media (max-width: 1000px) {
    .panel { overflow: visible; border-inline-end: 0; border-block-end: 1px solid var(--line); }
  }

  .panel__intro h1 { font-size: var(--step-2); }
  .panel__intro p { margin-top: 0.5rem; font-size: var(--step--1); color: var(--ink-soft); }

  .panel fieldset { border: 0; padding: 0; margin: var(--space-m) 0 0; }
  .panel legend {
    padding: 0;
    font-size: var(--step--2);
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: 0.75rem;
  }

  .panel select,
  .panel input[type="text"] {
    width: 100%;
    padding: 0.7rem 0.85rem;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }
  .panel select:focus-visible,
  .panel input:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent);
  }

  .panel__row { display: grid; gap: 0.8rem; }
  .panel__row label > span {
    display: block;
    font-size: var(--step--1);
    font-weight: 600;
    margin-bottom: 0.35rem;
  }

  /* -- Palette swatches ------------------------------------------------ */
  .swatch-set {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(6.4rem, 1fr));
    gap: 0.5rem;
  }
  .swatch {
    display: block;
    padding: 0.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
  }
  .swatch:hover { border-color: var(--line-strong); }
  /* :has() lets the label style itself from the state of the input it wraps,
     which keeps the markup to one element per option. */
  .swatch:has(:checked) {
    border-color: var(--accent);
    background: color-mix(in oklab, var(--accent) 8%, transparent);
  }
  .swatch:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
  .swatch__chips { display: flex; gap: 2px; height: 1.35rem; border-radius: 2px; overflow: hidden; }
  .swatch__chips i { flex: 1; }
  .swatch__chips i:nth-child(2) { flex: 0.7; }
  .swatch__name {
    display: block;
    margin-top: 0.4rem;
    font-size: var(--step--2);
    line-height: 1.25;
    color: var(--ink-soft);
  }
  .swatch:has(:checked) .swatch__name { color: var(--ink); font-weight: 600; }

  /* -- Style chips ------------------------------------------------------ */
  .chip-set { display: grid; gap: 0.4rem; }
  .chip {
    display: block;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
  }
  .chip:hover { border-color: var(--line-strong); }
  .chip:has(:checked) { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 8%, transparent); }
  .chip:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
  .chip__name { display: block; font-weight: 600; font-size: var(--step--1); }
  .chip__note { display: block; font-size: var(--step--2); color: var(--ink-soft); margin-top: 0.1rem; }

  /* -- Segmented toggles ------------------------------------------------ */
  .seg {
    display: inline-flex;
    padding: 3px;
    gap: 3px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
  }
  .seg button {
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-pill);
    font-size: var(--step--2);
    font-weight: 600;
    color: var(--ink-soft);
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  }
  .seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

  /* -- Photo ------------------------------------------------------------ */
  .photo-drop {
    display: block;
    padding: 0.9rem;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    text-align: center;
    font-size: var(--step--1);
    cursor: pointer;
    transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
  }
  .photo-drop:hover { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 6%, transparent); }
  .photo-drop strong { display: block; color: var(--accent); }
  .photo-status { margin-top: 0.4rem; font-size: var(--step--2); color: var(--ink-faint); }

  .panel__actions { margin-top: var(--space-m); display: grid; gap: 0.5rem; }
  .panel__actions .btn { width: 100%; }
  .panel__pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }

  /* ------------------------------------------------------------------ *
   * Preview stage
   * ------------------------------------------------------------------ */
  .stage-wrap {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-width: 0;
    min-height: 0;
    background:
      radial-gradient(60rem 40rem at 50% -10%, color-mix(in oklab, var(--accent) 9%, transparent), transparent 70%),
      var(--bg-alt);
  }

  .stage-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-s);
    padding: 0.85rem clamp(1rem, 2vw, 1.5rem);
    border-block-end: 1px solid var(--line);
  }
  .stage-id { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
  .stage-id__icon {
    width: 2.4rem; height: 2.4rem;
    flex: none;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--accent);
  }
  .stage-id__icon svg { width: 1.15rem; height: 1.15rem; }
  .stage-id__text { min-width: 0; }
  .stage-id__text strong {
    display: block;
    font-family: var(--font-display);
    font-size: var(--step-0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .stage-id__text span { display: block; font-size: var(--step--2); color: var(--ink-soft); }

  .stage {
    position: relative;
    min-height: 0;
    overflow: hidden;
  }
  @media (max-width: 1000px) { .stage { height: 72svh; min-height: 26rem; } }

  /* Absolutely positioned so the frame's own (large, scaled) box never
     contributes to the stage's height — see the note on .studio above. */
  #preview-frame {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-start: 50%;
    translate: -50% -50%;
    transform-origin: center center;
    border: 0;
    background: #fff;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
  }
  .stage[data-device="phone"] #preview-frame { border-radius: 1.6rem; }

  .recipe {
    font-size: var(--step--2);
    color: var(--ink-soft);
    padding: 0.6rem clamp(1rem, 2vw, 1.5rem);
    border-block-start: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1rem;
  }

  /* ------------------------------------------------------------------ *
   * Standalone full-screen preview (preview.html)
   * ------------------------------------------------------------------ */
  body.is-preview { margin: 0; padding: 0; overflow: hidden; }
  .preview-full { position: fixed; inset: 0; border: 0; width: 100%; height: 100%; }
  /* Sits clear of the generated site's own sticky bottom bar on a phone, and
     never wraps — a two-line badge over somebody's website looks like a bug. */
  .preview-badge {
    position: fixed;
    inset-block-end: calc(4rem + env(safe-area-inset-bottom));
    inset-inline-end: 0.75rem;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0.45rem 0.4rem 0.9rem;
    background: var(--ink);
    color: var(--bg);
    border-radius: var(--radius-pill);
    font-size: var(--step--2);
    white-space: nowrap;
    box-shadow: var(--shadow-lg);
    opacity: 0.4;
    transition: opacity var(--dur) var(--ease);
  }
  @media (min-width: 761px) {
    .preview-badge { inset-block-end: 1rem; }
  }
  .preview-badge:hover, .preview-badge:focus-within { opacity: 1; }
  .preview-badge a {
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: var(--ink);
    font-weight: 600;
  }
}
