/* =============================================================================
   jaquesbody design system — main.css
   Phase 0 — shared base for all projects
   Font: Inter (self-hosted, see /static/fonts/)
   Deviation from protocol.md Section 3.1 — justified: open-source (OFL),
   no external request, no privacy compromise, consistent geometric aesthetic
   ============================================================================= */

/* -----------------------------------------------------------------------------
   @font-face — Inter self-hosted
   Files expected at: static/fonts/
   ----------------------------------------------------------------------------- */

@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* -----------------------------------------------------------------------------
   :root — light mode tokens (fallback)
   Dark mode is primary — these are the accessible alternative
   ----------------------------------------------------------------------------- */

:root {
  /* --- Colour: monochrome base (cool-biased) --- */
  --color-black: #0d0d0f;
  --color-charcoal: #1a1a1f;
  --color-mid: #6b6b78;
  --color-light: #c2c2cc;
  --color-white: #f0f0f5;

  /* --- Colour: semantic surface/text assignments (light mode) --- */
  --bg: var(--color-white);
  --bg-surface: #e2e2ea;
  --text-primary: var(--color-black);
  --text-secondary: var(--color-mid);
  --border: #c2c2cc;
  --color-white-pure: #ffffff;

  /* --- Accent --- */
  /* --accent is intentionally undefined here. */
  /* Each project sets --accent, --accent-hover, --accent-muted in its */
  /* own <style> block or project css file before importing this system. */

  /* --- Typography: scale --- */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.75rem;
  --text-2xl: 2.75rem;

  /* --- Typography: weight --- */
  --weight-regular: 400;
  --weight-bold: 700;

  /* --- Typography: line-height --- */
  --leading-body: 1.6;
  --leading-heading: 1.15;

  /* --- Typography: font stack --- */
  --font-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
    Ubuntu, Cantarell, sans-serif;

  /* --- Spacing scale (8px base) --- */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-6: 3rem;
  --space-8: 4rem;
  --space-12: 6rem;

  /* --- Border radius --- */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-pill: 999px;

  /* --- Shadows --- */
  --shadow-none: none;
  --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.08),
                     0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-elevated: 0 4px 12px rgba(0, 0, 0, 0.12),
                     0 2px 4px rgba(0, 0, 0, 0.08);
}

/* -----------------------------------------------------------------------------
   Dark mode — primary visual identity
   Token swap only — layout and spacing unchanged
   ----------------------------------------------------------------------------- */

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--color-black);
    --bg-surface: var(--color-charcoal);
    --text-primary: var(--color-white);
    --text-secondary: var(--color-mid);
    --border: #2a2a32;
    --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.4),
                       0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-elevated: 0 4px 12px rgba(0, 0, 0, 0.5),
                       0 2px 4px rgba(0, 0, 0, 0.4);
  }
}

/* -----------------------------------------------------------------------------
   Reset — minimal, opinionated
   ----------------------------------------------------------------------------- */

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

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
  scroll-padding-top: 5rem;
}

body {
  font-family: var(--font-base);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
  color: var(--text-primary);
  background-color: var(--bg);
  min-height: 100vh;
  scrollbar-gutter: stable;
  scroll-padding-top: 5rem;
}

img, svg, video {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

button, input, select, textarea {
  font: inherit;
}

/* -----------------------------------------------------------------------------
   Typography — base element styles
   ----------------------------------------------------------------------------- */

h1 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-heading);
}

h2 {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-heading);
}

h3 {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  line-height: var(--leading-heading);
}

h4, h5, h6 {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  line-height: var(--leading-heading);
}

p {
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--text-primary);
}

small {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* -----------------------------------------------------------------------------
   Utility classes — spacing, text, layout
   ----------------------------------------------------------------------------- */

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }

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

.font-regular { font-weight: var(--weight-regular); }
.font-bold { font-weight: var(--weight-bold); }

.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.container {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: var(--space-2);
}

.container--narrow {
  max-width: 48rem;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.surface {
  background-color: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.shadow-subtle { box-shadow: var(--shadow-subtle); }
.shadow-elevated { box-shadow: var(--shadow-elevated); }

.btn-accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background-color: var(--accent);
  color: var(--color-black);
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 150ms ease, opacity 150ms ease;
}

.btn-accent:hover {
  background-color: var(--accent-hover);
}

.btn-accent:active {
  opacity: 0.85;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background-color: transparent;
  color: var(--accent);
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.btn-ghost:hover {
  background-color: var(--accent-muted);
}
