/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 200; background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: var(--r-sm); font-family: var(--font-mono); font-size: .875rem; transform: translateY(-200%); }
.skip-link:focus { transform: none; }
:focus-visible { outline: 3px solid var(--accent-btn); outline-offset: 3px; border-radius: 4px; }
#about :focus-visible, footer :focus-visible { outline-color: var(--accent-soft); }
main:focus { outline: none; }

/* ============================================================
   TOKENS — warm paper / hand-annotated studio palette
   ============================================================ */
:root {
  --paper:       #FBF6EC;
  --paper-dim:   #F4EDDD;
  --card:        #FFFDF8;
  --panel:       #24211B;
  --panel-2:     #2C2820;

  --ink:         #221E17;
  --ink-soft:    #675F50;
  --ink-faint:   #7A6E58;
  --line:        #E2D6B8;
  --line-strong: #C9B98D;

  --accent:      #DD5A2C;
  --accent-dark: #A93F1B;
  --accent-soft: #F7DFC7;
  --accent-btn:  #B8441B; /* accent used as text / border / outline */
  --accent-fill: #B8441B; /* accent used as a solid fill behind white text */
  --accent-wash: #F7DFC7; /* soft accent tint for backgrounds and highlights */
  --on-accent:   #FFFFFF;
  --paper-deep:  #EADFC4; /* darker beige: secondary-button hover */
  --teal:        #0E8B78;
  --paper-rgb:   251 246 236;
  --on-panel:    #FBF6EC; /* text on the always-dark About / footer panels */
  --shadow-rgb:  60 40 10;
  color-scheme: light;

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body:    'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  --font-mono:    'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif; /* labels, pills and buttons use the body face */
  --font-hand:    'Caveat', 'Segoe Print', cursive;

  --sp-4: 4px;  --sp-6: 6px;  --sp-8: 8px;
  --sp-12: 12px; --sp-16: 16px; --sp-20: 20px;
  --sp-24: 24px; --sp-32: 32px; --sp-40: 40px;
  --sp-48: 48px; --sp-64: 64px; --sp-80: 80px;
  --sp-120: 120px;
  --sp-10: 10px; --sp-14: 14px; --sp-18: 18px; --sp-28: 28px; --sp-56: 56px;

  --r-sm: 8px; --r-md: 14px; --r-lg: 22px; --r-xl: 36px;

  --shadow-card:  0 1px 2px rgb(var(--shadow-rgb)/.06), 0 10px 30px -12px rgb(var(--shadow-rgb)/.28);
  --shadow-pop:   0 18px 48px -14px rgb(var(--shadow-rgb)/.32);
  --ease-spring:  cubic-bezier(.22,1.1,.36,1);
  --ease-out:     cubic-bezier(.16,1,.3,1);
}

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink-soft);
  overflow-x: hidden;
  overflow-x: clip;
}

/* ============================================================
   GRAIN OVERLAY — fixed, non-scrolling, cheap
   ============================================================ */
#grain {
  position: fixed; inset: 0; z-index: 3;
  pointer-events: none;
  opacity: .5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
}

/* ============================================================
   UTILITY
   ============================================================ */
.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 var(--sp-40); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.78125rem; color: var(--ink-faint);
  letter-spacing: .01em;
}
.eyebrow::before { content: '['; }
.eyebrow::after  { content: ']'; }

.annotation {
  font-family: var(--font-hand);
  font-size: 1.25rem;
  color: var(--ink-faint);
  line-height: 1;
  white-space: nowrap;
}

/* torn / dashed hairline used throughout instead of solid corporate borders */
.hairline-dashed { border: 1.5px dashed var(--line-strong); }

/* ============================================================
   NAVBAR
   ============================================================ */
#navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: var(--sp-16) var(--sp-20) 0;
  pointer-events: none;
}
#navbar-inner {
  pointer-events: all;
  max-width: 1160px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 66px; padding: 0 var(--sp-8) 0 var(--sp-20);
  background: rgb(var(--paper-rgb)/.78);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid var(--line);
  border-radius: 100px;
  box-shadow: 0 2px 4px rgb(var(--shadow-rgb)/.04);
  transition: background .3s ease, box-shadow .3s ease, border-color .3s ease;
}
#navbar-inner.scrolled {
  background: rgb(var(--paper-rgb)/.96);
  box-shadow: 0 10px 30px -12px rgb(var(--shadow-rgb)/.22);
  border-color: var(--line-strong);
}
.nav-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.nav-logo-mark {
  width: 38px; height: 38px;
  background: var(--ink); color: var(--paper);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 0.875rem; letter-spacing: -.02em;
  transform: rotate(-6deg);
  transition: transform .35s var(--ease-spring), background .2s;
  flex-shrink: 0;
}
.nav-logo:hover .nav-logo-mark { transform: rotate(0deg) scale(1.06); background: var(--accent-btn); }
.nav-logo-name { font-family: var(--font-display); font-size: 1.0625rem; font-weight: 700; letter-spacing: -.01em; }

.nav-links { display: flex; align-items: center; gap: var(--sp-32); list-style: none; }
.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.84375rem; color: var(--ink-soft); text-decoration: none;
  position: relative; transition: color .2s;
}
.nav-links a::after {
  content: ''; position: absolute; bottom: -6px; left: 0; right: 0; height: 2px;
  background: var(--accent); border-radius: 2px;
  transform: scaleX(0); transform-origin: left;
  transition: transform .3s var(--ease-spring);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }
.nav-links a.active { color: var(--ink); }

.nav-actions { display: flex; align-items: center; gap: 8px; }
.nav-pill { font-size: 0.8125rem; padding: 9px 18px; min-height: 44px; gap: 6px; }

.nav-hamburger { display: none; flex-direction: column; align-items: center; justify-content: center; gap: 5px; cursor: pointer; background: none; border: none; width: 44px; height: 44px; }
.nav-hamburger span { display: block; width: 22px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .3s var(--ease-spring), opacity .3s; }
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

#mobile-menu {
  display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 99;
  padding-top: 100px;
  background: rgb(var(--paper-rgb)/.98);
  backdrop-filter: blur(20px);
  transform: translateY(-110%); visibility: hidden; max-height: 100dvh; overflow-y: auto;
  transition: transform .4s var(--ease-out), visibility 0s .4s;
}
#mobile-menu.open { transform: translateY(0); visibility: visible; transition-delay: 0s; }
#mobile-menu ul { list-style: none; padding: var(--sp-24) var(--sp-24) var(--sp-40); display: flex; flex-direction: column; gap: 4px; }
#mobile-menu a {
  display: block; font-family: var(--font-display); font-size: 1.5rem; font-weight: 700;
  color: var(--ink); text-decoration: none; padding: var(--sp-16) 0;
  border-bottom: 1.5px dashed var(--line-strong);
  transition: color .2s, padding-left .2s;
}
#mobile-menu a:hover { color: var(--accent); padding-left: 8px; }

/* ============================================================
   BUTTONS
   ============================================================ */
/* One system, two levels.
   PRIMARY   (.btn-primary, .nav-pill--solid): black, turns orange on hover.
   SECONDARY (.btn-ghost, .nav-pill--ghost, .card-arrow, .card-view-label): orange outline, darker-beige fill on hover. */
.btn-primary, .btn-ghost, .nav-pill, .card-arrow {
  font-family: var(--font-body); font-weight: 600; letter-spacing: 0;
  border: 1.5px solid transparent; border-radius: 100px;
  text-decoration: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  /* colour + shadow only: the button itself never moves, tilts or follows the pointer */
  transition: box-shadow .2s ease, background-color .2s ease, border-color .2s ease, color .2s ease;
}
.btn-primary, .btn-ghost { font-size: 0.9375rem; padding: 14px 26px; min-height: 48px; }
.btn-primary .icn { transition: transform .2s ease-out; }
.btn-primary:hover .icn { transform: translateX(3px); }

.btn-primary, .nav-pill--solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-primary:hover, .nav-pill--solid:hover { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); box-shadow: 0 10px 24px -10px rgba(221,90,44,.55); }

.btn-ghost, .nav-pill--ghost, .card-arrow { background: transparent; color: var(--ink); border-color: var(--accent-btn); }
.btn-ghost:hover, .nav-pill--ghost:hover, .card-arrow:hover { background: var(--paper-deep); border-color: var(--accent-btn); color: var(--ink); }

/* ============================================================
   HERO
   ============================================================ */
#hero {
  min-height: calc(100vh - 80px); min-height: calc(100svh - 80px);
  display: flex; align-items: center;
  padding: clamp(112px, 16vh, 150px) var(--sp-20) var(--sp-40);
  position: relative; overflow: hidden;
  background:
    radial-gradient(circle, var(--line) 1.4px, transparent 1.4px) 0 0/30px 30px,
    var(--paper);
  mask-image: none;
}
#hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 0%, var(--paper) 30%, transparent 78%);
  z-index: 0;
}
.hero-inner {
  position: relative; z-index: 1;
  width: 100%; max-width: 900px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-28);
}

.hero-badge {
  display: inline-flex; align-items: center; gap: var(--sp-8);
  background: var(--card); border: 1.5px dashed var(--line-strong);
  padding: 7px 18px; border-radius: 100px;
  transform: rotate(-2deg);
  opacity: 0; animation: fadeSlideDown .6s .1s var(--ease-out) forwards;
}
.hero-badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); animation: pulse 2s infinite; }
.hero-badge span { font-family: var(--font-mono); font-size: 0.78125rem; font-weight: 500; color: var(--ink-soft); }

.hero-headline {
  font-family: var(--font-display);
  font-size: clamp(2.875rem, 8.4vw, 6.5rem);
  font-weight: 700; line-height: .98; letter-spacing: -.03em; text-wrap: balance;
  color: var(--ink);
  opacity: 0; animation: fadeSlideUp .7s .22s var(--ease-out) forwards;
}

.hero-photo-wrap { position: relative; display: inline-block; vertical-align: -22%; margin: 0 6px; }
.hero-photo-inline {
  display: inline-block;
  width: clamp(58px, 7.4vw, 92px); height: clamp(58px, 7.4vw, 92px);
  background: var(--card);
  padding: 6px 6px 14px;
  border-radius: 4px;
  box-shadow: var(--shadow-card);
  transform: rotate(-6deg);
  transition: transform .4s var(--ease-spring);
  cursor: pointer; overflow: hidden;
}
.logo-stack { position: relative; display: block; width: 100%; height: 100%; }
.logo-stack { transform: scale(1.35); }
.logo-stack img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.logo-backdrop { opacity: 0; transition: opacity .35s ease; }
html[data-theme="dark"] .logo-backdrop { opacity: 1; }

.hero-photo-inline:hover { transform: rotate(4deg) scale(1.1); }
.hero-photo-tape {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%) rotate(-4deg);
  width: 40px; height: 16px; background: var(--accent-wash);
  opacity: .85; border-radius: 2px; z-index: 2;
}
.hero-photo-note {
  position: absolute; left: -22px; bottom: calc(100% + 14px); margin: 0;
  font-family: var(--font-hand); font-weight: 600; font-size: 1.3125rem;
  letter-spacing: 0; line-height: 1; color: var(--ink-faint);
  transform: rotate(-6deg); transform-origin: left bottom; white-space: nowrap; pointer-events: none;
}

.hero-sub {
  font-size: clamp(1rem, 1.9vw, 1.1875rem); color: var(--ink-soft); line-height: 1.7;
  max-width: 620px;
  opacity: 0; animation: fadeSlideUp .7s .36s var(--ease-out) forwards;
}

.hero-actions {
  display: flex; align-items: center; gap: var(--sp-16); flex-wrap: wrap; justify-content: center;
  position: relative;
  opacity: 0; animation: fadeSlideUp .7s .5s var(--ease-out) forwards;
}
.hero-actions-note {
  position: absolute; left: -14px; bottom: -34px;
  font-family: var(--font-hand); font-size: 1.25rem; color: var(--accent-dark);
  transform: rotate(-6deg); white-space: nowrap;
}

.hero-scroll-hint { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: var(--sp-24); opacity: 0; animation: fadeIn .6s 1s forwards; }
.hero-scroll-hint span { font-family: var(--font-mono); font-size: 0.6875rem; color: var(--ink-faint); }
.scroll-line { width: 1px; height: 38px; background: var(--line-strong); position: relative; overflow: hidden; }
.scroll-line::after { content: ''; position: absolute; top: -38px; left: 0; width: 1px; height: 38px; background: var(--accent); animation: scrollDrop 1.8s 1s infinite; }

/* ============================================================
   SECTION COMMON
   ============================================================ */
section { padding: var(--sp-120) 0; position: relative; }
.section-header { text-align: center; margin-bottom: var(--sp-64); }
.section-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.875rem, 4.2vw, 2.875rem); letter-spacing: -.03em;
  color: var(--ink); line-height: 1.06; margin-top: var(--sp-14);
}
.section-sub { margin-top: var(--sp-16); font-size: 1rem; color: var(--ink-soft); max-width: 520px; margin-inline: auto; line-height: 1.7; }

/* ============================================================
   WORK / CASE STUDY CARDS
   (structure preserved from the original build — image, overlay,
   view label, eyebrow, title, description, tags, arrow link —
   reskinned in the paper / pinned-to-the-board language)
   ============================================================ */
#work { background: var(--paper); padding-top: var(--sp-56); }

.projects-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-32); }
.project-card.featured { grid-column: 1 / -1; }

.project-card {
  position: relative;
  border-radius: var(--r-lg);
  overflow: visible;
  cursor: pointer;
  opacity: 1; transform: rotate(var(--tilt, 0deg));
  transition: opacity .6s var(--ease-out), transform .5s var(--ease-spring), box-shadow .3s;
}
.project-card:nth-child(odd)  { --tilt: -1.1deg; }
.project-card:nth-child(even) { --tilt: 1.1deg; }
.project-card.visible { opacity: 1; transform: translateY(0) rotate(var(--tilt)); }
.js .project-card:not(.visible) { opacity: 0; transform: translateY(28px); }
.project-card:focus-within { z-index: 2; }
@media (hover: hover) { .project-card:hover { transform: translateY(-8px) rotate(0deg); z-index: 2; } }
.project-card:active { transform: translateY(-2px) rotate(0deg) scale(.99); }

.project-card-inner {
  background: var(--card);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow .3s, border-color .3s, transform .2s ease-out;
}
.project-card:focus-within .project-card-inner { border-color: var(--accent-btn); border-style: solid; }
.project-card:hover .project-card-inner { box-shadow: var(--shadow-pop); border-color: var(--accent); border-style: solid; }

.card-pin {
  position: absolute; top: -9px; left: 28px; z-index: 3;
  width: 16px; height: 16px; border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle at 35% 30%, #ff8a5c, var(--accent-dark) 75%);
  box-shadow: 0 3px 6px rgb(var(--shadow-rgb)/.35);
}

.card-image { position: relative; overflow: hidden; aspect-ratio: 16/9; background: var(--paper-dim); }
.project-card.featured .card-image { aspect-ratio: 21/9; }
.card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease-out); filter: saturate(.96); }
.project-card:hover .card-image img { transform: scale(1.045); }

.card-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(34,30,23,.7) 0%, transparent 55%); opacity: 0; transition: opacity .3s; }
.project-card:hover .card-overlay { opacity: 1; }

.card-view-label {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(.85) rotate(-3deg);
  background: var(--paper-deep); color: var(--ink);
  font-family: var(--font-body); font-size: 0.75rem; font-weight: 600;
  padding: 8px 18px; border: 1.5px solid var(--accent-btn); border-radius: 100px;
  opacity: 0; transition: opacity .25s, transform .3s var(--ease-spring); pointer-events: none;
}
.project-card:hover .card-view-label { opacity: 1; transform: translate(-50%,-50%) scale(1) rotate(-3deg); }

.card-body { padding: var(--sp-24) var(--sp-28) var(--sp-28); }
.card-type { font-family: var(--font-mono); font-size: 0.71875rem; font-weight: 500; color: var(--accent-dark); margin-bottom: var(--sp-8); }
.card-title { font-family: var(--font-display); font-size: clamp(1.25rem, 2.4vw, 1.6875rem); font-weight: 700; letter-spacing: -.02em; color: var(--ink); margin-bottom: var(--sp-10); line-height: 1.16; }
.card-desc { font-size: 0.90625rem; color: var(--ink-soft); line-height: 1.65; }
.card-tags { list-style: none; margin-top: var(--sp-16); display: flex; flex-wrap: wrap; gap: 7px; }
.card-tag {
  font-family: var(--font-mono); font-size: 0.65625rem; font-weight: 500;
  border: 1.5px dashed var(--line-strong); color: var(--ink-soft);
  padding: 5px 12px; border-radius: 100px; transition: border-color .2s, color .2s;
}
.project-card:hover .card-tag { border-color: var(--accent); color: var(--accent-dark); }

.card-arrow { font-size: 0.8125rem; padding: 10px 18px; min-height: 44px; margin-top: var(--sp-16); gap: 8px; }
.card-arrow::after { content: ''; position: absolute; inset: 0; z-index: 1; border-radius: var(--r-lg); }
.card-arrow:hover { gap: 12px; }
.card-arrow .icn { transition: transform .25s var(--ease-spring); }
.card-arrow:hover .icn { transform: translateX(2px); }


/* ============================================================
   ABOUT
   ============================================================ */
#about {
  background: var(--panel); color: var(--on-panel);
  position: relative; overflow: hidden;
}
#about::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 55% 70% at 85% 20%, rgba(221,90,44,.18) 0%, transparent 60%),
    radial-gradient(ellipse 40% 45% at 5% 85%, rgba(14,139,120,.12) 0%, transparent 55%);
}
#about .eyebrow { color: rgba(251,246,236,.72); }
.about-inner { position: relative; z-index: 1; display: grid; grid-template-columns: 1.05fr .95fr; gap: var(--sp-80); align-items: center; }
.about-title { font-family: var(--font-display); font-size: clamp(2rem, 4.2vw, 3.125rem); font-weight: 700; letter-spacing: -.03em; color: var(--on-panel); line-height: 1.08; margin-top: var(--sp-14); }
.about-title .hand { font-family: var(--font-hand); font-weight: 600; color: var(--accent-soft); font-size: 1.16em; display: inline-block; margin-top: 4px; }
.about-body { margin-top: var(--sp-24); font-size: 1rem; color: rgba(251,246,236,.62); line-height: 1.8; }
.about-body p + p { margin-top: var(--sp-16); }
.about-body strong { color: rgba(251,246,236,.9); font-weight: 600; }

.about-skills-label { margin-top: var(--sp-24); font-size: 1rem; font-weight: 600; color: rgba(251,246,236,.9); }
.about-skills { list-style: none; margin-top: var(--sp-12); display: flex; flex-wrap: wrap; gap: 10px; }
.skill-tape {
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500;
  background: rgba(251,246,236,.07); color: rgba(251,246,236,.75);
  border: 1px solid rgba(251,246,236,.16);
  padding: 8px 15px; border-radius: 4px;
  transition: border-color .2s, color .2s, background .2s, transform .2s var(--ease-spring);
}
.skill-tape:nth-child(3n)   { transform: rotate(-1.6deg); }
.skill-tape:nth-child(3n+1) { transform: rotate(1.3deg); }
.skill-tape:hover { border-color: var(--accent); color: var(--on-panel); background: rgba(221,90,44,.18); transform: translateY(-2px) rotate(0deg); }

.about-right { position: relative; display: flex; justify-content: center; }
.about-photo-card {
  width: 100%; max-width: 340px;
  background: var(--paper); padding: 14px 14px 34px;
  border-radius: 6px; box-shadow: 0 30px 70px -20px rgba(0,0,0,.5);
  transform: rotate(3deg);
  transition: transform .4s var(--ease-spring);
}
.about-photo-card:hover { transform: rotate(0deg) translateY(-4px); }
.about-photo-img { width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: 2px; }
.about-photo-caption { margin-top: 12px; text-align: center; font-family: var(--font-hand); font-size: 1.3125rem; color: var(--ink-soft); }
.about-photo-note {
  position: absolute; top: -34px; right: 4px;
  font-family: var(--font-hand); font-size: 1.25rem; color: rgba(251,246,236,.55);
  transform: rotate(4deg);
}

/* ============================================================
   CONTACT
   ============================================================ */
#contact { background: var(--paper-dim); }
.contact-card {
  background: var(--card); border: 1.5px dashed var(--line-strong); border-radius: var(--r-xl);
  padding: var(--sp-56) var(--sp-56);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-40); flex-wrap: wrap;
  box-shadow: var(--shadow-card);
}
.contact-left .eyebrow { margin-bottom: var(--sp-14); }
.contact-left .section-title { text-align: left; margin-top: 0; }
.contact-sub { font-size: 1rem; color: var(--ink-soft); margin-top: var(--sp-14); max-width: 420px; }
.contact-actions { display: flex; gap: var(--sp-16); flex-wrap: wrap; }

/* ============================================================
   FOOTER
   ============================================================ */
footer { background: var(--panel); padding: var(--sp-40) 0; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-24); flex-wrap: wrap; }
.footer-left { font-family: var(--font-mono); font-size: 0.78125rem; color: rgba(251,246,236,.72); }
.footer-links { display: flex; gap: var(--sp-24); }
.footer-links a { padding: 12px 0; display: inline-block; font-family: var(--font-mono); font-size: 0.78125rem; color: rgba(251,246,236,.72); text-decoration: none; transition: color .2s; }
.footer-links a:hover { color: var(--on-panel); }

/* ============================================================
   KEYFRAMES
   ============================================================ */
@keyframes fadeSlideUp   { from { opacity: 0; transform: translateY(24px);} to { opacity: 1; transform: translateY(0);} }
@keyframes fadeSlideDown { from { opacity: 0; transform: translateY(-14px) rotate(-2deg);} to { opacity: 1; transform: translateY(0) rotate(-2deg);} }
@keyframes fadeIn        { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse         { 0%,100% { opacity: 1; transform: scale(1);} 50% { opacity: .45; transform: scale(.75);} }
@keyframes scrollDrop    { 0% { transform: translateY(0); opacity: 1;} 100% { transform: translateY(76px); opacity: 0;} }

.reveal { transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); }
.js .reveal:not(.visible) { opacity: 0; transform: translateY(30px); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
  .js .project-card:not(.visible), .js .reveal:not(.visible) { opacity: 1; transform: none; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1023px) {
  .container { padding: 0 var(--sp-24); }
  .projects-grid { grid-template-columns: 1fr; }
  .project-card.featured { grid-column: auto; }
  .about-inner { grid-template-columns: 1fr; gap: var(--sp-48); }
  .about-right { order: -1; }
  .hero-photo-note, .about-photo-note { display: none; }
}
@media (max-width: 767px) {
  :root { --sp-120: 68px; --sp-80: 48px; }
  #navbar { padding: var(--sp-12) var(--sp-12) 0; }
  #navbar-inner { padding-left: 16px; }
  .hero-actions-note { display: none; }
  .contact-card { flex-direction: column; align-items: flex-start; padding: var(--sp-40) var(--sp-28); }
  .contact-left .section-title { text-align: left; }
  .contact-actions { width: 100%; }
}
@media (max-width: 479px) {
  .hero-headline { letter-spacing: -.02em; }
  .hero-actions { flex-direction: column; width: 100%; }
  .btn-primary, .btn-ghost { justify-content: center; width: 100%; }
  .contact-actions { flex-direction: column; }
  .contact-actions a { justify-content: center; }
  .footer-inner { flex-direction: column; text-align: center; }
}

/* ============================================================
   RESPONSIVE ADDITIONS
   ============================================================ */
@media (max-width: 899px) {
  .nav-links, .nav-pill--ghost { display: none; }
  .nav-hamburger { display: flex; }
  #mobile-menu { display: block; }
}
@media (min-width: 1440px) { .container, #navbar-inner { max-width: 1240px; } }
@media (max-height: 700px) { .hero-scroll-hint { display: none; } }
@media (max-width: 479px) {
  :root { --sp-120: 56px; }
  .container { padding: 0 var(--sp-20); }
  .card-body { padding: var(--sp-20); }
  .contact-card { padding: var(--sp-32) var(--sp-24); }
  .section-header { margin-bottom: var(--sp-40); }
}
.img-missing img { opacity: 0; }
.card-image.img-missing { background: repeating-linear-gradient(45deg, var(--paper-dim) 0 12px, var(--card) 12px 24px); }
.card-image.img-missing::after { content: 'Image unavailable'; position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-mono); font-size: .8125rem; color: var(--ink-soft); }

/* ============================================================
   ACCESSIBILITY WIDGET (bottom-right corner)
   ============================================================ */
#a11y-widget { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 120; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
#a11y-fab { width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--ink); background: var(--card); color: var(--ink); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow-pop); transition: background .2s, color .2s; }
#a11y-fab:hover, #a11y-fab[aria-expanded="true"] { background: var(--ink); color: var(--paper); }
#a11y-panel { width: min(340px, calc(100vw - 32px)); max-height: calc(100dvh - 110px); overflow-y: auto; background: var(--card); color: var(--ink); border: 1.5px solid var(--line-strong); border-radius: var(--r-lg); padding: var(--sp-20); box-shadow: var(--shadow-pop); font-family: var(--font-body); }
#a11y-title { font-family: var(--font-display); font-size: 1.125rem; color: var(--ink); margin-bottom: var(--sp-8); }
.a11y-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 44px; padding: 8px 0; background: none; border: 0; border-bottom: 1px dashed var(--line-strong); color: var(--ink); font-size: .9375rem; text-align: left; cursor: pointer; }
.a11y-row small { display: block; margin-top: 2px; font-weight: 400; font-size: .8125rem; color: var(--ink-soft); }
.a11y-row--preset { font-weight: 600; border-bottom: 2px solid var(--ink); }
.a11y-track { position: relative; flex: none; width: 44px; height: 26px; border-radius: 99px; background: var(--ink-faint); transition: background .2s; }
.a11y-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .25s var(--ease-spring); }
[aria-checked="true"] > .a11y-track { background: var(--teal); }
[aria-checked="true"] > .a11y-track::after { transform: translateX(18px); }
.a11y-group { padding: 10px 0; border-bottom: 1px dashed var(--line-strong); font-size: .9375rem; }
.a11y-sizes { display: flex; gap: 8px; margin-top: 8px; }
.a11y-size { flex: 1; min-height: 44px; border: 1.5px solid var(--line-strong); border-radius: var(--r-sm); background: var(--card); color: var(--ink); font-weight: 600; cursor: pointer; }
.a11y-size[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.a11y-reset { margin-top: 10px; min-height: 44px; background: none; border: 0; color: var(--ink); font-size: .875rem; text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }

/* ============================================================
   ACCESSIBILITY MODES (html data attributes)
   ============================================================ */
html[data-a11y-text="1"] { font-size: 112.5%; }
html[data-a11y-text="2"] { font-size: 125%; }
html[data-a11y-contrast] { --paper-rgb:255 255 255; --accent-fill:#8f2f0e; --accent-wash:#F7DFC7; --paper-deep:#e4e4e4; --paper:#fff; --paper-dim:#f2f2f2; --card:#fff; --ink:#000; --ink-soft:#1c1812; --ink-faint:#40382a; --line:#6b5f43; --line-strong:#3d3524; --accent-btn:#8f2f0e; --accent-dark:#7a2809; --panel:#000; }
html[data-a11y-contrast] .about-body, html[data-a11y-contrast] .footer-left, html[data-a11y-contrast] .footer-links a, html[data-a11y-contrast] .skill-tape { color: #fff; }
html[data-a11y-contrast] #about .eyebrow { color: #e8dcc0; }
html[data-a11y-contrast] .skill-tape { border-color: #fff; }
html[data-a11y-contrast] .project-card-inner, html[data-a11y-contrast] .contact-card, html[data-a11y-contrast] .card-tag { border-style: solid; border-width: 2px; }
html[data-a11y-contrast] :is(.btn-primary, .btn-ghost, .nav-pill, .card-arrow, .card-view-label) { border-width: 2px; }
html[data-a11y-font] { --font-display: 'Atkinson Hyperlegible', Verdana, Tahoma, sans-serif; --font-body: 'Atkinson Hyperlegible', Verdana, Tahoma, sans-serif; --font-mono: 'Atkinson Hyperlegible', Verdana, Tahoma, sans-serif; --font-hand: 'Atkinson Hyperlegible', Verdana, Tahoma, sans-serif; }
html[data-a11y-calm] *, html[data-a11y-calm] *::before, html[data-a11y-calm] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
html[data-a11y-calm] .reveal, html[data-a11y-calm] .project-card { opacity: 1 !important; transform: none !important; }
html[data-a11y-calm] .hero-badge, html[data-a11y-calm] .hero-photo-inline, html[data-a11y-calm] .skill-tape, html[data-a11y-calm] .about-photo-card, html[data-a11y-calm] .nav-logo-mark, html[data-a11y-calm] .project-card-inner { transform: none !important; }
html[data-a11y-calm] .hero-badge, html[data-a11y-calm] .hero-sub, html[data-a11y-calm] .hero-headline, html[data-a11y-calm] .hero-actions, html[data-a11y-calm] .hero-scroll-hint { opacity: 1; }
html[data-a11y-calm] #grain, html[data-a11y-calm] .annotation, html[data-a11y-calm] .hero-photo-tape, html[data-a11y-calm] .card-pin, html[data-a11y-calm] .hero-scroll-hint { display: none; }
html[data-a11y-calm] #hero { background-image: none; }
html[data-a11y-links] a:not(.btn-primary):not(.btn-ghost):not(.nav-pill):not(.card-arrow):not(.nav-logo) { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .22em; }
html[data-a11y-space] body { line-height: 1.8; letter-spacing: .02em; word-spacing: .1em; }
html[data-a11y-space] p { max-width: 68ch; }

/* Graceful fallback while the profile photo is missing */
.hero-photo-inline{position:relative}
.hero-photo-inline.img-missing::after{content:'PJ';position:absolute;inset:6px 6px 14px;display:grid;place-items:center;background:var(--paper-dim);border-radius:2px;font-family:var(--font-display);font-weight:700;font-size:1.1rem;color:var(--ink)}
.about-photo-card.img-missing .about-photo-img{opacity:1;background:var(--paper-dim);color:transparent}


/* ============================================================
   SMALL SCREENS (down to 320px)
   ============================================================ */
.nav-logo-name { white-space: nowrap; }
@media (max-width: 399px) {
  .nav-pill--solid { display: none; }
  #navbar-inner { padding-left: 12px; }
  .nav-logo-name { font-size: 1rem; }
  .hero-sub { font-size: .96875rem; line-height: 1.65; }
  .section-title { font-size: 1.75rem; }
  .card-title { font-size: 1.1875rem; }
  .card-body { padding: var(--sp-16) var(--sp-16) var(--sp-20); }
  .about-photo-card { max-width: 100%; padding: 10px 10px 26px; }
  .about-photo-caption { font-size: 1.125rem; }
  .contact-card { padding: var(--sp-28) var(--sp-20); border-radius: var(--r-lg); }
  .footer-left { font-size: .71875rem; }
  .footer-links { gap: var(--sp-16); }
  #mobile-menu a { font-size: 1.3125rem; }
}
@media (max-width: 479px) {
  #a11y-widget { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
  #a11y-fab { width: 44px; height: 44px; }
  #a11y-fab svg { width: 22px; height: 22px; }
}

/* Graceful fallback for the missing About photo (no broken-image icon) */
.about-photo-card.img-missing { position: relative; }
.about-photo-card.img-missing .about-photo-img { opacity: 0; }
.about-photo-card.img-missing::before { content: 'PJ'; position: absolute; top: 14px; left: 14px; right: 14px; aspect-ratio: 4/5; display: grid; place-items: center; background: var(--paper-dim); border-radius: 2px; font-family: var(--font-display); font-weight: 700; font-size: 3rem; color: var(--ink); }

/* ============================================================
   TESTIMONIALS (carousel + modal) — from demo3.html, in the site's palette
   ============================================================ */
#testimonials {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--accent-fill) 0%, #8A3012 100%);
}
#testimonials::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 55% 60% at 15% 15%, rgba(255,255,255,.10) 0%, transparent 60%),
    radial-gradient(ellipse 45% 55% at 90% 85%, rgba(14,139,120,.22) 0%, transparent 60%);
}
#testimonials .container { position: relative; z-index: 1; }
#testimonials .eyebrow { color: #fff; }
#testimonials .section-title { color: #fff; }
#testimonials .section-sub { color: rgba(255,255,255,.9); }

.testimonial-carousel { position: relative; }
.testimonial-track { position: relative; width: 100%; max-width: 1040px; height: 420px; margin: 0 auto; }

.testimonial-card {
  position: absolute; top: 0; left: 50%;
  width: min(340px, 84vw);
  padding: var(--sp-48) var(--sp-24) var(--sp-24);
  background: var(--card);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  text-align: center; cursor: pointer;
  transition: transform .6s var(--ease-out), opacity .5s ease, filter .5s ease;
  will-change: transform, opacity, filter;
}
.testimonial-card:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.testimonial-quote-mark {
  position: absolute; top: 12px; left: 22px;
  font-family: var(--font-display); font-size: 46px; font-weight: 700; line-height: 1;
  color: var(--accent-wash);
}
.testimonial-avatar {
  position: relative;
  width: 76px; height: 76px; margin: 0 auto var(--sp-16);
  border-radius: 50%; border: 3px solid var(--card);
  box-shadow: 0 4px 16px rgba(34,30,23,.22);
  overflow: hidden; background: var(--paper-dim);
}
.testimonial-avatar img { width: 100%; height: 100%; object-fit: cover; }
.testimonial-avatar.img-missing img { opacity: 0; }
.testimonial-avatar.img-missing::after {
  content: attr(data-initials); position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; color: var(--ink);
}
.testimonial-name {
  font-family: var(--font-display); font-size: 1.0625rem; font-weight: 700; letter-spacing: -.01em;
  text-transform: uppercase; color: var(--accent-dark);
}
.testimonial-role { margin-top: 2px; font-family: var(--font-mono); font-size: .75rem; color: var(--ink-soft); }
.testimonial-text {
  margin-top: var(--sp-16); font-size: .875rem; line-height: 1.7; color: var(--ink-soft);
  /* a long testimonial is cut to 6 lines on the card; the full text opens in the pop-up */
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden;
}
.testimonial-card[data-slot="center"] { transform: translate(-50%, 0) scale(1); opacity: 1; filter: blur(0); z-index: 3; }
.testimonial-card[data-slot="left"], .testimonial-card[data-slot="right"] { opacity: .5; filter: blur(2.5px); z-index: 1; pointer-events: none; }
.testimonial-card[data-slot="left"]  { transform: translate(calc(-50% - 300px), 0) scale(.86); }
.testimonial-card[data-slot="right"] { transform: translate(calc(-50% + 300px), 0) scale(.86); }

.carousel-nav {
  position: absolute; top: 50%; z-index: 10; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--card); border: none; display: grid; place-items: center; cursor: pointer;
  font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; color: var(--ink); line-height: 1;
  box-shadow: 0 10px 28px rgba(34,30,23,.3);
  transition: background-color .2s ease;
}
.carousel-nav-prev { left: var(--sp-8); }
.carousel-nav-next { right: var(--sp-8); }
.carousel-nav:hover { background: var(--accent-wash); }
.carousel-nav:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.testimonial-dots { display: flex; align-items: center; justify-content: center; gap: var(--sp-4); margin-top: var(--sp-32); }
.testimonial-dot {
  /* 24px tap area around a small visible dot */
  position: relative; width: 24px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer;
}
.testimonial-dot::before {
  content: ''; position: absolute; top: 50%; left: 50%; width: 9px; height: 9px; transform: translate(-50%, -50%);
  border-radius: 100px; background: rgba(255,255,255,.45); transition: background-color .25s, width .25s;
}
.testimonial-dot.is-active::before { background: #fff; width: 26px; }
.testimonial-dot:hover::before { background: rgba(255,255,255,.8); }
.testimonial-dot:focus-visible { outline: 3px solid #fff; outline-offset: 0; border-radius: 8px; }

@media (max-width: 1023px) {
  .testimonial-track { height: 400px; }
  .testimonial-card { width: min(300px, 78vw); }
  .testimonial-card[data-slot="left"]  { transform: translate(calc(-50% - 220px), 0) scale(.84); }
  .testimonial-card[data-slot="right"] { transform: translate(calc(-50% + 220px), 0) scale(.84); }
}
@media (max-width: 767px) {
  .testimonial-track { height: 390px; }
  .testimonial-card { width: min(272px, 72vw); padding: var(--sp-40) var(--sp-20) var(--sp-20); }
  .testimonial-card[data-slot="left"], .testimonial-card[data-slot="right"] { opacity: 0; filter: none; }
  .testimonial-card[data-slot="left"]  { transform: translate(calc(-50% - 100vw), 0) scale(1); }
  .testimonial-card[data-slot="right"] { transform: translate(calc(-50% + 100vw), 0) scale(1); }
  /* arrows sit on either side of the dots so they never cover the card on a narrow screen */
  .carousel-nav { top: calc(100% + 18px); transform: none; width: 44px; height: 44px; font-size: 1.0625rem; }
  .carousel-nav-prev { left: calc(50% - 98px); }
  .carousel-nav-next { right: calc(50% - 98px); }
  .testimonial-dots { margin-top: var(--sp-32); min-height: 44px; }
  .testimonial-modal-panel { cursor: pointer; } /* on small screens a tap anywhere also closes it */
}
@media (max-width: 399px) {
  .testimonial-card { width: min(272px, 76vw); }
}

.testimonial-modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: var(--sp-24);
  background: rgba(34,30,23,.62);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden;
  transition: opacity .3s ease, visibility 0s linear .3s;
}
.testimonial-modal.is-open { opacity: 1; visibility: visible; transition: opacity .3s ease, visibility 0s linear 0s; }
.testimonial-modal-panel {
  position: relative; width: min(520px, 100%); max-height: 84vh; max-height: 84dvh; overflow-y: auto;
  background: var(--card); border: 1.5px dashed var(--line-strong); border-radius: var(--r-xl);
  padding: var(--sp-48) var(--sp-32) var(--sp-32); text-align: center;
  box-shadow: var(--shadow-pop);
  transform: translateY(24px) scale(.96); transition: transform .35s var(--ease-out);
}
.testimonial-modal-panel:focus { outline: none; }
.testimonial-modal.is-open .testimonial-modal-panel { transform: translateY(0) scale(1); }
.testimonial-modal-close {
  position: absolute; top: var(--sp-16); right: var(--sp-16);
  width: 44px; height: 44px; border-radius: 50%;
  border: 1.5px solid var(--line-strong); background: var(--card);
  font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; color: var(--ink); line-height: 1;
  display: grid; place-items: center; cursor: pointer;
  transition: border-color .2s, background-color .2s;
}
.testimonial-modal-close:hover { border-color: var(--accent-btn); background: var(--accent-wash); }
.testimonial-modal-quote { display: block; font-family: var(--font-display); font-size: 56px; font-weight: 700; line-height: 1; color: var(--accent-wash); }
.testimonial-modal-avatar {
  width: 96px; height: 96px; margin: var(--sp-8) auto var(--sp-16);
  border-radius: 50%; overflow: hidden; border: 3px solid var(--card);
  box-shadow: 0 6px 20px rgba(34,30,23,.2); background: var(--paper-dim);
}
.testimonial-modal-avatar img { width: 100%; height: 100%; object-fit: cover; }
.testimonial-modal-name { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; text-transform: uppercase; color: var(--accent-dark); }
.testimonial-modal-role { margin-top: 2px; font-family: var(--font-mono); font-size: .8125rem; color: var(--ink-soft); }
.testimonial-modal-text { margin-top: var(--sp-20); font-size: .96875rem; line-height: 1.8; color: var(--ink-soft); text-align: left; }
@media (max-width: 399px) {
  .testimonial-modal { padding: var(--sp-16); }
  .testimonial-modal-panel { padding: var(--sp-40) var(--sp-20) var(--sp-24); border-radius: var(--r-lg); }
}

/* ============================================================
   PHOTO GALLERY (zigzag, hover / tap to focus)
   ============================================================ */
#gallery { background: var(--paper); }
.gallery-strip { display: flex; align-items: center; justify-content: center; gap: 4px; padding: var(--sp-40) 0 var(--sp-24); }
.gallery-item {
  position: relative; flex: 1 1 200px; max-width: 220px; aspect-ratio: 3/4;
  background: var(--card); border: 5px solid var(--card); border-radius: var(--r-sm);
  overflow: hidden; box-shadow: var(--shadow-card); cursor: pointer;
  transition: transform .45s var(--ease-out), box-shadow .45s var(--ease-out), opacity .4s ease;
  will-change: transform;
}
.gallery-item:nth-child(odd)  { transform: translateY(-18px) rotate(-3deg); }
.gallery-item:nth-child(even) { transform: translateY(18px) rotate(3deg); }
.gallery-item img {
  width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(1) contrast(1.02); transform: scale(1.02);
  transition: filter .45s ease, transform .45s var(--ease-out);
}
.gallery-item.img-missing { background: repeating-linear-gradient(45deg, var(--paper-dim) 0 12px, var(--card) 12px 24px); }
.gallery-item.img-missing img { opacity: 0; }
.gallery-strip.has-active .gallery-item { opacity: .45; }
.gallery-item.is-active {
  opacity: 1 !important; z-index: 5;
  transform: translateY(-10px) rotate(0deg) scale(1.12) !important;
  box-shadow: var(--shadow-pop);
}
.gallery-item.is-active img { filter: grayscale(0) contrast(1.05); transform: scale(1.06); }
.gallery-item:focus-visible { outline: 3px solid var(--accent-btn); outline-offset: 4px; z-index: 6; }
.gallery-caption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 12px;
  background: linear-gradient(to top, rgba(34,30,23,.85) 0%, transparent 100%);
  color: #fff; font-family: var(--font-display); font-size: .8125rem; font-weight: 700; text-align: center; line-height: 1.25;
  opacity: 0; transform: translateY(6px);
  transition: opacity .3s ease, transform .3s var(--ease-out); pointer-events: none;
}
.gallery-item.is-active .gallery-caption { opacity: 1; transform: translateY(0); }

@media (max-width: 1023px) {
  /* two frames per row, all the way down to 320px */
  .gallery-strip { flex-wrap: wrap; row-gap: 28px; column-gap: 12px; }
  .gallery-item { flex: 1 1 40%; max-width: 45%; }
  .gallery-item:nth-child(odd)  { transform: translateY(-8px) rotate(-3deg); }
  .gallery-item:nth-child(even) { transform: translateY(8px) rotate(3deg); }
}
@media (max-width: 479px) {
  .gallery-strip { padding-top: var(--sp-24); row-gap: 24px; column-gap: 10px; }
  .gallery-item { flex: 1 1 42%; max-width: 46%; border-width: 4px; }
  .gallery-caption { font-size: .75rem; padding: 18px 6px 8px; }
}

/* accessibility panel: calm layout / high contrast */
html[data-a11y-calm] .gallery-item,
html[data-a11y-calm] .gallery-item:nth-child(odd),
html[data-a11y-calm] .gallery-item:nth-child(even) { transform: none !important; }
html[data-a11y-calm] #testimonials::before { display: none; }
html[data-a11y-contrast] #testimonials { background: #000; }
html[data-a11y-contrast] .testimonial-card, html[data-a11y-contrast] .testimonial-modal-panel { border-style: solid; border-width: 2px; }

/* ============================================================
   THEME TOGGLE (sun / moon) — sits in the navbar, next to the menu button
   ============================================================ */
.theme-toggle {
  position: relative; flex: none; width: 44px; height: 44px; padding: 0;
  display: grid; place-items: center; cursor: pointer;
  border: 1.5px solid var(--accent-btn); border-radius: 50%;
  background: transparent; color: var(--ink);
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.theme-toggle:hover { background: var(--paper-deep); }
.theme-toggle svg {
  grid-area: 1 / 1; width: 20px; height: 20px;
  transition: transform .5s var(--ease-spring), opacity .25s ease;
}
.theme-toggle .icon-sun  { opacity: 0; transform: rotate(-90deg) scale(.5); }
.theme-toggle .icon-moon { opacity: 1; transform: none; }
html[data-theme="dark"] .theme-toggle .icon-sun  { opacity: 1; transform: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(.5); }
html[data-a11y-contrast] .theme-toggle { border-width: 2px; }

/* brief colour cross-fade while the theme flips (class is added and removed by js/site.js) */
html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
  transition: background-color .35s ease, color .35s ease, border-color .35s ease, fill .35s ease, stroke .35s ease;
}

/* ============================================================
   DARK THEME — html[data-theme="dark"]
   Same warm paper palette, re-lit: darkest surface is the page, cards sit one
   step lighter, text is warm off-white (never pure white), accents are lifted
   and slightly desaturated so they hold 4.5:1+ on every surface.
   Light/dark is chosen by prefers-color-scheme on first visit, then by the toggle.
   ============================================================ */
html[data-theme="dark"] {
  color-scheme: dark;
  --paper:       #17140F;
  --paper-dim:   #1E1A14;
  --card:        #26211A;
  --panel:       #0F0D0A;
  --panel-2:     #14110D;
  --paper-deep:  #30291F;

  --ink:         #EFE8DA;
  --ink-soft:    #B9AF9C;
  --ink-faint:   #A0957F;
  --line:        #342E24;
  --line-strong: #52493A;

  --accent:      #EC7A4E;
  --accent-dark: #F3996F;
  --accent-btn:  #F0875C;
  --accent-fill: #B8441B;
  --accent-wash: #3B2518;
  --on-accent:   #FFFFFF;
  --teal:        #3DBFA9;
  --paper-rgb:   23 20 15;
  --shadow-rgb:  0 0 0;
}
html[data-theme="dark"][data-a11y-contrast] {
  --paper:#000; --paper-dim:#0B0B0B; --card:#000; --panel:#000; --paper-deep:#262626; --paper-rgb:0 0 0;
  --ink:#fff; --ink-soft:#F2EDE0; --ink-faint:#D8D0BC; --line:#C9BE9F; --line-strong:#E8DFC4;
  --accent:#FFA77F; --accent-dark:#FFB794; --accent-btn:#FFA77F; --accent-fill:#8f2f0e; --accent-wash:#3B2518;
}
/* surfaces that are always "paper" (polaroids) stay light so photos keep their frame */
html[data-theme="dark"] .about-photo-card { background: #EFE8DA; }
html[data-theme="dark"] .about-photo-caption { color: #675F50; }
html[data-theme="dark"] :is(.cs-main img, .testimonial-avatar img, .testimonial-modal-avatar img) { filter: brightness(.9); }
/* texture and imagery */
html[data-theme="dark"] #grain { opacity: .22; mix-blend-mode: screen; }
html[data-theme="dark"] .card-image img { filter: saturate(.94) brightness(.9); }
html[data-theme="dark"] :is(.cs-main img, .hero-photo-inline img, .testimonial-avatar img, .testimonial-modal-avatar img) { filter: brightness(.9); }
html[data-theme="dark"] .gallery-item img { filter: grayscale(1) contrast(1.02) brightness(.92); }
html[data-theme="dark"] .gallery-item.is-active img { filter: grayscale(0) contrast(1.05) brightness(.95); }
html[data-theme="dark"] .testimonial-modal { background: rgba(0,0,0,.72); }
html[data-theme="dark"] #about, html[data-theme="dark"] footer { border-top: 1px solid var(--line); }
html[data-theme="dark"][data-a11y-calm] #grain { display: none; }


.a11y-heading{margin:14px 0 2px;font-size:.75rem;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--ink-soft)}
.a11y-section+.a11y-section .a11y-heading{margin-top:18px}
