/* Organic — design-system tokens and component classes.
 *
 * A copy of styles.css from the Organic design system (claude.ai/design), which
 * is the source of truth for the look. Two deliberate departures, both marked
 * below; everything else is verbatim, so the file can be re-copied when the
 * system changes without hunting for local edits.
 *
 *   1. The fonts are served from /fonts rather than imported from
 *      fonts.googleapis.com. The import would make Google a recipient of every
 *      visitor's IP address — on the privacy policy page, of all places — and
 *      would have to be declared in that policy. The files are already in the
 *      repository for the app.
 *
 *   2. A dark-mode block is appended. Organic itself is a light theme, but these
 *      pages are read on phones at night, and the values are taken from the
 *      app's own dark ColorScheme (organic_scheme.dart) rather than invented, so
 *      the pages and the app agree.
 */

/* — 1. fonts, served from this site — */
@font-face {
  font-family: "Caprasimo";
  src: url("/fonts/Caprasimo-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/fonts/Figtree-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/fonts/Figtree-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/fonts/Figtree-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --color-bg: #f9f4f2;
  --color-surface: #ffffff;
  --color-text: #241b1b;
  --color-accent: #8b0909;
  --color-accent-2: #7e9774;
  --color-divider: color-mix(in srgb, #241b1b 16%, transparent);

  /* Tonal ramps — generated in OKLCH on one shared lightness scale, so the
     same step of any role matches the others in visual value. */
  --color-neutral-100: #ffffff;
  --color-neutral-200: #faf8f7;
  --color-neutral-300: #f1ecea;
  --color-neutral-400: #ddd4d1;
  --color-neutral-500: #beb2ae;
  --color-neutral-600: #978a87;
  --color-neutral-700: #6e6361;
  --color-neutral-800: #4a4241;
  --color-neutral-900: #241b1b;

  --color-accent-100: #fff1f1;
  --color-accent-200: #ffd9d9;
  --color-accent-300: #ffb3b3;
  --color-accent-400: #f26f6f;
  --color-accent-500: #d93a3a;
  --color-accent-600: #b81f1f;
  --color-accent-700: #8b0909;
  --color-accent-800: #670707;
  --color-accent-900: #420404;

  --color-accent-2-100: #f5f8f3;
  --color-accent-2-200: #e5ede2;
  --color-accent-2-300: #c8d6c2;
  --color-accent-2-400: #a7ba9f;
  --color-accent-2-500: #7e9774;
  --color-accent-2-600: #657b5c;
  --color-accent-2-700: #4d5f46;
  --color-accent-2-800: #384536;
  --color-accent-2-900: #232b22;

  --font-heading: "Caprasimo", system-ui, sans-serif;
  --font-heading-weight: 400;
  --font-body: "Figtree", system-ui, sans-serif;

  --space-1: 4.4px;
  --space-2: 8.8px;
  --space-3: 13.2px;
  --space-4: 17.6px;
  --space-6: 26.4px;
  --space-8: 35.2px;

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 28px;

  /* Elevation — derived from the ground: soft ink-tinted shadows on a
     light theme, a hairline edge + ambient darkness on a dark one. */
  --shadow-sm: 0 1px 2px color-mix(in srgb, #241b1b 14%, transparent);
  --shadow-md: 0 3px 10px color-mix(in srgb, #241b1b 16%, transparent);
  --shadow-lg: 0 12px 32px color-mix(in srgb, #241b1b 22%, transparent);
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
}
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: var(--font-heading-weight); }

.washed{filter:saturate(0.6) contrast(0.85) brightness(1.1) opacity(0.94)}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.55; font-weight: 400; }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 var(--space-2);
}
h1 { font-size: 42px; }
h2 { font-size: 32px; }
h3 { font-size: 25px; }
h4 { font-size: 20px; }
h5 { font-size: 16px; }
h6 { font-size: 13px; }
h6 { letter-spacing: 0.08em; text-transform: uppercase; }
p { margin: 0 0 var(--space-3); }
a { color: var(--color-accent); text-underline-offset: 3px; }
img { display: block; max-width: 100%; }
figure { margin: 0; }
figcaption {
  font-size: 11px; margin-top: var(--space-1);
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}
.text-muted { color: color-mix(in srgb, var(--color-text) 55%, transparent); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }

/* — rules — */
.hr {
  height: 1px; border: 0; margin: var(--space-4) 0;
  background: var(--color-divider);
}

/* — buttons — */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; text-decoration: none;
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 14px; line-height: 1.2; color: var(--color-text);
  background: transparent; border: 1px solid transparent;
  padding: var(--space-2) calc(var(--space-3) * 1.2);
  border-radius: var(--radius-md);
}
.btn svg { display: block; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--color-accent); color: var(--color-bg); }
.btn-primary:hover { background: var(--color-accent-600); }
.btn-primary:active { background: var(--color-accent-700); }
.btn-secondary { border-color: var(--color-divider); }
.btn-secondary:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.btn-secondary:active { background: color-mix(in srgb, var(--color-text) 14%, transparent); }
.btn-ghost { color: var(--color-accent); padding-inline: var(--space-1); }
.btn-ghost:hover { background: color-mix(in srgb, var(--color-accent) 10%, transparent); }
.btn-ghost:active { background: color-mix(in srgb, var(--color-accent) 18%, transparent); }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-block { width: 100%; margin-top: var(--space-2); }

/* — forms — */
.field > label {
  display: block; font-size: 12px; margin-bottom: 5px;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
}
.input {
  width: 100%; min-height: 36px; padding: 6px 10px; font: inherit;
  font-size: 14px; color: var(--color-text); caret-color: var(--color-accent);
  background: var(--color-surface);
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.input:hover { border-color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.input:focus-visible { border-color: var(--color-accent); outline-offset: 0; }
textarea.input { min-height: 90px; resize: vertical; }
.radio { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.radio input, .seg-opt input {
  position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;
}
.radio .dot {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 1.5px solid var(--color-divider);
}
.radio:hover .dot { border-color: var(--color-accent); }
.radio input:checked + .dot {
  border-color: var(--color-accent); background: var(--color-accent);
  box-shadow: inset 0 0 0 4px var(--color-bg);
}
.radio input:focus-visible + .dot { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* — cards — */
.card {
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-surface);
}
.card-kicker { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-accent); }
.card-title {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 17px; line-height: 1.2;
}
.card-body { margin: 0; font-size: 13px; opacity: 0.8; flex: 1; }
.card-meta {
  display: flex; align-items: center; gap: 6px; font-size: 11px;
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
}
.elev-sm { box-shadow: var(--shadow-sm); }
.elev-md { box-shadow: var(--shadow-md); }
.elev-lg { box-shadow: var(--shadow-lg); }

/* — tags — */
.tag {
  display: inline-flex; align-items: center; font-size: 11px;
  letter-spacing: 0.02em; padding: 3px 10px;
  border-radius: calc(var(--radius-md) * 0.75);
}
.tag-accent { background: var(--color-accent-100); color: var(--color-accent-800); }
.tag-accent-2 { background: var(--color-accent-2-100); color: var(--color-accent-2-800); }
.tag-neutral { background: var(--color-neutral-100); color: var(--color-neutral-800); }
.tag-outline { border: 1px solid var(--color-accent); color: var(--color-accent); }

/* — tables — */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
  padding: var(--space-2); border-bottom: 1px solid var(--color-divider);
}
.table td {
  padding: var(--space-2);
  border-bottom: 1px solid color-mix(in srgb, var(--color-text) 8%, transparent);
}
.table tbody tr:hover { background: color-mix(in srgb, var(--color-text) 4%, transparent); }

/* — rounded frame: everything softens, small controls go pill — */
.card { border-radius: calc(var(--radius-lg) * 1.15); }
.btn, .tag, .input { border-radius: 999px; }
.input { padding-inline: 14px; }

/* — 2. dark mode, appended —
 *
 * Not part of Organic, which is a light theme. The values are the app's own dark
 * ColorScheme from organic_scheme.dart, so a phone in dark mode sees the same
 * pairing here as in the app:
 *   page   = text (#241b1b)      card = neutral-900
 *   ink    = neutral-100          muted = neutral-300
 *   links  = accent-400, the Bordeaux stepped light enough to read on a dark
 *            ground; 600 is for a pale page and goes muddy here
 */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #140f10;
    --color-surface: #241b1b;
    --color-text: #ffffff;
    --color-accent: #f26f6f;
    --color-accent-2: #a7ba9f;
    --color-divider: color-mix(in srgb, #ffffff 18%, transparent);

    --shadow-sm: 0 1px 2px color-mix(in srgb, #000 45%, transparent);
    --shadow-md: 0 3px 10px color-mix(in srgb, #000 50%, transparent);
    --shadow-lg: 0 12px 32px color-mix(in srgb, #000 58%, transparent);
  }

  /* The light ramps invert: a tag needs a dark ground and light ink. */
  .tag-accent { background: var(--color-accent-900); color: var(--color-accent-300); }
  .tag-accent-2 { background: var(--color-accent-2-800); color: var(--color-accent-2-200); }
  .tag-neutral { background: var(--color-neutral-800); color: var(--color-neutral-200); }
  .btn-primary { color: #3d1019; }
}
