/* The Marriage Meeting — direction A, "the letter".
   Flat parchment, one serif, no glows or gradients. */

/* Newsreader (SIL Open Font License), self-hosted. Variable: weight 400–500, optical size 6–72. */
@font-face {
  font-family: 'Newsreader'; font-style: normal; font-weight: 400 500; font-display: swap;
  src: url("../assets/fonts/newsreader-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Newsreader'; font-style: normal; font-weight: 400 500; font-display: swap;
  src: url("../assets/fonts/newsreader-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Newsreader'; font-style: italic; font-weight: 400 500; font-display: swap;
  src: url("../assets/fonts/newsreader-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Newsreader'; font-style: italic; font-weight: 400 500; font-display: swap;
  src: url("../assets/fonts/newsreader-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --parchment: #E2C9A0;
  --sheet: #EAD9BE;
  --ink: #211404;
  --ink-2: #5A4630;          /* secondary text, 5.5:1 on parchment */
  --ink-3: #4A3A26;
  --line: rgba(33, 20, 4, 0.35);
  --line-soft: rgba(33, 20, 4, 0.18);
  --ochre: #7A4F12;          /* large type and accents */
  --ochre-text: #6B440F;     /* small text, 5.3:1 */
  --rose: #8A4535;           /* dots, wick */
  --rose-text: #763A2D;      /* small text, 5.4:1 */

  --velvet: #1E0610;
  --velvet-tile: #2C0B18;
  --velvet-line: rgba(212, 160, 112, 0.30);
  --gold: #D4A070;
  --cream: #F5E8D2;
  --cream-2: #D9C9B0;

  --serif: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --gutter: 24px;
  --radius: 6px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fade: 350ms;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;      /* no double-tap zoom */
  overscroll-behavior: none;       /* no pull-to-refresh mid-meeting */
  background: var(--parchment);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--parchment);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 1.4s ease;
}
body.is-velvet { background: var(--velvet); }

/* Paper grain, very faint. No blend mode: blending a full-screen layer costs the phone work on every frame. */
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: url("../assets/noise.webp");
  background-size: 185px 185px;
  opacity: 0.045;
  contain: strict;
  transition: opacity 1.4s ease;
}
body.is-velvet .grain { opacity: 0.02; }

p, h1, h2, h3, ol, fieldset { margin: 0; }
em { font-style: italic; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--rose); outline-offset: 3px; border-radius: 3px; }
.velvet :focus-visible { outline-color: var(--gold); }

/* ── Screens ─────────────────────────────────────────── */

#app { position: relative; z-index: 1; }

.screen {
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding:
    calc(12px + env(safe-area-inset-top))
    calc(var(--gutter) + env(safe-area-inset-right))
    calc(24px + env(safe-area-inset-bottom))
    calc(var(--gutter) + env(safe-area-inset-left));
  animation: screen-in var(--fade) ease both;
}
@keyframes screen-in { from { opacity: 0; } to { opacity: 1; } }

.velvet { color: var(--cream); }

.bar {
  display: flex; justify-content: space-between; align-items: center;
  min-height: 44px; gap: 12px;
}
.bar-center { justify-content: center; }
.bar-stack { display: flex; flex-direction: column; gap: 14px; }
.bar-note { font-size: 16px; color: var(--ink-2); }

.wordmark { font-size: 17px; font-weight: 500; color: var(--ochre-text); }
.wordmark-btn {
  background: none; border: 0; padding: 0; min-height: 44px;
  text-align: left;
}

.body { flex: 1; display: flex; flex-direction: column; }
.body-center { justify-content: center; }
.foot { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding-top: 20px; }

.stack-xs { display: flex; flex-direction: column; gap: 8px; }
.stack-s  { display: flex; flex-direction: column; gap: 12px; }
.center { text-align: center; }

/* ── Type ─────────────────────────────────────────────── */

.kicker { font-size: 17px; font-style: italic; color: var(--rose-text); }
.display {
  font-size: clamp(46px, 14vw, 58px); line-height: 1.02; font-weight: 400;
  letter-spacing: -0.02em;
}
.display em, .title em, .sheet-title em { color: var(--ochre); }
.velvet .title em { color: var(--gold); }
.lede { font-size: 19px; line-height: 1.5; color: var(--ink-2); max-width: 30ch; }
.title { font-size: 34px; line-height: 1.15; font-weight: 400; }
.sub { font-size: 18px; line-height: 1.5; color: var(--ink-2); }
.velvet .sub { color: var(--cream-2); }
.label { font-size: 17px; font-style: italic; color: var(--ochre-text); }
.velvet .label { color: var(--gold); }
.quote { font-size: 25px; line-height: 1.35; font-style: italic; }

/* ── Buttons ──────────────────────────────────────────── */

.btn {
  width: 100%; min-height: 56px; padding: 0 20px;
  background: var(--ink); color: var(--parchment);
  border: 0; border-radius: var(--radius);
  font-size: 19px; font-weight: 500;
  transition: opacity 0.25s ease, transform 0.15s ease;
}
.btn:active:not(:disabled) { transform: scale(0.985); }
/* Instant feedback on touch for everything else that can be tapped. */
.btn-quiet:active:not(:disabled), .link-btn:active, .history-link:active, .back-btn:active,
.icon-btn:active, .wordmark-btn:active, .tip-item summary:active { opacity: 0.6; }
.choice-btn:active, .pace:active, .mdot:active { transform: scale(0.98); }
.choice-btn, .pace { transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease; }
.btn:disabled { opacity: 0.4; }
.btn-light { background: var(--parchment); color: var(--velvet); }

.btn-quiet {
  width: 100%; min-height: 48px;
  background: none; border: 0;
  font-size: 17px; color: var(--ink-2);
}
.btn-italic { font-style: italic; }
.velvet .btn-quiet { color: var(--cream-2); }
.btn-quiet:disabled { opacity: 0.4; }

.icon-btn {
  width: 44px; height: 44px; margin-right: -10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; color: var(--ochre-text);
}
.icon-btn-sm { margin: 0; color: var(--ink-2); flex-shrink: 0; }

.link-btn {
  min-height: 44px; padding: 0 10px; flex-shrink: 0;
  background: none; border: 0;
  font-size: 17px; font-weight: 500; color: var(--ink);
  text-decoration: underline; text-underline-offset: 4px;
  text-decoration-color: var(--line);
}

.back-btn {
  min-height: 44px; margin-left: -6px; padding: 0 6px;
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: 0; font-size: 17px; color: var(--ink);
}

/* ── Fields ───────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 16px; font-style: italic; color: var(--ochre-text); }
.field input, .field textarea {
  width: 100%;
  font-size: 24px; color: var(--ink);
  background: transparent; border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; padding: 6px 0 8px;
  -webkit-appearance: none; appearance: none;
  transition: border-color 0.3s ease;
}
.field textarea { font-size: 19px; line-height: 1.45; resize: none; overflow: hidden; min-height: 44px; }
.field input:focus, .field textarea:focus { border-bottom-color: var(--rose); outline: none; }

/* ── Home ─────────────────────────────────────────────── */

.home-body { gap: 40px; padding: 24px 0 8px; }
.intro { display: flex; flex-direction: column; gap: 18px; }
.names { display: flex; flex-direction: column; gap: 22px; }
.resume-note { font-size: 18px; font-style: italic; color: var(--ink-2); }

.tip {
  display: flex; align-items: center; gap: 4px;
  margin-bottom: 12px; padding: 4px 4px 4px 16px;
  border: 1px solid var(--line-soft); border-radius: 8px;
}
.tip p { flex: 1; font-size: 16px; line-height: 1.4; color: var(--ink-3); }
.tip em { color: var(--ochre-text); }

.history-link {
  align-self: center; min-height: 44px; margin-top: 6px; padding: 0 8px;
  display: inline-flex; align-items: center; gap: 12px;
  background: none; border: 0;
  font-size: 17px; font-style: italic; color: var(--ink-2);
}
.week-dots { display: inline-flex; gap: 7px; }
.week-dots i {
  width: 8px; height: 8px; border-radius: 50%;
  border: 1px solid var(--rose);
}
.week-dots i.on { background: var(--rose); }

/* ── Welcome back ─────────────────────────────────────── */

.welcome-body { gap: 30px; padding-top: 28px; }
.choice { border: 0; padding: 0; }
.choice legend { padding: 0; margin-bottom: 12px; font-size: 21px; }
.choice-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.choice-btn {
  min-height: 52px;
  background: transparent; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 18px;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.choice-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--parchment); }

/* ── Meeting ──────────────────────────────────────────── */

.wick { height: 2px; background: var(--line-soft); position: relative; overflow: hidden; }
.wick-fill {
  position: absolute; inset: 0 auto 0 0; width: 0;
  background: var(--rose);
  transition: width 1.2s var(--ease);
}

.stage {
  flex: 1; position: relative;
  display: flex; align-items: center;
  padding: 32px 0;
}
.question {
  font-size: clamp(27px, 7.6vw, 32px); line-height: 1.38; font-weight: 400;
  transition: opacity var(--fade) ease;
  will-change: opacity;
}
.question b { font-weight: 500; }
.question.is-out { opacity: 0; }

.pass-line {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: clamp(27px, 7.6vw, 32px); line-height: 1.38; font-style: italic;
  color: var(--ink-3);
  opacity: 0; pointer-events: none;
  transition: opacity 600ms ease;
}
.pass-line.is-in { opacity: 1; }

.floor {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px;
  padding: 18px 0 4px;
  border-top: 1px solid var(--line-soft);
}
.person { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.person-right { align-items: flex-end; text-align: right; }
.person-name { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.person .name {
  font-size: 22px; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: color 0.5s ease;
}
.person .dot { opacity: 0; transform: scale(0.4); transition: opacity 0.5s ease, transform 0.5s var(--ease); }
.person .turn {
  font-size: 16px; font-style: italic; color: var(--rose-text);
  padding-left: 17px;
  opacity: 0; transition: opacity 0.5s ease;
}
.person-right .turn { padding-left: 0; }
.person.is-turn .name { color: var(--ink); font-weight: 500; }
.person.is-turn .dot, .person.is-turn .turn { opacity: 1; transform: none; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rose); flex-shrink: 0; }
.dot-ochre { background: var(--gold); }

/* ── Commitments + reveal (velvet) ────────────────────── */

.commit-body, .reveal-body { gap: 28px; padding: 16px 0; }

.card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--velvet-tile);
  border: 1px solid var(--velvet-line); border-radius: 10px;
  padding: 20px 20px 18px;
  transition: opacity var(--fade) ease;
}
.card.is-out { opacity: 0; }
.card-write { gap: 4px; padding: 22px 20px 20px; }
.writer { font-size: 26px; line-height: 1.2; font-weight: 500; color: var(--gold); }
.card .prompt { font-size: 17px; font-style: italic; color: var(--cream-2); margin-bottom: 10px; }
#commit-sub { font-size: 17px; }
.card textarea {
  width: 100%; min-height: 64px;
  font-size: 21px; line-height: 1.4; color: var(--cream);
  background: transparent; border: 0; border-bottom: 1px solid var(--velvet-line);
  border-radius: 0; padding: 6px 0 8px; resize: none; overflow: hidden;
  -webkit-appearance: none; appearance: none;
}
.card textarea::placeholder { color: rgba(245, 232, 210, 0.45); font-style: italic; }
.card textarea:focus { border-bottom-color: var(--gold); outline: none; }
.card .said { font-size: 22px; line-height: 1.38; }

.spark {
  display: flex; flex-direction: column; gap: 4px;
  padding-top: 18px; border-top: 1px solid var(--velvet-line);
}
.spark-title { font-size: 20px; font-weight: 500; }
.spark-text { font-size: 18px; line-height: 1.45; color: var(--cream-2); }

/* ── History ──────────────────────────────────────────── */

.history-body { gap: 28px; padding-top: 24px; }
.months { display: flex; flex-direction: column; gap: 4px; }
.month { display: grid; grid-template-columns: 92px 1fr; align-items: center; }
.month-label { font-size: 17px; font-style: italic; color: var(--ink-2); }
.month-dots { display: flex; flex-wrap: wrap; }
.mdot {
  width: 44px; height: 44px; margin-left: -10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 50%;
}
.mdot::before {
  content: ''; width: 12px; height: 12px; border-radius: 50%;
  background: var(--rose);
  transition: transform 0.25s var(--ease), box-shadow 0.25s ease;
}
.mdot[aria-pressed="true"]::before { transform: scale(1.25); box-shadow: 0 0 0 3px var(--parchment), 0 0 0 4px var(--rose); }

.detail { display: flex; flex-direction: column; gap: 18px; padding-top: 20px; border-top: 1px solid var(--line-soft); }
.detail:empty { display: none; }
.detail-date { font-size: 22px; }
.detail-date span { color: var(--ink-2); font-style: italic; font-size: 17px; }
.detail-person { display: flex; flex-direction: column; gap: 4px; }
.detail-person .said { font-size: 20px; line-height: 1.4; }
.detail-person .looked { font-size: 17px; line-height: 1.45; color: var(--ink-2); }
.detail-person .looked em { color: var(--rose-text); }

/* ── Sheets ───────────────────────────────────────────── */

dialog.sheet {
  position: fixed; inset: auto 0 0 0;
  width: 100%; max-width: 480px; max-height: 92dvh;
  margin: 0 auto; padding: 0;
  border: 0; border-radius: 16px 16px 0 0;
  background: var(--sheet); color: var(--ink);
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 380ms var(--ease);
}
dialog.sheet.is-open { transform: none; }
dialog.sheet::backdrop {
  background: rgba(20, 8, 6, 0);
  transition: background-color 380ms ease;
}
dialog.sheet.is-open::backdrop { background: rgba(20, 8, 6, 0.55); }
.sheet-tall { height: 92dvh; }

.sheet-inner {
  display: flex; flex-direction: column; gap: 20px; max-height: 92dvh;
  padding: 12px 20px calc(24px + env(safe-area-inset-bottom));
}
.sheet-tall .sheet-inner { height: 100%; padding-bottom: 0; gap: 0; }
.handle { width: 40px; height: 4px; border-radius: 2px; background: rgba(33, 20, 4, 0.25); align-self: center; flex-shrink: 0; }
.sheet-head { padding: 0 4px; }
.sheet-title { font-size: 27px; line-height: 1.2; font-weight: 400; }
.sheet-actions { display: flex; flex-direction: column; gap: 4px; }

.paces { display: flex; flex-direction: column; gap: 8px; }
.pace {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 72px; padding: 12px 18px;
  background: transparent; color: var(--ink);
  border: 1px solid var(--line-soft); border-radius: 10px;
  text-align: left;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}
.pace-name { font-size: 21px; font-weight: 500; }
.pace-desc { font-size: 16px; font-style: italic; color: var(--ink-2); }
.pace[aria-checked="true"] { background: #2A0818; border-color: #2A0818; color: var(--cream); }
.pace[aria-checked="true"] .pace-name { color: var(--gold); }
.pace[aria-checked="true"] .pace-desc { color: var(--cream-2); }

.sheet-top { position: relative; display: flex; justify-content: flex-end; align-items: center; min-height: 44px; flex-shrink: 0; }
.sheet-top .handle { position: absolute; left: 50%; top: 0; transform: translateX(-50%); }
.sheet-close { width: auto; padding: 0 4px; }
.sheet-scroll {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 8px 4px calc(40px + env(safe-area-inset-bottom));
}

.guide { display: flex; flex-direction: column; gap: 14px; }
.guide-intro { font-size: 18px; font-style: italic; color: var(--ink-2); line-height: 1.6; }
/* Ten tips as a quiet list of headings; each opens with a tap. */
.tips { margin-top: 10px; border-top: 1px solid var(--line-soft); }
.tip-item { border-bottom: 1px solid var(--line-soft); }
.tip-item summary {
  list-style: none; cursor: pointer;
  display: grid; grid-template-columns: 30px 1fr 16px; align-items: baseline; gap: 6px;
  min-height: 56px; padding: 15px 0;
  -webkit-user-select: none; user-select: none;
}
.tip-item summary::-webkit-details-marker { display: none; }
.tip-item summary::after {
  content: ''; width: 9px; height: 9px; align-self: center; justify-self: end;
  border-right: 1.5px solid var(--ink-2); border-bottom: 1.5px solid var(--ink-2);
  transform: translateY(-3px) rotate(45deg);
  transition: transform 0.3s var(--ease);
}
.tip-item[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.tip-num { font-size: 17px; color: var(--ochre-text); font-variant-numeric: oldstyle-nums; }
.tip-head { font-size: 20px; line-height: 1.3; }
.tip-item[open] .tip-head { font-weight: 500; }
.tip-body { display: flex; flex-direction: column; gap: 10px; padding: 0 0 22px 36px; }
.tip-body p { font-size: 17px; line-height: 1.55; color: var(--ink-3); }
.tip-body .say { font-size: 20px; line-height: 1.4; font-style: italic; color: var(--ink); padding: 2px 0; }
.tip-body em { color: var(--ink); }
.guide-closing { padding-top: 28px; font-size: 18px; font-style: italic; line-height: 1.65; color: var(--ink-2); text-align: center; }

.steps { list-style: none; padding: 0 4px; display: flex; flex-direction: column; gap: 16px; }
.steps li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; font-size: 18px; line-height: 1.5; }
.step-num { font-size: 18px; color: var(--ochre-text); }
.share-icon { vertical-align: -4px; margin: 0 2px; color: var(--ink); }
.nowrap { white-space: nowrap; }

/* ── Small screens and motion ─────────────────────────── */

@media (max-height: 700px) {
  .home-body { gap: 28px; }
  .display { font-size: 44px; }
  .welcome-body { gap: 22px; padding-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}
