/* ==========================================================================
   Bloom Journal — shared stylesheet

   Design tokens are copied VERBATIM from the mobile app's single source of
   truth. Never invent a value here; go read the source and copy it.

     · Colours + shadows : bloom-journal-app/src/theme.ts  (`colors`, `shadow`)
     · Type scale, spacing, radii, font roles :
       bloom-journal-app/docs/design-system.md
     · Font ROLES are fixed and must never be swapped:
       Playfair Display = headlines / ceremony · Lexend = body / UI
       (Patrick Hand is the app's journal-text face and has no job on this site,
       so it is deliberately not loaded.)

   Light mode only — dark mode is an explicit anti-pattern in the design system.
   Zero third-party requests: fonts are self-hosted, there is no JS anywhere.
   ========================================================================== */

/* ---- Fonts -------------------------------------------------------------- */

@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/playfair-display-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Playfair Display';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/playfair-display-400-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/playfair-display-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Lexend';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('/fonts/lexend-300.woff2') format('woff2');
}
@font-face {
  font-family: 'Lexend';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/lexend-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Lexend';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/lexend-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Lexend';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/lexend-600.woff2') format('woff2');
}

/* ---- Tokens ------------------------------------------------------------- */

:root {
  /* colours — src/theme.ts `colors` */
  --sage: #8b9e7c;
  --sage-light: #c5d4bc;
  --sage-dark: #6b7d60;
  --gold: #c4a55a;
  --gold-light: #e8d5a3;
  --paper: #faf8f5;
  --cream: #f5f0e8;
  --warm-gray: #e8ddd0;
  --taupe: #d4c5b2;
  --ink: #4a3728;
  --rose: #c4868c;
  --rose-light: #f0d4d7;
  --green: #7cab6e;

  /* CONTRAST NOTE — read before reaching for a colour here.
     The brand's secondary text colour, `textMuted` #8b7355, is 4.2:1 on --paper
     and 4.0:1 on --cream: below the 4.5:1 WCAG AA needs for body-size text. So
     this site gets its typographic hierarchy from WEIGHT AND SIZE, not from a
     lighter colour: all text is --ink (10.6:1 on paper) and secondary text is
     Lexend 300. `--text-muted` is defined for fidelity with theme.ts and is
     deliberately used by nothing — do not reintroduce it for text.
     Likewise --sage (2.7:1) and --sage-dark (4.2:1) are FILL and BORDER colours
     here, never text colours: links are ink with a sage underline. */
  --text-muted: #8b7355;

  /* shadows — always warm brown rgba(74, 55, 40, X), never black */
  --shadow-sm: 0 1px 4px rgba(74, 55, 40, 0.04);
  --shadow-md: 0 2px 12px rgba(74, 55, 40, 0.06);
  --shadow-lg: 0 8px 24px rgba(74, 55, 40, 0.1);

  /* type scale (design-system.md: xs 12 · sm 14 · base 16 · lg 18 · xl 22 ·
     2xl 28 · 3xl 35 · 4xl 45). Minimum body text 16. */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.1875rem;
  --text-4xl: 2.8125rem;

  /* 4px grid — space[1..12] = 4/8/12/16/24/32/48 */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;

  /* radii — buttons 8 · cards 12 · paintings 16 · pills 999 */
  --radius-button: 8px;
  --radius-card: 12px;
  --radius-painting: 16px;
  --radius-pill: 999px;

  --font-ceremony: 'Playfair Display', 'Iowan Old Style', 'Palatino Linotype',
    Palatino, Georgia, 'Times New Roman', serif;
  --font-body: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;

  --measure: 65ch;

  color-scheme: light;
}

/* ---- Base --------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* A single column, generous gutters, one reading measure everywhere. */
.wrap {
  width: 100%;
  max-width: calc(var(--measure) + var(--space-8) * 2);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

@media (min-width: 40rem) {
  .wrap {
    padding: 0 var(--space-8);
  }
}

/* ---- Skip link ---------------------------------------------------------- */

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-4);
  z-index: 10;
  padding: var(--space-3) var(--space-4);
  background: var(--cream);
  color: var(--ink);
  border: 1px solid var(--sage);
  border-radius: var(--radius-button);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---- Typography --------------------------------------------------------- */

h1,
h2,
h3 {
  font-family: var(--font-ceremony);
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
  margin: 0 0 var(--space-4);
  overflow-wrap: break-word;
}

/* Phones start at 2xl. The deletion page's email route has to be reachable
   without scrolling on a small phone WITH browser chrome, and an h1 at 3xl
   wrapping to two lines is what pushes it under the fold. */
h1 {
  font-size: var(--text-2xl);
  letter-spacing: -0.01em;
}

h2 {
  font-size: var(--text-xl);
  margin-top: var(--space-12);
}

h3 {
  font-size: var(--text-lg);
  font-weight: 400;
  margin-top: var(--space-8);
}

@media (min-width: 30rem) {
  h1 {
    font-size: var(--text-3xl);
  }
}

@media (min-width: 40rem) {
  h1 {
    font-size: var(--text-4xl);
  }
  h2 {
    font-size: var(--text-2xl);
  }
}

p,
ul,
ol,
dl {
  margin: 0 0 var(--space-4);
}

ul,
ol {
  padding-left: var(--space-6);
}

li {
  margin-bottom: var(--space-2);
}

/* The one sanctioned use of --sage on a glyph: a list marker is decoration —
   the list semantics come from the <ul>/<ol>, and the item text is ink. */
li::marker {
  color: var(--sage);
}

strong {
  font-weight: 600;
}

dt {
  font-weight: 600;
  margin-top: var(--space-4);
}

dd {
  margin: 0 0 var(--space-3);
}

/* Links are ink with a sage underline: AA-safe, and identifiable without
   relying on colour (WCAG 1.4.1). */
a {
  color: var(--ink);
  text-decoration: underline;
  /* --sage-dark, not --sage: the underline is the ONLY thing identifying a link
     (the text is ink like its neighbours), so it has to clear the 3:1 of WCAG
     1.4.11 against paper, cream and every card wash. --sage is 2.7:1 and does
     not. */
  text-decoration-color: var(--sage-dark);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

a:hover,
a:focus {
  text-decoration-color: var(--ink);
  background: var(--sage-light);
}

/* Real focus styles, on everything focusable. */
a:focus-visible,
.button:focus-visible,
.skip-link:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--sage-dark);
  outline-offset: 3px;
  border-radius: var(--radius-button);
}

.lede {
  font-size: var(--text-lg);
  font-weight: 300;
  margin-bottom: var(--space-8);
}

.meta {
  font-size: var(--text-sm);
  font-weight: 300;
  margin-bottom: var(--space-8);
}

.quiet {
  font-size: var(--text-sm);
  font-weight: 300;
}

/* The one place the painter speaks in the first person on a legal page. */
.voice {
  font-family: var(--font-ceremony);
  font-style: italic;
  font-size: var(--text-lg);
  line-height: 1.6;
}

/* ---- Header ------------------------------------------------------------- */

.site-header {
  padding: var(--space-6) 0 var(--space-4);
}

@media (min-width: 40rem) {
  .site-header {
    padding: var(--space-8) 0 var(--space-6);
  }
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-ceremony);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.wordmark {
  text-decoration: none;
}

.wordmark:hover {
  background: transparent;
  text-decoration: underline;
  text-decoration-color: var(--sage);
  text-decoration-thickness: 2px;
}

.wordmark svg {
  display: block;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}

/* ---- Main --------------------------------------------------------------- */

main {
  padding-bottom: var(--space-12);
}

/* ---- Cards and notices -------------------------------------------------- */

.card {
  background: var(--cream);
  border: 1px solid var(--warm-gray);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
  margin: 0 0 var(--space-6);
}

.card > :last-child {
  margin-bottom: 0;
}

.card h2,
.card h3 {
  margin-top: 0;
}

/* The route that has to be findable without scrolling: sage, first thing on
   the delete page. */
.card--primary {
  background: #eef2ea; /* sage at ~12% over paper — a wash, not a fill */
  border-color: var(--sage-light);
  border-left: 4px solid var(--sage);
  box-shadow: var(--shadow-md);
}

/* Billing warning — gold, because it is information, not an error. */
.card--warn {
  background: #fbf4e4; /* gold-light at ~40% over paper */
  border-color: var(--gold-light);
  border-left: 4px solid var(--gold);
}

/* Irreversible-consequence panel. */
.card--grave {
  background: var(--rose-light);
  border-color: var(--rose);
  border-left: 4px solid var(--rose);
}

.card-label {
  display: inline-block;
  margin: 0 0 var(--space-3);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--paper);
  border: 1px solid var(--taupe);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
}

/* ---- The email address, made unmissable --------------------------------- */

.mail {
  display: block;
  font-family: var(--font-ceremony);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 3px solid var(--sage-dark);
  padding: var(--space-2) 0;
  margin: var(--space-3) 0 var(--space-4);
  overflow-wrap: break-word;
  /* 44px minimum touch target */
  min-height: 44px;
}

.mail:hover,
.mail:focus {
  background: var(--sage-light);
  border-bottom-color: var(--ink);
}

/* ---- Steps -------------------------------------------------------------- */

.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0 0 var(--space-4);
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: var(--space-8);
  margin-bottom: var(--space-3);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.25em;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-pill);
  /* sage-light + ink = 7.2:1; sage + paper would be 2.7:1 */
  background: var(--sage-light);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 22px;
  text-align: center;
}

/* ---- Table of contents -------------------------------------------------- */

.toc {
  background: var(--cream);
  border: 1px solid var(--warm-gray);
  border-radius: var(--radius-card);
  padding: var(--space-4) var(--space-6);
  margin: 0 0 var(--space-8);
}

.toc h2 {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 var(--space-3);
}

.toc ol {
  margin: 0;
  padding-left: var(--space-6);
  font-size: var(--text-sm);
}

.toc li {
  margin-bottom: var(--space-1);
}

/* ---- Tables ------------------------------------------------------------- */

.table-scroll {
  overflow-x: auto;
  margin: 0 0 var(--space-6);
  border: 1px solid var(--warm-gray);
  border-radius: var(--radius-card);
  background: var(--cream);
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 30rem;
  font-size: var(--text-sm);
}

th,
td {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--warm-gray);
  vertical-align: top;
}

th {
  font-weight: 600;
  color: var(--ink);
  background: var(--paper);
}

/* Row headers are short labels; without a floor they wrap to one word per line
   while the value column takes everything. Long labels still wrap. */
tbody th[scope='row'] {
  min-width: 8rem;
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: none;
}

/* ---- Buttons / link buttons -------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-button);
  /* sage-light fill + ink label = 7.2:1. A --sage fill with --paper text is
     2.7:1 and must not come back. */
  background: var(--sage-light);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--sage-dark);
  box-shadow: var(--shadow-sm);
}

.button:hover,
.button:focus {
  background: var(--sage-light);
  color: var(--ink);
  border-width: 2px;
  box-shadow: var(--shadow-md);
}

.button--quiet {
  background: transparent;
  border-color: var(--sage-dark);
}

.button--quiet:hover,
.button--quiet:focus {
  background: var(--sage-light);
}

/* ---- Landing page ------------------------------------------------------- */

.hero {
  padding: var(--space-12) 0;
}

.hero h1 {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-6);
}

@media (min-width: 40rem) {
  .hero {
    padding: calc(var(--space-12) * 1.5) 0 var(--space-12);
  }
  .hero h1 {
    font-size: var(--text-4xl);
  }
}

.hero-mark {
  width: 72px;
  height: 72px;
  margin-bottom: var(--space-6);
}

.hero-lede {
  font-family: var(--font-ceremony);
  font-style: italic;
  font-size: var(--text-xl);
  font-weight: 400;
  line-height: 1.5;
  max-width: 34ch;
  margin: 0 0 var(--space-8);
}

.rule {
  border: 0;
  border-top: 1px solid var(--warm-gray);
  margin: var(--space-12) 0;
}

/* App Store / Play badges land here. */
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
  margin: 0 0 var(--space-8);
}

.badges:empty {
  display: none;
}

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

.centered {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ---- Footer ------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--warm-gray);
  background: var(--cream);
  padding: var(--space-8) 0;
  font-size: var(--text-sm);
  font-weight: 300;
}

.site-footer nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  padding: 0;
  margin: 0 0 var(--space-4);
}

.site-footer li {
  margin: 0;
}

.site-footer a {
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
}

.site-footer p {
  margin: 0 0 var(--space-1);
}

@media (min-width: 40rem) {
  .site-footer a {
    min-height: 0;
    line-height: inherit;
  }
  .site-footer nav ul {
    margin-bottom: var(--space-3);
  }
}

/* ---- Print -------------------------------------------------------------- */

@media print {
  body {
    background: #fff;
  }
  .site-header,
  .site-footer,
  .toc,
  .skip-link {
    display: none;
  }
  .card {
    box-shadow: none;
  }
}
