/* =============================================================================
   tokens.css: the Pixel & Plate brand foundation (Phase 1)

   A "design token" is a named value (a color, a size, a shadow) that every
   other stylesheet uses instead of typing raw values. Change a token here and
   the whole site follows. Rule of thumb: other CSS files should never contain
   a raw hex color; they use var(--something) from this file.

   Sections:
     1. Fonts (@font-face for the three self-hosted fonts)
     2. Palette: raw brand colors (what the colors ARE)
     3. Semantic colors: what the colors are FOR (use these in components)
     4. Typography: families, weights, fluid type scale, line heights
     5. Spacing, radius, borders, shadows, motion
     6. Textures: leather, paper, gold, stitching (pure CSS + inline SVG noise)

   Contrast rules (WCAG AA, checked on /_preview/brand/):
     - Gold (#C9A24B) is DECORATIVE ONLY on light backgrounds (2.1:1).
       For gold-looking text on cream use --color-gold-deep.
     - On oxblood leather, gold text must be --color-gold-light (6.2:1);
       plain --color-gold is 4.3:1 and only passes for large text (24px+).
     - On the wall color use --color-ink only (ink-soft fails there).
   ============================================================================= */


/* 1. FONTS -------------------------------------------------------------------
   Self-hosted variable fonts (one file covers every weight). Latin subset only,
   which keeps them small. Licenses: src/fonts/LICENSES.md (all SIL OFL 1.1).
   font-display: swap shows fallback text immediately, then swaps in the font,
   so text is never invisible while a font loads. */

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-var-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-var-italic-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "DM Sans";
  src: url("../fonts/dm-sans-var-latin.woff2") format("woff2");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

/* Pixel face: wordmark and tiny accents ONLY, never body text (DECIDED). */
@font-face {
  font-family: "Pixelify Sans";
  src: url("../fonts/pixelify-sans-var-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}


:root {
  /* 2. PALETTE (raw values) ------------------------------------------------- */

  /* Leather (the menu cover, the brand's signature red) */
  --color-oxblood: #7A1F1F;
  --color-oxblood-dark: #5A1515;   /* leather shadow side, pressed buttons */
  --color-oxblood-light: #9A2D27;  /* hover on red buttons */

  /* Paper (menu pages, default page background) */
  --color-cream: #F6EEDC;
  --color-cream-deep: #ECDDBF;     /* cards and panels sitting on paper */
  --color-white-warm: #FFFDF8;     /* form fields, the brightest surface */

  /* Gold (corner caps, ribbon, small accents) */
  --color-gold: #C9A24B;           /* decorative; text only on dark */
  --color-gold-light: #E3C77E;     /* gold text on leather / espresso */
  --color-gold-deep: #735812;      /* gold-looking text on cream */

  /* Ink (text) */
  --color-ink: #2B2118;            /* near-black brown: body text */
  --color-ink-soft: #5E4C3D;       /* secondary text on paper */

  /* Restaurant scene colors */
  --color-wall: #D9B48C;           /* warm caramel wall behind the host stand */
  --color-wood: #6B4226;           /* podium, tables */
  --color-wood-dark: #4A2C18;      /* podium shadow side, wood grain */
  --color-espresso: #1F1712;       /* darkest surface: dark sections, footer */

  /* Utility */
  --color-note-bg: #FFF3B0;        /* yellow dev notes / OWNER INPUT NEEDED */


  /* 3. SEMANTIC COLORS (use these in components) -------------------------- */

  --color-bg: var(--color-cream);
  --color-surface: var(--color-cream-deep);
  --color-surface-raised: var(--color-white-warm);
  --color-text: var(--color-ink);
  --color-text-muted: var(--color-ink-soft);
  --color-heading: var(--color-ink);
  --color-link: var(--color-oxblood);
  --color-link-hover: var(--color-oxblood-dark);
  --color-accent: var(--color-gold);
  --color-accent-text: var(--color-gold-deep);

  /* Dark contexts (leather, espresso) */
  --color-bg-dark: var(--color-espresso);
  --color-text-on-dark: var(--color-cream);
  --color-accent-on-dark: var(--color-gold-light);

  /* Buttons */
  --color-button-bg: var(--color-oxblood);
  --color-button-bg-hover: var(--color-oxblood-dark);
  --color-button-text: var(--color-cream);

  /* Focus ring: must stand out 3:1 against whatever it surrounds */
  --color-focus: var(--color-oxblood);
  --color-focus-on-dark: var(--color-gold-light);


  /* 4. TYPOGRAPHY ----------------------------------------------------------- */

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-pixel: "Pixelify Sans", "Courier New", monospace;  /* wordmark + accents only */

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Fluid type scale (ratio ~1.25, "major third").
     clamp(min, preferred, max): grows smoothly between phone and desktop, so
     there are no breakpoints to maintain. Body text never drops below 16px. */
  --text-xs: 0.8125rem;                                   /* 13px: legal, tags */
  --text-sm: 0.875rem;                                    /* 14px: captions */
  --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);   /* 16-17px: body */
  --text-lg: clamp(1.125rem, 1.06rem + 0.3vw, 1.25rem);   /* 18-20px: lead text */
  --text-xl: clamp(1.25rem, 1.15rem + 0.5vw, 1.5625rem);  /* 20-25px: h4 */
  --text-2xl: clamp(1.5rem, 1.3rem + 0.9vw, 1.95rem);     /* 24-31px: h3 */
  --text-3xl: clamp(1.8rem, 1.5rem + 1.5vw, 2.45rem);     /* 29-39px: h2 */
  --text-4xl: clamp(2.2rem, 1.7rem + 2.4vw, 3.05rem);     /* 35-49px: h1 */
  --text-5xl: clamp(2.6rem, 1.8rem + 4vw, 3.8rem);        /* 42-61px: display */

  --leading-tight: 1.1;    /* display headings */
  --leading-snug: 1.3;     /* smaller headings */
  --leading-normal: 1.55;  /* body text */
  --tracking-caps: 0.08em; /* letter-spacing for small uppercase labels */
  --measure: 65ch;         /* comfortable max line length for paragraphs */


  /* 5. SPACING, RADIUS, BORDERS, SHADOWS, MOTION ------------------------- */

  /* 4px base grid. Use these for margins, padding and gaps. */
  --space-1: 0.25rem;  /*  4px */
  --space-2: 0.5rem;   /*  8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.5rem;   /* 24px */
  --space-6: 2rem;     /* 32px */
  --space-7: 3rem;     /* 48px */
  --space-8: 4rem;     /* 64px */
  --space-9: 6rem;     /* 96px */

  --tap-target: 44px;  /* minimum size of anything clickable (WCAG) */

  --radius-sm: 4px;    /* tags, inputs */
  --radius-md: 8px;    /* buttons, cards */
  --radius-lg: 16px;   /* menu pages, plates */
  --radius-pill: 999px;
  --radius-round: 50%; /* plates, cloche */

  --border-thin: 1px solid color-mix(in srgb, var(--color-ink) 18%, transparent);
  --border-strong: 2px solid var(--color-ink);

  /* Leather menu frame thickness (brief: ~24-40px desktop, ~8-12px mobile) */
  --frame-leather: clamp(10px, 2.5vw, 36px);

  /* Shadows are tinted warm brown (not grey) so they sit naturally on cream. */
  --shadow-1: 0 1px 2px rgb(43 33 24 / 0.12), 0 1px 1px rgb(43 33 24 / 0.08);
  --shadow-2: 0 4px 10px rgb(43 33 24 / 0.14), 0 2px 4px rgb(43 33 24 / 0.10);
  --shadow-3: 0 14px 34px rgb(43 33 24 / 0.22), 0 6px 12px rgb(43 33 24 / 0.12);
  --shadow-inset-paper: inset 0 0 40px rgb(122 80 30 / 0.10);  /* aged page edges */

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);   /* things arriving */
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1); /* things moving across */
  --duration-fast: 150ms;   /* hovers */
  --duration-base: 300ms;   /* small transitions */
  --duration-slow: 600ms;   /* menu open, cloche lift */


  /* 6. TEXTURES ------------------------------------------------------------
     Built from CSS gradients plus a tiny inline SVG noise filter (no image
     files to download). Use them as backgrounds:
       .leather { background: var(--texture-leather); }
     The noise is an SVG "feTurbulence" filter: the browser generates random
     grain, which reads as leather pores or paper fibre at low opacity. */

  --noise-leather: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --noise-paper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45  0 0 0 0 0.32  0 0 0 0 0.15  0 0 0 0.10 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  --texture-leather:
    var(--noise-leather),
    radial-gradient(120% 90% at 30% 20%, rgb(255 255 255 / 0.07), transparent 60%),
    radial-gradient(140% 100% at 80% 110%, rgb(0 0 0 / 0.28), transparent 60%),
    var(--color-oxblood);

  --texture-paper:
    var(--noise-paper),
    radial-gradient(130% 100% at 50% 40%, transparent 55%, rgb(150 110 50 / 0.10)),
    var(--color-cream);

  /* Metallic gold: light band across a darker base, like a brass corner cap. */
  --texture-gold: linear-gradient(135deg,
    #A88332 0%, var(--color-gold-light) 35%, var(--color-gold) 55%, #9C7A2C 100%);

  /* Stitching: a dashed line set just inside the leather edge. */
  --stitch: 2px dashed color-mix(in srgb, var(--color-gold-light) 70%, transparent);
  --stitch-inset: 8px;
}


/* Reduced motion: shrink every duration token so anything using them is instant.
   (Scene animations in later phases also check this media query directly.) */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 1ms;
    --duration-base: 1ms;
    --duration-slow: 1ms;
  }
}
