/* MailWhen — one stylesheet, no build step, no third-party requests.
   Fonts are system stacks on purpose: a service whose privacy page promises
   that nothing loads from anywhere else cannot then pull a webfont from a CDN. */

:root {
  color-scheme: light dark;

  --paper:      #f7f4ee;
  --surface:    #fffdf9;
  --surface-2:  #f1ece2;
  --ink:        #17150f;
  --ink-soft:   #4b463c;
  --muted:      #746c60;
  --rule:       #e2dbcd;
  --rule-soft:  #ece6da;
  --accent:     #a4500f;
  --accent-ink: #ffffff;
  --accent-wash:#f6ead9;
  --recur:      #2b5f57;
  --recur-wash: #e2eeea;
  --shadow:     0 1px 2px rgb(23 21 15 / .05), 0 8px 24px -12px rgb(23 21 15 / .18);
  --shadow-lg:  0 2px 4px rgb(23 21 15 / .06), 0 24px 48px -24px rgb(23 21 15 / .28);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono:  ui-monospace, SFMono-Regular, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --measure: 34rem;
  --gutter: clamp(1.25rem, 5vw, 3rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:      #131210;
    --surface:    #1b1a16;
    --surface-2:  #232119;
    --ink:        #ece7dd;
    --ink-soft:   #c3bcb0;
    --muted:      #948c80;
    --rule:       #322f27;
    --rule-soft:  #262420;
    --accent:     #e29a56;
    --accent-ink: #1b1409;
    --accent-wash:#2a2117;
    --recur:      #7fbcaf;
    --recur-wash: #1a2523;
    --shadow:     0 1px 2px rgb(0 0 0 / .4), 0 8px 24px -12px rgb(0 0 0 / .6);
    --shadow-lg:  0 2px 4px rgb(0 0 0 / .4), 0 24px 48px -24px rgb(0 0 0 / .7);
  }
}

:root[data-theme="dark"] {
  --paper:      #131210;
  --surface:    #1b1a16;
  --surface-2:  #232119;
  --ink:        #ece7dd;
  --ink-soft:   #c3bcb0;
  --muted:      #948c80;
  --rule:       #322f27;
  --rule-soft:  #262420;
  --accent:     #e29a56;
  --accent-ink: #1b1409;
  --accent-wash:#2a2117;
  --recur:      #7fbcaf;
  --recur-wash: #1a2523;
  --shadow:     0 1px 2px rgb(0 0 0 / .4), 0 8px 24px -12px rgb(0 0 0 / .6);
  --shadow-lg:  0 2px 4px rgb(0 0 0 / .4), 0 24px 48px -24px rgb(0 0 0 / .7);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.15; letter-spacing: -.01em; margin: 0; }
p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

code, kbd, samp { font-family: var(--mono); font-size: .9em; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

.wrap { width: min(100% - calc(var(--gutter) * 2), 64rem); margin-inline: auto; }
.prose { max-width: var(--measure); }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: .6rem 1rem; border-radius: 0 0 6px 0; font-size: .9rem;
}
.skip:focus { left: 0; }

/* ---------- address chips ---------- */

.addr {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: .1em .45em;
  font-family: var(--mono);
  font-size: .85em;
  white-space: nowrap;
  color: var(--ink);
}

/* A chip inside a link takes the link colour. Without this `.addr` wins on
   specificity over the bare `a` rule, and a file you can download reads as
   plain text that happens to be underlined. */
a .addr { color: var(--accent); border-color: var(--accent); }

/* ---------- header ---------- */

.site-head {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--rule-soft);
}
.site-head__inner { display: flex; align-items: center; gap: 1.5rem; height: 3.9rem; }

.wordmark {
  font-family: var(--serif); font-size: 1.28rem; font-weight: 600;
  letter-spacing: -.015em; color: var(--ink); text-decoration: none;
  display: inline-flex; align-items: baseline; margin-right: auto;
}
.wordmark em { font-style: normal; color: var(--accent); }

.nav { display: flex; align-items: center; gap: 1.35rem; }
.nav a {
  color: var(--ink-soft); text-decoration: none; font-size: .93rem;
  border-bottom: 1px solid transparent; padding-bottom: 1px;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

.theme-toggle {
  appearance: none; background: transparent; border: 1px solid var(--rule);
  border-radius: 999px; width: 2rem; height: 2rem; display: grid; place-items: center;
  cursor: pointer; color: var(--ink-soft); padding: 0; flex: none;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--muted); }
.theme-toggle svg { width: 1rem; height: 1rem; }

/* Which glyph shows: the one for the theme you would switch *to*. */
.icon-sun { display: none; }
.icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }

@media (max-width: 34rem) { .nav .nav-hide { display: none; } }

/* ---------- sections ---------- */

section { padding-block: clamp(3.5rem, 9vw, 6.5rem); }
section + section { border-top: 1px solid var(--rule-soft); }

.eyebrow {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .14em;
  color: var(--muted); font-weight: 600; margin: 0 0 1rem;
  font-family: var(--sans);
}
.section-title { font-size: clamp(1.6rem, 3.4vw, 2.1rem); margin-bottom: .8rem; }
.section-lede { color: var(--ink-soft); max-width: var(--measure); }

/* ---------- hero ---------- */

.hero { padding-block: clamp(3.5rem, 10vw, 7rem) clamp(3rem, 8vw, 5.5rem); }
.hero__grid { display: grid; gap: clamp(2.5rem, 6vw, 4rem); align-items: center; }
@media (min-width: 60rem) { .hero__grid { grid-template-columns: 1.05fr .95fr; } }

.hero h1 {
  font-size: clamp(2.35rem, 6.2vw, 3.9rem);
  line-height: 1.06; letter-spacing: -.028em; margin-bottom: 1.1rem;
  text-wrap: balance;
}
.hero h1 .accent { color: var(--accent); font-style: italic; }
.hero__lede { font-size: clamp(1.06rem, 2vw, 1.19rem); color: var(--ink-soft); max-width: 32rem; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.9rem; align-items: center; }

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .68rem 1.15rem; border-radius: 8px; font-size: .95rem; font-weight: 500;
  text-decoration: none; border: 1px solid transparent; cursor: pointer; font-family: var(--sans);
}
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { border-color: var(--rule); color: var(--ink); background: var(--surface); }
.btn--ghost:hover { border-color: var(--muted); }

/* compose-window mock */

.compose {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 12px;
  box-shadow: var(--shadow-lg); overflow: hidden; font-size: .95rem;
}
.compose__bar {
  display: flex; align-items: center; gap: .45rem;
  padding: .7rem .9rem; border-bottom: 1px solid var(--rule-soft); background: var(--surface-2);
}
.compose__dot { width: .62rem; height: .62rem; border-radius: 50%; background: var(--rule); flex: none; }
.compose__title { margin-left: .45rem; font-size: .78rem; color: var(--muted); letter-spacing: .02em; }
.compose__row { display: flex; gap: .8rem; padding: .72rem .95rem; border-bottom: 1px solid var(--rule-soft); align-items: baseline; }
.compose__label { color: var(--muted); font-size: .72rem; width: 3.4rem; flex: none; letter-spacing: .06em; text-transform: uppercase; }
.compose__value { font-family: var(--mono); font-size: .9rem; color: var(--ink); overflow-wrap: anywhere; }
.compose__value .to { color: var(--accent); font-weight: 600; }
.compose__body { padding: 1.1rem .95rem 1.4rem; color: var(--ink-soft); font-size: .93rem; min-height: 5.2rem; }
.compose__body p { margin: 0 0 .7em; }
.caret {
  display: inline-block; width: .55em; height: 1.05em; vertical-align: -.2em;
  background: var(--accent); margin-left: .06em; animation: blink 1.1s step-end infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .caret { animation: none; } }

.arrival {
  display: flex; align-items: center; gap: .6rem;
  margin-top: 1rem; padding: .7rem .85rem;
  background: var(--accent-wash); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: 8px; font-size: .85rem; color: var(--ink-soft);
}
.arrival svg { width: 1rem; height: 1rem; flex: none; color: var(--accent); }
.arrival strong { color: var(--ink); font-weight: 600; }

/* ---------- steps ---------- */

.steps { display: grid; gap: 1.1rem; margin-top: 2.6rem; counter-reset: step; }
@media (min-width: 48rem) { .steps { grid-template-columns: repeat(3, 1fr); gap: 1.4rem; } }
.step {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 12px;
  padding: 1.5rem 1.4rem;
}
.step::before {
  counter-increment: step; content: counter(step);
  font-family: var(--serif); font-size: .8rem; font-weight: 600;
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: var(--accent-wash); color: var(--accent);
  display: grid; place-items: center; margin-bottom: .9rem;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.step h3 { font-size: 1.06rem; margin-bottom: .45rem; }
.step p { color: var(--ink-soft); font-size: .93rem; margin: 0; }

/* ---------- vocabulary table ---------- */

.table-scroll { overflow-x: auto; margin-top: 2.4rem; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); }
table.vocab { width: 100%; border-collapse: collapse; font-size: .93rem; min-width: 32rem; }
table.vocab th, table.vocab td { text-align: left; padding: .78rem 1rem; border-bottom: 1px solid var(--rule-soft); vertical-align: baseline; }
table.vocab thead th {
  font-family: var(--sans); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); font-weight: 600; background: var(--surface-2);
}
table.vocab tbody tr:last-child td { border-bottom: 0; }
table.vocab td:first-child { white-space: nowrap; }
table.vocab .range { color: var(--muted); font-size: .86rem; white-space: nowrap; }
table.vocab .note { color: var(--ink-soft); }

.tag {
  display: inline-block; font-size: .66rem; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; padding: .1rem .4rem; border-radius: 4px; vertical-align: .1em;
  background: var(--recur-wash); color: var(--recur);
  border: 1px solid color-mix(in srgb, var(--recur) 26%, transparent);
}
.tag--alpha {
  background: var(--accent-wash); color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  font-size: .72rem; padding: .2rem .55rem;
}
.hero__badge { margin-bottom: 1.1rem; }
.hero__note { margin-top: 1rem; font-size: .88rem; color: var(--muted); max-width: 32rem; }

.callout {
  margin-top: 1.6rem; padding: 1.1rem 1.25rem;
  border-left: 3px solid var(--accent); background: var(--accent-wash);
  border-radius: 0 8px 8px 0; font-size: .95rem; color: var(--ink-soft);
  max-width: 40rem;
}
.callout strong { color: var(--ink); }
.callout--quiet { border-left-color: var(--muted); background: var(--surface-2); }

/* ---------- preview widget ---------- */

.preview {
  margin-top: 2.4rem; background: var(--surface); border: 1px solid var(--rule);
  border-radius: 14px; box-shadow: var(--shadow); overflow: hidden;
}
.preview__controls { padding: 1.4rem 1.4rem 1.5rem; border-bottom: 1px solid var(--rule-soft); }
.preview__legend { font-size: .74rem; text-transform: uppercase; letter-spacing: .11em; color: var(--muted); font-weight: 600; margin-bottom: .7rem; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
  appearance: none; cursor: pointer; font-family: var(--mono); font-size: .84rem;
  padding: .38rem .7rem; border-radius: 999px; border: 1px solid var(--rule);
  background: var(--paper); color: var(--ink-soft);
}
.chip:hover { border-color: var(--muted); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

.preview__amount { margin-top: 1.35rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.preview__amount label { font-size: .86rem; color: var(--muted); }
.preview__amount input[type="range"] { flex: 1 1 14rem; accent-color: var(--accent); min-width: 10rem; }
.preview__amount output { font-family: var(--mono); font-size: .95rem; color: var(--ink); min-width: 4rem; }
.preview__amount[hidden] { display: none; }

/* The month and hour pickers. Drawn here rather than left to the platform so
   they sit with the chips in both themes; the arrow is two gradients rather
   than an image. */
.preview__amount select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  font-family: var(--mono); font-size: .9rem; color: var(--ink);
  padding: .4rem 2.2rem .4rem .7rem; border: 1px solid var(--rule); border-radius: 8px;
  background-color: var(--paper);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1.05rem) 55%, calc(100% - .75rem) 55%;
  background-size: .3rem .3rem;
  background-repeat: no-repeat;
}
.preview__amount select:hover { border-color: var(--muted); }

/* The list a select opens is drawn by the browser, which follows the system
   theme rather than the toggle unless it is told which one is showing. */
.preview__amount select { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .preview__amount select { color-scheme: dark; }
}
:root[data-theme="dark"] .preview__amount select { color-scheme: dark; }

.preview__out { padding: 1.5rem 1.4rem; display: grid; gap: 1.15rem; background: var(--surface-2); }
@media (min-width: 46rem) { .preview__out { grid-template-columns: auto 1fr; align-items: center; gap: 1.8rem; } }
.preview__addr {
  font-family: var(--mono); font-size: clamp(1.05rem, 3vw, 1.4rem); font-weight: 600;
  color: var(--ink); overflow-wrap: anywhere;
}
.preview__addr .local { color: var(--accent); }
.preview__when { font-size: .95rem; color: var(--ink-soft); }
.preview__when strong { color: var(--ink); font-weight: 600; }
.preview__rule { display: block; margin-top: .3rem; font-size: .84rem; color: var(--muted); }

/* ---------- reminder anatomy ---------- */

.anatomy { margin-top: 2.4rem; display: grid; gap: 1.8rem; }
@media (min-width: 56rem) { .anatomy { grid-template-columns: 1fr 1fr; align-items: start; gap: 2.8rem; } }

.mail {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden; font-size: .9rem;
}
.mail__head { padding: 1rem 1.1rem; border-bottom: 1px solid var(--rule-soft); background: var(--surface-2); }
.mail__subject { font-family: var(--serif); font-size: 1.05rem; font-weight: 600; margin-bottom: .3rem; }
.mail__meta { font-size: .78rem; color: var(--muted); font-family: var(--mono); }
.mail__body { padding: 1.1rem; }
.mail__fields { display: grid; grid-template-columns: auto 1fr; gap: .35rem .9rem; font-size: .85rem; margin: 0 0 1rem; }
.mail__fields dt { color: var(--muted); }
.mail__fields dd { margin: 0; color: var(--ink); font-family: var(--mono); font-size: .8rem; }
.mail__status { color: var(--recur); font-weight: 600; }
.mail__rule { border: 0; border-top: 1px solid var(--rule-soft); margin: 1rem 0; }
.mail__quote { color: var(--ink-soft); font-size: .88rem; }
.mail__foot { font-size: .76rem; color: var(--muted); margin-top: 1.1rem; padding-top: .8rem; border-top: 1px dashed var(--rule); font-family: var(--mono); overflow-wrap: anywhere; }

.facts { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.15rem; }
.facts li { padding-left: 1.6rem; position: relative; color: var(--ink-soft); font-size: .95rem; }
.facts li::before {
  content: ""; position: absolute; left: 0; top: .6em;
  width: .5rem; height: .5rem; border-radius: 50%;
  background: var(--accent); opacity: .55;
}
.facts strong { color: var(--ink); font-weight: 600; display: block; font-size: 1.02rem; margin-bottom: .15rem; font-family: var(--serif); }

/* ---------- cards ---------- */

.cards { display: grid; gap: 1.1rem; margin-top: 2.4rem; }
@media (min-width: 46rem) { .cards { grid-template-columns: repeat(2, 1fr); gap: 1.3rem; } }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 1.4rem; }
.card h3 { font-size: 1.02rem; margin-bottom: .45rem; }
.card p { color: var(--ink-soft); font-size: .93rem; margin: 0; }

/* ---------- access ---------- */

.access { text-align: center; }
.access .section-lede { margin-inline: auto; }
.access__box {
  margin: 2.2rem auto 0; max-width: 34rem; padding: 1.8rem;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; box-shadow: var(--shadow);
}
.access__box p { font-size: .95rem; color: var(--ink-soft); }
.access__box .access__note { margin-top: 1.4rem; font-size: .86rem; color: var(--muted); }
.start-steps { text-align: left; margin: 0; padding-left: 1.3rem; color: var(--ink-soft); font-size: .95rem; }
.start-steps li { margin-bottom: .55em; padding-left: .2rem; }
.start-steps li:last-child { margin-bottom: 0; }
.start-steps li::marker { color: var(--accent); font-weight: 600; }

/* ---------- footer ---------- */

.site-foot { border-top: 1px solid var(--rule-soft); padding-block: 2.6rem 3.2rem; background: var(--surface-2); }
.site-foot__inner { display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem; justify-content: space-between; align-items: flex-start; }
.site-foot__about { max-width: 26rem; }
.site-foot p { font-size: .85rem; color: var(--muted); margin: 0; }
.site-foot .copyright { margin-top: .55rem; font-size: .8rem; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 1.2rem; }
.site-foot nav a { font-size: .85rem; color: var(--ink-soft); text-decoration: none; }
.site-foot nav a:hover { color: var(--accent); }

/* ---------- inner pages ---------- */

.page-head { padding-block: clamp(3rem, 7vw, 5rem) clamp(1.5rem, 4vw, 2.5rem); }
.page-head h1 { font-size: clamp(2rem, 5vw, 2.9rem); letter-spacing: -.025em; margin-bottom: .7rem; }
.page-head p { color: var(--ink-soft); max-width: var(--measure); font-size: 1.05rem; }

.doc { padding-block: 0 clamp(3.5rem, 8vw, 6rem); }
.doc section { padding-block: clamp(2.2rem, 5vw, 3rem); border-top: 1px solid var(--rule-soft); }
.doc h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); margin-bottom: .8rem; }
.doc h3 { font-size: 1.06rem; margin: 1.9rem 0 .5rem; }
.doc p, .doc li { color: var(--ink-soft); max-width: var(--measure); }
.doc ul, .doc ol { padding-left: 1.2rem; margin: 0 0 1.1em; }
.doc li { margin-bottom: .45em; }
.doc li::marker { color: var(--muted); }

.toc { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.6rem; }
.toc a {
  font-size: .84rem; text-decoration: none; color: var(--ink-soft);
  border: 1px solid var(--rule); border-radius: 999px; padding: .3rem .75rem; background: var(--surface);
}
.toc a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 404 ---------- */

.notfound { min-height: 60vh; display: grid; place-items: center; text-align: center; padding-block: 4rem; }
.notfound h1 { font-size: clamp(2rem, 6vw, 3rem); margin-bottom: .6rem; }
.notfound p { color: var(--ink-soft); max-width: 30rem; margin-inline: auto; }

.center { text-align: center; }
.mt { margin-top: 2rem; }

/* No inline style attributes anywhere on the site, so the Content-Security-
   Policy can refuse them outright rather than allowing 'unsafe-inline'. */
.bare { border: 0; padding: 0; margin: 0; }
.footnote { margin-top: 1.2rem; font-size: .88rem; }
