/* Thread: the Silk Line night. One rose thread is a voice; a gold one joins it. */
:root {
  --ground: #1B1519;
  --raised: #241B21;
  --ink: #F3EBE1;
  --soft: #CFC3BB;
  --rose: #E9A08E;
  --gold: #EFCB8C;
  --on-gold: #1B1519;

  --serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --sans: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --display: clamp(3.5rem, 13vw, 9.5rem);
  --title: clamp(2.25rem, 5.4vw, 4rem);
  --statement: clamp(1.5rem, 2.6vw, 2.25rem);
  --text: 1.0625rem;
  --small: 0.9375rem;

  --gutter: clamp(1rem, 4vw, 2.5rem);
  --section: clamp(6rem, 14vw, 12rem);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --rise: 640ms;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--ground); color-scheme: dark; scroll-behavior: smooth; scroll-padding-top: 5rem; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 var(--text)/1.55 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: clip; }
h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, svg, canvas { display: block; max-width: 100%; }
[hidden]:not(.again) { display: none !important; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
::selection { background: var(--gold); color: var(--on-gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }
html { scrollbar-color: #5C4A52 var(--ground); }

h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em; text-wrap: balance; }
h1 { font-size: var(--display); line-height: 0.92; letter-spacing: -0.035em; }
h2 { font-size: var(--title); line-height: 1; }
h3 { font: 600 1.1875rem/1.3 var(--sans); }
p { max-width: 62ch; text-wrap: pretty; }

.skip { position: absolute; left: var(--gutter); top: -4rem; z-index: 20; padding: 0.75rem 1rem; background: var(--gold); color: var(--on-gold); }
.skip:focus { top: 0.5rem; }

/* Bar */
.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 2rem; padding: 0.875rem var(--gutter); background: var(--ground); }
.mark { font: 400 1.75rem/1 var(--serif); letter-spacing: -0.02em; text-decoration: none; margin-right: auto; }
.bar nav { display: flex; gap: 1.75rem; font-size: var(--small); }
.bar nav a { text-decoration: none; padding: 0.5rem 0; }
@media (hover: hover) and (pointer: fine) { .bar nav a:hover { text-decoration: underline; } }
@media (max-width: 46rem) { .bar nav { display: none; } }
.js .bar:not(.past-hero) .btn-small { visibility: hidden; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 3.25rem; padding: 0 1.75rem; border: 0; border-radius: 999px; background: var(--gold); color: var(--on-gold); font: 600 1rem/1 var(--sans); text-decoration: none; cursor: pointer; transition: transform 160ms var(--ease-out), background-color 200ms ease; }
.btn:active { transform: scale(0.97); }
.btn[disabled] { background: #3A2D34; color: #B9AAA6; cursor: not-allowed; }
.btn-small { min-height: 2.75rem; padding: 0 1.25rem; font-size: var(--small); }
.btn-big { min-height: 4rem; padding: 0 2.5rem; font-size: 1.125rem; }
@media (hover: hover) and (pointer: fine) { .btn:not([disabled]):hover { background: #F6DBA9; } }
.link { background: none; border: 0; padding: 0.75rem 0; color: var(--ink); font: inherit; text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; }

/* Hero */
.hero { min-height: calc(100svh - 4.5rem); display: grid; grid-template-rows: auto 1fr auto; gap: clamp(1rem, 3vh, 2rem); padding: clamp(1rem, 4vh, 3rem) var(--gutter) clamp(1.5rem, 5vh, 3rem); }
.trace { position: relative; align-self: center; margin-inline: calc(var(--gutter) * -1); }
.trace canvas { width: 100%; height: clamp(8rem, 30vh, 18rem); }
.said { max-width: 46ch; margin: 0.5rem var(--gutter) 0; font: italic 400 clamp(1.25rem, 2.1vw, 1.75rem)/1.35 var(--serif); color: var(--ink); }
.said .w { transition: opacity 320ms ease; }
.js .said.playing .w { opacity: 0.52; }
.js .said.playing .w.on { opacity: 1; }
.again { margin: 0.75rem var(--gutter) 0; padding: 0.5rem 0; background: none; border: 0; color: var(--gold); font: inherit; font-size: var(--small); text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; }
.again[hidden] { display: block; visibility: hidden; }
.hero-foot { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1.5rem 3rem; }
.lede { max-width: 44ch; font-size: clamp(1.0625rem, 1.4vw, 1.25rem); }

/* Longing */
.longing { display: grid; grid-template-columns: repeat(12, 1fr); align-items: end; gap: 2.5rem var(--gutter); padding: var(--section) var(--gutter) 0; }
.statement { grid-column: 1 / span 6; max-width: 26ch; font: 400 var(--statement)/1.2 var(--serif); letter-spacing: -0.01em; }
.longing-more { grid-column: 7 / span 6; display: grid; gap: 1rem; }
dfn { font-style: normal; font-weight: 600; }
@media (max-width: 46rem) { .statement, .longing-more { grid-column: 1 / -1; } }

/* A first call: two voices, word by word */
.call { padding: var(--section) var(--gutter) 0; }
.call h2 { max-width: 12ch; }
.lines { display: grid; gap: clamp(1.75rem, 4vw, 3rem); margin-top: clamp(3rem, 7vw, 5.5rem); }
.line { max-width: 20ch; font: 400 clamp(1.625rem, 3.6vw, 3rem)/1.08 var(--serif); letter-spacing: -0.015em; text-wrap: balance; }
.line.sam { color: var(--rose); }
.line.alex { justify-self: end; text-align: right; color: var(--gold); }
.who { display: block; margin-bottom: 0.375rem; font: 400 var(--small)/1.4 var(--sans); letter-spacing: 0; color: var(--soft); }
.aside { justify-self: center; text-align: center; max-width: 30ch; font: italic 400 1.25rem/1.35 var(--serif); color: var(--soft); }
.call-note { margin-top: clamp(3rem, 7vw, 5.5rem); font-size: var(--small); color: var(--soft); }
.line .w, .aside .w { transition: opacity 420ms ease; }

/* How it goes: two threads run down the left edge */
.how { position: relative; display: grid; grid-template-columns: clamp(3rem, 22vw, 20rem) minmax(0, 1fr); column-gap: clamp(0.75rem, 2vw, 2rem); padding: var(--section) var(--gutter) 0 0; }
.thread-col { position: sticky; top: 4.5rem; align-self: start; height: calc(100svh - 4.5rem); }
.threads { width: 100%; height: 100%; overflow: visible; }
/* Where the threads cross is one call. The mark fills when the visitor finishes that conversation. */
.cross { position: absolute; left: 50%; width: 0.75rem; height: 0.75rem; margin: -0.375rem 0 0 -0.375rem; border-radius: 50%; border: 2px solid var(--gold); background: var(--ground); transition: background-color 240ms ease, opacity 300ms ease, transform 300ms var(--ease-out); }
.cross.done { background: var(--gold); transform: scale(1.25); }
.js .cross.wait { opacity: 0; }
.threads path { fill: none; stroke-width: 2; stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 0; }
.t-rose { stroke: var(--rose); }
@media (prefers-reduced-motion: no-preference) { .threads.glide path { transition: stroke-dashoffset 600ms var(--ease-out); } }
.t-gold { stroke: var(--gold); }
.steps { display: grid; gap: var(--section); padding-bottom: 4rem; }
.step { display: grid; gap: 1.25rem; align-content: start; }
.step h2 { max-width: 14ch; margin-bottom: 0.5rem; }

.journey { max-width: 52rem; display: grid; grid-template-columns: minmax(0, 17rem) minmax(0, 1fr); gap: 2rem; align-items: end; margin-top: 1.5rem; padding: clamp(1rem, 3vw, 2rem); background: var(--raised); border-radius: 1.25rem; }
.frame { position: relative; aspect-ratio: 4 / 5; overflow: hidden; border-radius: 0.75rem; background: #67423D; }
.silhouette { position: absolute; inset: 8% 6% 0; width: 88%; height: 92%; }
.silhouette path { fill: #8E5A4F; }
.portrait { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.04); transition: opacity 900ms ease, transform 1400ms var(--ease-out); }
.seen { position: absolute; left: 1rem; bottom: 0.75rem; font: italic 400 1.5rem/1 var(--serif); color: #fff; opacity: 0; transition: opacity 600ms ease 500ms; }
.journey.revealed .portrait { opacity: 1; transform: none; }
.journey.revealed .seen { opacity: 1; }
.journey.revealed .silhouette { opacity: 0; transition: opacity 600ms ease; }
.journey-controls { display: grid; gap: 0.75rem; justify-items: start; }
.status { font: 400 1.5rem/1.2 var(--serif); }
.knots { display: grid; gap: 0.25rem; width: 100%; }
.knot { display: flex; align-items: center; gap: 0.875rem; width: 100%; min-height: 3.25rem; padding: 0.5rem 0.75rem 0.5rem 0.5rem; background: none; border: 0; border-radius: 0.75rem; color: var(--ink); font: inherit; font-size: var(--small); text-align: left; cursor: pointer; transition: background-color 200ms ease, transform 160ms var(--ease-out); }
.knot:active { transform: scale(0.98); }
.knot b { display: block; font-size: 1rem; font-weight: 600; }
.knot-dot { flex: none; width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 2px solid var(--gold); transition: background-color 240ms ease, transform 300ms var(--ease-out); }
.knot[aria-pressed="true"] .knot-dot { background: var(--gold); transform: scale(0.82); }
@media (hover: hover) and (pointer: fine) { .knot:hover { background: #2E232A; } }
.hint { font-size: var(--small); color: var(--soft); }
@media (max-width: 46rem) { .journey { grid-template-columns: 1fr; } .frame { max-width: 15rem; } }

.room { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 2rem; margin-top: 1rem; }
.room dt { font-weight: 600; }
.room dd { margin: 0.125rem 0 0; color: var(--soft); }
.quiet { font: italic 400 1.375rem/1.35 var(--serif); margin-top: 1rem; }
@media (max-width: 34rem) { .room { grid-template-columns: 1fr; } }

/* Keepsake: the call as two lanes, then the same call as a drawing in three styles */
.keepsake { display: grid; gap: clamp(3rem, 6vw, 5rem); margin-top: var(--section); padding: clamp(4rem, 9vw, 8rem) var(--gutter); background: var(--raised); }
.keepsake-text { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem var(--gutter); }
.keepsake-text h2 { grid-column: 1 / -1; margin-bottom: 0.75rem; }
.keepsake-fig { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); grid-template-areas: "call made" "styles made" "reads made" "facts made"; gap: 2rem var(--gutter); align-content: center; }
.heard { grid-area: call; }
.made { grid-area: made; }
.reads { grid-area: reads; }
.styles { grid-area: styles; }
.keepsake-fig figcaption { grid-area: facts; }
.keepsake-fig svg { overflow: visible; }
.keepsake-fig :is(path, line, circle) { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.keepsake-fig .sam { stroke: var(--rose); }
.keepsake-fig .you { stroke: var(--gold); }
.keepsake-fig .cap { font: italic 1.375rem/1.2 var(--serif); color: var(--ink); }
.lanes { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 0.75rem; align-items: center; margin-top: 0.75rem; }
.lane { grid-column: 1; font-size: var(--small); line-height: 12px; }
.lane.sam { grid-row: 1; align-self: start; padding-top: 6px; color: var(--rose); }
.lane.you { grid-row: 1; align-self: end; padding-bottom: 6px; color: var(--gold); }
[data-strip] { grid-column: 2; grid-row: 1; width: 100%; height: 56px; }
[data-strip] rect { stroke: none; opacity: 0.3; }
[data-strip] rect.sam { fill: var(--rose); }
[data-strip] rect.you { fill: var(--gold); }
[data-strip] rect.on { opacity: 1; }
.playhead { stroke: var(--ink); stroke-width: 1; opacity: 0; }
.playhead.on { opacity: 0.8; }
.ends { grid-column: 2; display: flex; justify-content: space-between; margin-top: 0.375rem; font-size: 0.8125rem; color: var(--soft); }
.made { display: grid; justify-items: center; align-content: center; }
.art { width: min(100%, 34rem); aspect-ratio: 1; background: radial-gradient(closest-side, rgb(217 138 78 / 0.16), rgb(217 138 78 / 0)); }
.keepsake-fig .petal.sam { fill: rgb(233 160 142 / 0.16); }
.keepsake-fig .petal.you { fill: rgb(239 203 140 / 0.16); }
.keepsake-fig .vein { opacity: 0.6; }
.keepsake-fig .both { stroke-width: 1.2; }
.keepsake-fig .dot.sam { fill: var(--rose); stroke: none; }
.keepsake-fig .dot.you { fill: var(--gold); stroke: none; }
.keepsake-fig .behind.sam { stroke: #67423D; }
.keepsake-fig .behind.you { stroke: #746149; }
.keepsake-fig .body { fill: rgb(27 21 25 / 0.4); stroke: none; }
.keepsake-fig .end { fill: var(--ink); stroke: none; }
.keepsake-fig .end-loop { stroke: var(--ink); }
.keepsake-fig .sweep { stroke-dasharray: 1; }
.keepsake-fig [data-t]:not(rect, .on) { opacity: 0; }
.reads { max-width: 44ch; min-height: 4.8em; font-size: var(--small); color: var(--soft); }
.styles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.625rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.styles legend { padding: 0; margin-bottom: 0.75rem; font-size: var(--small); color: var(--soft); }
.styles label { position: relative; display: grid; justify-items: center; gap: 0.5rem; padding: 0.875rem 0.5rem; border: 1px solid #4A3B43; border-radius: 18px; font-size: var(--small); color: var(--ink); cursor: pointer; transition: border-color 160ms ease, background-color 160ms ease; }
.styles input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.styles svg { width: 4rem; height: 4.5rem; }
.styles label:has(:checked) { border-color: var(--gold); background: rgb(239 203 140 / 0.06); color: var(--gold); }
.styles label:has(:focus-visible) { outline: 2px solid var(--gold); outline-offset: 3px; }
.keepsake-fig figcaption { max-width: 44ch; font-size: var(--small); color: var(--soft); }
@media (prefers-reduced-motion: no-preference) {
  [data-strip] rect, .keepsake-fig .art [data-t] { transition: opacity 400ms ease; }
}
@media (max-width: 52rem) {
  .keepsake-text { grid-template-columns: 1fr; }
  .keepsake-fig { grid-template-columns: minmax(0, 1fr); grid-template-areas: "call" "styles" "made" "reads" "facts"; }
}

/* Recorded */
.recorded { padding: var(--section) var(--gutter) 0; }
.recorded h2 { max-width: 16ch; }
.plain { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.5rem var(--gutter); margin-top: 3.5rem; }
.plain h3 { font: 400 clamp(1.5rem, 2.4vw, 2rem)/1.15 var(--serif); margin-bottom: 0.75rem; }
.plain p { color: var(--soft); }
.policy { margin-top: 3.5rem; max-width: 70ch; }
@media (max-width: 52rem) { .plain { grid-template-columns: 1fr; } }

/* Yours */
.yours { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 2rem var(--gutter); align-items: center; margin-top: var(--section); padding: clamp(4rem, 9vw, 8rem) 0 clamp(4rem, 9vw, 8rem) var(--gutter); background: #67423D; }
.yours-text { display: grid; gap: 1.25rem; justify-items: start; }
.note { font-weight: 600; }
.mic-status { min-height: 1.5em; font-size: var(--small); }
.mine { width: 100%; height: clamp(9rem, 24vw, 16rem); }
@media (max-width: 52rem) { .yours { grid-template-columns: 1fr; gap: 0; padding-right: 0; padding-bottom: 2rem; } .yours-text { padding-right: var(--gutter); } .mine { height: clamp(6rem, 28vw, 9rem); } }

/* Questions */
.questions { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 2.5rem var(--gutter); padding: var(--section) var(--gutter) 0; }
.faq details { padding: 0.25rem 0; }
.faq summary { display: flex; justify-content: space-between; gap: 1rem; padding: 0.875rem 0; font: 400 clamp(1.375rem, 2.2vw, 1.75rem)/1.2 var(--serif); cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ''; flex: none; width: 0.75rem; height: 0.75rem; margin-top: 0.4em; border-radius: 50%; border: 2px solid var(--rose); transition: background-color 200ms ease; }
.faq details[open] summary::after { background: var(--rose); }
.faq details p { padding: 0 2rem 1.25rem 0; color: var(--soft); }
@media (max-width: 52rem) { .questions { grid-template-columns: 1fr; } }

/* Beta */
.beta { display: grid; gap: 2.5rem; justify-items: start; padding: var(--section) var(--gutter); }
.join { display: grid; gap: 0.75rem; counter-reset: join; font: 400 clamp(1.25rem, 2vw, 1.625rem)/1.3 var(--serif); }
.join li { counter-increment: join; display: grid; grid-template-columns: 2.25rem 1fr; }
.join li::before { content: counter(join); color: var(--rose); }

/* Footer */
.foot { padding: 0 var(--gutter) 2rem; overflow: hidden; }
.foot-mark { font: 400 clamp(8rem, 34vw, 30rem)/0.78 var(--serif); letter-spacing: -0.05em; color: var(--rose); margin-left: -0.04em; max-width: none; padding-bottom: 0.2em; }
@media (max-width: 46rem) { .foot-mark { margin-left: 0; } }
.foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; margin-top: 2.5rem; }
.credits { margin-top: 1.5rem; max-width: 80ch; font-size: var(--small); color: var(--soft); }

/* Entrances: content is visible without script; with script each part rises once. */
@media (prefers-reduced-motion: no-preference) {
  .js [data-rise] > * { opacity: 0; transform: translateY(1.5rem); transition: opacity var(--rise) ease, transform var(--rise) var(--ease-out); }
  .js [data-rise].in > * { opacity: 1; transform: none; }
  .js [data-rise].in > :nth-child(2) { transition-delay: 80ms; }
  .js [data-rise].in > :nth-child(3) { transition-delay: 140ms; }
  .js [data-rise].in > :nth-child(n+4) { transition-delay: 190ms; }
  /* Speech lights up word by word when a line comes into view. */
  .js [data-line] .w { opacity: 0.5; }
  .js .aside .w { opacity: 0.7; }
  .js [data-line] .w.on { opacity: 1; }
  .js .hero h1, .js .hero-foot { animation: rise 900ms var(--ease-out) both; }
  .js .hero-foot { animation-delay: 180ms; }
  @keyframes rise { from { opacity: 0; transform: translateY(1.5rem); } }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .portrait { transform: none; transition: opacity 300ms ease; }
  .btn, .knot, .knot-dot, .cross { transition: none; }
}
