/* ---------------------------------------------------------
   Design tokens
--------------------------------------------------------- */
:root {
  --bg: #f5f6ec;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --border: #dce3cf;
  --text: #202417;
  --text-muted: #52604a;
  --accent: #3f6b34;
  --accent-contrast: #ffffff;
  --accent-soft: #e6eeda;
  --focus-ring: #7fa863;

  --leaf-1: #3f6b34;
  --leaf-2: #6b8e4e;
  --leaf-3: #9fb98a;
  --leaf-vein: rgba(32, 36, 23, 0.4);

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --max-width: 1080px;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 15, 0.05), 0 8px 24px rgba(20, 30, 15, 0.08);

  color-scheme: light;
}

/* Custom properties that script.js sets while the page runs (so they are not defined above):
   --p scroll progress, --tl timeline fill, --d reveal delay, --rx / --ry mockup tilt,
   --mx / --my card spotlight position, --hx / --hy hero pointer offset. */

:root[data-theme="dark"] {
  --bg: #12160e;
  --bg-alt: #181d12;
  --surface: #1d2317;
  --border: #313b24;
  --text: #eff3e6;
  --text-muted: #b7c2a8;
  --accent: #92cb77;
  --accent-contrast: #10160b;
  --accent-soft: #26311c;
  --focus-ring: #92cb77;

  --leaf-1: #4c7a3d;
  --leaf-2: #6e9450;
  --leaf-3: #8faf6e;
  --leaf-vein: rgba(255, 255, 255, 0.22);

  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12160e;
    --bg-alt: #181d12;
    --surface: #1d2317;
    --border: #313b24;
    --text: #eff3e6;
    --text-muted: #b7c2a8;
    --accent: #92cb77;
    --accent-contrast: #10160b;
    --accent-soft: #26311c;
    --focus-ring: #92cb77;

    --leaf-1: #4c7a3d;
    --leaf-2: #6e9450;
    --leaf-3: #8faf6e;
    --leaf-vein: rgba(255, 255, 255, 0.22);

    color-scheme: dark;
  }
}

/* ---------------------------------------------------------
   Reset & base
--------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

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

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

/* <picture> wrappers (WebP with a JPEG fallback) must not change the layout. */
picture { display: contents; }
picture > source { display: none; }

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

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
p { margin: 0 0 1em; }

ul { margin: 0; padding: 0; list-style: none; }

/* Text for screen readers only (visually hidden) */
.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;
}

/* The SVG sprite that holds the shared leaf shape takes no space. */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.wrap {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 24px;
}

/* Focus visibility (WCAG 2.4.7 / 2.4.11) */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 10px 16px;
  border-radius: 8px;
  z-index: 1000;
  transition: top 0.2s ease;
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* ---------------------------------------------------------
   Header / nav
--------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg-alt) 92%, transparent);
  -webkit-backdrop-filter: blur(8px); /* Safari before 18 */
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.25s ease; /* fades in the shadow once the page is scrolled */
  view-transition-name: site-header; /* keeps the header still during page-to-page transitions */
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px; /* taller tap area; the width is left alone so the nav stays centered */
  font-weight: 800;
  font-size: 1.25rem;
  text-decoration: none;
  color: var(--text);
  letter-spacing: -0.02em;
}
.brand-dot { color: var(--accent); }

.site-nav ul {
  display: flex;
  gap: 28px;
}

.site-nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 24px;
  min-height: 24px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.icon-btn:hover { background: var(--accent-soft); }

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }

.nav-toggle { display: none; }

.mobile-nav {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  /* On a short screen (phone held sideways) the menu scrolls instead of running off the bottom */
  max-height: calc(100vh - 70px);
  max-height: calc(100dvh - 70px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.mobile-nav ul { padding: 12px 24px 20px; display: flex; flex-direction: column; gap: 4px; }
.mobile-nav a {
  display: block;
  padding: 12px 4px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  min-height: 24px;
}
.mobile-nav[data-open="true"] { display: block; }
@media (min-width: 861px) { .mobile-nav { display: none !important; } }

@media (max-width: 860px) {
  .site-nav { display: none; }
  .nav-toggle { display: inline-flex; }
}

/* ---------------------------------------------------------
   Decorative leaves (organic, inline SVG — no external assets)
--------------------------------------------------------- */
.leaf-cluster {
  position: absolute;
  width: clamp(170px, 26vw, 320px);
  aspect-ratio: 1 / 1;
  pointer-events: none;
  z-index: 0;
}
.leaf-cluster--tl { top: -12%; left: -6%; }
.leaf-cluster--tr { top: -12%; right: -6%; transform: scaleX(-1); }
.leaf-cluster--bl { bottom: -14%; left: -6%; transform: scaleY(-1); }
.leaf-cluster--br { bottom: -14%; right: -6%; transform: scale(-1, -1); }

.leaf-cluster--small {
  width: clamp(120px, 16vw, 200px);
}

.leaf { position: absolute; aspect-ratio: 100 / 140; }
.leaf-p1 { top: -6%; left: -4%; width: 52%; transform: rotate(-18deg); opacity: 0.95; }
.leaf-p2 { top: 8%; left: 32%; width: 40%; transform: rotate(14deg); opacity: 0.9; }
.leaf-p3 { top: 30%; left: -6%; width: 36%; transform: rotate(-42deg); opacity: 0.82; }
.leaf-p4 { top: 0%; left: 58%; width: 32%; transform: rotate(30deg); opacity: 0.78; }
.leaf-p5 { top: 42%; left: 20%; width: 28%; transform: rotate(-4deg); opacity: 0.7; }

.leaf-blade { fill: var(--leaf-fill, var(--leaf-1)); }
.leaf-vein { fill: none; stroke: var(--leaf-vein); stroke-width: 1.6; stroke-linecap: round; }

.leaf-tone-1 { --leaf-fill: var(--leaf-1); }
.leaf-tone-2 { --leaf-fill: var(--leaf-2); }
.leaf-tone-3 { --leaf-fill: var(--leaf-3); }

.heading-leaf {
  width: 20px;
  aspect-ratio: 100 / 140;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .leaf-cluster { width: clamp(120px, 34vw, 200px); }
}

/* ---------------------------------------------------------
   Hero
--------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: 96px 72px;
  text-align: center;
}
.hero-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }

/* Headshot in a leaf-shaped crop */
.hero-avatar {
  width: 152px;
  height: 152px;
  margin-bottom: 24px;
  overflow: hidden;
  background: var(--accent-soft);
  border-radius: 10% 64%; /* leaf shape: two opposite rounded corners */
  box-shadow: 0 0 0 4px var(--accent), 0 22px 44px -20px rgba(0, 0, 0, 0.65);
}
.hero-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
@media (max-width: 600px) { .hero-avatar { width: 128px; height: 128px; } }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 12px;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.hero-lede {
  max-width: 620px;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.hero-cta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}

/* ---------------------------------------------------------
   Buttons
--------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.95rem;
  border: 1px solid transparent;
  min-height: 24px;
  max-width: 100%;
  overflow-wrap: anywhere; /* a long label (the email address) wraps rather than overflowing small screens */
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
}
.btn .icon { flex-shrink: 0; } /* keep the icon full size when the label wraps */
.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}
.btn-primary:hover { opacity: 0.9; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface); }
.btn-lg { padding: 14px 26px; font-size: 1rem; }

/* ---------------------------------------------------------
   Sections
--------------------------------------------------------- */
.section { padding-block: 72px; }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--border); }

.section h2 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.section-index {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.section-note { color: var(--text-muted); max-width: 620px; margin-bottom: 28px; }

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 40px;
  align-items: start;
}
.about-copy { color: var(--text-muted); font-size: 1.05rem; max-width: 640px; }
.competency-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.competency-list li {
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.92rem;
}

@media (max-width: 760px) {
  .about-grid { grid-template-columns: 1fr; }
}

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
}
.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.skill-card h3 { font-size: 1rem; margin-bottom: 14px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  background: var(--accent-soft);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
}
.tag-note { font-weight: 400; color: var(--text-muted); }

/* Projects */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 24px;
}
/* Two columns on wide screens. An odd last card sits centered on its own row instead of hugging the left. */
@media (min-width: 900px) {
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-grid > .project-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - 12px);
  }
}
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
  overflow: hidden; /* clips the mockup banner to the card's rounded corners */
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.project-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 10px;
}
.project-card h3 { font-size: 1.2rem; }
.project-date { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 14px; }
.project-links {
  margin-top: 16px;
  margin-bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}
.project-links a {
  font-weight: 700;
  text-decoration: none;
}
.project-links a:hover,
.project-links a:focus-visible { text-decoration: underline; }

/* Timeline (Education & Experience) */
.timeline {
  list-style: none;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 36px;
  padding-left: 28px;
  border-left: 2px solid var(--border);
}
.timeline-item { position: relative; }
.timeline-marker {
  position: absolute;
  left: -34px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
}
.timeline-date {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.timeline-content h3 { font-size: 1.15rem; margin-bottom: 2px; }
.timeline-org { color: var(--text-muted); font-weight: 600; margin-bottom: 10px; }
.timeline-content ul { display: flex; flex-direction: column; gap: 6px; }
.timeline-content ul li {
  position: relative;
  padding-left: 18px;
  color: var(--text-muted);
}
.timeline-content ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
}
.timeline-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 8px;
}

/* Contact */
.contact-wrap { text-align: center; }
.contact-wrap .section-note { margin-inline: auto; }
.contact-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 18px;
}
.contact-location { color: var(--text-muted); margin-top: 18px; }

/* Footer */
.site-footer {
  position: relative;
  overflow: hidden;
  border-top: 1px solid var(--border);
  padding-block: 28px;
}
.footer-inner {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.back-to-top { color: var(--text-muted); text-decoration: none; font-weight: 600; }
.back-to-top:hover { color: var(--accent); }

/* ---------------------------------------------------------
   Scroll reveal (progressive enhancement, safe default = visible)
--------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.is-visible { opacity: 1; transform: none; }

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

/* ---------------------------------------------------------
   Case-study pages
--------------------------------------------------------- */
.breadcrumb { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 14px; }
.breadcrumb a { color: var(--text-muted); display: inline-flex; align-items: center; min-height: 24px; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb [aria-current] { color: var(--text); font-weight: 600; }

.case-hero { padding-block: 56px 40px; }
.case-hero h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}
.case-lede { color: var(--text-muted); font-size: 1.15rem; max-width: 720px; }

.case-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin: 28px 0 22px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.case-meta dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2px;
}
.case-meta dd { margin: 0; font-weight: 600; }

.case-figure { margin: 0; }
.case-figure img {
  width: 100%;
  max-width: 799px; /* the screenshot's real width: larger would look blurry */
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.case-figure figcaption { color: var(--text-muted); font-size: 0.9rem; margin-top: 10px; }

.case-body { max-width: 760px; }
.case-body h2 { display: block; font-size: 1.5rem; margin: 44px 0 14px; }
.case-body h2:first-child { margin-top: 0; }
.case-body p { color: var(--text-muted); }
.case-body ul { display: flex; flex-direction: column; gap: 12px; margin-bottom: 1em; }
.case-body li { position: relative; padding-left: 20px; color: var(--text-muted); }
.case-body li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.case-body li strong { color: var(--text); }

.case-nav { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.case-nav a {
  display: block;
  flex: 1 1 260px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
}
.case-nav a:hover, .case-nav a:focus-visible { border-color: var(--accent); }
.case-nav small {
  display: block;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
  margin-bottom: 2px;
}
.case-nav .case-next { text-align: right; }

.project-card .case-link { font-weight: 700; }

/* ---------------------------------------------------------
   Skills-across-projects matrix (built by script.js)
--------------------------------------------------------- */
.skill-matrix { margin-top: 56px; }
.skill-matrix h3 { font-size: 1.3rem; margin-bottom: 6px; }
.skill-matrix .section-note { margin-bottom: 18px; }

.matrix-scroll {
  position: relative;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.matrix { width: 100%; min-width: 880px; border-collapse: collapse; } /* nine project columns: scroll sideways on small screens */
.matrix th, .matrix td { padding: 10px 6px; border-bottom: 1px solid var(--border); text-align: center; }
.matrix tbody tr:last-child th, .matrix tbody tr:last-child td { border-bottom: 0; }
.matrix thead th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--accent-soft);
}
.matrix thead th:first-child, .matrix tbody th { text-align: left; }
.matrix tbody th { font-weight: 600; padding: 4px 8px; }

.matrix-skill {
  width: 100%;
  text-align: left;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 7px 8px;
  cursor: pointer;
}
.matrix-skill:hover { background: var(--accent-soft); }
.matrix-skill[aria-pressed="true"] { background: var(--accent); color: var(--accent-contrast); }

.matrix-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--border);
}
.matrix-cell.is-on .matrix-dot { background: var(--accent); border-color: var(--accent); }
.matrix-cell.is-dim { opacity: 0.3; }
.matrix tr.is-active { background: var(--accent-soft); }

.matrix-total { white-space: nowrap; text-align: left; }
.matrix-bar {
  display: inline-block;
  vertical-align: middle;
  width: 56px;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  margin-right: 8px;
}
.matrix-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.matrix-count { color: var(--text-muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }

.matrix-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; margin-top: 14px; }
.matrix-status { margin: 0; color: var(--text-muted); font-size: 0.92rem; }
.matrix-reset { padding: 8px 16px; }

.matrix-reset[hidden] { display: none; }

/* ---------------------------------------------------------
   Contact form (opens the visitor's email app)
--------------------------------------------------------- */
.contact-form {
  max-width: 520px;
  margin: 8px auto 28px;
  padding: 24px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.contact-form h3 { font-size: 1.15rem; margin-bottom: 6px; }
.form-help { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 18px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 0.92rem; margin-bottom: 6px; }
.field-note { font-weight: 400; color: var(--text-muted); }
.field input,
.field textarea {
  display: block;
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
}
.field textarea { resize: vertical; min-height: 120px; }
.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] { border-color: #a4262c; border-color: light-dark(#a4262c, #ff9e9a); }

.form-error {
  color: #a4262c;
  color: light-dark(#a4262c, #ff9e9a);
  font-weight: 600;
  margin-bottom: 14px;
}
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.form-status { color: var(--text-muted); font-size: 0.92rem; margin: 14px 0 0; min-height: 1.4em; }

/* ---------------------------------------------------------
   Hero "Now" line and cross-page transitions
--------------------------------------------------------- */
.hero-now {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  margin: 30px 0 0;
  padding: 10px 18px;
  font-size: 0.92rem;
  text-align: left;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.hero-now strong { color: var(--text); }
.hero-now a { font-weight: 600; }
.now-date { white-space: nowrap; }
.now-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}
.is-live .now-dot { animation: now-pulse 2.4s ease-out infinite; }
@keyframes now-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  70%, 100% { box-shadow: 0 0 0 10px transparent; }
}
@media (max-width: 600px) {
  .hero-now { border-radius: var(--radius); }
}

@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.25s; }
}

/* ---------------------------------------------------------
   Hover effects, scroll progress bar, and entrance animations.
   Anything that moves on its own is wrapped in
   prefers-reduced-motion: no-preference.
--------------------------------------------------------- */
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 20px -14px rgba(20, 30, 15, 0.55); }
.btn:active { transform: none; box-shadow: none; }

.project-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 2px 4px rgba(20, 30, 15, 0.05), 0 18px 36px -14px rgba(20, 30, 15, 0.22); }
.skill-card:hover { transform: translateY(-3px); border-color: var(--accent); }

.site-header.is-scrolled { box-shadow: 0 10px 28px -22px rgba(20, 30, 15, 0.55); }

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 200;
  pointer-events: none;
  transform-origin: 0 50%;
  transform: scaleX(var(--p, 0));
  background: var(--accent);
}

@media (prefers-reduced-motion: no-preference) {
  .hero-inner > * { animation: pf-rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .hero-inner > :nth-child(2) { animation-delay: 0.06s; }
  .hero-inner > :nth-child(3) { animation-delay: 0.12s; }
  .hero-inner > :nth-child(4) { animation-delay: 0.2s; }
  .hero-inner > :nth-child(5) { animation-delay: 0.28s; }
  .hero-inner > :nth-child(6) { animation-delay: 0.36s; }
  .hero-inner > :nth-child(7) { animation-delay: 0.44s; }
  .hero-inner > :nth-child(8) { animation-delay: 0.52s; }
  @keyframes pf-rise {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
  }

  /* Slow, small sway on the decorative leaves. Uses the separate `rotate` and
     `translate` properties so it does not fight the layout transforms. */
  .is-live .leaf-cluster { animation: pf-sway 16s ease-in-out infinite alternate; }
  .is-live .leaf-cluster--tr { animation-duration: 19s; animation-delay: -4s; }
  .is-live .leaf-cluster--bl { animation-duration: 21s; animation-delay: -7s; }
  .is-live .leaf-cluster--br { animation-duration: 18s; animation-delay: -2s; }
  @keyframes pf-sway {
    from { rotate: -1.6deg; scale: 1; }
    to { rotate: 1.6deg; scale: 1.04; }
  }

  .reveal { transition-delay: var(--d, 0s); }
}

/* ---------------------------------------------------------
   Project mockups (desktop + phone) at the top of each card
--------------------------------------------------------- */
.device-stage {
  position: relative;
  margin: -26px -26px 22px;
  padding: 24px 24px 38px;
  background: linear-gradient(160deg, var(--accent-soft), var(--bg));
  border-bottom: 1px solid var(--border);
  perspective: 900px;
}
.device-rig {
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.35s ease-out;
}
.device-rig.is-tilting { transition: transform 0.08s linear; }
.browser {
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 24px 36px -26px rgba(0, 0, 0, 0.6);
}
.browser-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
  font-size: 0.66rem;
  color: var(--text-muted);
}
.browser-bar i { display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--leaf-1); }
.browser-bar i:nth-child(2) { background: var(--leaf-2); }
.browser-bar i:nth-child(3) { background: var(--leaf-3); }
.browser-bar span {
  flex: 1;
  margin-left: 6px;
  padding: 2px 10px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: var(--bg);
  border-radius: 999px;
}
.browser img { width: 100%; height: auto; }
.phone {
  position: absolute;
  right: -4px;
  bottom: -18px;
  width: 26%;
  overflow: hidden;
  border: 4px solid #1b2014;
  border-radius: 15px;
  background: #1b2014;
  box-shadow: 0 20px 28px -14px rgba(0, 0, 0, 0.6);
  transform: translateZ(44px);
}
.phone img { width: 100%; height: auto; border-radius: 10px; }

/* Cards without a desktop screenshot: three phones side by side (TripNest), or the app icon on the same tinted stage. */
.device-stage--phones {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding-bottom: 28px;
}
.device-stage--phones .phone {
  position: static;
  width: 30%;
  max-width: 150px;
  transform: none;
}
.device-stage--icon {
  display: flex;
  justify-content: center;
  padding-block: 28px;
}
.device-stage--icon img {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  box-shadow: 0 14px 24px -14px rgba(0, 0, 0, 0.55);
}

/* ---------------------------------------------------------
   At-a-glance strip under the hero
--------------------------------------------------------- */
.glance {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
  max-width: 920px;
  margin: 34px 0 0;
  text-align: left;
}
.glance li {
  padding: 16px 18px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.glance strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--accent);
}
.glance span { display: block; font-size: 0.86rem; line-height: 1.45; color: var(--text-muted); }
@media (max-width: 760px) {
  .glance { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 28px; }
}

/* ---------------------------------------------------------
   Timeline: scroll-filled line and role filter
--------------------------------------------------------- */
.timeline::after {
  content: "";
  position: absolute;
  top: 0;
  left: -2px;
  width: 2px;
  height: calc(var(--tl, 0) * 100%);
  background: var(--accent);
  pointer-events: none;
}

.role-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.role-chip {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.role-chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.role-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.role-status { margin: 0 0 26px; min-height: 1.4em; color: var(--text-muted); font-size: 0.92rem; }

/* ---------------------------------------------------------
   Cursor spotlight on cards (mouse and trackpad only)
--------------------------------------------------------- */
@media (hover: hover) and (pointer: fine) {
  .project-card, .skill-card, .glance li { position: relative; }
  .project-card::after,
  .skill-card::after,
  .glance li::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 15%, transparent), transparent 64%);
    transition: opacity 0.3s ease;
  }
  .project-card:hover::after,
  .skill-card:hover::after,
  .glance li:hover::after { opacity: 1; }
}

/* ---------------------------------------------------------
   Skills ticker (a static wrapped list unless JS enables it)
--------------------------------------------------------- */
.marquee {
  position: relative;
  padding: 16px 0;
  background: var(--bg-alt);
  border-block: 1px solid var(--border);
  overflow: hidden;
}
.marquee-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 28px;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 24px;
}
.marquee-list li {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.marquee-list li::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

.marquee.is-ticker {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}
.marquee.is-ticker .marquee-inner {
  display: flex;
  width: max-content;
}
.is-live .marquee.is-ticker .marquee-inner { animation: marquee-scroll 55s linear infinite; }
.marquee.is-ticker .marquee-list {
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 0 28px;
  max-width: none;
  margin: 0;
  padding: 0 28px 0 0;
}
.marquee.is-ticker:hover .marquee-inner,
.marquee.is-ticker:focus-within .marquee-inner,
.marquee.is-ticker.is-paused .marquee-inner { animation-play-state: paused; }
@keyframes marquee-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.marquee-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}
.marquee-toggle:hover { border-color: var(--accent); color: var(--text); }

/* ---------------------------------------------------------
   Hero: rotating focus line, pointer-reactive leaves, photo glow
--------------------------------------------------------- */
.hero-focus { margin: -4px 0 14px; font-size: 1.05rem; font-weight: 600; color: var(--text-muted); }
.hero-focus .rotator-clip { display: inline-block; height: 1.5em; line-height: 1.5; overflow: hidden; vertical-align: bottom; }
.hero-focus .rotator { display: block; color: var(--accent); transition: transform 0.22s ease; }
.hero-focus .rotator.is-out { transform: translateY(-110%); }
.hero-focus .rotator.is-pre { transform: translateY(110%); transition: none; }

@media (prefers-reduced-motion: no-preference) {
  .hero .leaf-cluster {
    translate: calc(var(--hx, 0) * var(--depth, 14px)) calc(var(--hy, 0) * var(--depth, 14px));
    transition: translate 0.6s ease-out;
  }
  .hero .leaf-cluster--tl { --depth: 18px; }
  .hero .leaf-cluster--tr { --depth: 26px; }

  .hero-avatar { animation: pf-rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .is-live .hero-avatar { animation: pf-glow 4.5s ease-in-out 3; }
  @keyframes pf-glow {
    0%, 100% { box-shadow: 0 0 0 4px var(--accent), 0 22px 44px -20px rgba(0, 0, 0, 0.65), 0 0 0 0 transparent; }
    50% { box-shadow: 0 0 0 4px var(--accent), 0 22px 44px -20px rgba(0, 0, 0, 0.65), 0 0 34px 6px color-mix(in srgb, var(--accent) 38%, transparent); }
  }
}

/* ---------------------------------------------------------
   Accent color picker (green is the default and needs no attribute)
--------------------------------------------------------- */
:root[data-accent="terracotta"] {
  --accent: #a8492b; --accent-contrast: #ffffff; --accent-soft: #f3e1d8; --focus-ring: #c4693f;
  --leaf-1: #a8492b; --leaf-2: #c4693f; --leaf-3: #e0a67d;
}
:root[data-accent="blue"] {
  --accent: #2c5f8a; --accent-contrast: #ffffff; --accent-soft: #dde9f3; --focus-ring: #4f86b3;
  --leaf-1: #2c5f8a; --leaf-2: #4f86b3; --leaf-3: #9dbfdc;
}
:root[data-accent="terracotta"][data-theme="dark"] {
  --accent: #e8946f; --accent-contrast: #1c0f08; --accent-soft: #3a2218; --focus-ring: #e8946f;
  --leaf-1: #9a4a2c; --leaf-2: #b8683f; --leaf-3: #d9a57d;
}
:root[data-accent="blue"][data-theme="dark"] {
  --accent: #7fb4e6; --accent-contrast: #0b1520; --accent-soft: #1c2a3a; --focus-ring: #7fb4e6;
  --leaf-1: #3a6b95; --leaf-2: #5a8fba; --leaf-3: #8fb5d6;
}
@media (prefers-color-scheme: dark) {
  :root[data-accent="terracotta"]:not([data-theme="light"]) {
    --accent: #e8946f; --accent-contrast: #1c0f08; --accent-soft: #3a2218; --focus-ring: #e8946f;
    --leaf-1: #9a4a2c; --leaf-2: #b8683f; --leaf-3: #d9a57d;
  }
  :root[data-accent="blue"]:not([data-theme="light"]) {
    --accent: #7fb4e6; --accent-contrast: #0b1520; --accent-soft: #1c2a3a; --focus-ring: #7fb4e6;
    --leaf-1: #3a6b95; --leaf-2: #5a8fba; --leaf-3: #8fb5d6;
  }
}

.accent-picker { position: relative; }
.accent-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 300;
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.accent-menu[hidden] { display: none; }
.accent-swatch {
  position: relative;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.accent-swatch span { position: absolute; inset: 3px; border-radius: 50%; background: var(--sw); }
.accent-swatch[data-accent="green"] span { --sw: #3f6b34; }
.accent-swatch[data-accent="terracotta"] span { --sw: #a8492b; }
.accent-swatch[data-accent="blue"] span { --sw: #2c5f8a; }
.accent-swatch[aria-pressed="true"] { border-color: var(--text); }
.accent-swatch:hover { transform: scale(1.08); }

/* ---------------------------------------------------------
   Project previews: looping screenshot frames in the mockups
--------------------------------------------------------- */
.browser-screen { position: relative; line-height: 0; }
.browser-screen .frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.8s ease;
}
.browser-screen .frame.is-on { opacity: 1; }

/* ---------------------------------------------------------
   404 page
--------------------------------------------------------- */
.not-found { text-align: center; padding-block: 120px; }
.not-found h1 { font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -0.03em; }
.not-found-text { color: var(--text-muted); max-width: 520px; margin-inline: auto; }

/* ---------------------------------------------------------
   Windows high-contrast ("forced colors") mode. The system replaces background colors, so
   anything that was shown only by a fill gets a system-color fill or border instead.
--------------------------------------------------------- */
@media (forced-colors: active) {
  .hero-avatar { border: 4px solid CanvasText; } /* the colored ring is a box-shadow, which is dropped */
  .timeline-content ul li::before,
  .case-body li::before,
  .marquee-list li::after,
  .now-dot,
  .timeline::after,
  .matrix-fill,
  .matrix-cell.is-on .matrix-dot { background: CanvasText; } /* a filled dot means "used" */
  .scroll-progress { background: Highlight; }
  .matrix-bar,
  .tag,
  .timeline-badge { border: 1px solid CanvasText; }
  .matrix tr.is-active { outline: 2px solid Highlight; outline-offset: -2px; }
  /* Selected filter chips, skills, and accent swatches */
  .matrix-skill[aria-pressed="true"],
  .role-chip[aria-pressed="true"] {
    forced-color-adjust: none; /* use the matched Highlight / HighlightText pair so the label stays readable */
    background: Highlight;
    color: HighlightText;
    border-color: Highlight;
  }
  .accent-swatch[aria-pressed="true"] { border-color: Highlight; }
  .accent-swatch span { forced-color-adjust: none; } /* the swatch IS the color sample */
}

/* ---------------------------------------------------------
   Print. The "Download Résumé" button calls window.print(), so the page turns into a
   clean, single-column, ink-friendly résumé whatever theme is active.
--------------------------------------------------------- */
@media print {
  @page { margin: 0.6in; }

  /* Hidden on paper: navigation, decoration, and controls that do nothing in print */
  .no-print,
  .site-header,
  .leaf-cluster,
  .heading-leaf,
  .hero-cta,
  .hero-avatar,
  .hero-now,
  .eyebrow,
  .skip-link,
  .glance,
  .marquee,
  .accent-picker,
  .device-stage,
  .skill-matrix,
  .role-filters,
  .role-status,
  .timeline::after,
  .case-nav,
  .breadcrumb,
  .project-card::after,
  .skill-card::after,
  .glance li::after,
  .site-footer .footer-inner .back-to-top {
    display: none !important;
  }

  /* Scroll-reveal fades must not leave unseen sections blank on paper */
  .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  /* Plain black on white */
  html, body {
    background: #ffffff !important;
    color: #111111 !important;
  }

  .section, .section-alt, .hero {
    background: transparent !important;
    border: none !important;
    padding-block: 14px !important;
  }

  .hero { text-align: left; padding-top: 0 !important; }
  .hero-lede { color: #222222 !important; max-width: none; }

  a { color: #111111 !important; text-decoration: underline; }

  .section h2 {
    color: #111111 !important;
    border-bottom: 1px solid #999999;
    padding-bottom: 4px;
  }
  .section-index { color: #444444 !important; }

  /* Grids become stacked blocks; cards lose their fills and never split across pages */
  .about-grid,
  .skills-grid,
  .project-grid {
    display: block !important;
  }
  .competency-list { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .competency-list li,
  .skill-card,
  .project-card {
    background: transparent !important;
    border: 1px solid #cccccc !important;
    box-shadow: none !important;
    break-inside: avoid;
  }

  /* Experience: show every role, even ones the on-screen filter has hidden */
  .timeline { border-left-color: #999999 !important; }
  .timeline-marker { background: #111111 !important; border-color: #ffffff !important; }
  .timeline-item { break-inside: avoid; }
  .timeline-item[hidden] { display: block !important; }

  /* Projects the on-screen skill filter hid are printed too */
  .project-card[hidden] { display: block !important; }

  .tag { background: transparent !important; border: 1px solid #cccccc !important; color: #111111 !important; }
  .btn { border: 1px solid #999999 !important; color: #111111 !important; background: transparent !important; }
  .contact-wrap { text-align: left; }
}
