/* Mia — shared styles for every page (home, legal, journal).
   Warm and light, like the app: ivory paper, espresso ink, a rosso accent. */

:root {
  color-scheme: light;

  --paper: #FBF6EE;
  --paper-2: #F5ECDF;
  --paper-3: #EEE2D0;
  --card: #FFFDF9;
  --ink: #2A1E18;
  --ink-2: #5C4A3F;
  --ink-3: #766455;
  --line: rgba(42, 30, 24, .12);
  --line-2: rgba(42, 30, 24, .22);

  --rosso: #A3303A;
  --rosso-2: #C2414B;
  --terra: #C8693F;
  --gold: #C49A52;
  --olive: #6E7148;
  --night: #1D1411;
  --night-2: #2B1E19;

  /* The app's own accent, used inside the phone screens only. */
  --blush: #F7EAEB;

  --serif: "DM Serif Display", Georgia, "Times New Roman", serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 22px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --shadow: 0 1px 2px rgba(42, 30, 24, .06), 0 12px 40px -12px rgba(42, 30, 24, .18);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
::selection { background: rgba(163, 48, 58, .18); }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.06;
  letter-spacing: -.005em;
  margin: 0;
  text-wrap: balance;
}
p { margin: 0; text-wrap: pretty; }
em.it, .it { font-style: italic; }
.rosso { color: var(--rosso); }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px;
  text-decoration: none; transition: top .2s;
}
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--rosso); outline-offset: 3px; border-radius: 6px; }

/* ───────────── Nav ───────────── */
.nav {
  position: sticky; top: 0; z-index: 50;
  transition: background-color .3s, box-shadow .3s, backdrop-filter .3s;
}
.nav.is-stuck {
  background: rgba(251, 246, 238, .82);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  box-shadow: 0 1px 0 var(--line);
}
.nav.on-dark { background: rgba(29, 20, 17, .72); box-shadow: 0 1px 0 rgba(255, 255, 255, .06); }
.nav.on-dark .nav-mark { color: #FBF3E6; }
.nav.on-dark .nav-links a:not(.btn) { color: rgba(246, 237, 225, .78); }
.nav.on-dark .nav-links a:not(.btn):hover { color: #fff; }
.nav.on-dark .btn { background: #FBF3E6; color: var(--ink); }
.nav-in {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 72px; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter);
}
.nav-mark { display: block; width: 68px; color: var(--ink); transition: color .3s; }
.nav-links { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 30px); font-size: 15px; }
.nav-links a { text-decoration: none; color: var(--ink-2); transition: color .2s; }
.nav-links a:hover { color: var(--ink); }
.nav-links .btn { color: var(--paper); }

/* ───────────── Buttons & form ───────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 22px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--ink); color: var(--paper); font-weight: 600; font-size: 15px;
  text-decoration: none; white-space: nowrap;
  transition: transform .25s var(--ease), background-color .25s, box-shadow .25s;
  box-shadow: 0 8px 22px -10px rgba(42, 30, 24, .6);
}
.btn:hover { background: #3A2A22; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn-sm { height: 38px; padding: 0 16px; font-size: 14px; }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn-ghost:hover { background: rgba(42, 30, 24, .05); }
.btn-light { background: #FBF3E6; color: var(--ink); box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .6); }
.btn-light:hover { background: #fff; }

.wl { width: 100%; max-width: 560px; }
.wl-row {
  display: flex; gap: 6px; padding: 6px;
  background: var(--card); border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
}
.wl-row input { min-width: 0; height: 46px; border: 0; background: transparent; outline: none; font-size: 16px; }
.wl-row input::placeholder { color: var(--ink-3); }
.wl-row .wl-name { flex: 0 1 38%; padding: 0 12px 0 18px; border-right: 1px solid var(--line); }
.wl-row input[type="email"] { flex: 1 1 auto; padding: 0 8px 0 14px; }
.wl-row .btn { flex: 0 0 auto; }
.wl-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.wl-msg { min-height: 1.5em; margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.wl-msg.ok { color: var(--olive); font-weight: 600; }
.wl-msg.err { color: var(--rosso); }
.wl.is-done .wl-row { display: none; }
.wl.is-done .wl-msg { font-size: 16px; margin-top: 0; }
.wl-note { margin-top: 10px; font-size: 13px; color: var(--ink-3); }
.wl-note a { color: var(--ink-2); }

@media (max-width: 600px) {
  .wl-row { flex-wrap: wrap; border-radius: 22px; padding: 8px; gap: 0; }
  .wl-row .wl-name, .wl-row input[type="email"] { flex: 1 1 100%; height: 48px; padding: 0 12px; border-right: 0; }
  .wl-row input[type="email"] { border-top: 1px solid var(--line); margin-bottom: 6px; }
  .wl-row .btn { flex: 1 1 100%; }
}

/* ───────────── Scroll reveals (only hide when JS can bring them back) ───────────── */
.js .reveal { opacity: 0; transform: translateY(22px); }
/* If site.js never runs (blocked, failed to load), show everything after a moment instead of a blank page. */
.js:not(.js-ready) .reveal { animation: reveal-failsafe .4s 2.5s forwards; }
@keyframes reveal-failsafe { to { opacity: 1; transform: none; } }
.js .reveal.in {
  opacity: 1; transform: none;
  transition: opacity .9s var(--ease), transform .9s var(--ease);
  transition-delay: var(--d, 0s);
}
.d1 { --d: .08s; } .d2 { --d: .16s; } .d3 { --d: .24s; } .d4 { --d: .32s; } .d5 { --d: .4s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ───────────── Footer ───────────── */
.foot { background: var(--paper-2); border-top: 1px solid var(--line); padding: 64px 0 40px; font-size: 14px; color: var(--ink-2); }
.foot-top { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 32px; }
.foot-mark { width: 84px; color: var(--ink); margin-bottom: 14px; }
.foot-tag { font-family: var(--serif); font-size: 21px; color: var(--ink); line-height: 1.3; max-width: 18em; }
.foot h4 { margin: 0 0 12px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.foot a { text-decoration: none; color: var(--ink-2); }
.foot a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.foot-fine { margin-top: 48px; padding-top: 22px; border-top: 1px solid var(--line); display: grid; gap: 6px; font-size: 12.5px; color: var(--ink-3); }
@media (max-width: 760px) {
  .foot-top { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
}

/* ───────────── Long-form pages (legal, help, journal) ───────────── */
.page-head { padding: clamp(48px, 9vw, 110px) 0 clamp(28px, 5vw, 48px); position: relative; }
.page-head .kicker { margin-bottom: 14px; }
.page-head h1 { font-size: clamp(38px, 6vw, 68px); max-width: 15em; }
.page-head .meta { margin-top: 18px; color: var(--ink-3); font-size: 15px; }
.kicker {
  font-family: var(--sans); font-size: 12.5px; font-weight: 600; color: var(--rosso);
  letter-spacing: .16em; text-transform: uppercase;
}
.prose { max-width: 720px; padding-bottom: 96px; font-size: 17.5px; line-height: 1.75; color: #3A2B23; }
.prose > * + * { margin-top: 1.05em; }
.prose h2 { font-size: clamp(26px, 3.4vw, 34px); margin-top: 1.9em; color: var(--ink); line-height: 1.15; }
.prose h3 { font-size: 22px; margin-top: 1.6em; color: var(--ink); line-height: 1.2; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .45em; }
.prose li::marker { color: var(--rosso); }
.prose a { color: var(--rosso); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose blockquote { margin: 1.6em 0; padding: 4px 0 4px 22px; border-left: 2px solid var(--rosso); font-family: var(--serif); font-size: 1.25em; color: var(--ink); }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; }
.prose th, .prose td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-weight: 600; color: var(--ink); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.prose code { font-size: .9em; background: var(--paper-2); padding: 1px 6px; border-radius: 6px; }
/* Unfilled placeholders in the drafts, shown loudly so nobody publishes them by mistake. */
.prose .todo { background: #FFE9A8; color: #6B4A00; padding: 0 4px; border-radius: 4px; font-weight: 600; }

.draft-banner {
  background: #FFF4D6; color: #6B4A00; border-bottom: 1px solid #F0D894;
  font-size: 14px; text-align: center; padding: 10px var(--gutter);
}

.page-cta {
  margin: 0 0 96px; padding: clamp(28px, 5vw, 48px); border-radius: var(--radius);
  background: var(--card); box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
  display: grid; gap: 18px; max-width: 720px;
}
.page-cta h2 { font-size: clamp(26px, 3.4vw, 34px); }

/* Journal posts: the "In short" answer, the mid-article waitlist box, and "Keep reading" */
.prose .tldr {
  padding: 20px 24px; border-radius: 16px; background: var(--paper-2);
  border-left: 3px solid var(--rosso); font-size: 16.5px; line-height: 1.65; color: var(--ink-2);
}
.prose .inline-cta {
  margin: 2.2em 0; padding: 26px 28px; border-radius: 18px;
  background: var(--card); box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
}
.prose .inline-cta > * + * { margin-top: 10px; }
.prose .inline-cta-h { font-family: var(--serif); font-size: 24px; line-height: 1.2; color: var(--ink); }
.prose .inline-cta p:not(.inline-cta-h) { font-size: 16px; line-height: 1.6; color: var(--ink-2); }
.prose .inline-cta .btn { margin-top: 6px; color: var(--paper); text-decoration: none; }
.related { max-width: 720px; padding-bottom: 96px; }
.related h2 { font-size: clamp(26px, 3.4vw, 34px); margin-bottom: 12px; }

/* Journal index */
.prose .journal, .related .journal { list-style: none; padding: 0; margin: 0; }
.prose .journal li + li { margin-top: 0; }
.journal a { display: grid; gap: 6px; padding: 28px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.journal li:last-child a { border-bottom: 1px solid var(--line); }
.journal .j-date { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.journal .j-title { font-family: var(--serif); font-size: clamp(24px, 3vw, 32px); line-height: 1.15; color: var(--ink); transition: color .2s; }
.journal a:hover .j-title { color: var(--rosso); }
.journal .j-ex { color: var(--ink-2); font-size: 16px; }
/* Post photo as a thumbnail: on the right on wide screens, on top on phones. */
.journal a.has-img { grid-template-columns: minmax(0, 1fr) 220px; column-gap: 28px; align-content: center; }
.journal a.has-img > span { grid-column: 1; }
.journal .j-img { grid-column: 2; grid-row: 1 / span 3; align-self: center; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 14px; background: var(--paper-2); }
@media (max-width: 600px) {
  .journal a.has-img { grid-template-columns: minmax(0, 1fr); }
  .journal .j-img { grid-column: 1; grid-row: auto; order: -1; margin-bottom: 8px; }
}
.page-head h1 em { font-style: normal; color: var(--rosso); }

/* Journal post photo, between the heading and the article */
.post-hero { margin: 0 0 clamp(32px, 5vw, 48px); max-width: 960px; }
.post-hero img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); background: var(--paper-2); }
.post-hero figcaption { margin-top: 10px; font-size: 13px; color: var(--ink-3); }
.post-hero figcaption a { color: inherit; text-underline-offset: 2px; }
