/* ==========================================================================
   BASE — Reset, custom properties, typography, accessibility
   ========================================================================== */

/* Reset
   ========================================================================== */
*,
*::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;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

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

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

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

ul,
ol {
  list-style: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: inherit;
  font-size: inherit;
}

table {
  border-collapse: collapse;
}

/* Custom properties (design tokens)
   ========================================================================== */
:root {
  /* Colour palette */
  --color-cream: #F5F1E8;
  --color-sand: #E8DFD0;
  --color-walnut: #2B1F14;
  --color-oak: #7A5C3E;
  --color-moss: #3D4F3A;
  --color-stone: #6B6357;
  --color-snow: #FFFFFF;
  --color-espresso: #1A130C;

  /* Semantic aliases */
  --color-bg: var(--color-cream);
  --color-bg-alt: var(--color-sand);
  --color-text: var(--color-walnut);
  --color-text-muted: var(--color-stone);
  --color-accent: var(--color-oak);
  --color-accent-dark: var(--color-espresso);
  --color-line: rgba(43, 31, 20, 0.12);
  --color-line-strong: rgba(43, 31, 20, 0.24);

  /* Typography */
  --font-serif: 'Cormorant Garamond', 'Times New Roman', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --fs-eyebrow: clamp(0.6875rem, 0.65rem + 0.2vw, 0.75rem);
  --fs-body: clamp(0.9375rem, 0.9rem + 0.2vw, 1rem);
  --fs-lead: clamp(1.125rem, 1.05rem + 0.4vw, 1.25rem);
  --fs-h3: clamp(1.25rem, 1.1rem + 0.7vw, 1.5rem);
  --fs-h2: clamp(1.75rem, 1.4rem + 1.6vw, 2.625rem);
  --fs-h1: clamp(2.25rem, 1.6rem + 3vw, 4rem);
  --fs-display: clamp(3rem, 1.8rem + 5.6vw, 6.5rem);

  --lh-tight: 1.05;
  --lh-snug: 1.2;
  --lh-normal: 1.5;
  --lh-loose: 1.7;

  --ls-eyebrow: 0.18em;
  --ls-tight: -0.01em;

  /* Spacing scale (8pt grid) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --space-10: 8rem;
  --space-11: 12rem;

  /* Layout */
  --container-max: 1440px;
  --container-pad: clamp(1.25rem, 1rem + 2vw, 2.5rem);
  --section-pad-y: clamp(4rem, 3rem + 4vw, 8rem);
  --grid-gutter: clamp(1rem, 0.7rem + 1.4vw, 2rem);

  /* Effects */
  --radius-sm: 2px;
  --radius-md: 4px;
  --shadow-1: 0 1px 2px rgba(26, 19, 12, 0.06);
  --shadow-2: 0 8px 24px rgba(26, 19, 12, 0.08);
  --shadow-3: 0 20px 60px rgba(26, 19, 12, 0.14);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 200ms;
  --dur: 360ms;
  --dur-slow: 600ms;

  /* Accessibility — minimum interactive target (WCAG 2.1 SC 2.5.5) */
  --tap-target-min: 44px;

  /* Z-index */
  --z-base: 1;
  --z-header: 50;
  --z-overlay: 80;
  --z-modal: 90;
}

/* Base typography
   ========================================================================== */
body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  font-weight: 400;
}

h1,
h2,
h3,
.serif {
  font-family: var(--font-serif);
  font-weight: 300;
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--color-walnut);
}

h1 {
  font-size: var(--fs-h1);
}

h2 {
  font-size: var(--fs-h2);
  line-height: var(--lh-snug);
}

h3 {
  font-size: var(--fs-h3);
  font-weight: 400;
  line-height: var(--lh-snug);
}

p {
  line-height: var(--lh-loose);
}

a {
  color: inherit;
  transition: color var(--dur-fast) var(--ease-out);
}

a:hover {
  color: var(--color-accent);
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--fs-eyebrow);
  font-weight: 500;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.lead {
  font-size: var(--fs-lead);
  line-height: var(--lh-loose);
  color: var(--color-text-muted);
  max-width: 60ch;
}

/* Focus
   ========================================================================== */
:focus {
  outline: none;
}

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

/* Skip link
   ========================================================================== */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--color-walnut);
  color: var(--color-cream);
  font-size: var(--fs-eyebrow);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  transition: top var(--dur) var(--ease-out);
}

.skip-link:focus {
  top: var(--space-4);
  color: var(--color-cream);
}

/* Reveal animation
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity var(--dur-slow) var(--ease-out),
    transform var(--dur-slow) var(--ease-out);
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

.reveal--delay-1 { transition-delay: 80ms; }
.reveal--delay-2 { transition-delay: 160ms; }
.reveal--delay-3 { transition-delay: 240ms; }
.reveal--delay-4 { transition-delay: 320ms; }

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal--delay-1,
  .reveal--delay-2,
  .reveal--delay-3,
  .reveal--delay-4 {
    opacity: 1;
    transform: none;
    transition: none;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Visually hidden (a11y)
   ========================================================================== */
.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;
}

/* Selection
   ========================================================================== */
::selection {
  background: var(--color-walnut);
  color: var(--color-cream);
}

/* Page chrome
   ========================================================================== */
html {
  background: var(--color-bg);
}

body {
  overflow-x: hidden;
}

/* Image defaults
   ========================================================================== */
img {
  background: var(--color-sand);
  object-fit: cover;
}

img[loading="lazy"] {
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out);
}

img[loading="lazy"].is-loaded,
img[loading="lazy"].is-visible {
  opacity: 1;
}
