/*
 * theme.css — shared CSS token layer.
 * Values mirror design/tokens/tokens.json — if a value needs to change,
 * change it there first and copy it here. Everything below this file
 * should be consumed as a variable, never a raw color or spacing value.
 *
 * House style: "Blueprint + Anton". The owner picked a hybrid of two
 * explored directions — Blueprint's light, technical-grid layout with
 * Anton (a bold display face) for headings. Brand green stays the live
 * #08CC99. Fonts (Anton, Geist, Geist Mono) are now self-hosted instead
 * of relying on the system font stack.
 */

@layer fonts, tokens, base;

@layer fonts {
  @font-face {
    font-family: 'Anton';
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    src: url('/assets/fonts/Anton-400.woff2') format('woff2');
  }
  @font-face {
    font-family: 'Geist';
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    src: url('/assets/fonts/Geist-Variable.woff2') format('woff2');
  }
  @font-face {
    font-family: 'Geist Mono';
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    src: url('/assets/fonts/GeistMono-Variable.woff2') format('woff2');
  }
}

@layer tokens {
  :root {
    /* Color */
    --color-primary: #046249;          /* dark green — links, secondary buttons, focus */
    --color-primary-on: #ffffff;
    --color-primary-muted: #a9c3b9;    /* light sage — muted text on dark sections */
    --color-secondary: #35786a;        /* teal accent (retuned from indigo) */
    --color-secondary-on: #ffffff;
    --color-accent: #08cc99;           /* signature green — CTA carries DARK text */
    --color-accent-on: #0e1512;
    --color-surface: #ffffff;
    --color-surface-on: #0e1512;
    --color-surface-alt: #ebfef9;      /* light mint */
    --color-surface-warm: #e9e3e6;     /* hero gradient end */
    --color-surface-dark: #0e1512;     /* green near-black — dark band */
    --color-surface-dark-on: #ffffff;
    --color-text: #0e1512;             /* green-neutral near-black (was blue-black) */
    --color-text-muted: #52605a;       /* green-grey (was indigo) */
    --color-border: #e1e8e4;
    --color-grid-line: rgba(8, 204, 153, 0.08); /* faint background grid — decorative, low-alpha */
    --color-success: #15803d;
    --color-warning: #b45309;
    --color-error: #c33149;

    /* Typography */
    --font-heading: 'Anton', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', Arial, sans-serif;
    --font-body: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', 'Menlo', monospace;

    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-md: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.375rem;
    --font-size-2xl: 1.875rem;
    --font-size-3xl: 3.25rem;

    --line-tight: 1.05;
    --line-snug: 1.4;
    --line-normal: 1.6;
    --tracking-tight: -0.01em;   /* Anton is already tight/condensed; heavier negative tracking collides glyphs */

    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-bold: 700;

    /* Spacing (4px base) */
    --space-3xs: 0.25rem;
    --space-2xs: 0.5rem;
    --space-xs: 0.75rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-2xl: 4rem;
    --space-3xl: 6rem;

    /* Radius */
    --radius-none: 0;
    --radius-sm: 3px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-full: 9999px;

    /* Shadow */
    --shadow-sm: 0 1px 2px rgba(6, 7, 14, 0.06);
    --shadow-md: 0 4px 14px rgba(6, 7, 14, 0.08);
    --shadow-lg: 0 14px 36px rgba(6, 7, 14, 0.12);

    /* Breakpoints (reference for JS/container queries) */
    --breakpoint-sm: 640px;
    --breakpoint-md: 1024px;
    --breakpoint-lg: 1280px;
    --breakpoint-xl: 1536px;

    /* Layout (content width constraints) */
    --content-width: 720px;
    --wide-width: 1200px;
  }
}

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

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

  body {
    margin: 0;
    font-family: var(--font-body);
    font-size: var(--font-size-md);
    line-height: var(--line-normal);
    color: var(--color-text);
    /* Blueprint-style faint technical grid, 32px cells (matches --space-lg) */
    background:
      linear-gradient(var(--color-grid-line) 1px, transparent 1px) 0 0 / 100% var(--space-lg),
      linear-gradient(90deg, var(--color-grid-line) 1px, transparent 1px) 0 0 / var(--space-lg) 100%,
      var(--color-surface);
  }

  h1, h2, h3, h4 {
    font-family: var(--font-heading);
    /* Anton only ships one weight (400); leaving the browser's default bold
       (700) here makes it fake-bold the glyphs instead of rendering them as designed. */
    font-weight: var(--font-weight-regular);
    line-height: var(--line-tight);
    letter-spacing: var(--tracking-tight);
    color: var(--color-text);
  }

  a { color: var(--color-primary); }

  img { max-width: 100%; height: auto; }

  /* Focus ring uses dark green (7.4:1 on light; visible on the one dark band via offset). */
  :focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
  }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }
}
