/* Art direction: Warm cottage / Iowan Old Style serif headings / card-forward rhythm */
/* Task t_6dbbdfb2 spec §2 — token block is contract; values verified by contrast-check.py. */

:root {
  color-scheme: light dark;

  /* Surfaces & text */
  --bg: #fbf7f2;              /* page background — warm cream */
  --surface: #ffffff;         /* cards, header bar, footer */
  --text: #2b2119;            /* primary text — deep cocoa (14.76:1 on bg) */
  --muted: #6d5c4d;           /* secondary text (5.99:1 on bg) */
  --border: #e7dbcd;          /* hairlines, card outlines */

  /* Accent system */
  --accent: #a9603a;          /* terracotta — buttons, large accents only in light (4.45:1, AA-large) */
  --accent-deep: #96532f;     /* small accent TEXT: links, prices, badges in light (5.51:1 bg / 5.87:1 surface) */
  --accent-soft: #f1e5dc;     /* hover washes, badge fills (12% accent over bg) */
  --accent-contrast: #ffffff; /* text on solid accent fills (4.75:1) */

  /* Typography */
  --heading-font: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --body-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Layout */
  --max-width: 68rem;
  --space: clamp(1rem, 2.5vw, 2rem);   /* legacy gutter token, kept for compat */
  --radius: 14px;
  --radius-lg: 18px;                   /* media frames, map frame */
  --radius-pill: 999px;                /* badges, theme toggle */

  /* Spacing scale (use these, not ad-hoc paddings) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;

  /* Elevation (warm-tinted shadows, never neutral grey) */
  --shadow-rest: 0 1px 2px rgba(43, 33, 25, 0.06), 0 2px 8px rgba(43, 33, 25, 0.08);
  --shadow-lift: 0 2px 4px rgba(43, 33, 25, 0.08), 0 10px 24px rgba(43, 33, 25, 0.12);

  /* Form status error (AA-checked pair on bg) */
  --status-error: #a03030;
}

[data-theme="dark"] {
  --bg: #191411;
  --surface: #221b16;
  --text: #f3ebe2;            /* 15.48:1 on bg */
  --muted: #bda893;           /* 7.99:1 on bg */
  --border: #3a2e26;

  --accent: #d08a5f;          /* lighter terracotta — safe for small text in dark (6.51:1) */
  --accent-deep: #e8a97f;     /* kept for API parity; use where light used accent-deep */
  --accent-soft: #36271d;     /* badge fills (16% accent over bg) */
  --accent-contrast: #0d0d0d; /* text on solid accent fills (6.93:1) */

  --shadow-rest: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.30);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.40), 0 10px 24px rgba(0, 0, 0, 0.45);

  --status-error: #e08d8d; /* AA on dark bg */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #191411;
    --surface: #221b16;
    --text: #f3ebe2;
    --muted: #bda893;
    --border: #3a2e26;

    --accent: #d08a5f;
    --accent-deep: #e8a97f;
    --accent-soft: #36271d;
    --accent-contrast: #0d0d0d;

    --shadow-rest: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.30);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.40), 0 10px 24px rgba(0, 0, 0, 0.45);

    --status-error: #e08d8d; /* AA on dark bg */
  }
}
