/* Act one screens: #landing (demo loop), #rules (count, faces, rules box, receipt, host, catalog, zero), #test.
   Owner: the act-one implementer. Build on the theme.css tokens and components; never restyle them here.
   Layout and screen-specific sizes only: colours come from the act tokens (--field, --on, --accent, --paper ...). */

/* ---------- shared bits ---------- */
/* Horizontal clipping of every screen and the reduced-motion rule for fitted heroes live in theme.css. */
.lock { display: inline-block; flex: none; vertical-align: -1px; }
.pill button, .chip button { text-transform: inherit; letter-spacing: inherit; font-weight: inherit; }

/* ================================================================== LANDING */
/* The demo strip sits between two ink rules (poster screen 1): ticket + count, 18 faces, one caption per step. */
/* The landing keeps the whole poster (question, line, demo, buttons, fine print) on one 812px screen: 16px steps. */
#landing { gap: 16px; }
#landing .lede { margin-top: 4px; }
#landing .demo {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 10px 0; border-top: var(--line) solid var(--on); border-bottom: var(--line) solid var(--on);
}
.demo-top { display: flex; align-items: center; justify-content: space-between; gap: var(--u); min-height: var(--h-pill); }
.demo-ticket {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: var(--h-pill); padding: 0 12px 0 22px;
  background: var(--paper); color: var(--paper-on); border: var(--line) solid var(--on); border-radius: 6px;
  font-size: var(--t-12); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
  rotate: -5deg; transform-origin: left center;
  opacity: 0; translate: 0 -14px; transition: opacity 160ms ease-out, translate var(--dur-slap) var(--ease-slap);
}
.demo-ticket::before { content: ""; position: absolute; left: 9px; top: 3px; bottom: 3px; border-left: 2px dashed var(--on); }
.demo[data-step="1"] .demo-ticket, .demo[data-step="2"] .demo-ticket, .demo[data-step="3"] .demo-ticket, .demo[data-step="4"] .demo-ticket { opacity: 1; translate: 0 0; }
.demo-count { font-size: var(--t-16); font-weight: 800; white-space: nowrap; }
.demo-count .dc-rest, .demo-count .dc-to { display: none; }
.demo[data-step="2"] .demo-count :is(.dc-rest, .dc-to), .demo[data-step="3"] .demo-count :is(.dc-rest, .dc-to), .demo[data-step="4"] .demo-count :is(.dc-rest, .dc-to) { display: inline; }
.demo[data-step="2"] .dc-from, .demo[data-step="3"] .dc-from, .demo[data-step="4"] .dc-from { opacity: .45; }

.demo-grid { display: grid; grid-template-columns: repeat(9, 30px); justify-content: space-between; row-gap: 8px; padding-bottom: 16px; } /* room for the tag under the hearted face */
.demo-grid .face { width: 100%; height: auto; aspect-ratio: 1; transition: scale 260ms ease, opacity 260ms ease; }
.demo-grid .face .badge { width: 18px; height: 18px; right: -7px; top: -7px; font-size: 11px; border-width: 2px; opacity: 0; }
.demo-grid .face .tag { height: 20px; padding: 0 6px; bottom: -12px; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; opacity: 0; }
/* step 2: the four smokers leave; step 3: one of them comes back, hearted and tagged; step 4: caught. */
.demo[data-step="2"] .face[data-smoker], .demo:is([data-step="3"], [data-step="4"]) .face[data-smoker]:not([data-hearted]) { scale: .2; opacity: 0; }
.demo:is([data-step="3"], [data-step="4"]) .face[data-hearted] { z-index: 2; scale: 1.28; outline: var(--line) solid var(--on); outline-offset: 1px; }
.demo:is([data-step="3"], [data-step="4"]) .face[data-hearted] :is(.badge, .tag) { opacity: 1; }
.demo:is([data-step="3"], [data-step="4"]) .face[data-hearted] .tag { background: var(--hot); color: var(--hot-on); }

/* the caption row: one line per step; the stamp slams into its right end (never over the faces) */
.demo-cap { display: flex; align-items: center; min-height: var(--h-tag); font-size: var(--t-16); line-height: 20px; font-weight: 700; }
.demo-cap .stamp { order: 2; flex: none; margin-left: auto; rotate: 8deg; display: none; }
.demo[data-step="4"] .demo-cap .stamp { display: inline-flex; animation: slap var(--dur-slap) var(--ease-slap) both; }
.demo-cap-text { min-width: 0; padding-right: 8px; }
:lang(ru) .demo-cap { min-height: 40px; } /* the Russian punchline takes two lines: keep the row still */

/* ================================================================== RULES */
/* The count: three digits at the full poster size would not fit beside the caption, so 100+ steps down a size. */
#rules .lockup { min-height: calc(var(--hero-xl) * .76); }
#count.n3 { font-size: clamp(112px, 44vw, 176px); }
#count-cap { flex: none; }
#bench:empty { display: none; }

/* faces still in: 8 slots, a changed set cross-fades as a whole */
#passers { justify-content: flex-start; gap: 5px; min-height: 36px; transition: opacity var(--dur-slap) ease; }
#passers.fading { opacity: 0; }
#passers .more-n { --size: 36px; flex: none; }

/* when the zero moment is up it takes the faces' place, right under the count; the rest keeps its order */
#rules > #rule-field, #rules > #receipt, #rules > #host, #rules > #catalog, #rules > .dock { order: 1; }

/* the rules box: pills (hard lime + lock, soft white + heart) then the input */
#rule-pills > .pill { max-width: 100%; }
.pill-row { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.pill-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.pill .pill-icon { margin-left: -6px; margin-right: 0; }
.pill .pill-x { margin-right: -6px; margin-left: 0; font-size: 16px; }
.pill .pill-extra { font-weight: 900; }
.pill.two-line .typed { font-size: 11px; line-height: 14px; padding-left: 20px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill-soft .pill-icon { font-size: 14px; }
.pill.unclear .pill-name::after { content: " ?"; }
.pill-flip.unclear { animation: nudge 1.4s ease-in-out infinite; }
.pill-live.reading { animation: breathe 1.2s ease-in-out infinite; }
#rule-pills > .pill-ask {
  rotate: 0deg; flex: 1 1 100%; height: auto; min-height: var(--h-pill); padding: 8px 12px; border-radius: 16px;
  flex-direction: column; align-items: stretch; gap: 8px; white-space: normal;
}
.pill-ask > .pill-row { justify-content: space-between; }
.pill-ask .pill-name { white-space: normal; }
.ask-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.ask-opts .chip { height: var(--h-pill); padding: 0 12px; font-size: var(--t-12); letter-spacing: .04em; }
.rulebox-enter { flex: none; }
#rule-field[aria-busy="true"] .rulebox-enter { opacity: .4; }

/* receipt: one line per clause, then one person proving it */
#receipt:empty { display: none; }
.receipt-line { font-size: var(--t-16); line-height: var(--lh-16); font-weight: 700; }
.receipt-row { align-items: flex-start; }
.receipt-row .face { margin-top: -1px; }
.receipt-who { min-width: 0; font-size: var(--t-16); line-height: var(--lh-16); font-weight: 600; }
.receipt-who q, .who-words q { quotes: "“" "”"; }
.receipt-try { display: flex; align-items: center; flex-wrap: wrap; gap: var(--u); }

/* the host's one question */
.host { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.host .sticker { rotate: -4deg; }
.host-q { font-size: var(--t-16); line-height: 20px; font-weight: 800; }
.host-line { display: inline-flex; align-items: center; gap: 4px; }
.host .chips { width: 100%; }
.chip .after.heart, .chip .heart { font-weight: 900; }
.chip .after.zeroes { opacity: .45; }

/* the catalogue */
.catalog { display: flex; flex-direction: column; gap: 12px; }
.cat-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-tabs .seg-btn { display: inline-flex; align-items: center; gap: 4px; }
.cat-n { display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--on); color: var(--field); font-size: 10px; line-height: 1; vertical-align: 0; }
.seg-btn[aria-pressed="true"] .cat-n { background: var(--field); color: var(--on); }
.cat-chips .chip { max-width: 100%; }
.cat-chips .chip > span:first-child { overflow: hidden; text-overflow: ellipsis; }

/* the zero moment */
.zero { display: flex; flex-direction: column; align-items: stretch; gap: 16px; padding: 20px 0; border-top: var(--line) solid var(--on); border-bottom: var(--line) solid var(--on); }
.zero .hero { text-wrap: balance; }
.zero-stamp { align-self: flex-start; rotate: -6deg; font-size: var(--t-12); height: 28px; padding: 0 10px; }
.zero-rows { display: flex; flex-direction: column; gap: 10px; }
.zero-row { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 12px; }
.zero-who { display: flex; flex-direction: column; min-width: 0; }
.zero-miss { font-size: var(--t-12); line-height: var(--lh-12); font-weight: 700; }
.zero-score { font-weight: 800; }
.zero-fixes { display: flex; flex-direction: column; gap: var(--u); }
.zero-fixes .btn { white-space: normal; text-align: center; line-height: 1.15; }
.zero .link { align-self: flex-start; }

/* ================================================================== THE TEST (ink) */
.test-step { color: var(--accent); }
.test-intro, .test-page { flex: 1; }
.test-card { display: flex; flex-direction: column; gap: 16px; padding: 20px; border-radius: var(--r-block); background: var(--paper); color: var(--paper-on); rotate: -1deg; }
.test-stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--u); }
.test-stat { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: var(--line) solid var(--paper-on); border-radius: var(--r-box); }
.test-stat .hero { margin-left: 0; }
.test-stat:first-child { background: var(--accent); color: var(--accent-on); border-color: var(--accent-on); }
.test-rules .pill-out, .test-facts .pill-out { gap: 5px; }
.test-top { display: flex; align-items: center; justify-content: space-between; gap: var(--u); margin-bottom: calc(-1 * var(--m) + 12px); }
.test-progress { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.test-progress i { height: 6px; border-radius: 3px; background: var(--on); opacity: .22; }
.test-progress i.done { background: var(--accent); opacity: 1; }
.test-progress i.now { background: var(--on); opacity: 1; }
.test-photo { max-height: 46dvh; }
.test-photo.slap { animation: slap var(--dur-slap) var(--ease-slap) both; }
/* the name is the hero: lime, sitting on the photo's bottom edge */
.test-name { position: relative; z-index: 1; margin-top: calc(-1 * var(--m) - .5em); color: var(--accent); }
.test-page .text.soft { margin-top: calc(-1 * var(--m) + 8px); }
.test-page .quote { max-width: 34ch; }
.test-page .dock, .test-intro .dock { margin-top: auto; }

/* ================================================================== SHEETS (Who & why, a person's page) */
.who .seg { justify-content: flex-start; }
.who .seg-btn { display: inline-flex; align-items: center; gap: 5px; height: var(--h-pill); }
.who-rows { display: flex; flex-direction: column; gap: 14px; }
.who-row { display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: flex-start; }
.who-words { display: flex; flex-direction: column; gap: 2px; font-size: var(--t-16); line-height: var(--lh-16); font-weight: 600; }
.who-out { padding: 10px 12px; border: 2px dashed var(--ink); border-radius: 12px; opacity: 1; }
.who .faces-grid.g8 { --size: 36px; }
.who-foot { margin-top: 8px; }
.sheet .hero-s { font-size: 36px; }
.sheet-head .hero { min-width: 0; flex: 1; }
.profile .photo { aspect-ratio: 4 / 5; }

@keyframes breathe { 50% { opacity: .45; } }
@keyframes nudge { 0%, 70%, 100% { rotate: 0deg; } 80% { rotate: -14deg; } 90% { rotate: 14deg; } }
