/* ─── Driftwood homepage ──────────────────────────────────────
   The homepage borrows the app's own visual language instead of the
   marketing site's: palette, type roles, cards and scenes all mirror
   src/app/globals.css and the Shore / Tide components, so what a visitor
   sees here is what they walk into. Interior pages keep site.css. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

:root {
  /* App palette (src/app/globals.css) */
  --shore: #d6e6f3;
  --sand: #ede6d8;
  --driftwood: #756656;
  --deep: #36322d;
  --charcoal: #241f1b;
  --paper: #fdfcfa;
  --water: #8fa9b8;
  --water-light: #c5d5de;
  --sage: #9baf9a;
  --clay: #c4977a;
  --lavender: #a798b5;
  --dusty-rose: #c9a9a6;

  /* Type roles, as in the app: serif = Driftwood's voice, sans = your words */
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --hand: "Bradley Hand", "Segoe Print", "Segoe Script", "Ink Free", "Noteworthy", cursive;

  --col: 600px;
  --gutter: 20px;
}

body {
  font-family: var(--sans);
  font-weight: 450;
  color: var(--deep);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ─── Nav ─────────────────────────────────────────────────── */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  transition: background-color .4s ease, box-shadow .4s ease;
}
.nav-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px var(--gutter);
}
.nav-mark {
  font-family: var(--serif); font-size: 19px; color: var(--charcoal);
  letter-spacing: -0.01em;
  opacity: 0; transition: opacity .4s ease;
}
.nav-actions { display: flex; align-items: center; gap: 18px; }
.nav-login { font-size: 14px; color: var(--deep); }
.nav-login:hover { color: var(--charcoal); }
.nav-cta {
  font-size: 14px; color: var(--paper); background: var(--charcoal);
  padding: 8px 16px; border-radius: 999px;
}
.nav-cta:hover { background: #3a332d; }
.nav.is-solid {
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--sand) 80%, transparent);
}
.nav.is-solid .nav-mark { opacity: 1; }

/* ─── Hero ────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding: clamp(96px, 15vh, 150px) var(--gutter) clamp(120px, 22vh, 220px);
  overflow: hidden;
  isolation: isolate;
  background: var(--paper);
}
.hero-scene {
  position: absolute; inset: auto 0 0 0; height: 62%;
  z-index: -1;
  background: url("/assets/scenes/arrival/mobile.webp") center 78% / cover no-repeat;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,.55) 34%, #000 62%, #000 80%, transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,.55) 34%, #000 62%, #000 80%, transparent 100%);
  opacity: .9;
}
@media (min-width: 768px) {
  .hero-scene { background-image: url("/assets/scenes/arrival/desktop.webp"); background-position: center 72%; height: 58%; }
}

.hero h1 { font-weight: normal; }
.hero-pre {
  display: block;
  font-family: var(--serif); font-style: italic;
  font-size: clamp(21px, 2.3vw, 30px);
  color: var(--driftwood);
  letter-spacing: 0.01em;
}
.hero-you {
  display: block;
  font-family: var(--serif);
  font-size: clamp(132px, 23vw, 330px);
  line-height: .86;
  letter-spacing: -0.045em;
  color: var(--charcoal);
  margin: .08em 0 0 -0.04em; /* optical: the period pulls the word right */
}
.hero-lines {
  margin-top: clamp(28px, 4.5vh, 48px);
  font-family: var(--serif);
  font-size: clamp(18px, 1.75vw, 23px);
  line-height: 1.6;
  color: var(--deep);
}
.hero-lines span, .hero-tag span { display: block; text-wrap: balance; }
.hero-sign {
  position: relative;
  margin-top: clamp(40px, 7vh, 76px);
  padding: 18px 48px 22px;
}
.hero-sign::before { /* a pocket of mist so the sign reads over the grass */
  content: ""; position: absolute; inset: -30px -90px; z-index: -1;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--paper) 92%, transparent) 40%, color-mix(in srgb, var(--paper) 0%, transparent));
}
.hero-mark {
  font-family: var(--serif);
  font-size: clamp(26px, 2.6vw, 34px);
  letter-spacing: -0.01em;
  color: var(--charcoal);
}
.hero-tag {
  margin-top: 10px;
  font-family: var(--serif); font-style: italic;
  font-size: clamp(16px, 1.35vw, 18px);
  line-height: 1.65;
  color: var(--deep);
}
.hero-tag span { display: block; }

/* ─── Stage: one fixed scene behind the page, like the app's SceneLayer.
   It cross-fades between the shore and the tide as the reader moves. ── */
.stage { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.stage-layer {
  position: absolute; inset: 0; opacity: 0;
  background-size: cover; background-position: center; background-repeat: no-repeat;
  transition: opacity 1.4s ease;
}
/* The app's veil: a translucent paper wash so the scene recedes (globals.css .scene-veil) */
.stage-layer::after { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--paper) 52%, transparent); }
.stage-layer.shore { background-image: url("/assets/scenes/shore/mobile.webp"); }
.stage-layer.tide  { background-image: url("/assets/scenes/tide/mobile.webp"); }
@media (min-width: 768px) {
  .stage-layer.shore { background-image: url("/assets/scenes/shore/desktop.webp"); }
  .stage-layer.tide  { background-image: url("/assets/scenes/tide/desktop.webp"); }
}
.stage[data-on="shore"] .shore, .stage[data-on="tide"] .tide { opacity: 1; }
html:not(.js) .stage .shore { opacity: 1; }

.beat { position: relative; }
.beat-shore::before { /* mist between the threshold and the shore */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 34vh; z-index: 0;
  background: linear-gradient(to bottom, var(--paper), color-mix(in srgb, var(--paper) 0%, transparent));
  pointer-events: none;
}

.app-col {
  position: relative; z-index: 1;
  width: min(100% - 2 * var(--gutter), var(--col));
  margin: 0 auto;
}
.beat-shore .app-col { padding: 22vh 0 18vh; }

/* App header: "driftwood / what's washing ashore?" (src/app/page.tsx) */
.app-head { margin-bottom: 30px; }
.surface-label {
  display: inline-block;
  background: color-mix(in srgb, var(--paper) 95%, transparent);
  border-radius: 10px; padding: .2rem .7rem;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.app-title {
  font-family: var(--serif); font-weight: normal;
  font-size: 27px; letter-spacing: -0.5px; color: var(--charcoal);
}
.app-sub {
  margin-top: 4px;
  font-family: var(--serif); font-style: italic; font-size: 14px; color: var(--driftwood);
}
/* Our own annotation, outside the app UI: quieter, uppercase, never mistaken for the product */
.note {
  font-family: var(--sans); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--driftwood);
}
.example-note { margin: 14px 0 0 .7rem; }

/* ─── Capture card (Shore) ───────────────────────────────── */
.capture {
  background: var(--paper);
  border-radius: 20px;
  padding: 24px 20px 20px;
  box-shadow: 0 1px 8px rgba(74,67,64,.06), 0 12px 40px -24px rgba(36,31,27,.25);
}
.mic { display: flex; flex-direction: column; align-items: center; }
.mic-btn {
  width: 72px; height: 72px; border-radius: 50%;
  border: 2px solid var(--water-light);
  background: linear-gradient(135deg, var(--paper), color-mix(in srgb, var(--water-light) 20%, transparent));
  display: grid; place-items: center; color: var(--water);
}
.mic-label { margin-top: 16px; font-family: var(--serif); font-style: italic; font-size: 14px; color: var(--driftwood); }
.capture-row {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--sand);
  display: flex; align-items: flex-start; gap: 8px;
}
.capture-row .pen { margin-top: 4px; color: var(--driftwood); flex-shrink: 0; }
.capture-row .cam { margin-top: 2px; color: var(--driftwood); flex-shrink: 0; }
.field {
  flex: 1; min-height: 1.6em;
  font-family: var(--sans); font-size: 17px; line-height: 1.6; color: var(--charcoal);
}
.field .ph { color: color-mix(in srgb, var(--deep) 60%, transparent); }
.field .caret {
  display: inline-block; width: 1.5px; height: 1.05em; vertical-align: -0.15em;
  background: var(--charcoal); margin-left: 1px;
  animation: caret 1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
.capture-foot { margin-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 30px; }
.status { font-size: 11px; color: var(--sage); display: flex; align-items: center; gap: 4px; }
.status .dot { font-size: 7px; line-height: 1; }
.release {
  border: 1px solid var(--sand); border-radius: 10px; padding: 6px 14px;
  font-family: var(--serif); font-style: italic; font-size: 13px; color: var(--deep);
  background: color-mix(in srgb, var(--paper) 95%, transparent);
  opacity: 0; transition: opacity .3s ease, background-color .2s ease;
}
.release.show { opacity: 1; }
.release.pressed { background: var(--sand); }

/* ─── Fragment card (src/components/fragment-card.tsx) ───── */
.stream { margin-top: 26px; }
.card {
  position: relative;
  background: var(--paper);
  border-radius: 14px;
  border-left: 3px solid var(--accent, transparent);
  padding: 16px 18px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(74,67,64,.04), 0 10px 30px -22px rgba(36,31,27,.28);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.when { font-size: 12px; color: var(--driftwood); white-space: nowrap; }
.card-tools { display: flex; align-items: center; gap: 8px; color: var(--driftwood); }
.card-tools .t { font-size: 15px; line-height: 1; padding: 0 4px; opacity: .7; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 10px; padding: 2px 8px;
  font-family: var(--serif); font-style: italic; font-size: 11px; color: var(--deep);
  background: color-mix(in srgb, var(--paper) 78%, var(--accent, var(--sand)) 22%);
  white-space: nowrap;
}
.chip .g { font-style: normal; font-size: 13px; line-height: 1; }
.saved {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 8px; padding: 2px 8px;
  background: color-mix(in srgb, var(--sage) 10%, transparent);
  font-size: 11px; color: var(--sage);
}
.saved .dot { font-size: 8px; line-height: 1; }
.card-body {
  font-family: var(--sans); font-size: 17px; line-height: 1.55; color: var(--charcoal);
  white-space: pre-wrap; overflow-wrap: break-word;
}
.card.c-dream  { --accent: var(--water); }
.card.c-3am    { --accent: var(--lavender); }
.card.c-waking { --accent: var(--sage); }
.card.c-idea   { --accent: var(--clay); }
.card.c-memory { --accent: var(--water-light); }

/* Compact (minimized) row */
.card.compact { padding: 10px 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card.compact .line { min-width: 0; flex: 1; font-size: 14px; color: var(--driftwood); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.compact .when-r { font-size: 12px; color: color-mix(in srgb, var(--driftwood) 75%, transparent); white-space: nowrap; }


/* ─── Eido: an introduction, not a demonstration ─────────────
   The approved four lines and one link. The tide scene stays behind it; a pool of
   light rises behind the words; the three phrases sit along a tide line. */
:root { --eido-ink: #2c4756; } /* Eido's water blue (the app's --water, taken deep) */
.beat-eido { position: relative; }
.beat-eido::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(62% 52% at 56% 40%, color-mix(in srgb, var(--paper) 80%, transparent), color-mix(in srgb, var(--paper) 0%, transparent) 72%);
}
.eido-wrap {
  position: relative; z-index: 1;
  max-width: 1180px; margin: 0 auto;
  padding: 24vh 32px 12vh;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px;
}
.eido-name {
  grid-column: 1 / span 8; margin: 0;
  font-family: var(--serif); font-weight: normal;
  font-size: clamp(120px, 16vw, 236px); line-height: .8; letter-spacing: -0.035em;
  color: var(--eido-ink);
}
.eido-link { display: inline-flex; align-items: flex-end; color: inherit; border-radius: 8px; }
/* The way through: a long, thin arrow running off the end of the name. The whole word
   is the link; the arrow says so without a button or another word. */
.eido-arrow {
  width: .44em; height: .17em; margin: 0 0 .19em .1em; flex-shrink: 0; overflow: visible;
  fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  opacity: .78; transition: transform .45s cubic-bezier(.2,.7,.2,1), opacity .3s ease;
}
.eido-arrow path { vector-effect: non-scaling-stroke; }
.eido-link:hover .eido-arrow, .eido-link:focus-visible .eido-arrow { opacity: 1; transform: translateX(.06em); }
.eido-link:focus-visible .eido-arrow { opacity: 1; transform: translateX(.03em); }
.eido-link:focus-visible { outline: 2px solid var(--water); outline-offset: 10px; }
.eido-statement {
  grid-column: 6 / span 7; margin-top: 5vh;
  font-family: var(--serif); font-size: clamp(40px, 4.6vw, 70px); line-height: 1.06; letter-spacing: -0.02em;
  color: var(--charcoal); text-wrap: balance;
}
.eido-statement span { display: block; font-style: italic; color: var(--eido-ink); }
.tideline {
  grid-column: 1 / -1; position: relative; margin-top: 13vh; height: 100px;
  font-family: var(--serif); font-style: italic; font-size: clamp(20px, 1.8vw, 26px); color: var(--deep);
}
.tideline-wave {
  position: absolute; left: 0; right: 0; top: 46px; width: 100%; height: 40px; overflow: visible;
  fill: none; stroke: var(--driftwood); stroke-width: 1; opacity: .5;
}
.tideline-wave path { vector-effect: non-scaling-stroke; }
.tideline span { position: absolute; white-space: nowrap; }
.tideline span:nth-of-type(1) { left: 3%; top: 31px; }
.tideline span:nth-of-type(2) { left: 41%; top: 27px; }
.tideline span:nth-of-type(3) { right: 3%; top: 29px; }
.eido-close { /* Eido's colour: the section closes in her voice, before Driftwood's door */
  grid-column: 6 / span 7; margin-top: 13vh;
  font-family: var(--serif); font-style: italic; font-size: clamp(30px, 3vw, 44px); line-height: 1.2; letter-spacing: -0.01em;
  color: var(--eido-ink);
}

/* The words come to light: the statement sharpens out of a blur, the phrases wash in
   along the line one after another, the line draws itself. */
.js .eido-statement.land { filter: blur(8px); }
.js .eido-statement.land.is-in { filter: none; transition: opacity 1.4s ease, filter 1.8s ease, transform 1.2s cubic-bezier(.2,.7,.2,1); }
.js .tideline.land, .js .tideline.land.is-in { opacity: 1; transform: none; }
.js .tideline span { opacity: 0; transform: translateY(8px); transition: opacity 1s ease, transform 1.2s cubic-bezier(.2,.7,.2,1); }
.js .tideline.is-in span { opacity: 1; transform: none; }
.js .tideline.is-in span:nth-of-type(2) { transition-delay: .45s; }
.js .tideline.is-in span:nth-of-type(3) { transition-delay: .9s; }
.js .tideline-wave path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 2.4s ease; }
.js .tideline.is-in .tideline-wave path { stroke-dashoffset: 0; }
.js .eido-arrow path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.1s cubic-bezier(.4,.1,.2,1) .7s; }
.js .eido-name.is-in .eido-arrow path { stroke-dashoffset: 0; }

@media (max-width: 1023px) {
  .eido-name { grid-column: 1 / -1; }
  .eido-statement, .eido-close { grid-column: 3 / -1; }
}
@media (max-width: 759px) {
  .eido-wrap { display: block; padding: 18vh 20px 6vh; }
  .eido-name { font-size: 31vw; }
  .eido-arrow { stroke-width: 1.8; }
  .eido-statement { margin-top: 28px; font-size: clamp(32px, 9.2vw, 46px); }
  .tideline { height: auto; margin-top: 9vh; padding-bottom: 30px; display: grid; gap: 14px; font-size: 22px; }
  .tideline span { position: static; }
  .tideline span:nth-of-type(2) { margin-left: 18%; }
  .tideline span:nth-of-type(3) { margin-left: 36%; }
  .tideline-wave { top: auto; bottom: 0; height: 26px; }
  .eido-close { margin-top: 9vh; font-size: 28px; }
}

/* A snapshot, not the whole shore: the stream trails off into the scene. */
.stream.snapshot {
  max-height: 470px; overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 58%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 58%, transparent 100%);
}
.beat-shore .app-col { padding-bottom: 8vh; }

/* ─── Waitlist ────────────────────────────────────────────── */
.door::before { /* the tide fades into the paper the door is drawn on */
  content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 32vh; pointer-events: none;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--paper) 0%, transparent), var(--paper));
}
.door {
  position: relative; isolation: isolate; overflow: visible;
  text-align: center;
  padding: clamp(110px, 18vh, 180px) var(--gutter) clamp(120px, 20vh, 200px);
}
.door-scene {
  position: absolute; inset: 0; z-index: -1; overflow: hidden;
  background: url("/assets/scenes/shore/mobile.webp") center / cover no-repeat;
}
@media (min-width: 768px) { .door-scene { background-image: url("/assets/scenes/shore/desktop.webp"); background-position: center 60%; } }
.door-scene::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, var(--paper) 0%, color-mix(in srgb, var(--paper) 62%, transparent) 30%, color-mix(in srgb, var(--paper) 62%, transparent) 100%);
}
.door h2 {
  font-family: var(--serif); font-weight: normal;
  font-size: clamp(34px, 4.4vw, 56px); line-height: 1.08; letter-spacing: -0.02em; color: var(--charcoal);
}
.door p.lead {
  margin: 18px auto 0; max-width: 460px;
  font-family: var(--serif); font-style: italic; font-size: 18px; line-height: 1.55; color: var(--deep);
  text-wrap: balance;
}
.wl-form {
  margin: 34px auto 0; max-width: 440px;
  display: grid; gap: 10px; text-align: left;
}
.wl-form input {
  width: 100%; font: inherit; font-size: 16px; color: var(--charcoal);
  background: var(--paper); border: 1px solid var(--sand); border-radius: 14px;
  padding: 13px 16px;
}
.wl-form input::placeholder { color: color-mix(in srgb, var(--deep) 55%, transparent); }
.wl-form input:focus { outline: none; border-color: var(--water); }
.wl-form button {
  font-size: 15px; color: var(--paper); background: var(--charcoal);
  border-radius: 14px; padding: 14px 20px;
}
.wl-form button:hover { background: #3a332d; }
.wl-form button:disabled { opacity: .5; cursor: default; }
.wl-msg {
  margin: 26px auto 0; max-width: 440px; min-height: 1px;
  font-family: var(--serif); font-style: italic; font-size: 18px; line-height: 1.5; color: var(--charcoal);
}
.wl-msg.error { font-family: var(--sans); font-style: normal; font-size: 14px; color: #9b4a3c; }
.wl-note { margin-top: 16px; font-size: 13px; color: var(--driftwood); }

/* ─── Footer ──────────────────────────────────────────────── */
.foot { background: var(--charcoal); color: var(--paper); padding: 56px var(--gutter) 36px; }
.foot-inner { max-width: 1100px; margin: 0 auto; }
.foot-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 32px; padding-bottom: 36px; border-bottom: 1px solid rgba(255,255,255,.1); }
.foot-brand { font-family: var(--serif); font-size: 19px; }
.foot-tag { margin-top: 8px; font-family: var(--serif); font-style: italic; font-size: 14px; color: #b9ac9c; }
.foot nav { display: flex; flex-wrap: wrap; gap: 10px 24px; max-width: 520px; }
.foot nav a { font-size: 14px; color: rgba(253,252,250,.7); }
.foot nav a:hover { color: var(--paper); }
.foot-bottom { padding-top: 22px; font-size: 12px; color: #b9ac9c; }

/* ─── Motion ──────────────────────────────────────────────── */
/* "Fragments land" (globals.css): a gentle upward drift + fade */
.js .land { opacity: 0; transform: translateY(14px); }
.js .land.is-in { opacity: 1; transform: none; transition: opacity .7s ease, transform .9s cubic-bezier(.2,.7,.2,1); }
.js .slot { display: none; }
.js .slot.is-in { display: block; animation: landin .7s ease both; }
@keyframes landin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.mic-btn { animation: breathe 4s ease-in-out infinite; }
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }

@media (prefers-reduced-motion: reduce) {
  .mic-btn, .field .caret { animation: none; }
  .js .land { opacity: 1; transform: none; transition: none; }
  .js .eido-statement.land { filter: none; }
  .js .tideline span { opacity: 1; transform: none; transition: none; }
  .js .tideline-wave path, .js .eido-arrow path { stroke-dashoffset: 0; transition: none; }
  .js .slot { display: block; animation: none; }
}

/* ─── Small screens ───────────────────────────────────────── */
@media (max-width: 520px) {
  :root { --gutter: 16px; }
  .hero-sign { padding: 18px 0 22px; }
  .hero-sign::before { inset: -20px -40px; }
  .nav-actions { gap: 14px; }
  .nav-cta { padding: 8px 14px; }
  .hero-you { letter-spacing: -0.05em; }
  .beat-shore .app-col { padding-top: 16vh; }
  .card { padding: 14px 16px; }
  .card-body { font-size: 16px; }
}
