/* THE QUIET MAIN — Quiet Main Plumbing Co. (fictional) · plumbing adapter world.
   Thesis: the house is quiet because the main is doing its job — until the night
   it isn't. Ink-black night, one copper thread of light; pressure held, call carried.
   Content adapter on the flagship-validated shell: shared engine + shared relay
   component; its own palette, motif, and copy. */

:root {
  --night: #0c1013;         /* ink night ground */
  --night-deep: #07090b;
  --copper: #b87333;        /* the one copper thread */
  --copper-bright: #e09a55;
  --mist: #cfd9dd;          /* night-light text */
  --held: #8fd8c9;          /* the carried call / pressure held */
  --white: #ffffff;
  --w-display: "Constantia", "Charter", "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(--night); color: var(--mist); 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(--night); }

.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(--night-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 copper main — narrative spine: a vertical run descending as the film plays */
.main-line { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; pointer-events: none; }
.main-line path { fill: none; stroke-width: 3; stroke: color-mix(in srgb, var(--copper-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); }

/* scene 1 · THE QUIET HOUSE (night elevation, one lit window) */
.night-house { position: absolute; z-index: 1; left: 50%; top: 46%; transform: translate(-50%, -50%); width: min(72vw, 48rem); }
.night-house svg { width: 100%; height: auto; }
.night-house .frame { stroke: rgba(207, 217, 221, 0.35); stroke-width: 2; fill: none; }
.night-house .lit { fill: rgba(224, 154, 85, calc(0.25 + var(--p, 0) * 0.5)); }
.scene-1 .scene-copy { position: absolute; z-index: 5; left: clamp(1.25rem, 6vw, 6rem); bottom: 12vh; max-width: 46rem; }

.w-kicker { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.24em; text-transform: uppercase; color: var(--copper-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(--copper-bright); }
.scene--held .w-display em { color: var(--held); }
.w-lede { max-width: 34rem; font-size: 1.12rem; color: var(--mist); }

/* scene 2 · THE DRIP (low ripples, not rings — water, not sound) */
.ripples { position: absolute; z-index: 2; left: 50%; top: 62%; transform: translateX(-50%); width: min(80vw, 56rem); height: 30vh; }
.ripples i { position: absolute; left: 50%; top: 50%; border: 2px solid var(--copper-bright); border-radius: 50%; transform: translate(-50%, -50%) scaleY(0.28); width: calc(var(--p, 0) * var(--rip-size)); height: calc(var(--p, 0) * var(--rip-size)); opacity: calc(0.85 - var(--p, 0) * 0.8); }
.ripples i:nth-child(1) { --rip-size: 30vmin; }
.ripples i:nth-child(2) { --rip-size: 52vmin; }
.ripples i:nth-child(3) { --rip-size: 78vmin; }
html.rm .ripples i, html:not(.js) .ripples i { width: var(--rip-size); height: var(--rip-size); opacity: 0.12; }
.drip-count { position: absolute; z-index: 5; left: 50%; top: 34%; transform: translate(-50%, -50%); font-family: var(--w-display); font-size: clamp(3.4rem, 10vw, 7.5rem); color: var(--white); }

/* 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(--copper-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(--copper-bright); color: var(--copper-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(--night-deep); color: var(--mist); }
.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(--mist); 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(--copper-bright); border: 1px solid var(--copper-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(--mist); color: var(--night-deep); border-color: var(--mist); }
.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(--mist); color: var(--night-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(--night-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(--night-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(--mist); opacity: 0.8; background: var(--night-deep); }

dialog.boundary { border: 1px solid var(--mist); background: var(--night-deep); color: var(--mist); 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(--mist); }
.dialog-confirm { border: 1px solid var(--mist); background: var(--mist); color: var(--night-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; }
}

/* 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; }
