/* ================================================================
   NAPA — Design Tokens + Base Styles (app.css)
   ================================================================
   Loaded FIRST in the cascade, before style.css / napa-photo.css.
   Contains: tokens, reset, fluid typography, spacing, grid utils.
   Does NOT override component styles — those live in style.css.
   ================================================================ */

/* ─── BREAKPOINTS (reference only — CSS can't use vars in media queries,
       but documenting here keeps them in one place) ─────────────── */
/*  --bp-xs:   0px     small phones                                  */
/*  --bp-sm:   480px   large phones / landscape                      */
/*  --bp-md:   768px   tablets portrait                              */
/*  --bp-lg:   1024px  tablets landscape / small laptops             */
/*  --bp-xl:   1280px  desktops                                     */
/*  --bp-2xl:  1536px  large desktops / ultrawide                   */

:root {
  /* ─── Spacing scale (4px base) ────────────────────────────────── */
  --space-1:  0.25rem;  /*  4px */
  --space-2:  0.5rem;   /*  8px */
  --space-3:  0.75rem;  /* 12px */
  --space-4:  1rem;     /* 16px */
  --space-6:  1.5rem;   /* 24px */
  --space-8:  2rem;     /* 32px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-24: 6rem;     /* 96px */

  /* ─── Border radius ───────────────────────────────────────────── */
  --radius-sm:  3px;
  --radius-md:  6px;
  --radius-lg:  12px;
  --radius-xl:  20px;
  --radius-full: 9999px;

  /* ─── Shadows ─────────────────────────────────────────────────── */
  --shadow-sm:  0 1px  3px rgba(0,0,0,.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,.1);
  --shadow-lg:  0 12px 32px rgba(0,0,0,.14);
  --shadow-xl:  0 24px 60px rgba(0,0,0,.2);

  /* ─── Fluid typography ────────────────────────────────────────── */
  --text-xs:   clamp(0.6875rem, 0.65rem + 0.2vw, 0.75rem);     /* ~11–12px */
  --text-sm:   clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);      /* ~12–14px */
  --text-base: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);       /* ~14–16px */
  --text-md:   clamp(1rem, 0.925rem + 0.375vw, 1.125rem);      /* ~16–18px */
  --text-lg:   clamp(1.125rem, 1rem + 0.625vw, 1.5rem);        /* ~18–24px */
  --text-xl:   clamp(1.25rem, 1rem + 1vw, 1.75rem);            /* ~20–28px */
  --text-2xl:  clamp(1.5rem, 1rem + 1.5vw, 2.25rem);           /* ~24–36px */
  --text-3xl:  clamp(1.75rem, 1.25rem + 2vw, 2.75rem);         /* ~28–44px */
  --text-4xl:  clamp(2rem, 1.25rem + 3vw, 3.5rem);             /* ~32–56px */

  /* ─── Fluid container padding ─────────────────────────────────── */
  --container-pad: clamp(1rem, 0.5rem + 2vw, 3rem);

  /* ─── Tap target minimum (WCAG 2.5.8 AAA) ────────────────────── */
  --tap-min: 48px;

  /* ─── Transition defaults ─────────────────────────────────────── */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 150ms;
  --duration-normal: 300ms;
}

/* ═══════════════════════════════════════════════════════════════════
   CSS RESET (modern, minimal)
   ═══════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Account for sticky header when jumping to #anchors */
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, picture, video, canvas {
  display: block;
  max-width: 100%;
  height: auto;
}
/* SVGs are NOT reset to display:block — inline SVG icons inside nav links,
   buttons, and flex containers need to stay inline/inherit. Size them
   explicitly via CSS where needed. */

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

/* Remove 300ms tap delay on touch devices */
a, button, input, select, textarea, [role="button"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ═══════════════════════════════════════════════════════════════════
   BASE TYPOGRAPHY
   ═══════════════════════════════════════════════════════════════════ */
body {
  font-size: 100%; /* 16px baseline */
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.15;
  text-wrap: balance;
}
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-md); }
h6 { font-size: var(--text-base); }

p {
  max-width: 70ch;
}

/* Prevent iOS zoom on focus for small inputs */
@media (max-width: 767px) {
  input, select, textarea {
    font-size: max(1rem, 16px);
  }
}

/* ═══════════════════════════════════════════════════════════════════
   FOCUS STYLES (accessible, visible on all interactive elements)
   ═══════════════════════════════════════════════════════════════════ */
:focus-visible {
  outline: 2px solid var(--color-primary, #7A1B3B);
  outline-offset: 2px;
}
/* Don't double-outline elements with their own focus styles */
:focus:not(:focus-visible) {
  outline: none;
}

/* ═══════════════════════════════════════════════════════════════════
   CONTAINER
   ═══════════════════════════════════════════════════════════════════ */
.container {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE GRID UTILITIES
   ═══════════════════════════════════════════════════════════════════ */
.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: var(--space-4);
}

.grid-2 { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
.grid-3 { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
.grid-4 { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }

@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ═══════════════════════════════════════════════════════════════════
   FLEX UTILITIES
   ═══════════════════════════════════════════════════════════════════ */
.flex         { display: flex; }
.flex-wrap    { flex-wrap: wrap; }
.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); }
.gap-6  { gap: var(--space-6); }
.gap-8  { gap: var(--space-8); }

/* ═══════════════════════════════════════════════════════════════════
   TEXT UTILITIES
   ═══════════════════════════════════════════════════════════════════ */
.text-center  { text-align: center; }
.text-sm      { font-size: var(--text-sm); }
.text-xs      { font-size: var(--text-xs); }

/* Line-clamp (multi-line text truncation) */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════
   ACCESSIBILITY UTILITIES
   ═══════════════════════════════════════════════════════════════════ */
.visually-hidden,
.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;
}

/* ═══════════════════════════════════════════════════════════════════
   SCROLLABLE TABLE WRAPPER (for admin tables on mobile)
   ═══════════════════════════════════════════════════════════════════ */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ═══════════════════════════════════════════════════════════════════
   MODAL / DRAWER BACKDROP (prevent background scroll)
   ═══════════════════════════════════════════════════════════════════ */
.modal-open {
  overflow: hidden;
}
.backdrop {
  overscroll-behavior: contain;
}

/* ═══════════════════════════════════════════════════════════════════
   MOBILE MENU DRAWER
   ═══════════════════════════════════════════════════════════════════ */
.mobile-menu {
  padding: var(--space-4) var(--space-6);
}
.mobile-menu a {
  min-height: var(--tap-min);
  display: flex;
  align-items: center;
  padding: var(--space-3) 0;
}

/* ═══════════════════════════════════════════════════════════════════
   AUTH FORM CARDS (login, register, forgot/reset password)
   ═══════════════════════════════════════════════════════════════════ */
.auth-card {
  width: 100%;
  max-width: 480px;
  margin-inline: auto;
  padding: var(--space-6) var(--container-pad);
}
@media (min-width: 768px) {
  .auth-card {
    padding: var(--space-8) var(--space-8);
  }
}
.auth-card input,
.auth-card select,
.auth-card textarea {
  min-height: var(--tap-min);
}
.auth-card button[type="submit"] {
  width: 100%;
  min-height: var(--tap-min);
}
@media (min-width: 768px) {
  .auth-card button[type="submit"] {
    width: auto;
    min-width: 200px;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════════════════ */
@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;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   FONT LOADING (prevent FOIT — flash of invisible text)
   ═══════════════════════════════════════════════════════════════════ */
@font-face { font-display: swap; }
