/* Featured: one project a week, live, in its own skin. The stage box is p-exhibit.css's (the frame's one
   stage); this file only places the parts and fixes the stage's height so a rotation never moves the page. */
@layer featured {
  .featured { display: grid; gap: 0.9rem; padding-block-start: 1rem; border-top: 1px solid var(--hair-strong); }

  .featured__label {
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem;
    font: 400 var(--fs-label) / 1.45 var(--mono); letter-spacing: 0.06em; color: var(--ink-3);
  }
  .featured__title {
    font: 500 var(--fs-label) / 1.45 var(--mono); letter-spacing: var(--track-label); text-transform: uppercase;
    color: var(--ink);
    &::before {
      content: ''; display: inline-block; inline-size: 0.55em; block-size: 0.55em; margin-inline-end: 0.6em;
      border-radius: 50%; background: var(--accent);
    }
  }

  /* Reserved height (no CLS on load, no shift on rotation): the tallest fragment in the rotation at each
     width, measured at 320-1920 and fitted to lines (three bands: phones, 40-64rem, 64rem+). The rotation is
     real projects only (tools/site/hub.mjs), today hyperplot alone, without a Next button (it shares the
     actions row when it comes). Re-measure when a fragment's copy changes or a project joins the rotation. */
  .featured__slot {
    display: grid; gap: 0.9rem; align-content: start;
    grid-template-areas: "head" "fig" "notes" "act";
    min-block-size: max(35.5rem, 44.25rem - 21vw);
  }
  .featured__fallback { font: 400 var(--fs-mono) / 1.4 var(--mono); & a { display: inline-flex; align-items: center; min-block-size: 44px; } }

  /* Head: No. and class, the name (a link to its page), the tagline, the people */
  .featured__head {
    grid-area: head;
    display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 0.15rem 1.25rem;
  }
  .featured__no {
    grid-column: 1 / -1;
    display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem;
    font: 500 var(--fs-label) / 1.4 var(--mono); letter-spacing: var(--track-label); text-transform: uppercase;
    color: var(--ink-3);
    & b { font-weight: 500; color: var(--ink); }
  }
  /* a dated register note ("First tenant"): frame ink, never red, as on the tile */
  .featured__note { padding-inline: 0.35rem; border: 1px solid var(--hair-strong); color: var(--ink); }
  .featured__name {
    font-size: clamp(2.25rem, 1.8rem + 1vw, 2.875rem); line-height: 1; letter-spacing: -0.04em;
    & a { display: inline-block; padding-block: 0.1em 0.15em; text-decoration: none; }
    & a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
  }
  /* A logomark before the name (48px), inside the name's own line box so the reserved slot height holds */
  .featured__name:has(> .featured__mark) { display: flex; align-items: center; gap: 0.8rem; }
  .featured__mark { flex: none; inline-size: 3rem; block-size: 3rem; }
  .featured__tagline { font-size: 1.15rem; line-height: 1.25; font-style: italic; color: var(--ink-2); text-wrap: pretty; }
  .featured__meta {
    grid-column: 1 / -1;
    font: 400 var(--fs-label) / 1.5 var(--mono); letter-spacing: 0.06em; color: var(--ink-3);
    & b { font-weight: 400; color: var(--ink-2); }
  }

  /* The stage: fixed height per width band; the skin lays itself out inside it */
  .featured .exhibit { grid-area: fig; align-self: start; margin: 9px; }
  .featured .exhibit__stage { block-size: 14rem; } /* the frame stage minimum (p-exhibit.css) */

  /* Notes A-D to the figure */
  .featured__more { grid-area: notes; min-inline-size: 0; }
  /* The fold is for phones only (featured.js closes it there); from 40rem the notes always show */
  .featured__summary {
    display: flex; align-items: center; gap: 0.6rem; min-block-size: 44px;
    border-top: 1px solid var(--hair);
    font: 500 var(--fs-label) / 1 var(--mono); letter-spacing: var(--track-label); text-transform: uppercase;
    color: var(--ink-2); cursor: pointer; list-style: none;
    &::-webkit-details-marker { display: none; }
    &::before { content: '+'; inline-size: 1ch; font-size: 0.875rem; color: var(--accent-text); }
    &:hover { color: var(--ink); }
  }
  .featured__more[open] > .featured__summary::before { content: '\2212'; }
  @media (width >= 40rem) { .featured__summary { display: none; } }

  .featured__notes {
    counter-reset: note;
    font: 400 var(--fs-mono) / 1.5 var(--mono); color: var(--ink-2);

    & li {
      counter-increment: note;
      position: relative;
      padding-block: 0.55rem 0.65rem; padding-inline-start: 1.75rem;
      border-top: 1px solid var(--hair);
      text-wrap: pretty;
      &::before {
        content: counter(note, upper-alpha);
        position: absolute; inset-inline-start: 0; top: 0.45rem;
        font: italic 400 1.5rem / 1 var(--serif); color: var(--accent-text);
      }
    }
  }

  .featured__actions { grid-area: act; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem; }
  .featured__open {
    display: inline-flex; align-items: center; gap: 0.4rem; min-block-size: 44px;
    font: italic 400 1.35rem / 1 var(--serif); text-decoration-thickness: 1px;
    & span { color: var(--accent); font-style: normal; }
  }
  .featured__next {
    display: inline-flex; align-items: center; gap: 0.5rem; min-block-size: 44px; padding-inline: 0.9rem;
    border: 1px solid var(--hair-strong);
    font: 500 var(--fs-label) / 1 var(--mono); letter-spacing: var(--track-label); text-transform: uppercase;
    color: var(--ink-2); cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    &:hover { color: var(--ink); border-color: var(--ink); }
    &.htmx-request { cursor: progress; }
  }

  /* Phones: Featured follows the project list (masthead.css orders it) and is trimmed to one screen or so.
     The rotation rule is read, not shown; the meta line keeps one line, people first (the project's row below has it in full); the
     notes become a swipeable strip. */
  @media (width < 40rem) {
    .featured__rule {
      position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden;
      clip-path: inset(50%); white-space: nowrap;
    }
    .featured__head { grid-template-columns: minmax(0, 1fr); }
    .featured__meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .featured__notes {
      display: grid; grid-auto-flow: column; grid-auto-columns: minmax(15rem, 82%); gap: var(--col-gap);
      overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
      scrollbar-width: thin; scrollbar-color: var(--hair-strong) transparent;
      & li { scroll-snap-align: start; padding-block-end: 0.8rem; }
    }
    .featured, .featured__slot { gap: 0.7rem; }
    .featured { padding-block-start: 0.75rem; }
    .featured__actions { gap: 0.35rem 1.25rem; }
    /* 'Next' alone on phones; the accessible name keeps the visible word and adds the project */
    .featured__next-name {
      position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden;
      clip-path: inset(50%); white-space: nowrap;
    }
  }
  /* From 40rem: notes A-D in two columns under the stage they annotate (the pins inside it carry the same
     letters), then the project page and Next. Wide (64rem+) the slot is cols 6-12 of the opening grid. */
  @media (width >= 40rem) {
    .featured__notes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--col-gap); }
  }
  @media (40rem <= width < 64rem) {
    .featured .exhibit__stage { block-size: 21rem; }
    .featured__slot { min-block-size: max(45.5rem, 56.75rem - 17vw); }
  }
  @media (width >= 64rem) {
    .featured .exhibit__stage { block-size: 22rem; }
    .featured__notes { font-size: 0.75rem; }
    .featured__slot { min-block-size: max(46rem, 58.25rem - 11.4vw); }
  }
}
