/* =========================================================
   SHARED — variables, base type, header/nav, hamburger menu,
   and the static margin-wave decoration. Loaded by every page.
   ========================================================= */

:root {
  --ink: #2A1F14;
  --ink-soft: rgba(42,31,20,0.68);
  --cream: #F7EEE0;
  --cream-dim: #EFE3CE;
  --amber: #C4791E;
  --rust: #A8481F;
  --gold-line: rgba(42,31,20,0.16);

  /* hero tint — follows the water theme toggle, used on index.html */
  --hero-glow: rgba(120,55,10,0.4);
  --hero-text: #FFF9EE;
  --hero-accent: #FFD9A0;
  --mote-color: #FFE9C2;

  /* static margin-wave palette, inspired by the reference photo,
     also follows the theme toggle so it never clashes */
  --wave-back:  #7A3A18;
  --wave-mid:   #B9642A;
  --wave-front: #E3A15C;
  --wave-foam:  #FCEBC9;
}
body.theme-cold {
  --hero-glow: rgba(15,35,55,0.45);
  --hero-text: #F3FAFF;
  --hero-accent: #BFE3F5;
  --mote-color: #D8ECF7;

  --wave-back:  #1E3648;
  --wave-mid:   #3A6E8C;
  --wave-front: #8AB6CF;
  --wave-foam:  #F5F9FB;
}

* { box-sizing: border-box; }
html {
  background: var(--cream);
}
html, body { margin: 0; padding: 0; }
body {
  background: transparent;
  color: var(--ink);
  font-family: 'Geist', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--ink); color: var(--cream); }
a { color: inherit; }

/* ---------- SITE HEADER (nav + toggle + hamburger) ---------- */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px clamp(20px, 4vw, 56px);
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  position: relative;
  z-index: 20;
}
.site-header:not(.overlay) {
  border-bottom: 1px solid var(--gold-line);
  color: var(--ink);
}
.site-header.overlay {
  color: var(--hero-text);
  text-shadow: 0 1px 18px var(--hero-glow);
}
.site-header .brand {
  font-family: 'Geist', system-ui, sans-serif;
  letter-spacing: 0.2em;
  font-weight: 500;
  text-decoration: none;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 26px;
}
.nav-links { display: flex; align-items: center; gap: 26px; font-family: 'Geist', system-ui, sans-serif;}
.nav-links a { text-decoration: none; opacity: 0.72; }
.site-header:not(.overlay) .nav-links a { opacity: 0.62; }
.nav-links a:hover,
.nav-links a[aria-current="page"] {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.28);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 7px;
  padding: 5px 12px 5px 8px;
  color: #FFF9EE;
  font-family: 'Geist', system-ui, sans-serif;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease;
}
.theme-toggle:hover { background: rgba(0,0,0,0.4); }
.theme-toggle.on-light {
  background: rgba(42,31,20,0.06);
  border: 1px solid var(--gold-line);
  color: var(--ink);
}
.theme-toggle.on-light:hover { background: rgba(42,31,20,0.1); }
.theme-toggle .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFC876, #C4491A);
  transition: background 0.3s ease;
  flex-shrink: 0;
}
body.theme-cold .theme-toggle .dot {
  background: linear-gradient(135deg, #C4DBE8, #3A6E8C);
}
.theme-toggle .label { min-width: 34px; text-align: left; }

/* Hamburger button — hidden on desktop */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 32px; height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.hamburger span {
  display: block;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

@media (max-width: 720px) {
  .hamburger { display: flex; }
  .nav-panel {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    padding: 22px clamp(20px, 4vw, 56px) 28px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.28s ease, opacity 0.2s ease, padding 0.28s ease;
  }
  .site-header:not(.overlay) .nav-panel {
    background: var(--cream);
    border-bottom: 1px solid var(--gold-line);
  }
  .site-header.overlay .nav-panel {
    background: rgba(20,14,8,0.55);
    backdrop-filter: blur(8px);
  }
  body.theme-cold .site-header.overlay .nav-panel {
    background: rgba(8,16,22,0.55);
  }
  .nav-panel.open {
    max-height: 240px;
    opacity: 1;
    padding: 22px clamp(20px, 4vw, 56px) 28px;
  }
  .nav-links { flex-direction: column; align-items: flex-start; gap: 16px; }
}

/* ---------- NAV CLICK RIPPLE (spawned by nav.js) ---------- */
.nav-ripple {
  position: fixed;
  top: var(--y);
  left: var(--x);
  z-index: 300;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 3px solid var(--wave-front);
  box-shadow: 0 0 0 1px var(--hero-accent) inset;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0.85;
  animation: nav-ripple-burst 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
@keyframes nav-ripple-burst {
  0%   { width: 14px;  height: 14px;  opacity: 0.85; }
  70%  { opacity: 0.35; }
  100% { width: 120px; height: 120px; opacity: 0; }
}

/* ---------- STATIC MARGIN WAVE ---------- */
.margin-wave {
  display: block;
  width: 100%;
  height: clamp(90px, 14vw, 160px);
  line-height: 0;
}
.margin-wave svg { display: block; width: 100%; height: 100%; }

/* ---------- MARGIN WAVE — idle drift ---------- */
@keyframes wave-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(var(--bob-amp, -4px)); }
}
@keyframes wave-foam-shimmer {
  0%, 100% { opacity: var(--foam-base, 0.5); }
  50%      { opacity: calc(var(--foam-base, 0.5) * 0.35); }
}
.margin-wave svg path:nth-child(1) { --bob-amp: -3px;   animation: wave-bob 7.2s ease-in-out infinite; }
.margin-wave svg path:nth-child(2) { --bob-amp: -5px;   animation: wave-bob 6s ease-in-out infinite; animation-delay: -2.1s; }
.margin-wave svg path:nth-child(3) { --bob-amp: -3.5px; animation: wave-bob 5.3s ease-in-out infinite; animation-delay: -1.2s; }
.margin-wave svg path:nth-child(4) { --foam-base: 0.55; animation: wave-foam-shimmer 5s ease-in-out infinite; }
.margin-wave svg path:nth-child(5) { --foam-base: 0.5;  animation: wave-foam-shimmer 6.4s ease-in-out infinite; animation-delay: -1.6s; }
.margin-wave svg path:nth-child(6) { --foam-base: 0.5;  animation: wave-foam-shimmer 5.7s ease-in-out infinite; animation-delay: -3s; }

/* ---------- SUBPAGE SHELL ---------- */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.page main {
  flex: 1;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: clamp(48px, 8vw, 96px) clamp(20px, 4vw, 56px) 0;
}
.eyebrow {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 0 0 14px;
}
.page h1 {
  font-family: 'Geist', system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.12;
  max-width: 20ch;
  margin: 0 0 20px;
}
.page p.lede {
  font-size: 16px;
  line-height: 1.65;
  max-width: 62ch;
  color: var(--ink-soft);
  margin: 0;
}

/* ---------- REDUCED MOTION — disable all ambient/decorative animation ---------- */
@media (prefers-reduced-motion: reduce) {
  .margin-wave svg path {
    animation: none !important;
  }
  .nav-ripple {
    animation: none !important;
    opacity: 0 !important;
  }
}

/* =========================================================
   BREATHING BACKGROUND — slow, barely-there noise drift.
   A fullscreen canvas sits fixed behind everything. The same
   fbm shader from the hero runs at a fraction of the opacity
   so the page surface feels alive without competing with content.
   ========================================================= */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}
/* everything above the canvas */
.page { position: relative; z-index: 1; }
.site-header { position: relative; z-index: 20; }

/* =========================================================
   HEADER WATER — animated water strip behind the nav bar
   on subpages (about, work, contact, creative).
   ========================================================= */
.header-water-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}
.header-water-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.header-water-wrap::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 14px;
  background: linear-gradient(to bottom, transparent, var(--cream));
}

/* =========================================================
   PAGE TRANSITIONS — fade out on leave, fade in on load.
   ========================================================= */
@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
body {
  animation: page-fade-in 0.38s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
body.page-leaving {
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

/* =========================================================
   STAGGERED TEXT ENTRANCE — eyebrow → h1 → lede → content.
   Elements with .reveal start invisible; JS adds .visible.
   ========================================================= */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s cubic-bezier(0.22, 0.61, 0.36, 1),
              transform 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  body { animation: none !important; }
  body.page-leaving { transition: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  #bg-canvas { display: none; }
}