/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
  --bg: #fbf5ec;
  --bg-elevated: #f6ead7;
  --surface: #fffcf6;
  --surface-hover: #fff6e6;
  --border: #e9d7bc;
  --border-soft: #f0e1c9;

  --text: #33281c;
  --text-muted: #7a6752;
  --text-faint: #a2907a;

  --accent: #d9662b;
  --accent-strong: #b8451b;
  --accent-soft: rgba(217, 102, 43, 0.12);
  --accent2: #c9971f;
  --accent2-soft: rgba(201, 151, 31, 0.14);
  --accent-ink: #fff8ef;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-lg: 0 20px 50px -22px rgba(120, 72, 30, 0.28);
  --shadow-md: 0 10px 26px -14px rgba(120, 72, 30, 0.22);

  --container: 1180px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60vw 40vw at 85% -10%, rgba(217, 102, 43, 0.08), transparent 60%),
    radial-gradient(50vw 40vw at 0% 10%, rgba(201, 151, 31, 0.07), transparent 55%);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 { font-weight: 650; letter-spacing: -0.02em; margin: 0; }
p { margin: 0; color: var(--text-muted); }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 28px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-strong);
}
.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ==========================================================================
   Nav
   ========================================================================== */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(251, 245, 236, 0.82);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border-soft);
}

.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  font-weight: 700;
  font-size: 15.5px;
  color: var(--text);
}
.brand span {
  font-weight: 500;
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-links a {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-links a:hover { color: var(--text); background: var(--surface); }
.nav-links a.active { color: var(--bg); background: var(--accent); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-soft);
    padding: 10px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 14px; }
}

/* ==========================================================================
   Buttons / tags
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { transform: translateY(-1px); background: var(--accent-strong); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-strong); }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  font-family: var(--font-mono);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* ==========================================================================
   Hero (home)
   ========================================================================== */
.hero {
  padding: 96px 0 64px;
  border-bottom: 1px solid var(--border-soft);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 56px;
  align-items: start;
}
.hero h1 {
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.08;
  margin: 18px 0 20px;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .lede {
  max-width: 62ch;
  font-size: 17.5px;
  color: var(--text-muted);
}
.hero .lede + .lede {
  margin-top: 14px;
}
.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  flex-wrap: wrap;
}
.hero-photo {
  position: sticky;
  top: 28px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  aspect-ratio: 9 / 16;
}
.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.skill-groups {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border-soft);
}
.skill-group .group-label {
  display: block;
  margin-bottom: 10px;
}
.skill-group .tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 760px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .hero-photo {
    position: static;
    max-width: 260px;
  }
}

/* ==========================================================================
   Project grid (home)
   ========================================================================== */
.section { padding: 72px 0; }
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 36px;
  gap: 20px;
  flex-wrap: wrap;
}
.section-head h2 { font-size: 28px; }

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}
@media (max-width: 820px) {
  .project-grid { grid-template-columns: 1fr; }
}

.project-card {
  position: relative;
  display: block;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(160deg, var(--surface), var(--bg-elevated));
  padding: 30px;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  min-height: 240px;
  display: flex;
  flex-direction: column;
}
.project-card:hover {
  transform: translateY(-4px);
  border-color: rgba(217, 102, 43, 0.4);
  box-shadow: var(--shadow-lg);
}
.project-card .card-index {
  font-family: var(--font-mono);
  color: var(--text-faint);
  font-size: 13px;
}
.project-card h3 {
  font-size: 21px;
  margin: 14px 0 10px;
}
.project-card p { font-size: 14.5px; }
.project-card .tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 20px;
}
.project-card .card-arrow {
  position: absolute;
  top: 26px;
  right: 26px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s ease;
}
.project-card:hover .card-arrow {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  transform: rotate(45deg);
}
.project-card.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* ==========================================================================
   Project page
   ========================================================================== */
.project-hero {
  padding: 56px 0 44px;
  border-bottom: 1px solid var(--border-soft);
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-faint);
  margin-bottom: 22px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent-strong); }

.project-hero h1 {
  font-size: clamp(28px, 4vw, 42px);
  max-width: 22ch;
  margin-bottom: 16px;
}
.project-hero .lede {
  max-width: 68ch;
  font-size: 16.5px;
}
.project-hero .tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.meta-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 40px;
}
.meta-strip .cell {
  background: var(--bg-elevated);
  padding: 18px 20px;
}
.meta-strip .cell .k {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-family: var(--font-mono);
}
.meta-strip .cell .v {
  margin-top: 6px;
  font-size: 14.5px;
  color: var(--text);
  font-weight: 500;
}
@media (max-width: 700px) {
  .meta-strip { grid-template-columns: repeat(2, 1fr); }
}

.prose { max-width: 74ch; }
.prose p { font-size: 15.5px; color: var(--text-muted); margin-bottom: 16px; }
.prose p:last-child { margin-bottom: 0; }
.prose ul { padding-left: 20px; color: var(--text-muted); font-size: 15.5px; }
.prose li { margin-bottom: 8px; }
.prose strong { color: var(--text); font-weight: 600; }
.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--accent-strong);
}

/* Background & Motivation — short, bold, reads like an annotation */
.story { max-width: 62ch; }
.story p {
  font-size: 22px;
  line-height: 1.5;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Secondary bold annotation — technical process notes under a section heading */
.annotate { max-width: 66ch; margin-bottom: 26px; }
.annotate p {
  font-size: 18px;
  line-height: 1.55;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.005em;
}

.block-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.block-title .num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-strong);
  border: 1px solid var(--border);
  background: var(--surface);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.block-title h2 { font-size: 22px; }

/* ---- Map explorer ---- */
.map-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.map-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}
.control-group { display: flex; flex-direction: column; gap: 8px; }
.control-group .label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}
.pill-group {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.pill-group button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-sans);
}
.pill-group button.active { background: var(--accent); color: var(--accent-ink); }
.pill-group button:hover:not(.active) { color: var(--text); }

.county-select {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.county-select button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13.5px;
  padding: 7px 13px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-sans);
}
.county-select button.active {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--accent-soft);
}
.county-select button:hover:not(.active) { border-color: var(--text-faint); color: var(--text); }

.map-frame-wrap {
  position: relative;
  height: 640px;
  background: #f5f3ee;
}
.map-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-elevated);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 13px;
  transition: opacity 0.25s ease;
}
.map-loading .spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.map-loading.hidden { opacity: 0; pointer-events: none; }

.map-footnote {
  padding: 14px 20px;
  font-size: 13px;
  color: var(--text-faint);
  border-top: 1px solid var(--border-soft);
  font-family: var(--font-mono);
}

@media (max-width: 700px) {
  .map-frame-wrap { height: 460px; }
}

/* ---- Image gallery: swipeable carousel ---- */
.gallery-group { margin-bottom: 40px; }
.gallery-group:last-child { margin-bottom: 0; }
.group-label {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 14px;
}

.carousel {
  position: relative;
  --carousel-h: 560px;
}
.carousel-viewport {
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.carousel-track {
  display: flex;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.carousel-slide {
  flex: 0 0 100%;
  min-width: 0;
  margin: 0;
}
.carousel-slide .frame {
  height: var(--carousel-h);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  padding: 28px;
}
.carousel-slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: zoom-in;
  border-radius: 6px;
}
.carousel-slide video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  background: #000;
}
.carousel-slide figcaption {
  padding: 13px 22px;
  font-size: 13.5px;
  color: var(--text-faint);
  background: var(--surface);
  border-top: 1px solid var(--border-soft);
}

.carousel-arrow {
  position: absolute;
  top: calc(var(--carousel-h) / 2);
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 252, 246, 0.92);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  z-index: 2;
}
.carousel-arrow:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.carousel-arrow.prev { left: 16px; }
.carousel-arrow.next { right: 16px; }
.carousel[data-single] .carousel-arrow { display: none; }

.carousel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px 0;
}
.carousel-counter {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
}
.carousel-dots { display: flex; gap: 6px; }
.carousel-dots button {
  width: 7px;
  height: 7px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: all 0.15s ease;
}
.carousel-dots button.active { background: var(--accent); width: 20px; border-radius: 4px; }

@media (max-width: 700px) {
  .carousel { --carousel-h: 340px; }
  .carousel-slide .frame { padding: 16px; }
  .carousel-arrow { width: 36px; height: 36px; font-size: 17px; }
}

/* ---- Takeaway ---- */
.takeaway {
  margin-top: 28px;
  padding-left: 20px;
  border-left: 3px solid var(--accent);
  max-width: 68ch;
}
.takeaway .k {
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-strong);
  display: block;
  margin-bottom: 6px;
}
.takeaway p { font-size: 15.5px; color: var(--text); margin: 0; }

/* ---- Lightbox ---- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(43, 33, 22, 0.82);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px;
  cursor: zoom-out;
}
.lightbox-overlay.open { display: flex; }
.lightbox-overlay img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
}
.lightbox-close {
  position: absolute;
  top: 24px;
  right: 28px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.placeholder-note {
  border: 1px dashed rgba(201, 151, 31, 0.5);
  background: var(--accent2-soft);
  color: #8a6412;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  font-family: var(--font-mono);
  margin-bottom: 20px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border-soft);
  padding: 40px 0;
  margin-top: 40px;
}
.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.site-footer p { font-size: 13px; color: var(--text-faint); }
.footer-links { display: flex; gap: 18px; }
.footer-links a { font-size: 13.5px; color: var(--text-muted); }
.footer-links a:hover { color: var(--accent-strong); }
