/* Phase-02 reskin (DEC-127): projects screens. Tokens come from app.css :root.
   Covers: the Projects tab (hero carousel + "Waiting on you"), a Project page (photo header,
   phase head/segmented bar/tracklist), the Questions list, the question card, and the Answer
   sheet's own contents. Loads after app.css — every rule below overrides an older, pre-reskin
   one there on purpose; nothing here renames or removes a class/attribute app.css or app/test/
   already reads (brief rule 3) — `.phero`, `.pbar`, `.phead` and `.plist` keep their names, with
   `.segbar`/`.track` added alongside, exactly as the brief allows. */

/* ================================================================================================
   Projects tab — hero carousel (design "06 Project hero card", "project cards v2", v3's
   one-card-at-a-time carousel + page dots). app.css's own `.hero`/`.carousel`/`.pdots` already
   carry the right sizes and tokens (DEC-127 foundation); only the design's own finishing touches
   that file does not set are added here.
   ================================================================================================ */
.hero { border-radius: 30px; } /* v2/v3: 26px → 30px */
.hero::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); pointer-events: none;
}
@media (prefers-color-scheme: light) {
  .hero { box-shadow: 0 12px 28px rgba(20,30,80,.18); }
}
.hero .name {
  font-size: 64px; /* v2: 88px (block 06) → 64px, at the card's own new, smaller width */
}
/* The design's own two-tier "long names get smaller letters" (its own JS then fine-tunes this
   with a real pixel measurement app/hero-carousel.mjs deliberately does not reproduce — see that
   file's own header comment); a plainly smaller tier here is what the length-based `.s` class
   this app draws instead is FOR — the design's own cascade leaves `.name.s` larger than plain
   `.name` post-v2 (an authoring order issue, not a rule to reproduce), so this picks the tier the
   feature is obviously meant to have, not the literal, likely-unintended cascade result. */
.hero .name.s { font-size: 40px; }

/* "Waiting on you" (design's own S7): the counts this needs already show on each card's own pill
   (`.gp.q`); the full question cards below it need every open question's own text, which `GET
   /api/projects` (already fetched here) does not carry — only a per-project fetch this reskin step
   does not add would (brief: "visuals and markup only… no new fetches"). Left for a later step,
   per brief rule 4 — nothing is drawn in its place. */

/* Tag filter chips (design's `.chips`, "All / Live / Ideation / Deploying soon"): no project in
   this API carries a tag at all (server/projects.mjs's own project row has none) — brief rule 4,
   left for a later step alongside its data. */

/* ================================================================================================
   Project page — photo header (design's project-page block, "07 Chips", "08 Phase tracklist").
   ================================================================================================ */
.phero {
  height: 330px; /* app.css's own 14rem (224px) → the design's own 330px */
}
.phero .shade {
  position: absolute; inset: auto 0 0 0; height: 60%;
  background: linear-gradient(180deg, transparent, var(--bg));
}
.phero .name {
  bottom: -.14em; font-size: 64px; line-height: 1; white-space: nowrap;
  padding-bottom: 0; text-shadow: none; /* app.css's own smaller, fixed 1.4rem/shadow tier, replaced */
  background: linear-gradient(180deg, rgba(255,255,255,.97), rgba(255,255,255,.6));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
@media (prefers-color-scheme: light) {
  .phero .name {
    background: linear-gradient(180deg, #fff, rgba(255,255,255,.7));
    -webkit-background-clip: text; background-clip: text;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,.25));
  }
}
/* Same disclosed two-tier as the carousel's own `.hero .name.s`, above, at this header's own,
   wider full-bleed width (app.js's `buildProjectPageScreen` picks a higher length threshold). */
.phero .name.s { font-size: 44px; }

/* Tag chips row (design's `.ptagrow`/`.taglbl`): no project in this API carries a tag — brief
   rule 4, same reasoning and same later step as the Projects tab's own filter chips, above. */

/* "Phase X of Y" head (design's `.phead`) — app.css's own rule already gives it a real gap
   (S-new-2); this adds the design's own sizes and right-aligns the "Updated…"/current-phase text. */
.phead { justify-content: space-between; }
.phead b { font-size: 15px; }
.phead span { font-size: 13px; color: var(--text-2); }

/* Segmented phase bar (design "08 Phase tracklist", "changed in v3") — the design's own decorative
   read of the exact same two numbers `.pbar` (kept, below) already carries. */
.segbar { display: flex; gap: 4px; height: 8px; margin-top: 4px; }
.segbar i { flex: 1; border-radius: 4px; background: var(--card-2); position: relative; overflow: hidden; }
.segbar i.d { background: var(--accent); }
.segbar i.p > b {
  display: block; position: absolute; inset: 0 auto 0 0;
  background: color-mix(in srgb, var(--accent) 60%, transparent); border-radius: 4px;
}
.segbar i.q { background: var(--ask); }

/* `.pbar` is the ONE element the locked browser-qa tests (S-new-2, B3) read `role="progressbar"`/
   `aria-valuenow` from — kept, real and in the accessibility tree, but visually folded under the
   segbar above (which now carries the same numbers for sighted users) rather than drawing the
   same progress twice. Standard visually-hidden sizing, not `display:none`/`visibility:hidden` —
   a screen reader still reports it. */
.phase-block .pbar {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Numbered tracklist (design's `.track`, added alongside the already-tested `.plist`/`li.done|
   cur|next`, per the common brief's rule 3). */
.plist.track { margin-top: 16px; }
.plist.track li {
  display: flex; align-items: center; gap: 12px; min-height: 64px;
  padding: 8px 4px; border-top: 1px solid var(--line); font-size: inherit;
}
.plist.track li:first-child { border-top: 0; }
.plist.track .tn {
  width: 26px; font-family: var(--round); font-size: 17px; color: var(--text-3);
  text-align: center; flex: none;
}
.plist.track .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.plist.track .tx b { font-size: 17px; font-weight: 600; color: var(--text); }
.plist.track .tx small { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.plist.track li.done .tx b { color: var(--text); }
.plist.track li.done .tx small { color: var(--ok); font-weight: 600; }
.plist.track li.next .tx b,
.plist.track li.next .tx small { color: var(--text-3); }
.plist.track li.cur { background: color-mix(in srgb, var(--accent) 9%, transparent); border-radius: 12px; }
.plist.track .ck {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-size: 15px; flex: none;
}
.plist.track .end { display: flex; align-items: center; gap: 8px; flex: none; }
.plist.track .mini { width: 64px; height: 6px; border-radius: 3px; background: var(--card-2); overflow: hidden; }
.plist.track .mini i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.plist.track .pct { font-family: var(--round); font-size: 13px; color: var(--accent); font-weight: 600; width: 34px; text-align: right; }

/* Question rows on the phase tracklist (design's `.qtap`): each design row links a SPECIFIC
   phase's own question text — this API's `phase` field on a question is free text (e.g. "Phase
   4"), never a reliable link back to one of the numbered rows above, and building a guessed match
   risks showing the wrong question against the wrong phase. The full, correctly-labelled question
   cards below (this same file's Question-card rules) are what this screen offers instead — brief
   rule 4/5: draw what the data actually supports, invent nothing. */

/* ================================================================================================
   Question card (design "09 Question card" + v5 "critique fixes" + v6 "project first" header).
   `app/questions.mjs` already builds `.qh`/`.qth`/`.qn`/`.qwhen` — every state (open, saved,
   waiting to send, conflict) keeps that same header rather than the design's own separate `.ey`
   "Sent…"/"Saved on phone…" line for saved/wait cards, so nothing here touches the already-tested
   `.acts`/`.bpill` branches in app/answer-wiring.mjs — a disclosed simplification, not a gap in
   the design's own richer states.
   ================================================================================================ */
.qcard {
  background: var(--card); color: var(--text); border-radius: var(--r-card, 22px);
  padding: 16px; display: flex; flex-direction: column; gap: 0;
}
.qcard .qh { display: flex; align-items: center; gap: 12px; font-size: inherit; opacity: 1; justify-content: flex-start; }
.qcard .qth {
  width: 36px; height: 36px; border-radius: 10px; overflow: hidden; flex: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.qcard .qn { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.qcard .qn b { font-size: 15px; font-weight: 600; line-height: 1.25; }
.qcard .qn small { font-size: 13px; color: var(--text-2); }
.qcard .qwhen { font-size: 13px; color: var(--text-2); align-self: flex-start; }
.qcard .qwhen.new { color: var(--ok); font-weight: 600; }
.qcard p { font-size: 17px; margin: 12px 0 16px; line-height: 1.35; }
.qcard .acts { justify-content: flex-start; border-top: 0; padding-top: 0; opacity: 1; }
.qcard .btn-w {
  margin-left: auto; background: var(--ask); color: #000; min-height: var(--tap, 44px);
  padding: 0 20px; border-radius: 18px; font-weight: 700; font-size: 15px;
}
.qcard.saved p, .qcard.wait p { opacity: .7; }

/* ================================================================================================
   Answer sheet contents (design "10 Sheets", S9/S9b) — the shell, `.field`, `.choices`, the blue
   `.btn` and `.done-state`/`.ck.big`/`.hint`/`.nextq` are already styled in app.css's own phase-02
   foundation block; the piece left to this screen is `.nextq`'s own content, which
   app/answer-sheet.mjs now draws — sized and coloured to match the rest of the sheet.
   ================================================================================================ */
.nextq .ey { display: block; }
.nextq b { color: var(--text); }

/* ================================================================================================
   DEC-192 · a project with its own logo (app/scenes.mjs's PROJECT_LOGOS, today only Postwise).
   app/scenes.mjs draws `svg.logo-mark` in place of the scene: the crest, white, on its own
   near-black square — which is all a small frame (`.thumb`, `.qth`, `.tth`) needs. The two big
   frames lay the crest out BESIDE the frame's own name label, as one lockup (Phoenix AI's main
   logo: crest beside the word, crest about a third taller than the letters), on near-black.
   Sizes are in rem so they follow the phone's text size (DASH-5), capped by the screen width
   (vw) so a large text size shrinks the lockup to fit the card instead of cutting the name. The
   name label is the same element as before, moved — not a second copy — so it is written once.
   Projects with no logo never match any rule below.
   Fix 3 (LOGO-1 at 150%): the card is the screen less the carousel's rem padding, so it gets
   NARROWER as the text grows while a vw cap does not — at 375 px and 150% the crest poked out of
   the card, at 200% the name was cut. Each size therefore has a third cap in card-width units
   (cqi, the frame is a size container), set to the 375 px design's own proportions (font 43.125px
   on a 311px card = 13.87%, and so on, rounded up). At 100% text that cap never binds at 375 px
   or wider, so the approved look is unchanged there; it only takes over once the card shrinks.
   The space between crest and word moves from the frame's `gap` to the word's own left margin,
   since a frame's `gap` cannot be measured in its own cqi.
   ================================================================================================ */
svg.logo-mark { color: #f5f5f7; }
svg.logo-mark .logo-bg { fill: #0b0b0c; }

.hero:has(> svg.logo-mark),
.phero:has(> svg.logo-mark) {
  display: flex; align-items: center; justify-content: center; gap: 0;
  container-type: inline-size; /* both frames are already position: relative with a set width */
  background: #0b0b0c; color: #f5f5f7;
}
.hero:has(> svg.logo-mark) > svg.logo-mark,
.phero:has(> svg.logo-mark) > svg.logo-mark {
  position: static; inset: auto; flex: none; width: min(4.75rem, 20vw, 24.2cqi); height: min(4.75rem, 20vw, 24.2cqi); margin: 0 max(-0.75rem, -3.2vw, -3.9cqi); /* the crest's own square carries 16% padding each side */
}
.hero:has(> svg.logo-mark) .shade,
.phero:has(> svg.logo-mark) .shade { display: none; }
.hero:has(> svg.logo-mark) .name,
.phero:has(> svg.logo-mark) .name {
  position: static; inset: auto; flex: 0 1 auto; min-width: 0; padding: 0; margin: 0 0 0 min(0.75rem, 3.9cqi);
  font-size: min(2.75rem, 11.5vw, 13.9cqi); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left;
  background: none; -webkit-background-clip: border-box; background-clip: border-box;
  color: #f5f5f7; filter: none; text-shadow: none;
}
.hero:has(> svg.logo-mark) .name.s,
.phero:has(> svg.logo-mark) .name.s { font-size: min(1.875rem, 8vw, 9.7cqi); }
.hero:has(> .name.s) > svg.logo-mark,
.phero:has(> .name.s) > svg.logo-mark { width: min(3.25rem, 14vw, 16.9cqi); height: min(3.25rem, 14vw, 16.9cqi); margin: 0 max(-0.5rem, -2.2vw, -2.7cqi); }

/* The Files tab's project row draws its scene twice: a thumb and a blurred full-row backdrop.
   A blurred crest is a grey smudge, so a logo project's row is plain near-black instead. */
a.frow:has(> svg.logo-mark.bgs) { background: #0b0b0c; }
a.frow > svg.logo-mark.bgs { display: none; }
