/* BETWEEN STORMS — Gulf Crown Roofing Co. (fictional) · roofing adapter world.
   Thesis: Houston weather comes in fronts — the film rides the gap between two,
   from gathering slate to the gold seam of a finished repair. Content adapter on
   the flagship-validated shell: shared engine + shared relay; its own palette,
   motifs, and copy. */

:root {
  --storm: #1b2025;         /* ink night ground */
  --storm-deep: #12161a;
  --gold: #d9b23a;        /* the one copper thread */
  --gold-bright: #e8cd6e;
  --sky: #ccd6de;          /* night-light text */
  --held: #8fd8c9;          /* the carried call / pressure held */
  --white: #ffffff;
  --w-display: "Rockwell", "Cambria", "Georgia", serif;
  --w-body: "Aptos", "Segoe UI", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body { margin: 0; background: var(--storm); color: var(--sky); font-family: var(--w-body); font-size: 1.0625rem; line-height: 1.55; -webkit-font-smoothing: antialiased; }

.skip-link { position: absolute; left: -999px; top: 0; z-index: 40; background: #000; color: #fff; padding: 0.6rem 1rem; font-weight: 700; }
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

.private-banner { position: relative; z-index: 30; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; background: #000; color: #fff; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 0.45rem clamp(1.25rem, 4vw, 3rem); }

.site-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1.5rem; padding: 0.85rem clamp(1.25rem, 4vw, 3rem); color: #fff; }
.site-header::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 180%; z-index: -1; background: linear-gradient(to bottom, rgba(4, 6, 8, 0.62), rgba(4, 6, 8, 0)); pointer-events: none; }
.site-header a { color: #fff; text-decoration: none; text-shadow: 0 1px 22px rgba(0, 0, 0, 0.55); }
.w-brand { font-family: var(--w-display); font-size: 1.15rem; letter-spacing: 0.02em; font-weight: 500; }
.w-brand small { display: block; font-family: var(--w-body); font-size: 0.58rem; font-weight: 800; letter-spacing: 0.22em; text-transform: uppercase; opacity: 0.85; }
.header-links { margin-left: auto; display: flex; gap: 1.4rem; align-items: center; }
.header-links a { font-size: 0.82rem; font-weight: 700; }
.header-links a:hover, .header-links a:focus-visible { text-decoration: underline; text-underline-offset: 4px; }
.exit-demo { border: 1px solid rgba(255, 255, 255, 0.75); padding: 0.45rem 0.75rem; font-size: 0.68rem !important; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
:focus-visible { outline: 2px solid var(--held); outline-offset: 3px; }

/* ---------- the film ---------- */

.film, .film-stage { background: var(--storm); }

.world-ground { position: absolute; inset: 0; z-index: 0; background: radial-gradient(110% 80% at 50% 110%, rgba(184, 115, 51, 0.16), transparent 60%), linear-gradient(180deg, #10151a, var(--storm-deep) 60%); }

.grain { position: absolute; inset: -60%; z-index: 6; pointer-events: none; opacity: 0.14; background-image: url("data:image/svg+xml,%3Csvg xmlns='http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E"); mix-blend-mode: soft-light; }

/* the storm line — narrative spine: the front passing through the film */
.main-line { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; pointer-events: none; opacity: calc(1 - clamp(0, (var(--film-p, 0) - 0.72) * 4, 1)); }
.main-line path { fill: none; stroke-width: 3; stroke: color-mix(in srgb, var(--gold-bright) calc((1 - var(--film-p, 0)) * 100%), var(--held)); stroke-dasharray: 1500; stroke-dashoffset: calc(1500 - var(--film-p, 0) * 1500); filter: drop-shadow(0 0 7px rgba(224, 154, 85, 0.35)); }
html.rm .main-line path, html:not(.js) .main-line path { stroke-dashoffset: 0; stroke: var(--held); }


.w-kicker { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.24em; text-transform: uppercase; color: var(--gold-bright); margin: 0 0 1.2rem; }
.scene--held .w-kicker { color: var(--held); }
.w-display { font-family: var(--w-display); font-weight: 500; line-height: 0.98; letter-spacing: -0.01em; font-size: clamp(3.2rem, 10vw, 8.2rem); margin: 0 0 1.2rem; color: var(--white); text-wrap: balance; }
.w-display em { font-style: italic; color: var(--gold-bright); }
.scene--held .w-display em { color: var(--held); }
.w-lede { max-width: 34rem; font-size: 1.12rem; color: var(--sky); }


/* scene 1 · THE FRONT — slate sky, rain, the roof profile */
.storm-sky { position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, #262d34 0%, #1b2025 45%, #14181c 100%); opacity: calc(1 - var(--film-p, 0) * 0.7); }
.rain { position: absolute; inset: -10% 0 0 0; z-index: 2; pointer-events: none; background: repeating-linear-gradient(78deg, transparent 0 46px, rgba(204, 214, 222, 0.14) 46px 47px, transparent 47px 96px); opacity: calc(var(--p, 0) * (1 - var(--film-p, 0)) * 0.9); }
html.rm .rain, html:not(.js) .rain { opacity: 0.15; }
.roof-profile { position: absolute; z-index: 2; left: 50%; bottom: 0; transform: translateX(-50%); width: min(96vw, 74rem); }
.roof-profile svg { width: 100%; height: auto; display: block; }
.roof-profile .frame { stroke: rgba(204, 214, 222, 0.4); stroke-width: 2; fill: none; }
.roof-profile .shingles { stroke: rgba(204, 214, 222, 0.18); stroke-width: 1.5; fill: none; }
.scene-1 .scene-copy { position: absolute; z-index: 5; left: clamp(1.25rem, 6vw, 6rem); top: 14vh; max-width: 46rem; }

/* scene 2 · THE LEAK — a traced path and a spreading stain */
.leak-trace { position: absolute; z-index: 2; left: 50%; top: 12vh; transform: translateX(-50%); width: min(70vw, 40rem); height: 60vh; }
.leak-trace svg { width: 100%; height: 100%; overflow: visible; }
.leak-trace .drop-path { fill: none; stroke: var(--gold-bright); stroke-width: 2.5; stroke-dasharray: 700; stroke-dashoffset: calc(700 - var(--p, 0) * 700); filter: drop-shadow(0 0 6px rgba(232, 205, 110, 0.4)); }
html.rm .leak-trace .drop-path, html:not(.js) .leak-trace .drop-path { stroke-dashoffset: 0; }
.stain { position: absolute; z-index: 1; left: 50%; bottom: 8vh; transform: translateX(-50%) scale(calc(0.3 + var(--p, 0) * 0.7)); width: 40vmin; height: 12vmin; border-radius: 50%; background: radial-gradient(50% 50% at 50% 50%, rgba(217, 178, 58, 0.2), transparent 70%); }

/* scene 4 extra · THE SEAM — one gold line across the ridge */
.seam-line { position: absolute; z-index: 2; left: 50%; top: 62%; transform: translateX(-50%); width: min(80vw, 56rem); }
.seam-line svg { width: 100%; height: auto; overflow: visible; }
.seam-line path { fill: none; stroke: var(--gold-bright); stroke-width: 3.5; stroke-dasharray: 900; stroke-dashoffset: calc(900 - var(--p, 0) * 900); filter: drop-shadow(0 0 10px rgba(232, 205, 110, 0.55)); }
html.rm .seam-line path, html:not(.js) .seam-line path { stroke-dashoffset: 0; }

/* scene 3 · THE ANSWER — shared relay component, this world's colors */
.relay-strip { position: absolute; z-index: 4; left: 50%; top: 56%; transform: translateX(-50%); width: min(80vw, 60rem); }
.relay-strip svg { width: 100%; height: auto; overflow: visible; }
.relay-strip .track { stroke: rgba(255, 255, 255, 0.32); stroke-width: 2; stroke-dasharray: 6 7; fill: none; }
.relay-strip .carried { stroke: var(--held); stroke-width: 3; fill: none; stroke-dasharray: 800; stroke-dashoffset: calc(800 - var(--p, 0) * 800); filter: drop-shadow(0 0 8px rgba(143, 216, 201, 0.5)); }
.relay-strip .dot { fill: color-mix(in srgb, var(--gold-bright) calc((1 - var(--p, 0)) * 100%), var(--held)); offset-path: path("M10 70 C 190 70, 260 20, 430 20 C 560 20, 620 60, 790 60"); offset-distance: calc(var(--p, 0) * 100%); }
html.rm .relay-strip .carried, html:not(.js) .relay-strip .carried { stroke-dashoffset: 0; }
html.rm .relay-strip .dot, html:not(.js) .relay-strip .dot { offset-distance: 100%; }
.capture-chips { position: absolute; z-index: 5; left: 50%; top: 70%; transform: translateX(-50%); display: flex; gap: 0.7rem; flex-wrap: wrap; justify-content: center; width: min(84vw, 56rem); }
.capture-chips span { border: 1px solid rgba(255, 255, 255, 0.4); color: var(--white); background: rgba(7, 9, 11, 0.6); backdrop-filter: blur(3px); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; padding: 0.5rem 0.8rem; opacity: var(--p, 0); transform: translateY(calc((1 - var(--p, 0)) * 14px)); }
html.rm .capture-chips span, html:not(.js) .capture-chips span { opacity: 1; transform: none; }

/* scene 4 · FINALE */
.scene--finale .scene-copy { position: absolute; z-index: 5; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; max-width: 60rem; width: calc(100% - 2.5rem); }
.wordmark { font-family: var(--w-display); font-weight: 500; color: var(--white); font-size: clamp(2.6rem, 8.4vw, 6.8rem); line-height: 0.98; margin: 0 0 1rem; }
.wordmark small { display: block; font-family: var(--w-body); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.32em; text-transform: uppercase; color: var(--held); margin-top: 1.1rem; }
.fiction-stamp { display: inline-block; margin-top: 2rem; transform: rotate(-2deg); border: 2px solid var(--gold-bright); color: var(--gold-bright); background: rgba(7, 9, 11, 0.8); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; text-align: center; line-height: 1.35; padding: 0.5rem 0.8rem; }
.fiction-stamp small { display: block; font-size: 0.56rem; letter-spacing: 0.06em; }

/* beats */
.beat { color: var(--white); }
.beat::before { content: ""; position: absolute; z-index: -1; inset: -55% -20% -55% -12%; background: radial-gradient(60% 58% at 22% 50%, rgba(2, 4, 6, 0.66), rgba(2, 4, 6, 0.38) 45%, transparent 78%); }
.beat h2 { font-family: var(--w-display); font-weight: 500; font-size: clamp(1.9rem, 4.4vw, 3.4rem); line-height: 1.06; margin: 0 0 0.5rem; }
.beat p { font-size: 1.02rem; margin: 0; opacity: 0.92; max-width: 26rem; }
.beat--tl { left: clamp(1.25rem, 6vw, 6rem); top: 22vh; }
.beat--bl { left: clamp(1.25rem, 6vw, 6rem); bottom: 14vh; }
.beat--br { right: clamp(1.25rem, 6vw, 6rem); bottom: 16vh; text-align: right; }
.beat--br::before { inset: -55% -12% -55% -20%; background: radial-gradient(60% 58% at 78% 50%, rgba(2, 4, 6, 0.66), rgba(2, 4, 6, 0.38) 45%, transparent 78%); }

/* after-film sections (shared shell rhythm) */
.section { min-height: min(92vh, 900px); display: grid; align-content: center; padding: clamp(4rem, 9vw, 8rem) clamp(1.25rem, 6vw, 6rem); border-top: 1px solid rgba(207, 217, 221, 0.14); }
.section .wrap { max-width: 72rem; width: 100%; margin: 0 auto; }
.after-film { background: var(--storm-deep); color: var(--sky); }
.sec-kicker { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.24em; text-transform: uppercase; color: var(--held); margin: 0 0 1.3rem; }
.sec-display { font-family: var(--w-display); font-weight: 500; color: var(--white); font-size: clamp(2.2rem, 5.2vw, 4.4rem); line-height: 1.02; margin: 0 0 1.4rem; text-wrap: balance; }
.sec-lede { color: var(--sky); opacity: 0.9; max-width: 36rem; font-size: 1.08rem; }
.desk-jobs { list-style: none; margin: 2.6rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.6rem; }
.desk-jobs li { border-top: 2px solid var(--held); padding-top: 1rem; }
.desk-jobs h3 { font-family: var(--w-body); font-size: 0.98rem; font-weight: 800; margin: 0 0 0.4rem; color: var(--white); }
.desk-jobs p { font-size: 0.9rem; margin: 0; opacity: 0.8; }

.challenge { border: 1px solid rgba(207, 217, 221, 0.25); background: rgba(12, 16, 19, 0.6); margin-top: 2.6rem; }
.challenge-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; padding: 1.1rem 1.6rem; border-bottom: 1px solid rgba(207, 217, 221, 0.18); }
.challenge-head h3 { font-family: var(--w-display); font-weight: 500; font-size: 1.5rem; margin: 0; color: var(--white); }
.challenge-label { font-size: 0.6rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-bright); border: 1px solid var(--gold-bright); padding: 0.3rem 0.55rem; }
.challenge-chips { display: flex; flex-wrap: wrap; gap: 0.6rem; padding: 1.1rem 1.6rem; border-bottom: 1px solid rgba(207, 217, 221, 0.18); }
.challenge-chips [role="tab"] { border: 1px solid rgba(255, 255, 255, 0.5); background: transparent; color: var(--white); cursor: pointer; font: 700 0.78rem/1.3 var(--w-body); padding: 0.6rem 0.85rem; min-height: 2.75rem; text-align: left; }
.challenge-chips [role="tab"][aria-selected="true"] { background: var(--sky); color: var(--storm-deep); border-color: var(--sky); }
.challenge-body { padding: 1.6rem; }
.exchange { margin: 0; display: grid; gap: 0.9rem; }
.exchange .line { display: grid; grid-template-columns: 6.2rem 1fr; gap: 1rem; align-items: start; }
.exchange dt { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; opacity: 0.7; padding-top: 0.5rem; }
.exchange dd { margin: 0; padding: 0.6rem 0.9rem; font-size: 0.97rem; }
.exchange .line--caller dd { border: 1px solid rgba(207, 217, 221, 0.3); }
.exchange .line--desk dd { background: var(--sky); color: var(--storm-deep); }
.exchange .line--limit dd { border: 1px dashed var(--held); }
.challenge-note { padding: 1rem 1.6rem; border-top: 1px solid rgba(207, 217, 221, 0.18); font-size: 0.85rem; opacity: 0.75; margin: 0; }

.demo-boundary { background: #05070a; }
.boundary-list { list-style: none; margin: 1.6rem 0 0; padding: 0; display: grid; gap: 0.8rem; max-width: 40rem; }
.boundary-list li { border-top: 1px solid rgba(207, 217, 221, 0.2); padding-top: 0.8rem; font-size: 0.96rem; font-weight: 600; }

.close { text-align: center; background: var(--storm-deep); }
.close .sec-display { font-size: clamp(2.5rem, 6vw, 5rem); }
.primary-action { display: inline-flex; flex-direction: column; align-items: center; gap: 0.2rem; margin-top: 1.6rem; background: var(--held); color: var(--storm-deep); border: 0; cursor: pointer; padding: 1rem 1.7rem; font-family: var(--w-body); box-shadow: 0 0 0 1px rgba(143, 216, 201, 0.4), 0 0 34px rgba(143, 216, 201, 0.22); }
.primary-action span { font-size: 1.05rem; font-weight: 800; }
.primary-action small { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.85; }
.primary-action:hover, .primary-action:focus-visible { box-shadow: 0 0 0 1px rgba(143, 216, 201, 0.7), 0 0 48px rgba(143, 216, 201, 0.38); transform: translateY(-1px); }
@media (prefers-reduced-motion: reduce) { .primary-action:hover { transform: none; } }
.separate-product { margin-top: 2.2rem; font-size: 0.85rem; opacity: 0.75; max-width: 34rem; margin-left: auto; margin-right: auto; }

.site-footer { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; padding: 1.4rem clamp(1.25rem, 6vw, 6rem); border-top: 1px solid rgba(207, 217, 221, 0.14); font-size: 0.78rem; color: var(--sky); opacity: 0.8; background: var(--storm-deep); }

dialog.boundary { border: 1px solid var(--sky); background: var(--storm-deep); color: var(--sky); padding: 2.2rem; }
dialog.boundary h2 { font-family: var(--w-display); font-weight: 500; color: var(--white); font-size: 1.7rem; margin: 0 0 0.8rem; }
dialog.boundary p { font-size: 0.95rem; opacity: 0.85; }
.dialog-close { position: absolute; top: 0.6rem; right: 0.8rem; border: 0; background: transparent; font-size: 1.7rem; cursor: pointer; color: var(--sky); }
.dialog-confirm { border: 1px solid var(--sky); background: var(--sky); color: var(--storm-deep); padding: 0.8rem 1.1rem; font-weight: 800; cursor: pointer; margin-top: 0.6rem; }

@media (max-width: 768px) {
  .w-display { font-size: clamp(2.5rem, 12vw, 4.2rem); }
  .beat { max-width: min(86vw, 26rem); }
  .beat--br { text-align: left; right: auto; left: 1.25rem; }
  .desk-jobs { grid-template-columns: 1fr 1fr; }
  .exchange .line { grid-template-columns: 1fr; gap: 0.3rem; }
  .exchange dt { padding-top: 0; }
  .relay-strip { top: 58%; }
  .capture-chips { top: 74%; }
}
@media (max-width: 480px) {
  .desk-jobs { grid-template-columns: 1fr; }
  .header-links a:not(.exit-demo) { display: none; }
}

/* ---------- photoreal keyframe layers (generated on the founder's engine, graded into the world) ---------- */

.photo { position: absolute; inset: 0; z-index: 1; background-size: cover; background-position: center; transform: scale(calc(1.04 + var(--p, 0) * 0.08)); }
.photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(27, 32, 37, 0.6), rgba(18, 22, 26, 0.28) 42%, rgba(18, 22, 26, 0.7)); }
.photo-1 { background-image: url("assets/kf1-storm.jpg"); }
.photo-2 { background-image: url("assets/kf2-house.jpg"); }
.photo-3 { background-image: url("assets/kf4-progress.jpg"); }
.photo-3::after { background: linear-gradient(180deg, rgba(18, 22, 26, 0.72), rgba(18, 22, 26, 0.5) 45%, rgba(18, 22, 26, 0.78)); }
.photo-4 { background-image: url("assets/kf5-finished.jpg"); }
.photo-4::after { background: linear-gradient(180deg, rgba(18, 22, 26, 0.45), rgba(18, 22, 26, 0.18) 45%, rgba(18, 22, 26, 0.55)); }
html.rm .photo, html:not(.js) .photo { transform: none; }
.scene-1 .roof-profile { opacity: 0.5; }
.storm-sky { opacity: calc((1 - var(--film-p, 0)) * 0.35); }

.scene--finale .scene-copy::before { content: ""; position: absolute; z-index: -1; inset: -18% -12%; background: radial-gradient(60% 60% at 50% 45%, rgba(10, 13, 15, 0.68), rgba(10, 13, 15, 0.4) 55%, transparent 80%); }
.scene--finale .scene-copy { z-index: 5; }

/* scene-copy hands off before the beats arrive (no text-over-text) */
.scene-1 .scene-copy { opacity: calc(1 - clamp(0, (var(--pl, 0) - 0.32) * 2.4, 1)); }
html.rm .scene-1 .scene-copy, html:not(.js) .scene-1 .scene-copy { opacity: 1; }
