/* W10: #start, the ultramarine slab and Reassembly. The wordmark's size and position come from one layout function (stages/wordmark.mjs):
   the scene writes --fs, --ml and --mt on .mast. Without them (no JS, reduced motion, fx-fail) the CSS below sets the same
   wordmark by width, cropped 18% at the bottom of the slab, so the page reads the same. Content stays above the canvas (stage z-index 2). */

/* The slab has no tilted edges: it starts and ends in straight cuts (founder directive D3, no diagonal band that echoes tape). The footer
   begins under a bone rule right where the wordmark's crop lands (chrome.css), so the crop reads as a ground line, not a slice. */
#start.sec--tilt { margin-top: 0; }
#start.sec--tilt::before { clip-path: none; }

/* Static layout (no JS, reduced motion, fx-fail): a relative stage so the composed frame can sit behind the copy. */
html:not(.js) #start .stage, html.static #start .stage, html.fx-fail #start .stage { position: relative; padding-bottom: 0; }
/* The frame is the reassembly at the 1440 x 900 layout, so it is pinned to the slab's bottom edge at its own aspect: its halo of
   dots then sits around the DOM wordmark, which is cropped at the same edge. */
html:not(.js) #start .composed, html.static #start .composed, html.fx-fail #start .composed {
  position: absolute; left: 0; bottom: 0; z-index: 0; width: 100%; height: auto; aspect-ratio: 1440 / 900; pointer-events: none;
}

#start .label { margin-bottom: clamp(.6rem, 1.6vh, 1.4rem); color: rgb(255 255 255 / .92); font-weight: 700; }
#start h2 { max-width: 24ch; }
.start__sub { max-width: 46ch; margin-top: clamp(.8rem, 2vh, 1.6rem); font-weight: 500; }

/* The lead line and the fit note share one row above the cards, so the cards get the height: art large, body at reading size. */
.start__body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); grid-template-areas: "sub fit" "doors doors"; column-gap: clamp(.7rem, 1.2vw, 1.2rem); align-items: end; }
.start__body > .start__sub { grid-area: sub; margin-top: clamp(.6rem, 1.4vh, 1.2rem); }
.start__body > .doors { grid-area: doors; }
.start__body > .start__fit { grid-area: fit; }
@media (min-width: 901px) { .start__body > .start__fit { margin-top: 0; padding: .5rem .9rem; font-size: .95rem; line-height: 1.35; } }
@media (max-width: 900px) { .start__body { grid-template-columns: minmax(0, 1fr); grid-template-areas: "sub" "doors" "fit"; } }

/* ---- doors: two tactile cards. They read as buttons with the pointer parked outside: a filled call to action with an arrow
   tile, and a hard offset shadow that hover lifts and a press sinks. Nothing here depends on hover to be understood. ---------- */
.doors {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: stretch;
  margin-block: clamp(.7rem, 1.6vh, 1.2rem) clamp(.8rem, 2.4vh, 1.6rem);
}
.door {
  --r: 1; --pad: clamp(1rem, 1.4vw, 1.4rem);
  position: relative; display: flex; flex-direction: column; gap: .55rem; min-width: 0; box-sizing: border-box;
  padding: var(--pad); border: 2px solid var(--ink); background: var(--bone); color: var(--on-bone); text-decoration: none;
  box-shadow: 8px 8px 0 rgb(8 12 40 / .55);
  opacity: min(1, calc(var(--r) * 2.2)); translate: 0 var(--dy, 0px); rotate: var(--dr, 0deg);
  transition: transform .16s cubic-bezier(.2, 0, .1, 1), box-shadow .16s cubic-bezier(.2, 0, .1, 1);
}
.door--primary { background: var(--ink); color: var(--on-ink); }
.door:hover, .door:focus-visible { transform: translate(-2px, -2px); box-shadow: 12px 12px 0 rgb(8 12 40 / .55); }
.door:active { transform: translate(6px, 6px); box-shadow: 2px 2px 0 rgb(8 12 40 / .55); }
.door:focus-visible { outline: 3px solid var(--bone); outline-offset: 3px; }
html.static .door { transition: none; }
#start.is-measuring .door { translate: none !important; rotate: none !important; transition: none !important; }

.door__badge {
  position: absolute; z-index: 2; top: -.7rem; left: calc(var(--pad) + .55rem); padding: .32rem .6rem;
  background: var(--bone); color: var(--on-bone); font: 700 .68rem/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase;
}
.door__tag {
  position: absolute; z-index: 2; top: -.7rem; padding: .32rem .6rem; background: var(--signal); color: var(--on-signal);
  font: 700 .68rem/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase;
}
.door--primary .door__tag { right: calc(var(--pad) + .55rem); }
.door:not(.door--primary) .door__tag { left: calc(var(--pad) + .55rem); background: var(--ink); color: var(--on-ink); }
.door__title { text-wrap: balance; font-family: var(--font-display); font-size: clamp(1.6rem, 2.4vw, 2.2rem); font-weight: 700; letter-spacing: -.025em; line-height: 1.04; }
.door__body { font-size: 1.05rem; line-height: 1.42; color: var(--on-bone-dim); }
.door--primary .door__body { color: rgb(241 236 224 / .82); }

/* The call to action is a filled block with the arrow tile inside it, so the whole card reads as one button. */
.door__cta {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; box-sizing: border-box; min-height: 48px; margin-top: auto;
  padding: .75rem 1.1rem; background: var(--ink); color: var(--on-ink); font: 700 .95rem/1 var(--font-display); letter-spacing: -.005em;
}
.door--primary .door__cta { background: var(--bone); color: var(--on-bone); }
.door__arrow { display: grid; place-items: center; flex: none; width: 32px; height: 32px; background: var(--signal); transition: transform .16s cubic-bezier(.2, 0, .1, 1); }
.door__arrow svg { width: 18px; height: 18px; fill: none; stroke: var(--on-signal); stroke-width: 2.4; stroke-linecap: square; stroke-linejoin: miter; }
.door:hover .door__arrow, .door:focus-visible .door__arrow { transform: translateX(4px); }
html.static .door__arrow { transition: none; }

/* The fold-in of "who this is for": one plain line under the doors. */
.start__fit { position: relative; z-index: 2; box-sizing: border-box; width: fit-content; max-width: 100%; margin-top: 1.4rem; padding: .8rem 1.1rem; background: var(--signal); border-left: 3px solid var(--ink); font-size: 1.1rem; line-height: 1.4; font-weight: 600; }

/* ---- door art: an inline picture on a plate. Without JavaScript, under reduced motion and in fx-fail it is the finished frame:
   cuts at full reach, the one-page sheet out, the tick showing. The scene writes --art (0..1) as the card arrives and adds
   .art-on, which starts the loops (CSS only, 7 s and 6 s). The seal's geometry is markup from svg/seal.mjs (sealLive). -------- */
.door { --art: 1; --art-h: clamp(8rem, 22svh, 14rem); }
.door__art {
  display: block; width: 100%; height: max(44px, calc(var(--art-h) * var(--art-k, 1))); flex: none; overflow: hidden; background: rgb(255 255 255 / .06); box-shadow: inset 0 0 0 1px var(--line-ink);
  opacity: clamp(0, calc(var(--art) * 3), 1); translate: 0 calc((1 - var(--art)) * 14px);
  --seal: var(--bone);
}
.door:not(.door--primary) .door__art { background: rgb(11 12 15 / .07); box-shadow: inset 0 0 0 1px var(--line-bone); --seal: var(--ink); }
.art__breathe { transform-box: fill-box; transform-origin: center; }
.seal__cut { transform-box: fill-box; transform-origin: 0 50%; }

/* card 1: six taps into the seal */
.art__page { fill: var(--bone); stroke: none; }
.art__fold { fill: var(--bone-3); stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.art__head { fill: none; stroke: var(--signal); stroke-width: 7; stroke-linecap: round; }
.art__line { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; opacity: .72; }
.art__dots circle { fill: var(--signal); stroke: var(--bone); stroke-width: 2.5; opacity: 0; }
.door--primary .seal__disc { fill: var(--signal); }
.art__form .art__line { opacity: .72; }

.art__formbox { fill: var(--bone); stroke: none; }
.art__chk { fill: none; stroke: var(--ink); stroke-width: 2.5; }
.art__chk--on { fill: var(--signal); stroke: var(--signal); }
.art__form .art__head { stroke-width: 6; }

.art__track { fill: none; stroke: var(--bone); stroke-width: 3; stroke-dasharray: 4 9; stroke-linecap: round; opacity: .5; }
.art__track--aux { stroke-width: 2; opacity: .22; }

/* card 2: the packet is a document whose two lines are the short and deep cut bars. They travel a straight track at a constant
   speed (two carriers, equal time apart) into your own AI's bubble, which answers with plain reply bars. No seal here: one full
   seal per act, and card 1 holds it. One stroke weight for outlines (3) and one for lines (6). */
.door__art--packet .art__page { fill: var(--bone); stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.door__art--packet .art__fold { stroke-width: 3; }
.door__art--packet .art__line { stroke-width: 6; opacity: .8; }
.door__art--packet .art__line--head { opacity: 1; }
.art__bar { fill: var(--signal); }
.art__track--run { stroke: var(--ink); stroke-width: 3; stroke-dasharray: 3 11; opacity: .55; }
.art__bubble-body { fill: var(--ink); stroke: none; }
.art__reply { fill: none; stroke: var(--bone); stroke-width: 6; stroke-linecap: round; opacity: .85; transform-box: fill-box; transform-origin: 0 50%; }
.art__reply--2 { opacity: .6; } .art__reply--3 { opacity: .4; }
.art__run { opacity: 0; }

/* Loops start when the card has arrived (.art-on), and sleep with the section. */
@keyframes art-breathe { 0%, 100% { transform: scale(1); } 45% { transform: scale(1.028); } 70% { transform: scale(.994); } }
@keyframes s1-cut { 0%, 10% { transform: scaleX(0); } 28%, 92.8% { transform: scaleX(1); } 99%, 100% { transform: scaleX(0); } }
@keyframes s2-run { 0% { transform: translateX(0); opacity: 0; } 6% { opacity: 1; } 86% { opacity: 1; } 100% { transform: translateX(232px); opacity: 0; } }
@keyframes s2-reply { 0%, 40% { transform: scaleX(0); } 54%, 94% { transform: scaleX(1); } 100% { transform: scaleX(0); } }
@keyframes s1-dot { 0% { transform: translateX(0); opacity: 0; } 1% { opacity: 1; } 6.4% { transform: translateX(var(--to)); opacity: 1; } 7%, 100% { transform: translateX(var(--to)); opacity: 0; } }
@keyframes s1-fill { 0%, 20% { fill: var(--bone); } 30%, 92.8% { fill: var(--signal); } 99%, 100% { fill: var(--bone); } }
@keyframes s1-sheet { 0%, 67% { transform: translateX(-144px); opacity: 1; } 75.7%, 92.8% { transform: translateX(0); opacity: 1; } 99% { transform: translateX(0); opacity: 0; } 100% { transform: translateX(-144px); opacity: 0; } }

/* Before a card has arrived (JavaScript on, motion allowed) the picture waits in its first frame. */
html.js:not(.static):not(.fx-fail) .door:not(.art-on) .seal__cut { transform: scaleX(0); }
html.js:not(.static):not(.fx-fail) .door:not(.art-on) .art__sheet { opacity: 0; }
html.js:not(.static):not(.fx-fail) .door:not(.art-on) .art__reply:not(.art__reply--1) { transform: scaleX(0); }
html.js:not(.static):not(.fx-fail) .door.art-on .art__breathe { animation: art-breathe 3.6s cubic-bezier(.34, 1.4, .64, 1) infinite; }
html.js:not(.static):not(.fx-fail) .door--primary.art-on .seal__cut { animation: s1-cut 7s cubic-bezier(.5, 0, .2, 1) infinite; }
html.js:not(.static):not(.fx-fail) .door--primary.art-on .seal__disc { animation: s1-fill 7s ease-in-out infinite; }
html.js:not(.static):not(.fx-fail) .door--primary.art-on .art__sheet { animation: s1-sheet 7s cubic-bezier(.3, .8, .2, 1) infinite; }
html.js:not(.static):not(.fx-fail) .door--primary.art-on .art__dots circle { animation: s1-dot 7s cubic-bezier(.5, 0, .3, 1) infinite both; animation-delay: var(--at); }
html.js:not(.static):not(.fx-fail) .door:not(.door--primary).art-on .art__run { animation: s2-run 3.2s linear infinite both; animation-delay: var(--at); }
html.js:not(.static):not(.fx-fail) .door:not(.door--primary).art-on .art__reply:not(.art__reply--1) { animation: s2-reply 6.4s ease-out infinite; }
.art__run.r1 { --at: 0s; } .art__run.r2 { --at: 1.6s; }
.art__dots .d1 { --at: .5s; } .art__dots .d2 { --at: 1.2s; } .art__dots .d3 { --at: 1.9s; } .art__dots .d4 { --at: 2.6s; } .art__dots .d5 { --at: 3.3s; } .art__dots .d6 { --at: 4s; }
#start.art-sleep .door .art__breathe, #start.art-sleep .door .art__dots circle, #start.art-sleep .door .art__run, #start.art-sleep .door .art__reply, #start.art-sleep .door .seal__cut, #start.art-sleep .door .seal__disc, #start.art-sleep .door .art__sheet,


/* ---- the wordmark ------------------------------------------------------------------------------------------- */
.mast {
  --fs: calc((100vw - 2 * var(--gutter)) / 4.26);
  margin: clamp(1rem, 3vh, 2rem) 0 0; height: calc(var(--fs) * .737); overflow: hidden;
  font: 900 var(--fs) / 1 var(--font-display); white-space: nowrap; color: var(--on-signal);
}
.mast__row { display: flex; margin-left: calc(var(--fs) * -.048); }
.mast__c { position: relative; flex: none; width: calc(var(--w) * 1em); text-align: center; transform-origin: 50% 70%; }
.mast__g { display: block; font-weight: var(--bw, 900); font-variation-settings: normal; }
.mast__dot { position: absolute; left: .062em; top: .03em; width: .224em; height: .224em; border-radius: 50%; background: currentColor; }
.mast__dot--gate { background: transparent; border: max(1.5px, .007em) solid currentColor; }
.mast__dot--gate::after { content: ""; position: absolute; inset: -1px; border: 1px solid currentColor; border-radius: 50%; opacity: 0; }

html.js:not(.fx-fail):not(.static) #start .mast {
  position: absolute; left: 0; width: 100%; top: var(--mt, 100%); height: var(--mh, auto); margin: 0; padding: var(--mp, 0px) 0 0 var(--ml, 0px); overflow: hidden; z-index: 3; pointer-events: none;
}
html.js:not(.fx-fail):not(.static) #start .mast__row { margin-left: 0; }
/* Hidden until the handover (p >= .85): the dots are the wordmark until then. The release is a last resort so a scene that
   never loads cannot leave the slab without its wordmark. */
html.js:not(.fx-fail):not(.static) #start:not(.is-live) .mast { opacity: 0; animation: start-release 0s linear 3.2s forwards; }
html.js:not(.fx-fail):not(.static) #start.is-live .mast { opacity: 0; transition: opacity .25s linear; }
html.js:not(.fx-fail):not(.static) #start.is-live .mast.is-on { opacity: 1; }
@keyframes start-release { to { opacity: 1; } }

/* The last gate: the second i's dot is an open ring until a person decides. A release fills it in one frame (human grammar)
   and sends a ring outward. */
html.js:not(.static) .mast.is-release .mast__dot--gate { animation: gate-fill .7s steps(1, end) both; }
html.js:not(.static) .mast.is-release .mast__dot--gate::after { animation: gate-wave .9s cubic-bezier(.2, .7, .3, 1) both; }
@keyframes gate-fill { 0% { background: currentColor; } 100% { background: transparent; } }
@keyframes gate-wave { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(3.6); } }

/* ---- the cinematic stage ------------------------------------------------------------------------------------ */
html.js:not(.fx-fail):not(.static) #start .stage { padding: clamp(68px, 9.5vh, 92px) var(--gutter) 0; }
html.js:not(.fx-fail):not(.static) #start h2 { font-size: min(var(--t-h2), 7.6vh); }
html.js:not(.fx-fail):not(.static) .start__fx { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; }
html.js:not(.fx-fail):not(.static) #start.has-layer .composed { opacity: 0; visibility: hidden; }


@media (max-width: 900px) {
  html.js:not(.fx-fail):not(.static) #start .stage { padding-top: 76px; }
  html.js:not(.fx-fail):not(.static) #start h2 { font-size: min(var(--t-h2), 7.2vh); }
  .start__sub { font-size: .85rem; margin-top: .5rem; }
  .start__fit { margin-top: .8rem; padding: .55rem .8rem; font-size: .84rem; line-height: 1.3; }
  /* Phone: the cards stack, each about 250 px: a slim picture, the title, two lines of body and a full-width call to action. */
  .doors { grid-template-columns: minmax(0, 1fr); gap: 14px; margin-block: .8rem .5rem; }
  .door { --pad: .8rem; gap: .4rem; box-shadow: 5px 5px 0 rgb(8 12 40 / .55); }
  .door:hover, .door:focus-visible { box-shadow: 8px 8px 0 rgb(8 12 40 / .55); }
  .door:active { box-shadow: 2px 2px 0 rgb(8 12 40 / .55); }
  .door { --art-h: clamp(120px, 31vw, 190px); }
  .door__badge, .door__tag { top: -.6rem; font-size: .62rem; padding: .2rem .5rem; }
  .door__badge, .door:not(.door--primary) .door__tag { left: calc(var(--pad) + .4rem); }
  .door--primary .door__tag { right: calc(var(--pad) + .4rem); }
  .door__title { font-size: 1.35rem; }
  .door__body { font-size: .88rem; line-height: 1.3; }
  .door__cta { padding: .5rem .5rem .5rem 1rem; }
}

/* Short viewports (laptops at 720): the same cards, tighter, so they clear the wordmark. */
@media (max-height: 760px) {
  html.js:not(.fx-fail):not(.static) #start .stage { padding-top: clamp(60px, 8vh, 76px); }
  html.js:not(.fx-fail):not(.static) #start h2 { font-size: min(var(--t-h2), 6.6vh); }
  #start .label { margin-bottom: .4rem; }
  .start__sub { margin-top: .5rem; font-size: .9rem; }
  .doors { margin-block: .7rem .5rem; gap: 20px; }
  .door { --pad: .8rem; gap: .35rem; }
  .door { --art-h: clamp(5.5rem, 19svh, 9.5rem); }
  .door__title { font-size: 1.35rem; }
  .door__body { font-size: .88rem; line-height: 1.32; }
  .door__cta { padding: .55rem .55rem .55rem 1rem; }
  .start__fit { margin-top: .8rem; padding: .55rem .8rem; font-size: .9rem; line-height: 1.3; }
}

/* Small phones (up to 360 wide, or no taller than 640): everything must clear the wordmark's ink, which rises with the width.
   A tighter stack first; if the scene still measures an overlap it adds .fit-1 to .fit-4 (start.mjs fitContent): spacing,
   then the tags, then the picture shrinks, and the body goes last. Both cards always keep their picture, title and call to action. */
@media (max-width: 360px), (max-width: 900px) and (max-height: 640px) {
  html.js:not(.fx-fail):not(.static) #start .stage { padding-top: 76px; }
  html.js:not(.fx-fail):not(.static) #start h2 { font-size: min(var(--t-h2), 8vw, 5.6vh); line-height: 1.04; }
  #start .label { margin-bottom: .3rem; }
  .start__sub { margin-top: .4rem; font-size: .8rem; line-height: 1.3; }
  .doors { margin-block: .5rem .4rem; gap: 10px; }
  .door { --pad: .6rem; gap: .3rem; }
  .door { --art-h: 72px; }
  .door__body { font-size: .78rem; line-height: 1.25; }
  .door__title { font-size: 1.15rem; }
  .door__tag { font-size: .62rem; }
  .start__fit { margin-top: .5rem; padding: .4rem .6rem; font-size: .76rem; line-height: 1.25; }
}
html.js:not(.fx-fail):not(.static) #start.fit-1 .door { gap: .3rem; }
html.js:not(.fx-fail):not(.static) #start.fit-2 .door__body { font-size: .84rem; line-height: 1.25; }
html.js:not(.fx-fail):not(.static) #start.fit-2 .door__title { font-size: 1.2rem; }
html.js:not(.fx-fail):not(.static) #start.fit-2 .door__cta { min-height: 44px; padding-block: .3rem; }
html.js:not(.fx-fail):not(.static) #start.fit-2 .start__fit { font-size: .76rem; line-height: 1.25; padding: .4rem .6rem; margin-top: .5rem; }
html.js:not(.fx-fail):not(.static) #start.fit-3 { --art-k: .7; }
html.js:not(.fx-fail):not(.static) #start.fit-3 .door { --pad: .5rem; gap: .25rem; }
/* the tag chip would cover a plate this small: the badge, title and call to action carry the card */
html.js:not(.fx-fail):not(.static) #start.fit-3 .door__tag { display: none; }
/* Tall phones (390 x 844): the art strip keeps its 120 px through the tiers, so the spacing and the fit note tighten instead. */
@media (max-width: 900px) and (min-height: 760px) {
  html.js:not(.fx-fail):not(.static) #start.fit-3 { --art-k: 1; }
  html.js:not(.fx-fail):not(.static) #start.fit-3 .doors { gap: 10px; margin-block: .4rem .3rem; }
  html.js:not(.fx-fail):not(.static) #start.fit-3 .door { gap: .2rem; }
  html.js:not(.fx-fail):not(.static) #start.fit-3 .door__cta { min-height: 44px; padding-block: .2rem; }
  html.js:not(.fx-fail):not(.static) #start.fit-3 .start__fit { margin-top: .3rem; padding: .3rem .55rem; font-size: .72rem; line-height: 1.22; }
  html.js:not(.fx-fail):not(.static) #start.fit-3 .stage { padding-top: 68px; }
  html.js:not(.fx-fail):not(.static) #start.fit-3 h2 { line-height: 1; }
  html.js:not(.fx-fail):not(.static) #start.fit-3 .start__sub { margin-top: .25rem; }
  html.js:not(.fx-fail):not(.static) #start.fit-3 .door__body { font-size: .78rem; line-height: 1.2; }
  html.js:not(.fx-fail):not(.static) #start.fit-4 { --art-k: 1; }
}
@media (max-width: 900px) and (max-height: 759px), (min-width: 901px) { html.js:not(.fx-fail):not(.static) #start.fit-4 { --art-k: .6; } }
html.js:not(.fx-fail):not(.static) #start.fit-4 .door__body { display: none; }
/* Last resort (320 wide, or no taller than 600): the fit note goes, its words stay in the page. Both cards keep their picture, title and call to action. */
html.js:not(.fx-fail):not(.static) #start.fit-5 .start__fit { display: none; }
