/* ==========================================================================
   Soft Minimal — design tokens & base styles
   Drop this in as-is. Per project, change only the three --accent-* values.
   ========================================================================== */

:root {
  /* Accent — the ONLY per-project change. Keep it muted/desaturated. */
  --accent: #3d7a6e;            /* primary action, links, active states */
  --accent-hover: #33675d;      /* slightly darker for hover */
  --accent-soft: #e8f1ee;       /* tinted background for selected/active rows, badges */

  /* Neutrals — warm-tinted, never pure white/black/gray */
  --bg: #fafaf8;                /* page background */
  --surface: #ffffff;           /* cards, panels, inputs */
  --surface-sunken: #f4f4f1;    /* wells, code blocks, subtle zones */
  --border: #e8e7e3;            /* hairline structure */
  --border-strong: #d6d5d0;     /* input borders, hover borders */

  /* Text — three tones only */
  --text: #1c1c1a;              /* primary */
  --text-secondary: #6f6e69;    /* labels, metadata, descriptions */
  --text-faint: #a3a29c;        /* placeholders, disabled, timestamps */

  /* Semantic — red is for destruction/errors ONLY */
  --danger: #c4453d;
  --danger-soft: #fbeeed;
  --success: #3e7a4e;
  --success-soft: #ecf4ee;

  /* Type */
  --font: ui-sans-serif, -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
  --text-xs: 0.75rem;   /* 12px — caps labels, timestamps */
  --text-sm: 0.875rem;  /* 14px — secondary text, table cells, buttons */
  --text-base: 1rem;    /* 16px — body */
  --text-lg: 1.25rem;   /* 20px — section headings */
  --text-xl: 1.75rem;   /* 28px — page title (one per page) */

  /* Spacing — 4px scale. Use these; don't invent values. */
  --space-1: 0.25rem;   /* 4px  */
  --space-2: 0.5rem;    /* 8px  */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-6: 1.5rem;    /* 24px — default card padding */
  --space-8: 2rem;      /* 32px */
  --space-12: 3rem;     /* 48px — between page sections */
  --space-16: 4rem;     /* 64px */

  /* Shape */
  --radius-sm: 6px;     /* small controls, badges */
  --radius-md: 8px;     /* buttons, inputs */
  --radius-lg: 12px;    /* cards, panels, modals */
  --radius-full: 999px; /* pills, avatars, toggles */

  /* Depth — faint and layered; borders do most structural work */
  --shadow-sm: 0 1px 2px rgba(28, 28, 26, 0.04);
  --shadow-md: 0 1px 2px rgba(28, 28, 26, 0.04), 0 4px 12px rgba(28, 28, 26, 0.06);
  --shadow-lg: 0 2px 4px rgba(28, 28, 26, 0.04), 0 12px 32px rgba(28, 28, 26, 0.10);

  /* Motion */
  --transition: 160ms ease-out;

  /* Layout */
  --content-max: 1100px;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.015em;
  font-weight: 600;
}
h1 { font-size: var(--text-xl); }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-base); }

p { margin: 0; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* Visible focus for keyboard users — accent ring, offset from the element */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* --------------------------------------------------------------------------
   Buttons — one .btn-primary per screen; everything else secondary/ghost
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.5rem 0.875rem;
  min-height: 2.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-sunken); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-sunken); color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }

/* --------------------------------------------------------------------------
   Surfaces
   -------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   Forms — labels above inputs, always visible
   -------------------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: var(--space-2); }

.field label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
}

.field .hint { font-size: var(--text-xs); color: var(--text-secondary); }
.field .error { font-size: var(--text-xs); color: var(--danger); }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], input[type="date"], input[type="time"],
textarea, select {
  font: inherit;
  font-size: var(--text-sm);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  min-height: 2.25rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field.has-error input, .field.has-error textarea { border-color: var(--danger); }

/* --------------------------------------------------------------------------
   Small utilities the recipes rely on
   -------------------------------------------------------------------------- */

.label-caps {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  background: var(--accent-soft);
  color: var(--accent);
}

.text-secondary { color: var(--text-secondary); }
.text-faint { color: var(--text-faint); }
