/* Dr. Ashley Pursglove — site shell */
:root {
  --bg-0: #06080d;
  --bg-1: #0b0f16;
  --bg-elevated: rgba(16, 22, 32, 0.88);
  --bg-glass: rgba(10, 14, 22, 0.72);
  --stroke: rgba(148, 163, 184, 0.12);
  --accent: #2dd4bf;
  --accent-hot: #5eead4;
  --accent-muted: #7eb8b0;
  --accent-dim: #115e59;
  --warn: #f59e0b;
  --text: #e8edf4;
  --text-muted: #8b9cb3;
  --text-subtle: #6b7c90;
  --link: #94d4ce;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.22);
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --header-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-stack: calc(var(--header-h) + var(--safe-top));
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html.nav-open {
  overflow: hidden;
  height: 100%;
}

html.nav-open body {
  overflow: hidden;
  touch-action: none;
  height: 100%;
  position: relative;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .nav-mobile,
  .nav-backdrop {
    transition: none;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.62;
  color: var(--text);
  -webkit-user-select: none;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg-0);
  background-image:
    radial-gradient(ellipse 100% 70% at 50% -15%, rgba(45, 212, 191, 0.045), transparent 55%),
    radial-gradient(ellipse 70% 45% at 100% 40%, rgba(17, 94, 89, 0.05), transparent 50%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.02'/%3E%3C/svg%3E");
  z-index: 0;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.2s var(--ease-out);
}

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

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 9999;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--bg-0);
  font-weight: 600;
  border-radius: 8px;
  transition: top 0.2s;
}

.skip-link:focus {
  top: max(16px, env(safe-area-inset-top, 0px));
  left: max(16px, env(safe-area-inset-left, 0px));
}

input,
textarea,
[contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
}

/* —— Site header —— */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  min-height: var(--header-stack);
  height: var(--header-stack);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--safe-top) max(var(--safe-right), clamp(12px, 4vw, 40px)) 0
    max(var(--safe-left), clamp(12px, 4vw, 40px));
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--stroke);
  transition: background 0.3s, border-color 0.3s;
}

.site-header.is-scrolled {
  background: rgba(6, 8, 13, 0.94);
  border-bottom-color: rgba(148, 163, 184, 0.1);
}

.nav-desktop {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-desktop a {
  padding: 10px 18px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 0.2s, background 0.2s;
}

.nav-desktop a:hover,
.nav-desktop a[aria-current="page"] {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.nav-toggle svg {
  width: 22px;
  height: 22px;
}

.nav-mobile {
  display: none;
  position: fixed;
  top: var(--header-stack);
  left: 0;
  right: 0;
  padding: 12px max(16px, var(--safe-right)) max(20px, var(--safe-bottom))
    max(16px, var(--safe-left));
  background: rgba(6, 8, 13, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--stroke);
  flex-direction: column;
  gap: 2px;
  z-index: 99;
  max-height: calc(100vh - var(--header-stack));
  max-height: calc(100dvh - var(--header-stack));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s var(--ease-out);
}

.nav-mobile.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.nav-mobile a {
  padding: 14px 18px;
  min-height: 48px;
  display: flex;
  align-items: center;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9375rem;
  letter-spacing: 0.02em;
  -webkit-tap-highlight-color: rgba(45, 212, 191, 0.12);
}

.nav-mobile a:hover,
.nav-mobile a:active {
  background: rgba(255, 255, 255, 0.05);
}

.nav-mobile a[aria-current="page"] {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

/* Dim page behind open mobile menu (tap to close) */
.nav-backdrop {
  position: fixed;
  top: var(--header-stack);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 98;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s var(--ease-out), visibility 0.25s;
  -webkit-tap-highlight-color: transparent;
}

.nav-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

@media (max-width: 900px) {
  .site-header {
    justify-content: flex-end;
  }

  .nav-desktop {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-mobile {
    display: flex;
  }
}

/* —— Main layout —— */
main {
  position: relative;
  z-index: 1;
  padding-top: var(--header-stack);
}

/* —— Hero (home) —— */
.hero {
  position: relative;
  min-height: calc(100vh - var(--header-stack));
  min-height: calc(100dvh - var(--header-stack));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-canvas-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
}

#hero-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hero-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(45, 212, 191, 0.15), transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(15, 118, 110, 0.2), transparent 45%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s;
}

.hero-fallback.is-visible {
  opacity: 1;
}

.hero-video-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.35;
  object-fit: cover;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero-gradient {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, transparent 0%, rgba(7, 10, 15, 0.4) 50%, var(--bg-0) 100%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 920px;
  padding: clamp(28px, 7vw, 80px) max(clamp(18px, 4vw, 40px), env(safe-area-inset-right, 0px))
    clamp(24px, 6vw, 48px) max(clamp(18px, 4vw, 40px), env(safe-area-inset-left, 0px));
  text-align: center;
}

.hero-kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-muted);
  margin-bottom: 1.1rem;
  opacity: 0;
  animation: fadeUp 0.8s var(--ease-out) 0.1s forwards;
}

.hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.35rem, 5.5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.08;
  opacity: 0;
  animation: fadeUp 0.8s var(--ease-out) 0.2s forwards;
}

.hero-lead {
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  color: var(--text-muted);
  font-weight: 400;
  max-width: 38ch;
  margin: 0 auto 2.25rem;
  line-height: 1.58;
  opacity: 0;
  animation: fadeUp 0.8s var(--ease-out) 0.35s forwards;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  opacity: 0;
  animation: fadeUp 0.8s var(--ease-out) 0.5s forwards;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-kicker,
  .hero h1,
  .hero-lead,
  .hero-actions {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .hero-video-fallback {
    display: none;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.03em;
  text-decoration: none;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn-primary {
  background: linear-gradient(165deg, #134e4a 0%, var(--accent-dim) 40%, #0d9488 100%);
  color: #f0fdf9;
  box-shadow: var(--shadow-soft), 0 0 0 1px rgba(45, 212, 191, 0.12);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(45, 212, 191, 0.2);
  color: #fff;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid var(--stroke);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(148, 163, 184, 0.22);
  color: var(--text);
}

/* —— Page hero (inner pages) —— */
.page-hero {
  padding: clamp(40px, 8vw, 88px) max(clamp(18px, 4vw, 40px), env(safe-area-inset-right, 0px))
    clamp(24px, 5vw, 48px) max(clamp(18px, 4vw, 40px), env(safe-area-inset-left, 0px));
  text-align: center;
  border-bottom: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 65%);
}

.page-hero h1 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.85rem, 4vw, 2.65rem);
  font-weight: 700;
  letter-spacing: -0.032em;
  line-height: 1.15;
}

.page-hero p {
  margin: 0 auto;
  max-width: 48ch;
  color: var(--text-muted);
  font-size: 1.0625rem;
  line-height: 1.58;
}

/* —— Sections —— */
.section {
  padding: clamp(48px, 7vw, 100px) max(clamp(18px, 4vw, 40px), env(safe-area-inset-right, 0px))
    clamp(48px, 7vw, 100px) max(clamp(18px, 4vw, 40px), env(safe-area-inset-left, 0px));
  max-width: 1200px;
  margin: 0 auto;
}

.section-head {
  margin-bottom: clamp(28px, 4vw, 48px);
}

.section-head h2 {
  margin: 0 0 0.55rem;
  font-size: clamp(1.4rem, 2.8vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.section-head p {
  margin: 0;
  color: var(--text-muted);
  max-width: 55ch;
}

.section-head p + p {
  margin-top: 0.85em;
}

/* —— Stats strip —— */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 148px), 1fr));
  gap: 12px 14px;
  margin-top: -40px;
  position: relative;
  z-index: 3;
  padding: 0 max(clamp(18px, 4vw, 40px), env(safe-area-inset-right, 0px)) 40px
    max(clamp(18px, 4vw, 40px), env(safe-area-inset-left, 0px));
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  text-align: center;
  backdrop-filter: blur(12px);
  transition: border-color 0.25s, box-shadow 0.25s var(--ease-out);
}

.stat-card:hover {
  border-color: rgba(148, 163, 184, 0.2);
  box-shadow: var(--shadow-soft);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: clamp(1.4rem, 2.8vw, 1.72rem);
  font-weight: 600;
  color: var(--text);
  display: block;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-top: 10px;
  line-height: 1.45;
}

/* —— Feature grid (home) —— */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 18px;
}

.feature-card {
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  padding: 26px 26px 28px;
  transition: border-color 0.25s, box-shadow 0.3s var(--ease-out);
}

.feature-card:hover {
  border-color: rgba(148, 163, 184, 0.18);
  box-shadow: var(--shadow-soft);
}

.feature-card h3 {
  margin: 0 0 0.65rem;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.feature-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.58;
}

.feature-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke);
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  color: var(--accent-muted);
}

/* —— D3 containers —— */
.viz-wrap {
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  padding: clamp(16px, 3vw, 28px);
  margin-bottom: 48px;
  overflow: hidden;
}

.viz-wrap h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.viz-caption {
  margin: 0 0 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

#d3-skills {
  width: 100%;
  min-height: 420px;
  display: block;
}

/* About: full-viewport bubble field */
body.page-about-bubbles {
  overflow: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}

body.page-about-bubbles main.about-bubbles-main {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--header-stack));
  min-height: calc(100dvh - var(--header-stack));
  padding-left: 0;
  padding-right: 0;
  padding-bottom: 0;
}

body.page-about-bubbles #d3-skills.about-bubbles-viz {
  min-height: 0;
  width: 100%;
  flex: 1;
  touch-action: none;
}

/* Motion-sensor gravity prompt (About page, mobile / tablet) */
.tilt-gravity-prompt {
  position: fixed;
  z-index: 200;
  left: 50%;
  top: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  width: min(360px, calc(100vw - 32px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  max-width: 100%;
  padding: 18px 18px;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  text-align: center;
  transition: opacity 0.55s ease;
  box-sizing: border-box;
}

.tilt-gravity-prompt--fadeout {
  opacity: 0;
  pointer-events: none;
}

.tilt-gravity-prompt__text {
  margin: 0 0 12px;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.tilt-gravity-prompt__btn {
  appearance: none;
  border: none;
  cursor: pointer;
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #f0fdf9;
  background: linear-gradient(165deg, #134e4a 0%, var(--accent-dim) 40%, #0d9488 100%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  -webkit-tap-highlight-color: transparent;
}

.tilt-gravity-prompt__btn:active {
  opacity: 0.92;
}

/* Mobile / coarse-pointer layout (class from app.js) */
html.is-touch .btn {
  min-height: 44px;
  -webkit-tap-highlight-color: rgba(45, 212, 191, 0.12);
}

html.is-touch .portfolio-card-inner button.collapsible-new {
  min-height: 44px;
}

html.is-touch .nav-desktop a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

html.is-narrow-phone .hero-actions {
  flex-direction: column;
  width: 100%;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

html.is-narrow-phone .hero-actions .btn {
  width: 100%;
}

html.is-mobile-layout .portfolio-filters {
  gap: 8px;
}

html.is-mobile-layout .filter-btn {
  min-height: 44px;
  padding: 10px 16px;
}

@media (max-width: 900px) {
  .portfolio-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    gap: 8px;
    padding: 4px 0 12px;
    margin-left: calc(-1 * max(clamp(18px, 4vw, 40px), env(safe-area-inset-left, 0px)));
    margin-right: calc(-1 * max(clamp(18px, 4vw, 40px), env(safe-area-inset-right, 0px)));
    padding-left: max(clamp(18px, 4vw, 40px), env(safe-area-inset-left, 0px));
    padding-right: max(clamp(18px, 4vw, 40px), env(safe-area-inset-right, 0px));
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }

  .portfolio-filters::-webkit-scrollbar {
    display: none;
  }

  .portfolio-filters .filter-btn {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .portfolio-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .exp-card summary {
    min-height: 56px;
    padding: 16px max(16px, env(safe-area-inset-right, 0px)) 16px
      max(16px, env(safe-area-inset-left, 0px));
    gap: 14px;
  }

  .exp-card-logo {
    width: 56px;
    height: 56px;
  }

}

.viz-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.viz-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.viz-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

/* —— Timeline list (experience cards) —— */
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.exp-card {
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.25s;
}

.exp-card:hover {
  border-color: rgba(148, 163, 184, 0.16);
}

.exp-card summary {
  list-style: none;
  cursor: pointer;
  padding: 22px 26px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
}

.exp-card summary::-webkit-details-marker {
  display: none;
}

.exp-card summary::after {
  content: "";
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  justify-self: end;
  transition: transform 0.25s;
}

.exp-card[open] summary::after {
  transform: rotate(-135deg);
}

.exp-card-logo {
  width: 68px;
  height: 68px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  padding: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.exp-card-meta h3 {
  margin: 0 0 4px;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.exp-card-meta .role {
  color: var(--accent-muted);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
}

.exp-card-meta .dates {
  color: var(--text-subtle);
  font-size: 0.8125rem;
  margin-top: 5px;
}

.exp-card-body {
  padding: 0 26px 26px 26px;
  border-top: 1px solid var(--stroke);
  color: var(--text-muted);
  font-size: 0.96875rem;
  line-height: 1.62;
}

.exp-card-body p {
  margin: 0 0 1em;
}

.exp-card-body p:last-child {
  margin-bottom: 0;
}

/* —— Portfolio —— */
.portfolio-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}

.filter-btn {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-color: rgba(148, 163, 184, 0.22);
}

.filter-btn.is-active {
  background: rgba(45, 212, 191, 0.07);
  color: var(--text);
  border-color: rgba(94, 234, 212, 0.22);
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.portfolio-card {
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s, border-color 0.25s;
}

.portfolio-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-soft);
  border-color: rgba(148, 163, 184, 0.18);
}

.portfolio-card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-1);
}

.portfolio-card-media:not(:has(img)) {
  background:
    linear-gradient(145deg, rgba(45, 212, 191, 0.12) 0%, transparent 45%),
    linear-gradient(225deg, rgba(15, 118, 110, 0.15) 0%, var(--bg-1) 100%);
}

.portfolio-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease-out);
}

.portfolio-card:hover .portfolio-card-media img {
  transform: scale(1.03);
}

.portfolio-card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(6, 8, 13, 0.88);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.portfolio-card-inner {
  padding: 20px 22px 22px;
}

.portfolio-card-inner h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.45;
}

.portfolio-card-inner .collapsible-wrap {
  border: none;
  padding: 0;
  margin: 0;
}

.portfolio-card-inner button.collapsible-new {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke);
  color: var(--text-muted);
  padding: 11px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.portfolio-card-inner button.collapsible-new:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(148, 163, 184, 0.2);
  color: var(--text);
}

.portfolio-card-inner .content-new {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s var(--ease-out);
}

.portfolio-card-inner .content-new-inner {
  padding-top: 14px;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.62;
}

.portfolio-card-inner .content-new-inner p {
  margin: 0 0 0.85em;
}

.portfolio-card-inner .content-new-inner p:last-child {
  margin-bottom: 0;
}

.portfolio-card.is-hidden {
  display: none;
}

/* —— About chips (below D3) —— */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke);
  font-size: 0.88rem;
  color: var(--text-muted);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.chip:hover {
  border-color: rgba(148, 163, 184, 0.22);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

/* —— CV —— */
.cv-layout {
  max-width: 1000px;
  margin: 0 auto;
  padding: clamp(32px, 5vw, 56px) max(clamp(18px, 4vw, 40px), env(safe-area-inset-right, 0px))
    clamp(32px, 5vw, 56px) max(clamp(18px, 4vw, 40px), env(safe-area-inset-left, 0px));
}

.cv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 32px;
}

.cv-frame {
  border-radius: var(--radius-lg);
  border: 1px solid var(--stroke);
  overflow: hidden;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-soft);
}

.cv-frame img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

/* —— Contact —— */
.contact-section {
  border-top: 1px solid var(--stroke);
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.015));
}

.contact-inner {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
  padding: clamp(48px, 7vw, 92px) max(20px, env(safe-area-inset-right, 0px))
    max(clamp(40px, 8vw, 64px), env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
}

.contact-inner h2 {
  margin: 0 0 14px;
  font-size: clamp(1.5rem, 2.8vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.025em;
}

.contact-inner > p {
  color: var(--text-muted);
  margin: 0 0 28px;
  font-size: 1.0625rem;
  line-height: 1.58;
}

.social-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  align-items: center;
}

.social-row a.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.social-row a.icon-link:hover {
  transform: translateY(-1px);
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: var(--shadow-soft);
}

.social-row a.icon-link img {
  width: 28px;
  height: auto;
  max-height: 28px;
  object-fit: contain;
}

.email-cta {
  display: inline-block;
  margin-bottom: 26px;
  font-size: clamp(0.98rem, 1.8vw, 1.125rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  word-break: break-all;
}

/* —— Footer —— */
.site-footer {
  padding: 28px max(24px, env(safe-area-inset-right, 0px)) max(32px, env(safe-area-inset-bottom, 0px))
    max(24px, env(safe-area-inset-left, 0px));
  text-align: center;
  color: var(--text-subtle);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  border-top: 1px solid var(--stroke);
}

.site-footer p {
  margin: 0;
}

/* —— Reveal on scroll —— */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.55s var(--ease-out), transform 0.55s var(--ease-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

/* —— Back link row —— */
.toolbar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px clamp(20px, 4vw, 40px) 0;
}

/* Legacy video section (subpages) — hide old full-bleed video pattern */
.legacy-video-section {
  display: none;
}
