/* glyphfield's skin: a gallery wall. "Pink-white plaster, the artwork full-bleed, a museum placard as
   the only UI." The painting is the server's HTML; CSS transitions paint the time between two states.
   One extra family, Fraunces (opsz, wght, SOFT), loaded by the plate. Scoped to its stage (SPEC §6). */
@layer skin {
  @scope ([data-skin="glyphfield"]) {
    :scope {
      --skin-accent: oklch(0.88 0.11 330);
      --skin-bg: oklch(0.955 0.012 345);
      --skin-ink: oklch(0.3 0.06 345);
      --skin-font: 'Fraunces', Georgia, serif;
      --plum: oklch(0.29 0.13 350);
      --drift: 2.8s;
      font-family: var(--skin-font);
      background-image:
        radial-gradient(60% 55% at 42% 0%, oklch(1 0 0 / 0.85), transparent 75%),
        linear-gradient(oklch(0.97 0.01 345), oklch(0.92 0.018 345));
    }

    .gf {
      display: grid; gap: clamp(1rem, 4cqi, 2.25rem); align-items: end;
      padding: clamp(0.5rem, 4cqi, 2.75rem) clamp(0rem, 2cqi, 1.5rem) clamp(0.5rem, 2.5cqi, 1.5rem);
    }
    @container (width > 44rem) { .gf { grid-template-columns: minmax(0, 1fr) 11rem; } }
    /* Mid-size stages (a tablet plate, the hub's fixed-height Featured window): hang the placard beside
       a narrower canvas so the label stays in view instead of falling below the fold of the window */
    @container (30rem < width <= 44rem) {
      .gf {
        grid-template-columns: minmax(0, 25rem) minmax(0, 13rem); justify-content: center; align-items: center;
        padding-block: clamp(0.25rem, 1.5cqi, 0.75rem);
      }
    }

    /* The work, hung: a pink ground, plum glyphs, the shadow of a stretcher bar */
    .gf__canvas {
      position: relative;
      container-type: inline-size;
      display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
      padding: 2.5cqi;
      background: var(--skin-accent);
      color: var(--plum);
      box-shadow:
        0 1px 0 oklch(1 0 0 / 0.55) inset,
        0 2px 3px oklch(0.3 0.08 345 / 0.2),
        0 34px 46px -26px oklch(0.3 0.09 345 / 0.5);
    }
    /* One glyph. The server sends --w (weight), --s (softness), --r (tilt) and --o (ink); morph
       changes only those attributes, and these transitions do the rest. */
    .gf__canvas i {
      display: grid; place-items: center; aspect-ratio: 1;
      font: 400 7.6cqi / 1 var(--skin-font); font-style: normal;
      font-variation-settings: 'opsz' 144, 'wght' var(--w, 400), 'SOFT' var(--s, 50);
      rotate: var(--r, 0deg);
      color: color-mix(in oklch, var(--plum) calc(25% + var(--o, 0.5) * 75%), var(--skin-accent));
      transition:
        font-variation-settings var(--drift) ease-in-out,
        rotate var(--drift) ease-in-out,
        color var(--drift) ease-in-out;
    }

    /* The placard: the only UI, and part of the response like everything else */
    .gf__placard {
      position: relative;
      justify-self: start; max-inline-size: 15rem;
      padding: 0.85rem 1rem 0.9rem;
      background: oklch(0.99 0.004 345); color: var(--skin-ink);
      box-shadow: 0 1px 2px oklch(0.3 0.05 345 / 0.22), 0 0 0 1px oklch(0.3 0.05 345 / 0.06);
      font-size: 0.875rem; line-height: 1.35;
      font-variation-settings: 'opsz' 14;
    }
    @container (width > 44rem) { .gf__placard { justify-self: stretch; margin-block-end: 0.5rem; } }
    .gf__who { font-weight: 600; font-variation-settings: 'opsz' 14, 'wght' 600; }
    .gf__what i { font-style: italic; }
    .gf__how {
      margin-block: 0.45rem 0.6rem; font-size: 0.78rem; color: color-mix(in oklch, var(--skin-ink) 72%, white);
      & span { font: 400 0.92em var(--mono); }
    }
    .gf__when {
      padding-block-start: 0.45rem; border-top: 1px solid color-mix(in oklch, var(--skin-ink) 25%, transparent);
      font: 400 0.6875rem / 1.4 var(--mono); letter-spacing: 0.04em; font-variant-numeric: tabular-nums;
      & [data-note] { margin-inline-end: 0.4rem; }
    }

    /* Frame-owned pins (A–D), placed where the plate's notes point */
    .gf__canvas > [data-note] { position: absolute; line-height: 1; }
    .gf__canvas > [data-note="A"] { top: 0.4rem; left: 0.5rem; }
    .gf__canvas > [data-note="B"] { bottom: 0.4rem; right: 0.6rem; }
    .gf__placard > [data-note] { position: absolute; top: 0.45rem; right: 0.6rem; }

    @media (prefers-reduced-motion: reduce) { .gf__canvas i { transition: none; } }
  }
}
