/* ==========================================================================
   Caffenation — Design System
   Premium · Minimal · Confident · Warm Neutral
   Single source of truth for palette, type scale, spacing and motion.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  /* --- Palette: warm neutrals + roast accents ---------------------------- */
  --color-cream:        #F7F2EA; /* page canvas, warm off-white */
  --color-sand:         #EDE4D6; /* alternating section background */
  --color-linen:        #E2D6C3; /* subtle fills, dividers on light */
  --color-clay:         #C9B79C; /* muted warm mid-tone, captions */
  --color-stone:        #8C7F6D; /* secondary text on light */
  --color-bark:         #564A3C; /* strong body text, dark surfaces */
  --color-espresso:     #2C231B; /* headings, footer background */
  --color-ink:          #17120D; /* near-black, maximum contrast text */

  --color-roast:        #6F4E37; /* primary accent, coffee brown */
  --color-roast-deep:   #4A3223; /* accent hover / pressed */
  --color-ember:        #B4551F; /* warm CTA / highlight, used sparingly */
  --color-amber:        #D89A4A; /* focus ring, decorative warmth */

  --color-success:      #4F6B4A;
  --color-danger:       #A4402F;

  /* --- Semantic surfaces & text ------------------------------------------ */
  --surface-page:       var(--color-cream);
  --surface-raised:     #FFFDF9;
  --surface-sunken:     var(--color-sand);
  --surface-inverse:    var(--color-espresso);

  --text-primary:       var(--color-ink);
  --text-secondary:     var(--color-stone);
  --text-inverse:       var(--color-cream);
  --text-accent:        var(--color-roast);

  --border-subtle:      rgba(44, 35, 27, 0.10);
  --border-strong:      rgba(44, 35, 27, 0.22);
  --border-inverse:     rgba(247, 242, 234, 0.20);

  /* --- Type scale (fluid, 1.25 major third) ------------------------------ */
  --font-display: "Fraunces", "Playfair Display", Georgia, "Times New Roman", serif;
  --font-body:    "Inter", "Helvetica Neue", Arial, system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  --step--1:  clamp(0.83rem, 0.80rem + 0.15vw, 0.89rem);
  --step-0:   clamp(1.00rem, 0.96rem + 0.20vw, 1.13rem);
  --step-1:   clamp(1.25rem, 1.18rem + 0.35vw, 1.41rem);
  --step-2:   clamp(1.56rem, 1.43rem + 0.65vw, 1.88rem);
  --step-3:   clamp(1.95rem, 1.72rem + 1.15vw, 2.50rem);
  --step-4:   clamp(2.44rem, 2.05rem + 1.95vw, 3.33rem);
  --step-5:   clamp(3.05rem, 2.40rem + 3.25vw, 4.44rem);
  --step-6:   clamp(3.81rem, 2.75rem + 5.30vw, 5.92rem);

  --leading-tight: 1.1;
  --leading-snug:  1.25;
  --leading-body:  1.65;
  --leading-loose: 1.8;

  --tracking-display: -0.02em;
  --tracking-normal:  0;
  --tracking-caps:    0.14em;

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

  /* --- Spacing scale (4px base, harmonic) -------------------------------- */
  --space-2xs: 0.25rem;  /*   4px */
  --space-xs:  0.5rem;   /*   8px */
  --space-sm:  0.75rem;  /*  12px */
  --space-md:  1rem;     /*  16px */
  --space-lg:  1.5rem;   /*  24px */
  --space-xl:  2.5rem;   /*  40px */
  --space-2xl: 4rem;     /*  64px */
  --space-3xl: 6rem;     /*  96px */
  --space-4xl: 9rem;     /* 144px */
  --space-section: clamp(4.5rem, 3rem + 7vw, 9rem);

  /* --- Layout ------------------------------------------------------------ */
  --container-max:   1240px;
  --container-narrow: 760px;
  --container-wide:  1440px;
  --gutter: clamp(1.25rem, 0.8rem + 2vw, 3rem);
  --grid-gap: var(--space-lg);
  --header-height: 72px;

  /* --- Radii, shadows, motion ------------------------------------------- */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(23, 18, 13, 0.06);
  --shadow-md: 0 8px 24px -12px rgba(23, 18, 13, 0.18);
  --shadow-lg: 0 24px 60px -28px rgba(23, 18, 13, 0.28);

  --ease-out:   cubic-bezier(0.22, 1, 0.36, 1);
  --ease-inout: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 160ms;
  --duration-base: 320ms;
  --duration-slow: 640ms;

  --z-base: 1;
  --z-sticky: 100;
  --z-overlay: 500;
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background-color: var(--surface-page);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: var(--leading-body);
  font-weight: var(--weight-regular);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, picture, svg, video { max-width: 100%; display: block; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }

::selection { background: var(--color-amber); color: var(--color-ink); }

:focus-visible {
  outline: 2px solid var(--color-amber);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--weight-semi);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
  color: var(--text-primary);
}

h1 { font-size: var(--step-6); }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-3); }
h4 { font-size: var(--step-2); }
h5 { font-size: var(--step-1); }
h6 { font-size: var(--step-0); }

p { margin: 0 0 var(--space-md); max-width: 68ch; }

.lead {
  font-size: var(--step-1);
  line-height: var(--leading-snug);
  color: var(--text-secondary);
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: var(--weight-semi);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-ember);
}

.text-muted { color: var(--text-secondary); }
.text-accent { color: var(--text-accent); }

/* --------------------------------------------------------------------------
   4. Layout primitives
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: var(--container-narrow); }
.container--wide   { max-width: var(--container-wide); }

.section { padding-block: var(--space-section); }
.section--sunken { background-color: var(--surface-sunken); }
.section--inverse {
  background-color: var(--surface-inverse);
  color: var(--text-inverse);
}
.section--inverse h1,
.section--inverse h2,
.section--inverse h3 { color: var(--text-inverse); }

.grid { display: grid; gap: var(--grid-gap); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--auto {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.stack > * + * { margin-top: var(--space-md); }
.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
}

/* --------------------------------------------------------------------------
   5. Components
   -------------------------------------------------------------------------- */
/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-lg);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--step--1);
  font-weight: var(--weight-semi);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  transition: background-color var(--duration-base) var(--ease-out),
              color var(--duration-base) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}
.btn--primary {
  background-color: var(--color-roast);
  color: var(--color-cream);
}
.btn--primary:hover { background-color: var(--color-roast-deep); transform: translateY(-1px); }
.btn--ghost {
  background-color: transparent;
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.btn--ghost:hover { border-color: var(--color-roast); color: var(--text-accent); }
.btn--inverse {
  background-color: var(--color-cream);
  color: var(--color-ink);
}

/* Cards */
.card {
  background-color: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration-base) var(--ease-out),
              transform var(--duration-base) var(--ease-out);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* Product / editorial image frame */
.media {
  overflow: hidden;
  border-radius: var(--radius-md);
  background-color: var(--color-linen);
  aspect-ratio: 4 / 5;
}
.media--wide { aspect-ratio: 16 / 9; }
.media img { width: 100%; height: 100%; object-fit: cover; }

/* Divider */
.divider {
  height: 1px;
  border: 0;
  background-color: var(--border-subtle);
  margin-block: var(--space-xl);
}

/* --------------------------------------------------------------------------
   6. Site header / navigation
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: var(--header-height);
  display: flex;
  align-items: center;
  background-color: color-mix(in srgb, var(--surface-page) 88%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.brand {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: var(--weight-bold);
  letter-spacing: calc(var(--tracking-caps) * -0.3);
}
.nav { display: flex; gap: var(--space-lg); }
.nav a {
  font-size: var(--step--1);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-secondary);
  transition: color var(--duration-fast) var(--ease-out);
}
.nav a:hover { color: var(--text-primary); }

/* --------------------------------------------------------------------------
   7. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  background-color: var(--surface-inverse);
  color: var(--text-inverse);
  padding-block: var(--space-3xl);
}
.site-footer a { color: rgba(247, 242, 234, 0.72); }
.site-footer a:hover { color: var(--color-cream); }

/* --------------------------------------------------------------------------
   8. Utilities & responsive
   -------------------------------------------------------------------------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.text-center { text-align: center; }
.mx-auto { margin-inline: auto; }

@media (max-width: 960px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid--2,
  .grid--3,
  .grid--4 { grid-template-columns: 1fr; }
  .nav { display: none; }
  h1 { font-size: var(--step-5); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
