/* ==========================================================================
   Jafacak.es — Jaffa theme
   Global layer of the design system: colour, type and spacing tokens plus
   a minimal page reset. All other styling belongs to the components in
   ui/components/, which use only these tokens. The gallery at
   /design-system/ documents them.
   ========================================================================== */
* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

/* ---------------------------------------------------------------------- */
/* Colour palette                                                         */
/* Every colour on the site, including code highlighting in code_block, */
/* comes from these tokens, so a new palette only needs this block.      */
/* ---------------------------------------------------------------------- */
:root {
    /* Jaffa: dark chocolate + orange, a nod to the site name. */
    --jc-bg: #120c08;
    --jc-surface: rgba(255, 240, 225, 0.06);
    --jc-text: #f7efe7;
    --jc-text-muted: #bba898;
    --jc-accent: #ff7a1a;
    --jc-accent-2: #ffc247;
    --jc-border: rgba(255, 235, 215, 0.14);
    --jc-glow-1: rgba(255, 122, 26, 0.26);
    --jc-glow-2: rgba(255, 194, 71, 0.14);
    --jc-glow-3: rgba(180, 60, 25, 0.20);
    --jc-shadow: rgba(110, 45, 10, 0.30);
    --jc-accent-hover-border: rgba(255, 122, 26, 0.6);
    --jc-accent-hover-shadow: rgba(255, 122, 26, 0.22);
    --jc-code-text: #f7efe7;
    --jc-code-keyword: #ff8f3f;
    --jc-code-string: #ffd479;
    --jc-code-title: #a6d98a;
    --jc-code-builtin: #7fd6c9;
    --jc-code-number: #ffb08a;
    --jc-code-comment: #8f7a6a;
}

/* ---------------------------------------------------------------------- */
/* Type, spacing and layout tokens                                        */
/* rem is the browser default (16px). Fluid sizes use clamp() so they     */
/* grow smoothly from phone to wide desktop.                              */
/* ---------------------------------------------------------------------- */
:root {
    --jc-font-heading: "Space Grotesk", "Inter", system-ui, sans-serif;
    --jc-font-body: "Space Grotesk", "Inter", system-ui, sans-serif;
    --jc-font-mono: "JetBrains Mono", ui-monospace, monospace;

    --jc-text-xs: 0.875rem;                                        /* 14px */
    --jc-text-sm: 0.9375rem;                                       /* 15px */
    --jc-text-code: 0.9375rem;                                     /* 15px */
    --jc-text-base: clamp(1.0625rem, 1rem + 0.15vw, 1.125rem);     /* 17-18px */
    --jc-text-lg: clamp(1.25rem, 1.15rem + 0.35vw, 1.375rem);      /* 20-22px */
    --jc-text-h3: clamp(1.375rem, 1.2rem + 0.6vw, 1.625rem);       /* 22-26px */
    --jc-text-h2: clamp(1.625rem, 1.3rem + 1.1vw, 2.125rem);       /* 26-34px */
    --jc-text-display: clamp(2rem, 1.4rem + 2.2vw, 3rem);          /* 32-48px */
    --jc-text-logo: clamp(1.75rem, 1.5rem + 0.9vw, 2.25rem);       /* 28-36px */

    --jc-space-1: 0.25rem;
    --jc-space-2: 0.5rem;
    --jc-space-3: 0.75rem;
    --jc-space-4: 1rem;
    --jc-space-5: 1.25rem;
    --jc-space-6: 1.5rem;
    --jc-space-7: 2rem;
    --jc-space-8: 2.5rem;
    --jc-space-9: 3rem;
    --jc-space-10: 4rem;
    --jc-gutter: clamp(1rem, 0.5rem + 2.5vw, 2rem);

    --jc-radius: 16px;
    /* Reading measure for article copy, about 70 characters a line. */
    --jc-max-width: 760px;
    /* Page shell (header + homepage card grid). */
    --jc-shell-width: 1440px;
}

/* ---------------------------------------------------------------------- */
/* Page reset                                                             */
/* Only document-level defaults live here; everything visible on the     */
/* page is styled by its component.                                       */
/* ---------------------------------------------------------------------- */
html {
    scroll-behavior: smooth;
    background: var(--jc-bg);
    color: var(--jc-text);
    -webkit-text-size-adjust: 100%;
}

body {
    color: var(--jc-text);
    font-family: var(--jc-font-body);
    font-size: var(--jc-text-base);
    line-height: 1.65;
    min-height: 100vh;
    /* Sized in vw/vh rather than fixed px so the mesh reads as full-bleed
       at any window width, not three small blobs pinned to the corners
       of a wide monitor. */
    background:
        radial-gradient(60vw circle at 15% 0%, var(--jc-glow-1), transparent 60%),
        radial-gradient(50vw circle at 100% 15%, var(--jc-glow-2), transparent 55%),
        radial-gradient(70vw circle at 50% 100%, var(--jc-glow-3), transparent 60%),
        var(--jc-bg);
    background-attachment: fixed;
}

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

:focus-visible {
    outline: 2px solid var(--jc-accent);
    outline-offset: 2px;
}
