/* Direction D, Ember's briefing. Ember leaves his warm night world, puts on the suit, and the page turns to civic paper.
   D1 Bid opening (index.html): the proposal is the object; tabs are chapters.
   D2 Council chamber (council.html): the agenda is the object; nameplates and the board close it.
   Material -> palette: bond paper, iron-gall ink, walnut (the room's wainscot), manila (the envelope), violet date-stamp ink.
   Type sits on the ground: no boxes, fills or halos behind text. Objects (envelope, screens, nameplates) are objects. */
:root {
  --paper: #f1ece2; --paper-2: #e7e0d2; --ink: #1e2124; --ink-2: #4a4740; --rule: #cfc6b6;
  --walnut: #4a3324; --manila: #d8c08c; --stamp: #463a7a; --seal: #7d2a1f;
  --night: #1b130d; --night-ink: #f3e9dc; --night-2: #c9b8a3;
  --focus: #463a7a;
  --text: 'Spectral', Georgia, serif; --label: 'ServiceAi Sans', system-ui, sans-serif; --mono: 'Courier Prime', 'Courier New', monospace;
  --gut: 16px; --max: 1180px;
}
body { font: 400 1.0625rem/1.6 var(--text); }
.council { --accent: #2f4a5e; --focus: #2f4a5e; }

/* ------------------------------------------------ header (sits in Ember's night until the page turns) */
.top { background: var(--night); color: var(--night-ink); }
.top-in { max-width: var(--max); margin: 0 auto; padding: 14px var(--gut); display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; justify-content: space-between; }
.top .brand img { filter: invert(1) brightness(1.4); }
.top nav ol { display: flex; flex-wrap: wrap; gap: 0 14px; margin: 0; font: 500 .85rem/1 var(--label); }
.top nav a { display: inline-block; padding: 14px 0; color: var(--night-ink); }
.top nav a[aria-current] { text-decoration-thickness: 2px; }
.top .skip { color: var(--ink); }

/* ------------------------------------------------ the arrival: door -> suit-up -> tone change */
.arrival { background: var(--night); color: var(--night-ink); }
.stage { max-width: var(--max); margin: 0 auto; padding: 24px var(--gut) 56px; display: grid; gap: 20px; justify-items: center; }
.doorway { position: relative; width: min(78vw, 320px); aspect-ratio: 4 / 5.4; display: grid; place-items: end center;
  background: linear-gradient(#2a1d14, #120c08); outline: 10px solid var(--walnut); outline-offset: 0; }
.doorway img { width: 86%; height: auto; margin-bottom: 4%; }
.doorway::after { content: ''; position: absolute; left: -10px; right: -10px; bottom: -18px; height: 8px; background: var(--walnut); }
.beats { display: grid; gap: 10px; text-align: center; max-width: 34ch; }
.beats.title { max-width: 22ch; }
.beat { font: 400 1.25rem/1.4 var(--text); color: var(--night-2); }
.beat em { font-style: italic; }
.arrival h1 { font: 600 clamp(2rem, 7.5vw, 4.6rem)/1.02 var(--label); letter-spacing: -.02em; color: var(--night-ink); }
.arrival .sub { font: 400 1.15rem/1.45 var(--text); color: var(--night-2); }
.cue { font: 500 .85rem/1 var(--label); letter-spacing: .08em; text-transform: uppercase; color: var(--night-2); }

/* scroll-scrub mode (briefing.js adds .scrub unless reduced motion) */
html.scrub .arrival { height: 330vh; }
html.scrub .stage { position: sticky; top: 0; height: 100vh; height: 100svh; align-content: center; padding-block: 12px; }
html.scrub .beat { transition: color .25s linear; }
html.scrub .beat.on { color: var(--night-ink); }
html.scrub .arrival.lit .beat.on { color: var(--ink); }
html.scrub .arrival { background: var(--stage-bg, var(--night)); }
html.scrub .arrival.lit { color: var(--ink); }
html.scrub .arrival.lit .beat, html.scrub .arrival.lit .sub, html.scrub .arrival.lit .cue { color: var(--ink-2); }
html.scrub .arrival.lit h1 { color: var(--ink); }
.arrival .doorway { transition: outline-color .4s; }
html.scrub .arrival.lit .doorway { background: transparent; outline-color: transparent; }
html.scrub .arrival.lit .doorway::after { background: transparent; }

/* ------------------------------------------------ paper sections */
.sheet { background: var(--paper); }
.wrap { max-width: var(--max); margin: 0 auto; padding: 56px var(--gut); }
.kicker { font: 500 .8rem/1.2 var(--label); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
h2 { font: 600 clamp(1.75rem, 5vw, 3rem)/1.08 var(--label); letter-spacing: -.015em; margin: 6px 0 16px; }
h3 { font: 600 1.2rem/1.25 var(--label); margin: 0 0 6px; }
.lede { font-size: 1.2rem; line-height: 1.5; max-width: 60ch; color: var(--ink-2); }
p + p { margin-top: .8em; }
.note { font-size: .95rem; color: var(--ink-2); }

/* the room (set key frame) */
.room { background: var(--paper); }
.room figure { margin: 0; }
.room img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.room figcaption { padding: 10px var(--gut) 0; max-width: var(--max); margin: 0 auto; font-size: .95rem; color: var(--ink-2); }

/* the sealed envelope (D1) */
.envelope-scene { display: grid; gap: 24px; align-items: center; }
.envelope { width: min(100%, 520px); justify-self: center; }
.envelope svg { width: 100%; height: auto; overflow: visible; }
.env-flap { transform-origin: 50% 0; transform: scaleY(calc(1 - 2 * var(--open, 0))); }
.seal-l { transform: translate(calc(-46px * var(--open, 0)), calc(30px * var(--open, 0))) rotate(calc(-28deg * var(--open, 0))); transform-box: fill-box; transform-origin: 100% 50%; }
.seal-r { transform: translate(calc(46px * var(--open, 0)), calc(30px * var(--open, 0))) rotate(calc(28deg * var(--open, 0))); transform-box: fill-box; transform-origin: 0 50%; }
.env-letter { transform: translateY(calc(-120px * var(--letter, 0))); }
.env-copy .kicker { color: var(--seal); }

/* proposal tabs (D1): the chapter index, folder tabs on the sheet's right edge from laptop up */
.proposal { position: relative; }
.tabs { margin: 0 0 32px; border-top: 2px solid var(--ink); }
.tabs ol { margin: 0; padding: 0; list-style: none; counter-reset: tab; }
.tabs li { counter-increment: tab; border-bottom: 1px solid var(--rule); }
.tabs a { display: flex; gap: 12px; align-items: baseline; padding: 12px 0; min-height: 44px; font: 500 1rem/1.2 var(--label); text-decoration: none; }
.tabs a::before { content: 'Tab ' counter(tab); font: 400 .8rem/1 var(--mono); color: var(--ink-2); min-width: 4.5ch; }
.tabs a:hover span, .tabs a:focus-visible span { text-decoration: underline; }
.tabs a[aria-current="true"] { color: var(--stamp); }
.chapter { padding: 40px 0; border-top: 1px solid var(--rule); scroll-margin-top: 16px; }
.chapter:first-of-type { border-top: 0; padding-top: 0; }
.chap-no { font: 400 .9rem/1 var(--mono); color: var(--ink-2); }

/* Tab 1: technical approach by NAICS */
.naics-list { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 0; }
.naics-list > li { display: grid; gap: 4px 24px; padding: 20px 0; border-top: 1px solid var(--rule); }
.code { font: 700 1.9rem/1 var(--mono); color: var(--walnut); letter-spacing: .02em; }
.code small { display: block; font: 400 .8rem/1.3 var(--label); color: var(--ink-2); letter-spacing: 0; margin-top: 6px; max-width: 26ch; }
.deliver { margin: 0; padding: 0; list-style: none; }
.deliver li { padding: 6px 0; }
.deliver b { font: 600 1rem/1.3 var(--label); }

/* Tab 2: example screens (mock data) */
.screens { display: grid; gap: 28px; margin-top: 24px; }
.screen { margin: 0; }
.device { background: #fbfaf7; border: 1px solid #b9b0a0; border-radius: 10px; padding: 14px; font: 400 .92rem/1.4 var(--label); color: var(--ink); box-shadow: 0 1px 0 #b9b0a0; }
.device .bar { display: flex; justify-content: space-between; gap: 8px; font-size: .78rem; color: var(--ink-2); border-bottom: 1px solid var(--rule); padding-bottom: 8px; margin-bottom: 10px; }
.device h3 { font-size: 1.05rem; }
.device dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0; }
.device dt { color: var(--ink-2); }
.device dd { margin: 0; }
.device ol { margin: 8px 0 0; padding-left: 0; list-style: none; }
.device ol li { padding: 6px 0; border-top: 1px dashed var(--rule); }
.device .slot { display: inline-block; margin: 4px 6px 0 0; padding: 8px 10px; border: 1px solid #8f877a; border-radius: 6px; min-height: 36px; }
.device .slot.picked { border: 2px solid var(--stamp); }
.device .q { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; }
.device .q span:nth-child(even) { font-family: var(--mono); text-align: right; }
.screen figcaption { margin-top: 8px; font-size: .9rem; color: var(--ink-2); }

/* Tab 3: compliance checklist (generated) */
.check { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 0 32px; }
.check li { display: grid; grid-template-columns: 28px 1fr auto; gap: 2px 8px; padding: 12px 0; border-top: 1px solid var(--rule); }
.check .tick { grid-row: span 2; font: 700 1.2rem/1.2 var(--label); color: var(--stamp); }
.check .wait .tick { color: var(--ink-2); }
.check .c-name { font: 600 1rem/1.3 var(--label); }
.check .c-id { font: 400 .85rem/1 var(--mono); color: var(--ink-2); white-space: nowrap; }
.check .c-sub { grid-column: 2; font-size: .92rem; color: var(--ink-2); }
.check .c-st { grid-row: 1; grid-column: 3; font: 500 .85rem/1.3 var(--label); }

/* Tab 4: the bid tabulation sheet with the award range drawn on it */
.tabsheet { margin-top: 24px; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); padding: 18px 0; font-family: var(--mono); }
.tabsheet .row { display: grid; gap: 4px 16px; padding: 10px 0; border-bottom: 1px dashed var(--rule); }
.tabsheet .row:last-child { border-bottom: 0; }
.tabsheet dt { font-size: .85rem; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; }
.tabsheet dd { margin: 0; font-size: 1.05rem; }
.range { margin: 28px 0 8px; }
.range svg { width: 100%; height: auto; overflow: visible; }
.range text { font: 400 13px var(--mono); fill: var(--ink); }
.steps { margin: 20px 0 0; padding-left: 1.4em; list-style: decimal; }
.steps li { padding: 4px 0; }

/* Tab 5 + close */
.download { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; font: 600 1.15rem/1.2 var(--label); color: var(--stamp); }
.close { display: grid; gap: 28px; align-items: start; }
.stampmark { justify-self: start; transform: rotate(-6deg); border: 3px double var(--stamp); color: var(--stamp); padding: 10px 18px; font: 700 1.15rem/1.25 var(--mono); text-transform: uppercase; letter-spacing: .1em; text-align: center; }
.stampmark small { display: block; font-size: .8rem; letter-spacing: .06em; }
.contact { font: 500 1.35rem/1.6 var(--label); }

/* ------------------------------------------------ D2 council chamber */
.council .agenda { list-style: none; padding: 0; margin: 24px 0 0; counter-reset: item; }
.council .agenda > li { counter-increment: item; display: grid; gap: 4px 24px; padding: 18px 0; border-top: 1px solid var(--rule); }
.council .agenda .no { font: 700 1rem/1.2 var(--mono); color: var(--accent); }
.council .agenda .no::before { content: 'Item ' counter(item); display: block; }
.council .agenda .no span { display: block; font-weight: 400; color: var(--ink-2); margin-top: 4px; }
.timer { display: inline-grid; justify-items: center; gap: 4px; }
.timer .digits { font: 700 3.2rem/1 var(--mono); letter-spacing: .04em; color: var(--ink); font-variant-numeric: tabular-nums; }
.timer .lab { font: 500 .8rem/1 var(--label); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.timer-bar { width: 100%; height: 4px; background: var(--rule); }
.timer-bar i { display: block; height: 100%; width: calc(100% * var(--left, 1)); background: var(--accent); }
.comment-head { display: grid; gap: 20px; align-items: end; }
.plates { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 14px; }
.plates li { display: grid; gap: 4px; padding: 10px 2px 12px; border-top: 3px solid var(--walnut); border-bottom: 1px solid var(--walnut); text-align: center; }
.plates .p-where { font: 600 1rem/1.3 var(--label); }
.plates .p-via { font: 400 .85rem/1.3 var(--mono); color: var(--ink-2); }
.board { margin-top: 24px; border-top: 2px solid var(--ink); }
.board .line { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; padding: 12px 0; border-bottom: 1px solid var(--rule); font: 500 1.05rem/1.3 var(--label); }
.board .line span:last-child { font-family: var(--mono); color: var(--ink-2); }
.board .final { font: 600 1.5rem/1.3 var(--label); color: var(--accent); }

/* ------------------------------------------------ footer */
.foot { background: var(--paper-2); }
.foot .wrap { padding-block: 28px; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; font: 400 .92rem/1.5 var(--label); }
.foot a { display: inline-block; padding: 12px 0; }

/* Phone (< 744): the stage must fit one screen: smaller door, only the active beat, title under it */
@media (max-width: 743px) {
  html.scrub .stage { gap: 12px; }
  html.scrub .doorway { width: min(62vw, calc(46svh * 4 / 5.4)); }
  html.scrub .beat:not(.on) { display: none; }
  html.scrub .arrival h1 { font-size: clamp(1.7rem, 7.6vw, 2.4rem); }
  html.scrub .arrival .sub { font-size: 1rem; }
}
/* rendered stills (art-directed <picture>: portrait on phones, 16:9 above) */
.shot { display: block; margin: 0; }
.shot img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: var(--paper-2); }
.room .shot-full img { aspect-ratio: 16 / 9; }
.room-copy { padding-block: 40px; }
.pair { display: grid; gap: 20px; }
.chap-media { margin-bottom: 20px; }
.close-media .shot img { max-width: 720px; }
@media (max-width: 743px) { .shot img, .room .shot-full img { aspect-ratio: 4 / 5; } }

/* ======================================================= tiers (custom layout per size, not reflow) */
/* Tablet 744-1279: doorway beside the beats; NAICS code in a margin column; screens and checklist two-up */
@media (min-width: 744px) {
  :root { --gut: 40px; }
  .stage { grid-template-columns: minmax(260px, 340px) 1fr; justify-items: start; column-gap: 48px; align-items: center; }
  .stage .doorway { grid-row: span 3; }
  .beats { text-align: left; }
  .naics-list > li { grid-template-columns: 180px 1fr; }
  .screens { grid-template-columns: 1fr 1fr; }
  .screens .screen:first-child { grid-column: span 2; }
  .check { grid-template-columns: 1fr 1fr; }
  .tabsheet .row { grid-template-columns: 220px 1fr; }
  .envelope-scene { grid-template-columns: 1.1fr 1fr; }
  .close { grid-template-columns: 1fr 1fr; gap: 48px; }
  .council .agenda > li { grid-template-columns: 160px 1fr; }
  .plates { grid-template-columns: repeat(2, 1fr); }
  .comment-head { grid-template-columns: 1fr auto; }
}
/* Laptop 1280-1679: the proposal is one sheet with folder tabs hanging off its right edge (sticky) */
@media (min-width: 1280px) {
  :root { --gut: 56px; }
  body { font-size: 1.125rem; }
  .stage { grid-template-columns: 420px 1fr; column-gap: 88px; }
  .doorway { width: 400px; }
  .beats.title { max-width: min(100%, 36rem); }
  .arrival h1 { font-size: 4.4rem; }
  .proposal { display: grid; grid-template-columns: 1fr 230px; gap: 56px; }
  .pair { grid-template-columns: 1.45fr 1fr; gap: 56px; align-items: center; }
  .pair-flip .pair-media { order: 2; }
  .room-copy { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: end; }
  .proposal .tabs { grid-column: 2; grid-row: 1; position: sticky; top: 24px; align-self: start; border-top: 0; border-left: 2px solid var(--ink); }
  .proposal .tabs a { padding: 12px 0 12px 16px; flex-direction: column; gap: 4px; }
  .proposal .chapters { grid-column: 1; grid-row: 1; }
  .screens { grid-template-columns: 1.3fr 1fr; }
  .screens .screen:first-child { grid-column: auto; grid-row: span 2; }
  .plates { grid-template-columns: repeat(3, 1fr); }
  .council .chamber-grid { display: grid; grid-template-columns: 1fr 300px; gap: 56px; }
  .council .chamber-grid .side { position: sticky; top: 24px; align-self: start; }
}
/* Desktop 1680+: wider sheet; NAICS as three columns (code | official title | what we deliver); screens three-up */
@media (min-width: 1680px) {
  :root { --max: 1520px; --gut: 72px; }
  body { font-size: 1.1875rem; }
  .stage { grid-template-columns: 520px 1fr; column-gap: 120px; }
  .doorway { width: 500px; }
  .beats.title { max-width: min(100%, 44rem); }
  .arrival h1 { font-size: 5.6rem; }
  .proposal { grid-template-columns: 1fr 260px; gap: 80px; }
  /* chapters: the tab's still sits beside the chapter's title and lede; the chapter body runs full width below */
  .chapter { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); column-gap: 56px; align-items: end; }
  .chapter > * { grid-column: 1 / -1; }
  .chapter > .chap-media { grid-column: 1; grid-row: 1 / span 3; margin: 0 0 8px; }
  .chapter > .chap-no, .chapter > h2, .chapter > .lede { grid-column: 2; }
  .pair { grid-template-columns: 1.6fr 1fr; gap: 96px; }
  .naics-list > li { grid-template-columns: 150px 280px 1fr; }
  .code small { margin-top: 0; font-size: .95rem; grid-column: 2; grid-row: 1; }
  .naics-list .code { display: contents; }
  .naics-list .code > span { grid-column: 1; grid-row: 1; }
  .screens { grid-template-columns: repeat(3, 1fr); }
  .screens .screen:first-child { grid-row: auto; }
  .check { grid-template-columns: repeat(3, 1fr); }
  .plates { grid-template-columns: repeat(5, 1fr); }
  .council .chamber-grid { grid-template-columns: 1fr 360px; gap: 96px; }
}

@media (prefers-reduced-motion: reduce) { .env-flap, .seal-l, .seal-r, .env-letter { transition: none; } }
@media print { .top, .arrival, .room, .foot a[href*="ember"] { display: none !important; } .sheet { background: #fff; } }
