/* Letters to the Future (architecture.md §51, Design.md §13).
 *
 * The design rule this page is built on: the WRITING is the interface. Everything
 * else — the choices, the chrome, the buttons — is quieter than the text someone is
 * typing, and gets out of the way once they start. There is no card stack, no
 * progress bar, no wizard: one page that scrolls, in the order a person actually
 * thinks (say it → when → who → confirm).
 *
 * Prefix: `lt-`. This page loads no other app stylesheet, so the prefix is about
 * keeping it greppable, not about collisions.
 */

:root {
  --lt-bg: #F4F1EA;
  --lt-paper: #FFFDF7;
  --lt-ink: #2C2A26;
  --lt-soft: #8B8172;
  --lt-line: #E3DCCB;
  --lt-accent: #7A6A50;
  --lt-accent-ink: #FFFDF7;
  --lt-blush: #B65A79;

  --lt-serif: 'Playfair Display', Georgia, serif;
  --lt-hand: 'Caveat', 'Segoe Script', cursive;
  --lt-sans: 'Pretendard', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --lt-gutter: clamp(20px, 5vw, 64px);
  --lt-measure: 62ch;   /* the reading line length everything is set to */
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--lt-bg);
  color: var(--lt-ink);
  font-family: var(--lt-sans);
  /* Painted paper grain under everything, fixed so scrolling feels like moving down
     one continuous sheet rather than past a repeated tile. */
  background-image:
    radial-gradient(140% 90% at 50% 0%, rgba(255, 253, 247, .9), rgba(255, 253, 247, 0) 60%);
  background-attachment: fixed;
}

/* Long-form pages get the whole viewport on iOS without the toolbar dance. */
#app { min-height: 100dvh; }

/* ── shared atoms ─────────────────────────────────────────────────────── */

.lt-wrap {
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  padding-inline: var(--lt-gutter);
}

.lt-eyebrow {
  font-size: 11px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--lt-soft);
  margin: 0;
}

.lt-display {
  font-family: var(--lt-serif);
  font-weight: 400;
  line-height: 1.14;
  letter-spacing: -.01em;
  margin: 0;
  font-size: clamp(38px, 7.4vw, 74px);
}
.lt-display em { font-style: italic; color: var(--lt-accent); }

.lt-lede {
  font-family: var(--lt-serif);
  font-size: clamp(17px, 2.1vw, 21px);
  line-height: 1.7;
  color: var(--lt-ink);
  max-width: 46ch;
  margin: 0;
}

.lt-note {
  font-size: 13px;
  line-height: 1.75;
  color: var(--lt-soft);
  margin: 0;
}

.lt-btn {
  appearance: none;
  border: 1px solid var(--lt-accent);
  background: var(--lt-accent);
  color: var(--lt-accent-ink);
  font: inherit;
  font-size: 15px;
  letter-spacing: .01em;
  padding: 15px 30px;
  border-radius: 3px;
  cursor: pointer;
  transition: transform .18s ease, opacity .18s ease, background .18s ease;
}
.lt-btn:hover { transform: translateY(-1px); }
.lt-btn:active { transform: translateY(0); }
.lt-btn[disabled] { opacity: .45; cursor: default; transform: none; }
.lt-btn.ghost { background: transparent; color: var(--lt-accent); }
.lt-btn.plain {
  border-color: transparent; background: transparent; color: var(--lt-soft);
  padding: 10px 4px; font-size: 13px; text-decoration: underline;
  text-underline-offset: 3px;
}

.lt-rule { height: 1px; background: var(--lt-line); border: 0; margin: 0; }

/* ── hero ─────────────────────────────────────────────────────────────── */

.lt-hero {
  position: relative;
  min-height: min(88dvh, 760px);
  display: grid;
  align-content: center;
  padding-block: clamp(72px, 14vh, 130px) clamp(48px, 9vh, 90px);
  overflow: hidden;
}

/* The painting sits BEHIND the words at low contrast and bleeds off the right edge —
   it is atmosphere, not an illustration to look at. On phones it drops to a wash so
   the headline never fights it. */
.lt-hero-art {
  position: absolute;
  inset: 0 -6% 0 28%;
  background: center right / cover no-repeat;
  opacity: .92;
  -webkit-mask-image: linear-gradient(100deg, transparent 0%, #000 34%, #000 100%);
  mask-image: linear-gradient(100deg, transparent 0%, #000 34%, #000 100%);
  pointer-events: none;
}
@media (max-width: 760px) {
  .lt-hero-art { inset: 0; opacity: .3; -webkit-mask-image: none; mask-image: none; }
}

.lt-hero-inner { position: relative; display: grid; gap: 26px; justify-items: start; }
.lt-hero .lt-display { max-width: 15ch; }

.lt-hero-cta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

/* The scroll cue: a hairline that draws itself down the page. */
.lt-scroll-cue {
  margin-top: 14px; display: grid; gap: 10px; justify-items: start;
  font-size: 11px; letter-spacing: .26em; text-transform: uppercase; color: var(--lt-soft);
}
.lt-scroll-cue::after {
  content: ''; width: 1px; height: 44px; background: var(--lt-line);
  animation: lt-draw 2.4s ease-in-out infinite;
  transform-origin: top;
}
@keyframes lt-draw { 0%, 100% { transform: scaleY(.35); opacity: .5; } 50% { transform: scaleY(1); opacity: 1; } }

/* ── the desk (the writing surface) ───────────────────────────────────── */

.lt-desk { padding-block: clamp(40px, 8vh, 88px); }

.lt-sheet {
  background: var(--lt-paper);
  border: 1px solid var(--lt-line);
  border-radius: 2px;
  padding: clamp(22px, 4vw, 46px);
  /* One soft shadow, low and wide: paper resting on a table, not a floating card. */
  box-shadow: 0 18px 40px -30px rgba(60, 50, 35, .55);
}

.lt-sheet-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}

.lt-to {
  appearance: none; border: 0; background: transparent; font-family: var(--lt-serif);
  font-size: clamp(20px, 3vw, 27px); color: var(--lt-ink); padding: 0; width: 100%;
  max-width: 22ch;
}
.lt-to::placeholder { color: #C9C0AE; }
.lt-to:focus { outline: none; }

/* The body. Ruled like a page, and the rules are real: 34px line-height, background
   lines every 34px, so text sits ON them at any zoom. */
.lt-body {
  appearance: none; width: 100%; border: 0; background: transparent;
  font-family: var(--lt-serif); font-size: 18px; line-height: 34px; color: var(--lt-ink);
  padding: 0; resize: none; min-height: 46vh; display: block;
  background-image: linear-gradient(to bottom, transparent 33px, rgba(200, 190, 170, .32) 33px, rgba(200, 190, 170, .32) 34px);
  background-size: 100% 34px;
}
.lt-body:focus { outline: none; }
.lt-body::placeholder { color: #C9C0AE; }

.lt-sheet-foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 14px; flex-wrap: wrap; margin-top: 20px;
}
.lt-count { font-size: 12px; color: var(--lt-soft); font-variant-numeric: tabular-nums; }

/* "Inspire me" — the prompt appears in the writer's own hand above the sheet, so it
   reads as a note-to-self rather than a system message. */
.lt-prompt {
  font-family: var(--lt-hand);
  font-size: clamp(21px, 3vw, 26px);
  color: var(--lt-blush);
  line-height: 1.45;
  margin: 0 0 14px;
  min-height: 1.45em;
  animation: lt-rise .5s ease both;
}
@keyframes lt-rise { from { opacity: 0; transform: translateY(6px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }

.lt-inspire {
  appearance: none; border: 1px solid var(--lt-line); background: transparent;
  color: var(--lt-soft); font: inherit; font-size: 13px; padding: 9px 16px;
  border-radius: 999px; cursor: pointer;
}
.lt-inspire:hover { color: var(--lt-accent); border-color: var(--lt-accent); }

/* ── choices ──────────────────────────────────────────────────────────── */

.lt-section { padding-block: clamp(34px, 6vh, 62px); display: grid; gap: 18px; }
.lt-section h2 {
  font-family: var(--lt-serif); font-weight: 400; font-size: clamp(23px, 3.4vw, 31px);
  margin: 0; line-height: 1.25;
}

.lt-choices { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }

.lt-choice {
  appearance: none; text-align: left; cursor: pointer;
  background: var(--lt-paper); border: 1px solid var(--lt-line); border-radius: 2px;
  padding: 15px 16px; font: inherit; color: var(--lt-ink);
  display: grid; gap: 3px; transition: border-color .16s ease, background .16s ease;
}
.lt-choice:hover { border-color: #CFC5AE; }
.lt-choice b { font-weight: 500; font-size: 15px; }
.lt-choice span { font-size: 12px; color: var(--lt-soft); line-height: 1.5; }
.lt-choice[aria-pressed="true"] {
  border-color: var(--lt-accent);
  background: #FBF7EE;
  box-shadow: inset 0 0 0 1px var(--lt-accent);
}

.lt-field { display: grid; gap: 7px; }
.lt-field label { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--lt-soft); }
.lt-input {
  appearance: none; width: 100%; background: var(--lt-paper);
  border: 1px solid var(--lt-line); border-radius: 2px; padding: 13px 14px;
  font: inherit; font-size: 16px; color: var(--lt-ink);
}
.lt-input:focus { outline: none; border-color: var(--lt-accent); }
.lt-grid2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* Paper swatches — colour only; the label sits under, not on, the swatch. */
.lt-papers { display: flex; gap: 12px; flex-wrap: wrap; }
.lt-paper-pick {
  appearance: none; border: 0; background: transparent; cursor: pointer; padding: 0;
  display: grid; gap: 7px; justify-items: center; font: inherit;
}
.lt-paper-swatch {
  width: 62px; height: 46px; border-radius: 2px; border: 1px solid var(--lt-line);
  display: grid; place-items: center; font-size: 15px;
}
.lt-paper-pick[aria-pressed="true"] .lt-paper-swatch { box-shadow: 0 0 0 2px var(--lt-accent); }
.lt-paper-pick small { font-size: 11px; color: var(--lt-soft); }

/* The excerpt preview: shows the literal string the wall would publish. */
.lt-excerpt-preview {
  font-family: var(--lt-serif); font-style: italic; font-size: 15px; line-height: 1.75;
  color: var(--lt-soft); border-left: 2px solid var(--lt-line); padding-left: 14px; margin: 0;
}

/* ── send ─────────────────────────────────────────────────────────────── */

.lt-send { padding-block: clamp(30px, 6vh, 60px) clamp(60px, 12vh, 120px); display: grid; gap: 18px; }
.lt-send-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.lt-error {
  color: #A33B4E; font-size: 14px; line-height: 1.6; margin: 0;
  animation: lt-rise .3s ease both;
}

/* ── confirmation / manage / read ─────────────────────────────────────── */

.lt-still {
  min-height: 100dvh; display: grid; align-content: center; justify-items: start;
  gap: 22px; padding-block: 12vh;
}
.lt-still .lt-display { max-width: 16ch; }

.lt-ticket {
  border: 1px dashed var(--lt-line); background: var(--lt-paper);
  padding: 22px 26px; display: grid; gap: 6px; justify-items: start; border-radius: 2px;
}
.lt-ticket b { font-family: var(--lt-serif); font-size: clamp(21px, 3vw, 27px); font-weight: 400; }

/* The delivered letter: one column, generous leading, nothing else on the page. */
.lt-read { min-height: 100dvh; padding-block: clamp(56px, 11vh, 120px); }
.lt-read-inner { max-width: 68ch; margin: 0 auto; display: grid; gap: 26px; }
.lt-read h1 {
  font-family: var(--lt-serif); font-weight: 400; font-size: clamp(28px, 5vw, 44px);
  line-height: 1.2; margin: 0;
}
.lt-read-body p {
  font-family: var(--lt-serif); font-size: clamp(17px, 2.2vw, 19px); line-height: 1.95;
  margin: 0 0 22px;
}
.lt-read-body p:last-child { margin-bottom: 0; }
.lt-sign { font-family: var(--lt-hand); font-size: clamp(24px, 4vw, 32px); color: var(--lt-accent); }

/* A sealed letter opened early: a closed envelope and the date. */
.lt-sealed { display: grid; gap: 18px; justify-items: center; text-align: center; padding-block: 14vh; }
.lt-sealed-mark { font-size: 54px; line-height: 1; color: var(--lt-accent); }
/* width/height are on the <img> so it can't reflow — keep height:auto or the painting
   renders stretched (the §43 trap). */
.lt-sealed-art {
  width: min(100%, 520px); height: auto; border-radius: 2px;
  border: 1px solid var(--lt-line); opacity: .95;
}

/* ── the wall (anonymous excerpts) ────────────────────────────────────── */

.lt-wall { padding-block: clamp(40px, 8vh, 90px); display: grid; gap: 22px; }
.lt-wall-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.lt-card {
  background: var(--lt-paper); border: 1px solid var(--lt-line); border-radius: 2px;
  padding: 20px; display: grid; gap: 12px;
}
.lt-card p {
  margin: 0; font-family: var(--lt-serif); font-size: 15px; line-height: 1.8; font-style: italic;
}
.lt-card small { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--lt-soft); }

/* ── trust strip + footer ─────────────────────────────────────────────── */

.lt-trust { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.lt-trust div { display: grid; gap: 5px; }
.lt-trust b { font-weight: 500; font-size: 14px; }
.lt-trust span { font-size: 13px; line-height: 1.65; color: var(--lt-soft); }

.lt-foot {
  padding-block: 40px 60px; display: flex; gap: 18px; flex-wrap: wrap;
  align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--lt-soft);
}
.lt-foot a { color: var(--lt-soft); }

/* ── motion ───────────────────────────────────────────────────────────── */

/* Sections settle in as they're reached — the same "veil" gesture the date player
   uses (§42e-bis): unblur and rise, never slide-from-the-side. */
.lt-veil { opacity: 0; transform: translateY(14px); filter: blur(6px); }
.lt-veil.in { opacity: 1; transform: none; filter: none; transition: opacity .7s ease, transform .7s ease, filter .7s ease; }

@media (prefers-reduced-motion: reduce) {
  .lt-veil, .lt-veil.in { opacity: 1; transform: none; filter: none; transition: none; }
  .lt-scroll-cue::after { animation: none; }
  .lt-prompt { animation: none; }
}

/* ── dark paper ───────────────────────────────────────────────────────── */
/* Chosen, never inherited: picking Midnight is a decision about the letter, so the
   whole desk follows the paper rather than the OS. */
body[data-paper="midnight"] {
  --lt-bg: #15161C; --lt-paper: #1E2029; --lt-ink: #E7E4EE; --lt-soft: #8E90A6;
  --lt-line: #333748; --lt-accent: #C7B7F0; --lt-accent-ink: #1A1620; --lt-blush: #D9A7C7;
  background-image: radial-gradient(140% 90% at 50% 0%, rgba(40, 42, 56, .9), rgba(21, 22, 28, 0) 60%);
}
body[data-paper="midnight"] .lt-hero-art { opacity: .18; }
body[data-paper="midnight"] .lt-body {
  background-image: linear-gradient(to bottom, transparent 33px, rgba(140, 140, 175, .22) 33px, rgba(140, 140, 175, .22) 34px);
}
body[data-paper="blush"] { --lt-bg: #FBEDF1; --lt-paper: #FFFAFB; --lt-line: #F1D6DE; --lt-accent: #B65A79; --lt-soft: #AE8B96; --lt-ink: #4A3138; }
body[data-paper="garden"] { --lt-bg: #EDF2EA; --lt-paper: #FBFDF8; --lt-line: #D6E0CE; --lt-accent: #5B7A55; --lt-soft: #88967F; --lt-ink: #2B342B; }
