/* ==========================================================================
   MEM PATISSERIE — GLOBAL STYLESHEET
   Design tokens, reset, typography, navigation, footer
   Stack: Vanilla HTML + CSS (no framework)
   ========================================================================== */

/* ==========================================================================
   GOOGLE FONTS — must be first, before any other rule per CSS spec
   Pinyon Script   → hero, chapter openers, brand moments
   Josefin Sans    → nav, labels, structured UI
   Cormorant Garamond → all body copy, product descriptions
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Pinyon+Script&family=Josefin+Sans:wght@300;400;600&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&display=swap');

/* ==========================================================================
   1. DESIGN TOKENS
   Single source of truth — every colour, spacing, and type value lives here.
   Never use hardcoded values in page CSS files — reference these variables.
   ========================================================================== */

:root {
  /* Colour palette */
  --copper:       #B87333;
  --copper-dim:   #B8733340;   /* copper at 25% opacity — dividers */
  --copper-hover: #A0622A;     /* slightly darker on hover */
  --dark-brown:   #2C1810;
  --dark-brown-2: #1A0C08;     /* deeper variant for overlays */
  --cream:        #FAF3E0;
  --warm-white:   #FFF8F0;
  --text-dark:    #1A0F0A;
  --text-light:   #FAF3E0;
  --text-muted:   #9A7B6A;     /* secondary text on dark backgrounds */
  --text-muted-light: #6B4F3A; /* secondary text on light backgrounds */
  --border:       rgba(184, 115, 51, 0.25);

  /* Typography */
  --font-display:   'Cormorant Garamond', serif;  /* display headlines — italic 300 */
  --font-wordmark:  'Pinyon Script', cursive;      /* MEM logo only — nav + footer */
  --font-heading:   'Josefin Sans', sans-serif;
  --font-body:      'Cormorant Garamond', serif;

  /* Spacing scale — 4px base */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;
  --space-32: 128px;

  /* Border radius — 2px only. This is a craft brand, not a tech product. */
  --radius: 2px;

  /* Transitions */
  --transition: 300ms ease-out;
  --transition-fast: 150ms ease-out;
  --transition-slow: 600ms ease-out;

  /* Z-index scale */
  --z-base:       10;
  --z-dropdown:   20;
  --z-overlay:    30;
  --z-modal:      40;
  --z-transition: 50;
  --z-nav:        60;

  /* Nav height — used to offset page content */
  --nav-height: 72px;
}

/* ==========================================================================
   2. CSS RESET
   Minimal, modern reset. Normalises cross-browser inconsistencies.
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
  /* Prevent horizontal overflow at the root */
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Prevent horizontal scroll on all pages */
  overflow-x: hidden;
}

img, video, svg {
  display: block;
  max-width: 100%;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
}

ul, ol {
  list-style: none;
}

/* Respect user motion preferences — wraps all GSAP inits in JS */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html {
    scroll-behavior: auto;
  }
}

/* ==========================================================================
   4. BASE TYPOGRAPHY
   ========================================================================== */

body {
  font-family: var(--font-body);
  font-size: 1.125rem;   /* 18px — Cormorant reads better slightly larger */
  color: var(--text-dark);
  background-color: var(--cream);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.display {
  font-family: var(--font-display);
  font-weight: 300;
  font-style: italic;
  letter-spacing: 0;
  line-height: 1.1;
  text-transform: none;
}

/* Every element that uses --font-display renders as italic 300.
   Cormorant Garamond at display size is most beautiful at this weight. */
[class*="__headline"],
[class*="__title"],
.drink-card__name,
.story-quote__text,
.ambiance-quote__text {
  font-style: italic;
  font-weight: 300;
}

p {
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.75;
  max-width: 65ch;   /* prevent overlong line lengths */
}

/* ==========================================================================
   5. NAVIGATION
   Fixed top nav. Identical markup copy-pasted into all four HTML files.
   Becomes hamburger on mobile (< 768px). Handled by nav.js.
   ========================================================================== */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background-color: var(--dark-brown);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-8);
  z-index: var(--z-nav);
  border-bottom: 1px solid var(--copper-dim);
}

/* Logo — Pinyon Script wordmark */
.nav__logo {
  font-family: var(--font-wordmark);
  font-size: 2rem;
  color: var(--copper);
  letter-spacing: 0.02em;
  transition: opacity var(--transition-fast);
  flex-shrink: 0;
}

.nav__logo:hover {
  opacity: 0.8;
}

/* Desktop links */
.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.nav__link {
  font-family: var(--font-heading);
  font-size: 0.8125rem;   /* 13px */
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-light);
  position: relative;
  padding-bottom: 2px;
  transition: color var(--transition);
  cursor: pointer;
}

/* Copper underline on hover — draws in left to right */
.nav__link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background-color: var(--copper);
  transition: width var(--transition);
}

.nav__link:hover {
  color: var(--copper);
}

.nav__link:hover::after,
.nav__link.active::after {
  width: 100%;
}

.nav__link.active {
  color: var(--copper);
}

/* Hamburger button — visible only on mobile */
.nav__hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: var(--space-2);
  cursor: pointer;
  /* Minimum 44px touch target */
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

.nav__hamburger-line {
  width: 24px;
  height: 1.5px;
  background-color: var(--text-light);
  transition: transform var(--transition), opacity var(--transition);
  transform-origin: center;
}

/* Animate hamburger to X when open */
.nav__hamburger.is-open .nav__hamburger-line:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}

.nav__hamburger.is-open .nav__hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.nav__hamburger.is-open .nav__hamburger-line:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* Mobile menu drawer */
.nav__mobile-menu {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  background-color: var(--dark-brown);
  border-bottom: 1px solid var(--copper-dim);
  padding: var(--space-6) var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  transition: transform var(--transition), opacity var(--transition);
  z-index: calc(var(--z-nav) - 1);
}

.nav__mobile-menu.is-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.nav__mobile-link {
  font-family: var(--font-heading);
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-light);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--copper-dim);
  transition: color var(--transition);
  /* 44px touch target */
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.nav__mobile-link:last-child {
  border-bottom: none;
}

.nav__mobile-link:hover,
.nav__mobile-link.active {
  color: var(--copper);
}

/* Responsive: switch to hamburger below 768px */
@media (max-width: 767px) {
  .nav {
    padding: 0 var(--space-6);
  }

  .nav__links {
    display: none;
  }

  .nav__hamburger {
    display: flex;
  }
}

/* ==========================================================================
   6. PAGE LAYOUT
   Every page gets a wrapper that accounts for the fixed nav height.
   ========================================================================== */

.page {
  padding-top: var(--nav-height);
  min-height: 100vh;
}

/* Dark-background page variant */
.page--dark {
  background-color: var(--dark-brown);
  color: var(--text-light);
}

/* Light-background page variant */
.page--light {
  background-color: var(--cream);
  color: var(--text-dark);
}

/* ==========================================================================
   7. SECTION UTILITIES
   Reusable layout helpers used across all pages.
   ========================================================================== */

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

.section--dark {
  background-color: var(--dark-brown);
  color: var(--text-light);
}

.section--light {
  background-color: var(--cream);
  color: var(--text-dark);
}

.section--warm {
  background-color: var(--warm-white);
  color: var(--text-dark);
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

.container--narrow {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

/* Copper divider line — animated on scroll via scrolltrigger.js */
.divider {
  width: 0;              /* starts at 0, animates to 80px via JS */
  height: 1px;
  background-color: var(--copper);
  margin: var(--space-8) 0;
  transition: width var(--transition-slow);
}

.divider.is-visible {
  width: 80px;
}

/* Section labels — small Josefin Sans eyebrow text */
.label {
  font-family: var(--font-heading);
  font-size: 0.6875rem;   /* 11px */
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--copper);
}

/* ==========================================================================
   8. COPPER CTA BUTTON
   Primary action button used across all pages.
   Sharp corners (radius: 2px) — matches brand aesthetic.
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition), border-color var(--transition);
  min-height: 44px;   /* accessibility: minimum touch target */
  white-space: nowrap;
}

/* Primary — copper fill */
.btn--primary {
  background-color: var(--copper);
  color: var(--dark-brown);
  border: 1px solid var(--copper);
}

.btn--primary:hover {
  background-color: var(--copper-hover);
  border-color: var(--copper-hover);
}

/* Ghost — copper outline */
.btn--ghost {
  background-color: transparent;
  color: var(--copper);
  border: 1px solid var(--copper);
}

.btn--ghost:hover {
  background-color: var(--copper);
  color: var(--dark-brown);
}

/* Light ghost — for use on dark backgrounds */
.btn--light-ghost {
  background-color: transparent;
  color: var(--text-light);
  border: 1px solid rgba(250, 243, 224, 0.4);
}

.btn--light-ghost:hover {
  background-color: var(--text-light);
  color: var(--dark-brown);
  border-color: var(--text-light);
}

/* ==========================================================================
   9. FOOTER
   Two-column dark brown footer with copper accents.
   Shared HTML block included in all pages.
   ========================================================================== */

.footer {
  background-color: var(--dark-brown-2);
  color: var(--text-light);
  padding: var(--space-16) var(--space-8) var(--space-8);
  border-top: 1px solid var(--copper-dim);
}

.footer__inner {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-16);
  padding-bottom: var(--space-12);
  border-bottom: 1px solid var(--copper-dim);
}

.footer__brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.footer__logo {
  font-family: var(--font-wordmark);
  font-size: 2.5rem;
  color: var(--copper);
  line-height: 1;
}

.footer__tagline {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.6;
}

.footer__nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-items: flex-end;
}

.footer__nav-label {
  font-family: var(--font-heading);
  font-size: 0.6875rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--copper);
  margin-bottom: var(--space-2);
}

.footer__nav-link {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-muted);
  transition: color var(--transition);
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.footer__nav-link:hover {
  color: var(--copper);
}

.footer__bottom {
  max-width: 1280px;
  margin: 0 auto;
  padding-top: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.footer__copy {
  font-family: var(--font-heading);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.footer__location {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: italic;
}

@media (max-width: 767px) {
  .footer__inner {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  .footer__nav {
    align-items: flex-start;
  }

  .footer__bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

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

/* ==========================================================================
   10. PAGE TRANSITION OVERLAY
   Copper wipe overlay — injected by pageTransition.js into every page.
   ========================================================================== */

.page-transition-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--copper);
  z-index: var(--z-transition);
  transform: scaleX(0);
  transform-origin: left center;
  pointer-events: none;
}

/* ==========================================================================
   11. SCROLL REVEAL UTILITIES
   Elements start invisible. scrolltrigger.js adds .is-visible on scroll.
   ========================================================================== */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 700ms ease-out, transform 700ms ease-out;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal--left {
  opacity: 0;
  transform: translateX(-32px);
  transition: opacity 700ms ease-out, transform 700ms ease-out;
}

.reveal--left.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal--right {
  opacity: 0;
  transform: translateX(32px);
  transition: opacity 700ms ease-out, transform 700ms ease-out;
}

.reveal--right.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Stagger delay utilities */
.reveal--delay-1 { transition-delay: 100ms; }
.reveal--delay-2 { transition-delay: 200ms; }
.reveal--delay-3 { transition-delay: 300ms; }
.reveal--delay-4 { transition-delay: 400ms; }
.reveal--delay-5 { transition-delay: 500ms; }

/* ==========================================================================
   12. UTILITY CLASSES
   ========================================================================== */

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

.cursor-pointer { cursor: pointer; }
.text-copper    { color: var(--copper); }
.text-cream     { color: var(--cream); }
.text-muted     { color: var(--text-muted); }
.bg-dark        { background-color: var(--dark-brown); }
.bg-cream       { background-color: var(--cream); }

/* ==========================================================================
   13. SHARED KEYFRAMES
   Defined here so any page can use them without importing index.css.
   ========================================================================== */

/* Horizontal marquee — used on index.html and story.html */
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* Generic fade-in-up — utility for entrance animations */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Subtle pulse on the scroll hint line */
@keyframes scrollPulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 1; }
}

/* Hero drink float */
@keyframes heroFloat {
  0%, 100% { transform: translateY(0px) rotate(-1deg); }
  50%       { transform: translateY(-16px) rotate(1deg); }
}

/* Generic float for [data-float] */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}

/* ==========================================================================
   14. FOCUS-VISIBLE STATES
   Keyboard navigation support — visible ring on all interactive elements.
   Uses :focus-visible so mouse users don't see the ring.
   ========================================================================== */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 3px;
  border-radius: var(--radius);
}

/* Nav links — override outline offset to sit on the underline baseline */
.nav__link:focus-visible {
  outline-offset: 6px;
}

/* ==========================================================================
   15. PERFORMANCE HINTS
   will-change declared here so the browser composites these layers early.
   Only applied to elements that definitely animate.
   ========================================================================== */

.page-transition-overlay {
  will-change: transform;
}

.reveal,
.reveal--left,
.reveal--right {
  will-change: opacity, transform;
}

.marquee-inner,
.story-marquee__inner {
  will-change: transform;
}
