/* ============================================================
   Design tokens
   ============================================================ */
:root {
  /* Palette — light creams → sage/forest greens → near-black charcoal */
  --cream-50:  #FAF8F2;  /* page background */
  --cream-100: #F2EEE3;  /* alternate section background */
  --cream-200: #E3DDCC;  /* borders, dividers */
  --sage-300:  #B7C4A4;  /* soft accents */
  --sage-500:  #7D9468;  /* mid green */
  --green-600: #4E6E45;  /* primary accent: links, buttons (AA on cream) */
  --green-700: #3D5937;  /* accent hover */
  --green-900: #24352B;  /* deep green */
  --ink-600:   #50574F;  /* secondary text */
  --ink-900:   #1D211E;  /* primary text, darkest surfaces */

  --bg: var(--cream-50);
  --bg-alt: var(--cream-100);
  --text: var(--ink-900);
  --text-muted: var(--ink-600);
  --accent: var(--green-600);
  --accent-hover: var(--green-700);
  --border: var(--cream-200);

  /* Type */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Spacing & shape */
  --gutter: clamp(16px, 4vw, 32px);
  --section-y: clamp(64px, 10vw, 112px);
  --radius: 10px;
  --header-h: 68px;
  --shadow-sm: 0 1px 2px rgb(29 33 30 / 0.06), 0 2px 8px rgb(29 33 30 / 0.06);
  --shadow-lg: 0 6px 16px rgb(29 33 30 / 0.10), 0 18px 40px rgb(29 33 30 / 0.14);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
}

p { margin: 0 0 1em; }

a { color: var(--accent); text-underline-offset: 0.2em; }
a:hover { color: var(--accent-hover); }

:focus-visible { outline: 3px solid var(--sage-500); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: absolute; left: 16px; top: -100px; z-index: 100;
  background: var(--ink-900); color: var(--cream-50);
  padding: 10px 16px; border-radius: var(--radius);
}
.skip-link:focus { top: 16px; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--gutter); }
.container-narrow { max-width: 760px; }

.section { padding: var(--section-y) 0; }
.section-title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin-bottom: clamp(28px, 4vw, 48px);
}

.eyebrow {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Buttons */
.button {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 24px;
  border-radius: 999px;
  font-weight: 600; font-size: 0.9375rem;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.2s var(--ease);
}
.button-primary { background: var(--cream-50); color: var(--ink-900); }
.button-primary:hover { background: var(--sage-300); color: var(--ink-900); }
.button-secondary { border: 1.5px solid var(--accent); color: var(--accent); }
.button-secondary:hover { background: var(--accent); color: var(--cream-50); }

/* ============================================================
   Header
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: rgb(250 248 242 / 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.3s, border-color 0.3s;
}
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand {
  font-family: var(--font-display); font-weight: 600; font-size: 1.25rem;
  color: var(--text); text-decoration: none;
}
.brand:hover { color: var(--text); }
.site-nav { display: flex; gap: clamp(16px, 3vw, 32px); }
.site-nav a {
  color: var(--text); text-decoration: none;
  font-size: 0.9375rem; font-weight: 500;
  padding: 8px 0;
}
.site-nav a:hover { color: var(--accent); }

/* Home: header floats transparent over the hero until scrolled */
.home .site-header { position: fixed; left: 0; right: 0; }
.home .site-header:not(.is-solid) { background: transparent; border-color: transparent; backdrop-filter: none; }
.home .site-header:not(.is-solid) .brand,
.home .site-header:not(.is-solid) .site-nav a { color: var(--cream-50); }
.home .site-header:not(.is-solid) .site-nav a:hover { color: var(--sage-300); }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; align-items: flex-end;
  color: var(--cream-50);
  background: var(--ink-900);
  overflow: hidden;
}
.hero-media {
  position: absolute; inset: 0;
  isolation: isolate; /* keep video layering contained beneath the scrim and text */
  background: var(--green-900) center / cover no-repeat;
}
/* Clips hard-cut (no transition): a crossfade between different scenes reads as ghosting */
.hero-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
}
.hero-video.is-active { opacity: 1; }

/* Darkens the bottom-left so text stays readable over any footage */
.hero-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(to top, rgb(29 33 30 / 0.85) 0%, rgb(29 33 30 / 0.35) 45%, rgb(29 33 30 / 0.15) 100%),
    linear-gradient(to right, rgb(29 33 30 / 0.45) 0%, transparent 60%);
}
.hero-content {
  position: relative;
  padding-top: calc(var(--header-h) + 48px);
  padding-bottom: clamp(56px, 10vh, 112px);
}
.hero-content .eyebrow { color: var(--sage-300); margin-bottom: 16px; }
.hero-title { font-size: clamp(2.75rem, 7vw, 5rem); margin-bottom: 20px; max-width: 14ch; }
.hero-tagline { font-size: clamp(1.0625rem, 1.6vw, 1.25rem); max-width: 40ch; margin-bottom: 32px; color: rgb(250 248 242 / 0.88); }

.hero-toggle {
  position: absolute; right: var(--gutter); bottom: 24px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1px solid rgb(250 248 242 / 0.4);
  border-radius: 50%;
  background: rgb(29 33 30 / 0.35);
  color: var(--cream-50);
  cursor: pointer;
  transition: background-color 0.2s;
}
.hero-toggle[hidden] { display: none; }
.hero-toggle:hover { background: rgb(29 33 30 / 0.6); }
.hero-toggle svg { width: 18px; height: 18px; fill: currentColor; }
.hero-toggle .icon-play, .hero-toggle.is-paused .icon-pause { display: none; }
.hero-toggle.is-paused .icon-play { display: block; }

/* ============================================================
   Project tiles
   ============================================================ */
.project-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: clamp(16px, 2.5vw, 28px);
}

.tile {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--cream-200);
  color: var(--cream-50);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.tile:hover { color: var(--cream-50); }
.tile-media, .tile-media img { width: 100%; height: 100%; }
.tile-media img {
  object-fit: cover;
  transition: transform 0.5s var(--ease), filter 0.4s var(--ease);
}

.tile-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: clamp(18px, 2.5vw, 28px);
  background: linear-gradient(to top, rgb(29 33 30 / 0.85), rgb(29 33 30 / 0.15) 70%, transparent);
}
.tile-title { font-size: 1.5rem; margin-bottom: 4px; }
.tile-meta { font-size: 0.875rem; color: var(--sage-300); margin: 0; font-weight: 500; }
.tile-summary { font-size: 0.9375rem; line-height: 1.5; margin: 12px 0 0; max-width: 42ch; }
.tile-cta { font-size: 0.875rem; font-weight: 600; margin-top: 14px; }

/* Touch devices: caption always visible, details stay hidden */
@media (hover: none) {
  .tile-summary, .tile-cta { display: none; }
}

/* Mouse/trackpad: reveal text on hover with blurred image */
@media (hover: hover) {
  .tile-overlay {
    background: rgb(29 33 30 / 0.55);
    opacity: 0;
    transition: opacity 0.35s var(--ease);
  }
  .tile-overlay > * {
    transform: translateY(8px);
    transition: transform 0.4s var(--ease);
  }
  .tile:hover, .tile:focus-visible { transform: scale(1.02); box-shadow: var(--shadow-lg); }
  .tile:hover .tile-overlay, .tile:focus-visible .tile-overlay { opacity: 1; }
  .tile:hover .tile-overlay > *, .tile:focus-visible .tile-overlay > * { transform: none; }
  /* Scale the image slightly so blurred edges stay inside the tile */
  .tile:hover .tile-media img, .tile:focus-visible .tile-media img { filter: blur(5px); transform: scale(1.08); }
}

/* ============================================================
   About
   ============================================================ */
.section-about { background: var(--bg-alt); padding: clamp(40px, 6vw, 64px) 0; }
.section-about .section-title { margin-bottom: 20px; }
.about-body { font-size: 1.125rem; }
.about-body p:last-child { margin-bottom: 0; }
.about-body .button { margin-top: 12px; }

/* ============================================================
   Footer / contact
   ============================================================ */
.site-footer {
  background: var(--ink-900);
  color: var(--cream-100);
  padding-top: var(--section-y);
}
.footer-inner {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end;
  gap: 40px;
  padding-bottom: 56px;
}
.footer-title { font-size: clamp(2rem, 4vw, 2.75rem); margin-bottom: 16px; color: var(--cream-50); }
.footer-intro p { color: rgb(242 238 227 / 0.75); max-width: 48ch; }
.footer-email {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.5vw, 1.625rem);
  color: var(--sage-300);
}
.footer-email:hover { color: var(--cream-50); }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px 28px; }
.footer-links a { color: var(--cream-100); font-weight: 500; text-decoration: none; padding: 8px 0; }
.footer-links a:hover { color: var(--sage-300); text-decoration: underline; }
.footer-bottom {
  border-top: 1px solid rgb(242 238 227 / 0.12);
  padding-top: 24px; padding-bottom: 32px;
  font-size: 0.875rem;
  color: rgb(242 238 227 / 0.55);
}
.footer-bottom p { margin: 0; }

/* ============================================================
   Project page
   ============================================================ */
.project-banner {
  aspect-ratio: 21 / 9;
  max-height: 70vh;
  width: 100%;
  background: var(--green-900);
  overflow: hidden;
}
.project-banner img, .project-banner video { width: 100%; height: 100%; object-fit: cover; }

.project-article { padding-top: clamp(40px, 6vw, 72px); }
.back-link {
  display: inline-block; margin-bottom: 20px;
  font-size: 0.9375rem; font-weight: 500; text-decoration: none;
}
.back-link:hover { text-decoration: underline; }
.project-title { font-size: clamp(2.5rem, 6vw, 4rem); margin-bottom: 28px; }

.project-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px 32px;
  margin: 0 0 40px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.project-meta dt {
  font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.project-meta dd { margin: 0; font-weight: 500; }

.prose .lead { font-size: 1.25rem; line-height: 1.6; }
.prose h2 { font-size: 1.75rem; margin: 48px 0 16px; }
.prose ul { padding-left: 1.25em; margin: 0 0 1em; }
.prose li { margin-bottom: 0.4em; }
.prose li::marker { color: var(--sage-500); }

.project-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.project-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr));
  gap: clamp(16px, 2.5vw, 28px);
  margin-top: clamp(48px, 6vw, 80px);
}
.project-gallery figure { margin: 0; }
.project-gallery img, .project-gallery video {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: var(--cream-200);
}
.project-gallery figcaption { margin-top: 10px; font-size: 0.9375rem; color: var(--text-muted); }

.project-pager { border-top: 1px solid var(--border); background: var(--bg-alt); }
.pager-inner { display: flex; justify-content: space-between; gap: 24px; padding-top: 40px; padding-bottom: 40px; }
.pager-link { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text); }
.pager-next { text-align: right; margin-left: auto; }
.pager-label { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.pager-title { font-family: var(--font-display); font-size: clamp(1.25rem, 2.5vw, 1.625rem); }
.pager-link:hover .pager-title { color: var(--accent); }

/* ============================================================
   Small screens
   ============================================================ */
@media (max-width: 560px) {
  .site-nav { gap: 16px; }
  .site-nav a { font-size: 0.875rem; }
  .brand { font-size: 1.0625rem; }
  .project-banner { aspect-ratio: 16 / 10; }
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
  .tile:hover, .tile:focus-visible { transform: none; }
}
