/* ==========================================================================
   Chowdown Base CSS
   CSS variable system, reset, typography scale, spacing system.
   All brand values injected from config.json by scaffold.py.
   No hardcoded colors or font names — everything references variables.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Variables — Brand Layer
   Default values: Mezza Luna Marietta (single-restaurant reference).
   scaffold.py overwrites these from config.json at build time.
   -------------------------------------------------------------------------- */

:root {
  /* Brand colors */
  --color-primary: #8B1A1A;
  --color-secondary: #C9A96E;
  --color-accent: #D4AF37;
  --color-bg: #1a1a1a;
  --color-text: #f5f5f5;

  /* Derived colors — set by scaffold.py alongside brand colors.
     CSS cannot compute these from brand hex values natively.
     scaffold.py reads config.json brand colors and generates all derived values. */
  --color-bg-alt: #252525;
  --color-bg-light: #f5f5f5;
  --color-text-dark: #333333;
  --color-text-muted: #999999;
  --color-text-on-light: #333333;
  --color-border: #333333;
  --color-border-light: #e0e0e0;
  --color-overlay: rgba(0, 0, 0, 0.5);
  --color-overlay-light: rgba(0, 0, 0, 0.35);
  --color-overlay-heavy: rgba(0, 0, 0, 0.7);

  /* Button colors */
  --color-btn-bg: var(--color-primary);
  --color-btn-text: #ffffff;
  --color-btn-border: var(--color-primary);
  --color-btn-hover-bg: #ffffff;
  --color-btn-hover-text: var(--color-primary);
  --color-btn-hover-border: var(--color-primary);

  /* Typography — font families
     Self-hosted woff2 files referenced in @font-face below.
     scaffold.py sets these values and generates @font-face declarations. */
  --font-heading: 'Libre Baskerville', Georgia, serif;
  --font-body: 'Lato', system-ui, sans-serif;
  --font-script: 'Alex Brush', cursive;

  /* Typography — scale
     Fluid type using clamp(min, preferred, max).
     Base: 1rem = 16px. Scale ratio ~1.25 (major third). */
  --text-xs:   clamp(0.75rem,  0.75rem  + ((1vw - 0.2rem) * 0.208), 0.875rem);
  --text-sm:   clamp(0.875rem, 0.875rem + ((1vw - 0.2rem) * 0.208), 1rem);
  --text-base: clamp(0.875rem, 0.875rem + ((1vw - 0.2rem) * 0.375), 1.1rem);
  --text-md:   clamp(1rem,     1rem     + ((1vw - 0.2rem) * 0.375), 1.2rem);
  --text-lg:   clamp(1.125rem, 1.125rem + ((1vw - 0.2rem) * 0.542), 1.45rem);
  --text-xl:   clamp(1.25rem,  1.25rem  + ((1vw - 0.2rem) * 1.25),  2rem);
  --text-2xl:  clamp(1.5rem,   1.5rem   + ((1vw - 0.2rem) * 1.875), 2.625rem);
  --text-3xl:  clamp(2rem,     2rem     + ((1vw - 0.2rem) * 2.5),   3.5rem);
  --text-4xl:  clamp(2.2rem,   2.2rem   + ((1vw - 0.2rem) * 3),     4rem);
  --text-hero: clamp(2.5rem,   2.5rem   + ((1vw - 0.2rem) * 4),     5rem);

  /* Spacing — 4px base, powers of 2 scale */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-section: clamp(40px, 5vw, 80px);

  /* Layout */
  --container-max: 1280px;
  --container-width: 90%;
  --content-max: 800px;
  --nav-height: 120px;
  --nav-height-scrolled: 80px;

  /* Borders */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-full: 50%;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
  --shadow-header: 0 2px 10px rgba(0, 0, 0, 0.3);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Z-index scale */
  --z-base: 1;
  --z-dropdown: 100;
  --z-header: 1000;
  --z-modal: 2000;
  --z-toast: 3000;

  /* Touch targets — WCAG 2.5.8 minimum */
  --touch-min: 44px;
}


/* --------------------------------------------------------------------------
   2. Font Face Declarations
   Self-hosted only. No external CDN dependencies.
   scaffold.py REPLACES this entire block from config.json font values.
   Each client gets different @font-face declarations for their fonts.
   Paths reference /assets/fonts/ — files placed by assets.py.
   -------------------------------------------------------------------------- */

@font-face {
  font-family: 'Libre Baskerville';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/libre-baskerville-regular.woff2') format('woff2');
}

@font-face {
  font-family: 'Libre Baskerville';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/libre-baskerville-bold.woff2') format('woff2');
}

@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('/assets/fonts/lato-light.woff2') format('woff2');
}

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

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

@font-face {
  font-family: 'Alex Brush';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/alex-brush-regular.woff2') format('woff2');
}


/* --------------------------------------------------------------------------
   3. Reset
   Modern reset. No external normalize dependency.
   -------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 300;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  border: 0;
  font-style: italic;
}

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

button, input, select, textarea {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
}

button {
  cursor: pointer;
}

ul, ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

address {
  font-style: normal;
}

h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

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

::selection {
  background: var(--color-primary);
  color: var(--color-btn-text);
}


/* --------------------------------------------------------------------------
   4. Typography
   All sizes use fluid clamp scale from variables.
   Headings use --font-heading. Body uses --font-body.
   -------------------------------------------------------------------------- */

h1 {
  font-family: var(--font-heading);
  font-size: var(--text-4xl);
  font-weight: 700;
  line-height: 1.1;
  color: var(--color-text);
}

h2 {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text);
}

h3 {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-text);
}

h4 {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-text);
}

h5, h6 {
  font-family: var(--font-heading);
  font-size: var(--text-md);
  font-weight: 700;
  line-height: 1.4;
  color: var(--color-text);
}

p {
  font-size: var(--text-base);
  line-height: 1.6;
  font-weight: 300;
}

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

.text-script {
  font-family: var(--font-script);
  font-weight: 400;
}

.text-uppercase {
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }


/* --------------------------------------------------------------------------
   5. Layout Utilities
   Container, section padding, grid helpers.
   -------------------------------------------------------------------------- */

.container {
  width: var(--container-width);
  max-width: var(--container-max);
  margin: 0 auto;
}

.container-narrow {
  width: var(--container-width);
  max-width: var(--content-max);
  margin: 0 auto;
}

.section {
  padding: var(--space-section) 0;
}

.section-flush {
  padding: 0;
}


/* --------------------------------------------------------------------------
   6. Buttons
   All colors from variables. No hardcoded values.
   Touch target minimum enforced.
   -------------------------------------------------------------------------- */

.btn {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-decoration: none;
  text-align: center;
  padding: var(--space-3) var(--space-8);
  min-height: var(--touch-min);
  border: 2px solid var(--color-btn-border);
  border-radius: var(--radius-lg);
  background-color: var(--color-btn-bg);
  color: var(--color-btn-text);
  transition: background-color var(--transition-base),
              color var(--transition-base),
              border-color var(--transition-base);
  cursor: pointer;
  line-height: 1.4;
}

.btn:hover,
.btn:focus-visible {
  background-color: var(--color-btn-hover-bg);
  color: var(--color-btn-hover-text);
  border-color: var(--color-btn-hover-border);
}

.btn-sm {
  padding: var(--space-2) var(--space-5);
  font-size: var(--text-xs);
}

.btn-outline {
  background-color: transparent;
  color: var(--color-btn-border);
}

.btn-outline:hover,
.btn-outline:focus-visible {
  background-color: var(--color-btn-bg);
  color: var(--color-btn-text);
}


/* --------------------------------------------------------------------------
   7. Accessibility
   Screen reader utilities, reduced motion, focus styles.
   -------------------------------------------------------------------------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@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;
  }
}


/* --------------------------------------------------------------------------
   8. Responsive Breakpoints
   Mobile-first. Breakpoints match common device widths.
   -------------------------------------------------------------------------- */

/* Tablet: 768px */
@media (max-width: 768px) {
  :root {
    --nav-height: 80px;
    --nav-height-scrolled: 60px;
  }

  .container {
    width: 92%;
  }
}

/* Mobile: 480px */
@media (max-width: 480px) {
  :root {
    --space-section: 32px;
  }

  .container {
    width: 95%;
  }
}
