/*
 * 8pt GRID SYSTEM - InLine Access Studio
 * All spacing (margin, padding, gap) must use multiples of 8:
 *   8, 16, 24, 32, 40, 48, 64, 80, 120
 * When adding or editing margin/padding/gap, default to the nearest
 * multiple of 8 unless explicitly specified otherwise.
 */

:root {
  --max-width: 960px;
  --radius-s: 6px;
  --radius-m: 10px;
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.08);

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", sans-serif;

  --fs-xs: 0.8rem;
  --fs-s: 0.9rem;
  --fs-m: 1rem;
  --fs-l: 1.4rem;
  --fs-xl: 2rem;

  --bg: #f7f7f9;
  --bg-elevated: #fff;
  --bg-subtle: #f1f3f7;

  --text: #111827;
  --text-muted: #4b5563;

  --border-subtle: #e5e7eb;

  --accent: #4c6fff;
  --accent-soft: rgba(76, 111, 255, 0.06);
  --accent-dark: #3a55d2;

  --link: #2563eb;
}

:root.dark {
  --bg: #050816;
  --bg-elevated: #0b1020;
  --bg-subtle: #111827;
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --border-subtle: #1f2933;
  --accent: #7c8cff;
  --accent-soft: rgba(124, 140, 255, 0.12);
  --accent-dark: #5a6ae8;
  --link: #93c5fd;
}

:root.environment {
  --bg: #f0f7f0;
  --bg-elevated: #ffffff;
  --bg-subtle: #e8f5e8;
  --text: #1a3a1a;
  --text-muted: #2d4a2d;
  --border-subtle: #c8e0c8;
  --accent: #2d7a2d;
  --accent-soft: rgba(45, 122, 45, 0.08);
  --accent-dark: #1f5a1f;
  --link: #1f5a1f;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

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

html, body {
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  position: relative;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  z-index: 1000;
  padding: 1rem 1.5rem;
  background: var(--accent-dark);
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  border-radius: 0 0 4px 0;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.link-disabled {
  color: var(--text-muted);
  opacity: 0.6;
  cursor: not-allowed;
  text-decoration: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(
      circle at 30% 20%,
      rgba(76, 111, 255, 0.035),
      transparent 60%
    ),
    radial-gradient(
      circle at 80% 70%,
      rgba(15, 20, 40, 0.06),
      transparent 70%
    );
}

:root.environment body::before {
  background:
    radial-gradient(
      circle at 30% 20%,
      rgba(45, 122, 45, 0.04),
      transparent 60%
    ),
    radial-gradient(
      circle at 80% 70%,
      rgba(34, 85, 34, 0.05),
      transparent 70%
    );
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP88OHDfwAJ+wP7rZWSdQAAAABJRU5ErkJggg==");
  opacity: 0.08;
}

a {
  color: inherit;
  text-decoration: none !important;
}

main {
  flex: 1;
  width: min(calc(100% - 2rem), var(--max-width));
  margin-inline: auto;
  padding-block: 40px;
  contain: layout;
}

#main-content {
  contain: layout;
}

@media (max-width: 640px) {
  main {
    min-height: 900px;
  }
  
  #main-content {
    min-height: 900px;
    contain: layout;
  }
  
  section {
    contain: layout;
  }
}

section {
  padding-block: 120px;
  margin-bottom: 0;
}

/* Header: 8pt grid, 32px vertical, 48px horizontal */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 32px 48px;
  min-height: 64px;
  contain: layout;
  transition: border-color 0.25s ease, background-color 0.22s ease, backdrop-filter 0.22s ease;
}

:root.dark .site-header {
  background: rgba(5, 8, 22, 0.9);
}

:root.environment .site-header {
  background: rgba(240, 247, 240, 0.9);
}

.site-header.scrolled {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

:root.dark .site-header.scrolled {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.28);
}

.site-header .nav {
  width: min(calc(100% - 2rem), var(--max-width));
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav .logo {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: none;
  white-space: nowrap;
}

.nav ul {
  list-style: none;
  display: flex;
  gap: 32px;
  padding: 0;
  margin: 0;
}

.nav li a {
  opacity: 0;
  transform: translateY(-4px);
  position: relative;
  animation: fadeInNav 0.4s ease forwards;
}

.nav li:nth-child(1) a { animation-delay: 0.05s; }
.nav li:nth-child(2) a { animation-delay: 0.12s; }
.nav li:nth-child(3) a { animation-delay: 0.19s; }

@keyframes fadeInNav {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.nav a.active {
  font-weight: 600;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.35rem;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.2s ease;
}

.nav a:hover::after {
  width: 100%;
}

.nav a.active::after {
  width: 100%;
}

.mobile-menu-toggle {
  display: none;
}

.nav-dropdown {
  display: none;
}

/* Resume: minimalist outlined button (8pt), inverts on hover */
.nav__resume {
  border: 1px solid currentColor;
  padding: 4px 12px;
  border-radius: 2px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav__resume::after {
  display: none;
}

.nav__resume:hover {
  background: currentColor;
  color: var(--bg);
}

.hero {
  padding: 24px 24px;
  border-radius: 16px;
  background: var(--bg-elevated);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.2rem);
  letter-spacing: -0.03em;
}

.hero p {
  margin: 24px 0 0;
  color: var(--text-muted);
  font-size: var(--fs-m);
}

.featured-section h2 {
  font-size: var(--fs-l);
  margin-bottom: 24px;
}

.featured-section {
  contain: layout;
  min-height: 800px;
}

.work-page {
  position: relative;
  padding-block: 24px 48px;
}

/* Connecting thread: track line behind projects */
.work-section {
  position: relative;
}

/* Thread line: behind all content (z-index -1) for gallery effect */
.work-section::before {
  content: '';
  position: absolute;
  left: 32px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: color-mix(in srgb, currentColor 12%, transparent);
  pointer-events: none;
  z-index: -1;
}

.scroll-progress-line {
  position: absolute;
  left: 32px;
  top: 0;
  width: 1px;
  height: 0;
  background: var(--text-muted);
  opacity: 0.6;
  pointer-events: none;
  z-index: -1;
  transition: height 0.35s ease-out;
}

@media (max-width: 900px) {
  .work-section::before,
  .scroll-progress-line {
    left: 16px;
  }

  .work-scroll-hint {
    margin-left: 16px;
  }
}

/* Work page sections: no global 120px; content above thread (z-index 1) */
.work-page .work-intro,
.work-page .work-section {
  padding-block: 0;
  position: relative;
  z-index: 1;
}

/* Work hero: 48px top padding (8pt crunch) */
.work-page .work-intro {
  padding-top: 48px;
}

.work-intro {
  margin-bottom: 0;
  max-width: 65ch;
  padding-block: 0;
}

.work-intro h1 {
  font-size: var(--fs-xl);
  margin: 0 0 16px 0;
  letter-spacing: -0.02em;
}

.work-intro p {
  font-size: var(--fs-m);
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

/* Scroll hint: row layout, line on thread axis, text 16px right; 48px above/below */
.work-scroll-hint {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  margin-top: 48px;
  margin-bottom: 48px;
  margin-left: 32px;
}

.work-scroll-hint__line {
  display: block;
  width: 1px;
  height: 20px;
  background: currentColor;
  opacity: 0.6;
  animation: work-scroll-hint-bounce 2s ease-in-out infinite;
}

.work-scroll-hint__text {
  font-family: var(--font-mono), 'Roboto Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
}

@keyframes work-scroll-hint-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

@media (prefers-reduced-motion: reduce) {
  .work-scroll-hint__line {
    animation: none;
  }
}

.work-section {
  margin-top: 0;
}

/* 64px below filters before first project row; above thread */
.work-page .work-filters {
  position: relative;
  z-index: 1;
  margin-bottom: 64px;
}

.work-page .category-filters {
  gap: 16px;
}

.work-page .filter-btn {
  padding: 16px 24px;
}

.category-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Universal tag / tech stack / filter styling */
.filter-btn,
.project-points li,
.tech-stack-grid li,
.case-study-stack .stack-list li,
.value-prop__skills li {
  border-radius: 2px;
  padding: 8px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans), 'Roboto Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background-color: #f7f7f7;
  color: #444;
  border: 1px solid #e0e0e0;
  transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out, color 0.2s ease-in-out;
  cursor: default;
}

:root.dark .filter-btn,
:root.dark .project-points li,
:root.dark .tech-stack-grid li,
:root.dark .case-study-stack .stack-list li,
:root.dark .value-prop__skills li {
  background-color: #1a1a1a;
  color: #ccc;
  border-color: #333;
}

.filter-btn {
  cursor: pointer;
}

.filter-btn:hover {
  border-color: #aaa;
  color: #222;
  background-color: #fcfcfc;
}

:root.dark .filter-btn:hover {
  border-color: #555;
  color: #e0e0e0;
  background-color: #2a2a2a;
}

.filter-btn.active {
  background-color: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
}

:root.dark .filter-btn.active {
  background-color: #333;
  color: #f0f0f0;
  border-color: #444;
}

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

/* Tag color-coding: backend / frontend / creative */
li.tag-backend,
.tag-backend {
  background-color: #edf2ed;
  border: 1px solid #bac7ba;
  color: #3b4d3b;
}

li.tag-frontend,
.tag-frontend {
  background-color: #edf0f5;
  border: 1px solid #b3c0d1;
  color: #364559;
}

li.tag-creative,
.tag-creative {
  background-color: #f9f5f0;
  border: 1px solid #d8c8bd;
  color: #5c4d43;
}

:root.dark li.tag-backend,
:root.dark .tag-backend {
  background-color: #2a332a;
  border-color: #3d4a3d;
  color: #b8c9b8;
}

:root.dark li.tag-frontend,
:root.dark .tag-frontend {
  background-color: #2a2f36;
  border-color: #3d4550;
  color: #b8c4d0;
}

:root.dark li.tag-creative,
:root.dark .tag-creative {
  background-color: #362e2a;
  border-color: #4a4038;
  color: #d4c8c0;
}

.no-results {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: var(--fs-m);
  grid-column: 1 / -1;
}

#work-grid,
#feature-grid {
  display: grid;
  gap: 1.5rem;
  min-height: 200px;
  contain: layout;
}

#feature-grid {
  min-height: 700px;
}

#work-grid {
  min-height: 1000px;
}

@media (max-width: 640px) {
  #work-grid {
    min-height: 1200px;
    contain: layout;
  }
  
  #feature-grid {
    min-height: 800px;
    contain: layout;
  }
  
  .project-card {
    min-height: 650px;
    contain: layout;
  }
  
  .project-card img {
    min-height: 280px;
    will-change: auto;
  }
  
  .featured-section {
    min-height: 1000px;
    contain: layout;
  }
  
  .hero {
    min-height: 260px;
    contain: layout;
  }
  
  .project-card-skeleton {
    min-height: 650px;
  }
  
  .work-page .project-card-skeleton {
    padding: 1.75rem 2rem;
    gap: 1rem;
  }
}

.project-card-skeleton {
  background: var(--bg-elevated);
  border-radius: var(--radius-m);
  border: 1px solid var(--border-subtle);
  padding: 1.25rem 1.3rem;
  min-height: 550px;
  contain: layout;
  animation: pulse 1.5s ease-in-out infinite;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.project-card-skeleton::before {
  content: "";
  display: block;
  width: 100%;
  height: 240px;
  min-height: 240px;
  aspect-ratio: 16 / 9;
  background: var(--bg-subtle);
  border-radius: var(--radius-s);
  flex-shrink: 0;
}

.project-card-skeleton::after {
  content: "";
  display: block;
  width: 60%;
  height: 1.5rem;
  background: var(--bg-subtle);
  border-radius: 4px;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

@keyframes statusPulse {
  0% { opacity: 1; }
  50% { opacity: 0.3; }
  100% { opacity: 1; }
}

@media (min-width: 700px) {
  #feature-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
  
  #work-grid {
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 2rem;
  }
}

@media (min-width: 1000px) {
  #work-grid {
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 2.5rem;
  }
}

.project-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-m);
  border: 1px solid var(--border-subtle);
  padding: 1.25rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  transform: translateY(0);
  transition: box-shadow 0.22s ease, transform 0.22s ease,
    border-color 0.22s ease, background-color 0.25s ease;
}

/* Work page: architectural project rows (flush image + text blocks) */
.work-page #work-grid {
  grid-template-columns: 1fr;
  gap: 0;
}

.work-page #work-grid .project-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  column-gap: 80px;
  row-gap: 0;
  align-items: center;
  margin-bottom: 48px;
  padding: 0;
  min-height: 90vh;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.work-page #work-grid .project-card:hover {
  box-shadow: none;
  border-color: transparent;
}

.work-page #work-grid .project-card:last-child {
  margin-bottom: 0;
}

/* Image block: inset/framed – 48px padding (16/24/32/48 grid) */
.work-page #work-grid .project-card > .project-card__image-link,
.work-page #work-grid .project-card > .project-card__image-wrap {
  border-radius: 0;
  overflow: hidden;
  padding: 48px;
  margin-bottom: 0;
  background: color-mix(in srgb, var(--bg-subtle) 40%, transparent);
}

.work-page #work-grid .project-card > .project-card__image-link img,
.work-page #work-grid .project-card > .project-card__image-wrap img {
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  display: block;
  border-radius: 0;
  aspect-ratio: auto;
  min-height: 0;
  margin-bottom: 0;
}

/* Text block: 48px padding, 8pt vertical rhythm */
.work-page #work-grid .project-card__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  padding: 48px;
}

/* Title–Description 24px; Description–View Case Study 40px */
.work-page #work-grid .project-card__body .project-desc {
  margin-top: 24px;
}

.work-page #work-grid .project-card__body .project-points {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0;
  margin-top: 24px;
}

.work-page #work-grid .project-card__body .links {
  margin-top: 40px;
}

@media (max-width: 900px) {
  .work-page #work-grid .project-card {
    grid-template-columns: 1fr;
    min-height: 0;
    margin-bottom: 48px;
  }

  .work-page #work-grid .project-card > .project-card__image-link,
  .work-page #work-grid .project-card > .project-card__image-wrap {
    order: 1;
    padding: 24px;
  }

  .work-page #work-grid .project-card > .project-card__image-link img,
  .work-page #work-grid .project-card > .project-card__image-wrap img {
    height: auto;
    max-height: 50vh;
    min-height: 160px;
  }

  .work-page #work-grid .project-card__body {
    order: 2;
    padding: 32px 24px;
  }
}

.project-card.project-card--has-case-study:hover {
  box-shadow: var(--shadow-soft);
  border-color: rgba(148, 163, 184, 0.6);
}

.work-page #work-grid .project-card.project-card--has-case-study:hover {
  box-shadow: none;
  border-color: transparent;
}

.project-card__image-link,
.project-card__image-wrap {
  display: block;
  overflow: hidden;
  border-radius: 0;
  margin-bottom: 0.5rem;
}

.project-card__image-link img {
  transition: transform 0.25s ease;
}

.project-card__image-link:hover img {
  transform: scale(1.04);
}

.project-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: top center;
  border-radius: 0;
  background: var(--bg-subtle);
  display: block;
  min-height: 240px;
  max-width: 100%;
}

.work-page #work-grid .project-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: top center;
  border-radius: 0;
  margin-bottom: 0.5rem;
}

.project-card h2 {
  font-size: 1.1rem;
  margin: 0.2rem 0 0.1rem;
}

.work-page #work-grid .project-card h2,
.work-page #work-grid .project-card h3 {
  font-size: 1.4rem;
  margin: 0.3rem 0 0.2rem;
}

.project-card .project-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-s);
}

.work-page #work-grid .project-card .project-desc {
  font-size: var(--fs-m);
  line-height: 1.6;
}

.project-points {
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.links {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
}

.links-row {
  display: flex;
  gap: 1rem;
}

.case-study-row {
  display: flex;
}

.links a {
  font-size: var(--fs-s);
  color: var(--link);
  padding-bottom: 1px;
  border-bottom: 1px solid transparent;
}

.work-page #work-grid .links a {
  font-size: var(--fs-m);
  font-weight: 500;
  position: relative;
  z-index: 1;
}

/* Primary button ::before so it sits above thread, AAA contrast */
.work-page #work-grid .links .case-study-link::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: inherit;
  border-radius: inherit;
}

.links a:hover {
  border-bottom-color: rgba(37, 99, 235, 0.6);
}



/* About page entry animation */
.about-intro {
  animation: fadeUp 0.6s ease-out 0.1s both;
}

.skills {
  animation: fadeUp 0.6s ease-out 0.25s both;
}

.work-with-me {
  animation: fadeUp 0.6s ease-out 0.4s both;
}

.about-intro h1 {
  font-size: var(--fs-xl);
  margin-bottom: 1.25rem;
}

.about-intro p {
  margin: 0 0 1.25rem;
  font-size: var(--fs-m);
  color: var(--text-muted);
  max-width: 70ch;
  line-height: 1.7;
}

.skills h2 {
  font-size: var(--fs-l);
  margin-bottom: 1.25rem;
}

.skills__grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem 2rem;
}

@media (min-width: 640px) {
  .skills__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.skills__category {
  background: transparent;
  padding: 0.75rem 0 0;
  border: none;
  border-top: 1px solid #d1d5db;
  border-radius: 0;
}

:root.dark .skills__category {
  border-top-color: #374151;
}

:root.environment .skills__category {
  border-top-color: #a8c8a8;
}

.skills__heading {
  display: block;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
  font-size: var(--fs-m);
}

.skills__tags {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skills__tags li {
  display: inline;
}

.skill-tag {
  display: inline-block;
  font-size: 0.9em;
  padding: 4px 10px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
  line-height: 1.4;
}

:root.dark .skill-tag {
  background: rgba(255, 255, 255, 0.06);
}

:root.environment .skill-tag {
  background: rgba(0, 0, 0, 0.05);
}

.about-bottom {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 3rem;
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border-subtle);
}

.about-bottom-text {
  flex: 1.2;
  max-width: 520px;
}

.about-bottom-text h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: var(--fs-l);
}

.about-bottom-text p {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  max-width: 60ch;
}

.contact-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}

.btn {
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  font-size: var(--fs-s);
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  background: none;
}

.btn--primary,
.btn.primary {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #ffffff;
  transition: all 0.3s ease;
}

.btn--primary:hover,
.btn.primary:hover {
  background: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn--secondary,
.btn.secondary {
  background: var(--bg-elevated);
  border-color: var(--border-subtle);
  color: var(--text-muted);
}

.btn--secondary:hover,
.btn.secondary:hover {
  border-color: var(--text);
  color: var(--text);
}

.about-bottom-images {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 2rem;
  margin-top: 4rem;
  padding: 2rem 0 3rem;
}

.about-bottom-images figure {
  margin: 0;
  flex: 1;
  min-width: 0;
  max-width: 480px;
  overflow: hidden;
  border-radius: 0;
}

.about-bottom-images img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 0;
  display: block;
  transition: transform 0.4s ease;
}

.about-bottom-images img:hover {
  transform: scale(1.03);
}

.about-bottom-images figcaption {
  margin-top: 0.4rem;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.gallery-item {
  flex: 0 0 auto;
  width: 46%;
}

.gallery-item img {
  width: 100%;
  display: block;
  border-radius: 0;
  object-fit: cover;
  aspect-ratio: 4 / 3;
}

html.dark .gallery-item img {
  border: 1px solid #333;
}

.footer-tagline {
  margin-top: 3rem;
  text-align: center;
  font-size: 0.95rem;
  opacity: 0.75;
}

@media (max-width: 640px) {
  .footer-tagline {
    margin-bottom: 7rem;
    padding-bottom: 1rem;
  }
}

[data-theme-toggle-container] {
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  z-index: 100;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border-subtle, #d1d5db);
  border-radius: 2px;
  cursor: pointer;
  font-family: var(--font-sans), monospace;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text, #141414);
  transition: border-color 0.3s ease, color 0.3s ease;
}

.theme-toggle:hover {
  border-color: currentColor;
}

.horizon-window {
  position: relative;
  width: 14px;
  height: 14px;
  overflow: hidden;
  display: flex;
  justify-content: center;
}

.celestial-body {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 1. LIGHT THEME (High Sun) */
[data-theme="light"] .celestial-body,
:root:not([data-theme]) .celestial-body {
  background-color: #1e3a8a;
  transform: translateY(2px);
  box-shadow: none;
}

/* 2. NATURE THEME (Sun on horizon) */
[data-theme="nature"] .celestial-body {
  background-color: #2f4f4f;
  transform: translateY(8px);
  box-shadow: none;
}

/* 3. DARK THEME (Crescent Moon) */
[data-theme="dark"] .celestial-body {
  background-color: transparent;
  transform: translateY(2px);
  box-shadow: inset -3px -2px 0 0 #e2e8f0;
}

.site-footer {
  border-top: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding-block: 1.2rem;
  min-height: 80px;
  contain: layout;
}

:root.dark .site-footer {
  background: rgba(5, 8, 22, 0.9);
}

:root.environment .site-footer {
  background: rgba(240, 247, 240, 0.9);
}

.footer-inner {
  width: min(100% - 2rem, var(--max-width));
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer-inner p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-xs);
}

.footer-nav {
  display: flex;
  gap: 1.25rem;
}

.footer-nav a {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.footer-nav a:hover {
  color: var(--text);
}

.fade-in {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

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

.fade-in-image {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-image.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 780px) {
  .about-bottom-images {
    flex-direction: column;
    gap: 1.75rem;
  }

  .about-bottom-images figure {
    width: 100%;
    max-width: 360px;
    margin-inline: auto;
  }
}

@media (max-width: 768px) {
  /* Task 1: Allow content to expand, remove 100vh; no fixed wrappers (audited: none on main, #main-content) */
  main,
  #main-content {
    position: relative;
    height: auto;
    min-height: auto;
    overflow: visible;
    contain: none;
  }

  /* Task 2: Force scroll behavior at root, prevent overflow inheritance traps */
  html,
  body {
    height: auto;
    min-height: 100vh;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Task 2: Thread container must not clip content */
  .work-page,
  .work-section {
    overflow: visible;
  }

  /* Task 3: No contain:paint or display:clip on content parents, all pages */
  section,
  .work-page,
  .work-section,
  #work-grid,
  #feature-grid,
  .work-page #work-grid .project-card {
    contain: none;
  }

  /* Task 4: Thread line, ensure parent grows; thread uses top/bottom, not height:100% */
  .work-section {
    min-height: fit-content;
  }

  .work-section::before {
    top: 0;
    bottom: 0;
    height: auto;
  }

  /* Task 1: Header, max separation, 8pt grid */
  .site-header {
    position: sticky;
    top: 0;
    padding: 24px 24px;
    overflow: visible;
    box-sizing: border-box;
  }

  /* Nature theme: header text legible on mobile */
  [data-theme="nature"] .site-header .nav .logo,
  [data-theme="nature"] .nav-dropdown a,
  :root.environment .site-header .nav .logo,
  :root.environment .nav-dropdown a {
    font-weight: 500;
  }

  .site-header .nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-inline: 0;
  }

  .nav .logo {
    font-size: 14px;
  }

  .nav .nav__links {
    display: none;
  }

  .mobile-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    min-width: 42px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 2px;
    font-family: 'Inter', var(--font-sans), monospace;
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    cursor: pointer;
    color: var(--text);
  }

  /* Task 3: Dropdown, 24px left axis, 32px vertical gap */
  .nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 100vh;
    overflow-y: auto;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
    padding: 40px 24px;
    z-index: 1000;
    flex-direction: column;
    gap: 32px;
    text-align: left;
    align-items: flex-start;
    box-sizing: border-box;
  }

  .nav-dropdown a {
    color: var(--text);
    text-decoration: none;
    font-size: var(--fs-m);
    padding: 8px 0;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
  }

  .nav-dropdown a:hover {
    opacity: 0.8;
  }

  /* Task 2: Architectural Resume button */
  .nav-dropdown .nav__resume {
    width: fit-content;
    min-height: 42px;
    min-width: 42px;
    padding: 16px 24px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    border: 1px solid currentColor;
    color: var(--text);
    border-radius: 2px;
  }

  .nav-dropdown .nav__resume::after {
    content: ' ↓';
    font-size: 10px;
    opacity: 0.8;
  }

  .nav-dropdown .nav__resume:hover {
    opacity: 1;
  }

  /* Task 2: Work hero & filters */
  .work-page .work-intro {
    padding-top: 32px;
  }

  .work-page .work-filters {
    margin-bottom: 48px;
  }

  .work-page .category-filters {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 16px;
    -webkit-overflow-scrolling: touch;
  }

  .work-page .filter-btn {
    white-space: nowrap;
    min-height: 42px;
    min-width: 42px;
    padding: 6px 16px;
    flex-shrink: 0;
  }

  /* Task 3: Spine & scroll hint at 24px */
  .work-section::before,
  .scroll-progress-line {
    left: 24px;
  }

  .work-scroll-hint {
    margin-left: 24px;
  }

  .work-scroll-hint__text {
    font-size: 8px;
  }

  /* Task 4: Theme toggle, fixed FAB bottom-right */
  [data-theme-toggle-container] {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
  }

  .theme-toggle {
    min-height: 42px;
    min-width: 42px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  }

  :root.dark .theme-toggle {
    background: rgba(5, 8, 22, 0.9);
  }

  :root.environment .theme-toggle {
    background: rgba(240, 247, 240, 0.9);
  }

  /* Task 5: 8pt scale-down, 120→64, 80→48, 48→24 */
  section {
    padding-block: 64px;
  }

  main {
    padding-block: 24px;
  }

  .work-page {
    padding-block: 24px 24px;
  }

  .work-scroll-hint {
    margin-top: 24px;
    margin-bottom: 24px;
  }

  /* Accessible 42px tap targets for all mobile buttons */
  .btn,
  .links a,
  .links .case-study-link {
    min-height: 42px;
    min-width: 42px;
  }

  /* Nature theme mobile legibility, dark green on pale green needs sharper weight */
  [data-theme="nature"] .work-page #work-grid .project-card h2,
  [data-theme="nature"] .work-page #work-grid .project-card h3,
  [data-theme="nature"] .work-page #work-grid .project-card .project-desc,
  [data-theme="nature"] .work-page .work-intro p,
  [data-theme="nature"] .project-card h2,
  [data-theme="nature"] .project-card .project-desc,
  [data-theme="nature"] .case-study-page .case-study-title,
  [data-theme="nature"] .case-study-page .case-study-overview,
  [data-theme="nature"] .case-study-page .case-study-section-content,
  [data-theme="nature"] .case-study-page .case-study-section-content p,
  [data-theme="nature"] .case-study-page .case-study-section-content li {
    font-weight: 500;
  }

  /* Nature: VIEW CASE STUDY, AAA contrast border + text */
  [data-theme="nature"] .links .case-study-link {
    background-color: #0d3d0d;
    border: 2px solid #0d3d0d;
    color: #ffffff;
  }

  [data-theme="nature"] .links .case-study-link:hover {
    background-color: transparent;
    border: 2px solid #0d3d0d;
    color: #0d3d0d;
  }

  /* 8pt grid audit: mobile header/footer */
  .site-footer {
    padding-block: 16px;
    min-height: 80px;
  }

  .footer-inner {
    padding-inline: 24px;
    gap: 16px;
  }

  .footer-nav {
    gap: 16px;
  }

  /* Case study nav: stack vertically, center on spine */
  .case-study-nav-inner {
    display: flex;
    flex-direction: column;
    gap: 32px;
    align-items: center;
    margin-top: 64px;
  }

  .nav-link-wrap-prev,
  .nav-link-wrap-all,
  .nav-link-wrap-next {
    text-align: center;
  }
}

@media (max-width: 720px) {
  .site-header .nav {
    padding-inline: 24px;
  }

  .site-header {
    padding: 16px 24px;
  }

  .nav ul {
    gap: 24px;
  }

  main {
    width: min(calc(100% - 32px), var(--max-width));
    padding-block: 32px;
  }

  .hero {
    padding: 24px 24px;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.12);
  }

  .work-intro {
    margin-bottom: 0;
  }

  .work-intro h1 {
    font-size: clamp(1.8rem, 4vw, 2rem);
  }

  #work-grid {
    gap: 24px;
  }

  .work-page #work-grid .project-card {
    padding: 0;
  }

  .work-filters {
    margin-bottom: 32px;
    gap: 24px;
  }

  .category-filters {
    gap: 8px;
  }

  .filter-btn {
    min-height: 42px;
    min-width: 42px;
    padding: 7px 14px;
    font-size: 11px;
  }

  .about-bottom {
    flex-direction: column;
    gap: 2.5rem;
  }
}

@media (max-width: 640px) {
  .gallery-item {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .nav .logo {
    font-size: 12px;
    letter-spacing: 0.04em;
  }

  .nav ul {
    font-size: var(--fs-xs);
  }

  .hero h1 {
    font-size: 1.6rem;
  }

  .work-intro h1 {
    font-size: 1.8rem;
  }

  .work-page #work-grid .project-card {
    padding: 1.25rem 1.25rem;
  }

  .work-page #work-grid .project-card h2 {
    font-size: 1.2rem;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .about-bottom-images figure {
    width: 100%;
    max-width: 340px;
  }

  [data-theme-toggle-container] {
    bottom: 4.5rem;
    right: 1rem;
  }

  .theme-toggle {
    min-height: 42px;
    min-width: 42px;
    padding: 6px 12px;
    font-size: 9px;
  }

  .filter-btn {
    min-height: 42px;
    min-width: 42px;
  }
}

.home-page {
  position: relative;
  overflow-x: hidden;
  background: var(--bg);
}

.home-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background-color: var(--bg);
  z-index: -2;
  pointer-events: none;
}

.home-page::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("../assets/bg.min.svg");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0.15;
  filter: brightness(1.4) contrast(0.7);
  z-index: -1;
  pointer-events: none;
}

:root.dark .home-page::before {
  background-color: #050816;
}

:root.dark .home-page::after {
  opacity: 0.12;
  filter: brightness(2) contrast(0.6) invert(1);
  mix-blend-mode: screen;
}



:root.environment .home-page::after {
  opacity: 0.20;
  filter: sepia(0.65) hue-rotate(-20deg) saturate(1.4) brightness(1.05);
  mix-blend-mode: multiply;
}

@media (max-width: 640px) {
  .home-page::before {
    background-color: var(--bg);
  }

  :root.dark .home-page::before {
    background-color: #050816;
  }

  :root.environment .home-page::before {
    background-color: #f0f7f0;
  }
}

/* ===== Home: long-scroll layout ===== */
.home-main {
  max-width: 720px;
  margin-inline: auto;
  padding-inline: 1.5rem;
  padding-block: 0;
}

.home-main .hero {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem 0 5rem;
  margin-bottom: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
  background: transparent;
}

.home-main .hero__header {
  margin-bottom: 2.5rem;
}

.hero__status-wrap {
  margin-bottom: 1.5rem;
}

.hero__status-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 6px 12px;
  font-family: var(--font-sans), 'Roboto Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #555;
  background-color: #f3f4f6;
  border: none;
  border-radius: 2px;
}

.hero__status-tag::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #22c55e;
  flex-shrink: 0;
  animation: statusPulse 2.5s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .hero__status-tag::before {
    animation: none;
  }
}

:root.dark .hero__status-tag {
  color: rgba(255, 255, 255, 0.85);
  background-color: rgba(255, 255, 255, 0.08);
  border: none;
}

:root.dark .hero__status-tag::before {
  background-color: #22c55e;
}

.home-main .hero__title {
  margin: 0 0 1.25rem;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text);
}

.home-main .hero__subhead {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.65;
  color: var(--text-muted);
  max-width: 52ch;
}

.home-main .hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
  justify-content: flex-start;
}

/* Section 2: Value prop */
.home-main .value-prop {
  padding: 1.5rem 0;
  margin-bottom: 0;
}

@media (min-width: 768px) {
  .home-main .value-prop {
    padding: 2rem 0;
  }
}

.home-main .value-prop__title {
  margin: 0 0 1.25rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text);
}

.home-main .value-prop__intro {
  margin: 0 0 1.25rem;
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text);
  max-width: 50ch;
}

.home-main .value-prop__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .home-main .value-prop__grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
}

.home-main .value-prop__card {
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text);
}

.home-main .value-prop__card-title {
  margin: 0 0 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--accent);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--text);
}

.home-main .value-prop__card-text {
  margin: 0;
  font-size: var(--fs-m);
  line-height: 1.55;
  text-align: left;
  color: var(--text);
}

.home-main .value-prop__skills {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Section 3: Featured case studies */
.home-main .featured-case-studies {
  padding: 3rem 0 4rem;
  margin-bottom: 0;
}

@media (min-width: 768px) {
  .home-main .featured-case-studies {
    padding: 4rem 0 5rem;
  }
}

.home-main .featured-case-studies__title {
  margin: 0 0 2rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text);
}

/* Featured Case Studies grid, home page only; prevent card stretch */
.home-main .case-studies-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  align-items: start;
}

@media (min-width: 768px) {
  .home-main .case-studies-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    align-items: start;
  }
}

.home-main .case-study-card {
  display: flex;
  flex-direction: column;
  background: transparent;
  border: none;
  border-radius: 0;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s ease;
}

.home-main .case-study-card:hover {
  opacity: 0.92;
}

/* Wrapper: strict 16:9, no stretch */
.home-main .case-studies-grid .case-study-card__image-wrap {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 0;
  overflow: hidden;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}

.home-main .case-studies-grid .case-study-card__image-wrap .case-study-card__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
  border-radius: 0;
  transition: transform 0.4s ease;
}

.home-main .case-study-card:hover .case-study-card__image-wrap .case-study-card__image {
  transform: scale(1.03);
}

.home-main .case-study-card__body {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.home-main .case-study-card__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--text);
}

.home-main .case-study-card__subtitle {
  margin: 0;
  font-size: var(--fs-s);
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.4;
}

.home-main .case-study-card__description {
  margin: 0;
  font-size: var(--fs-m);
  line-height: 1.5;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Section 4: CTA */
.home-main .cta {
  padding: 5rem 0 6rem;
  margin-bottom: 0;
}

.home-main .cta__title {
  margin: 0 0 1rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text);
}

.home-main .cta__intro {
  margin: 0 0 1.75rem;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-muted);
  max-width: 50ch;
}

.home-main .cta__action {
  margin: 0;
}

/* CTA primary button: same as View Work (jet black, 2px radius) */
.cta__link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background-color: #141414;
  color: #ffffff;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  text-decoration: none;
  border-radius: 2px;
  border: 1px solid #141414;
  padding: 12px 28px;
  transition: all 0.2s ease-in-out;
}

.cta__link:hover {
  background-color: #2a2a2a;
  border-color: #2a2a2a;
  color: #ffffff;
  transform: translateY(-1px);
}

.cta__link-icon {
  font-size: 1em;
  line-height: 1;
}

:root.dark .cta__link:hover {
  background-color: #2a2a2a;
  border-color: #2a2a2a;
  color: #ffffff;
}

/* ----- 3-theme overrides: primary buttons & status tag ----- */

/* Dark mode: primary buttons (View Work, View Case Study, Live Demo, GitHub Repo, Send an Email) – punched out on navy */
[data-theme="dark"] .home-main .hero__actions .btn,
[data-theme="dark"] .cta__link,
[data-theme="dark"] .links .case-study-link,
[data-theme="dark"] .case-study-links .btn {
  background-color: #ffffff;
  color: #0a0f1c;
  border: 1px solid #ffffff;
}

[data-theme="dark"] .home-main .hero__actions .btn:hover,
[data-theme="dark"] .cta__link:hover,
[data-theme="dark"] .links .case-study-link:hover,
[data-theme="dark"] .case-study-links .btn:hover {
  background-color: transparent;
  color: #ffffff;
  border-color: #ffffff;
}

/* Nature mode: primary buttons – dark green from theme */
[data-theme="nature"] .home-main .hero__actions .btn,
[data-theme="nature"] .cta__link,
[data-theme="nature"] .links .case-study-link,
[data-theme="nature"] .case-study-links .btn {
  background-color: var(--accent-dark, #1f5a1f);
  border: 1px solid var(--accent-dark, #1f5a1f);
  color: #ffffff;
}

[data-theme="nature"] .home-main .hero__actions .btn:hover,
[data-theme="nature"] .cta__link:hover,
[data-theme="nature"] .links .case-study-link:hover,
[data-theme="nature"] .case-study-links .btn:hover {
  background-color: transparent;
  color: var(--text, #1a3a1a);
  border-color: var(--text, #1a3a1a);
}

/* Dark mode: Open to Remote Roles status tag – glass on navy */
[data-theme="dark"] .hero__status-tag {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
}

/* Nature mode: status tag – crisp frosted glass, high-contrast text */
[data-theme="nature"] .hero__status-tag {
  background-color: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(27, 67, 50, 0.15);
  color: var(--text, #1a3a1a);
}

@media (max-width: 640px) {
  .home-main .hero {
    padding: 3rem 0 4rem;
  }

  .home-main .value-prop {
    padding-top: 1.75rem;
    padding-bottom: 2rem;
  }

  .home-main .featured-case-studies,
  .home-main .cta {
    padding-top: 3.5rem;
    padding-bottom: 4rem;
  }
}

.case-study-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.case-study {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.case-study-header {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.case-study-image {
  margin: 0;
  width: 100%;
  border-radius: 0;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.case-study-image img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: cover;
  border-radius: 0;
}

.case-study-page img,
.case-study-section-content img {
  border-radius: 0;
}

.case-study-title-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.case-study-title {
  font-size: var(--fs-xl);
  margin: 0;
  line-height: 1.2;
}

.case-study-type {
  font-size: var(--fs-m);
  color: var(--text-muted);
  margin: 0;
}

.case-study-overview {
  font-size: var(--fs-l);
  line-height: 1.6;
  color: var(--text);
  margin: 1rem 0 0;
  font-weight: 500;
}

.case-study-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
}

.case-study-main {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.case-study-description {
  max-width: 70ch;
}

.case-study-description p {
  font-size: var(--fs-m);
  line-height: 1.7;
  color: var(--text);
  margin: 0;
}

.case-study-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.case-study-section--hidden {
  display: none;
}

.case-study-section h2 {
  font-size: var(--fs-xl);
  margin: 0;
  line-height: 1.3;
  color: var(--text);
}

.case-study-section-content {
  font-size: var(--fs-m);
  line-height: 1.8;
  color: var(--text);
}

.case-study-section-content p {
  margin: 0 0 1.5rem;
}

.case-study-section-content p:last-child {
  margin-bottom: 0;
}

.case-study-section-content ul {
  margin: 1rem 0;
  padding-left: 1.5rem;
  list-style-type: disc;
}

.case-study-section-content ul ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
  list-style-type: circle;
}

.case-study-section-content li {
  margin: 0.5rem 0;
  line-height: 1.7;
}

.case-study-section-content li ul {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.case-study-section-content strong {
  font-weight: 600;
  color: var(--text);
}

.case-study-section-content h3 {
  font-size: var(--fs-l);
  margin: 2rem 0 1rem;
  font-weight: 600;
  color: var(--text);
}

.case-study-section-content h3:first-child {
  margin-top: 0;
}

.case-study-flex-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

@media (max-width: 768px) {
  .case-study-flex-grid {
    grid-template-columns: 1fr;
  }
}

.case-study-flex-col {
  padding: 1.25rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-s);
}

.case-study-flex-col h3 {
  margin: 0 0 0.75rem;
  font-size: var(--fs-m);
  font-weight: 600;
}

.case-study-flex-col p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

.case-study-screenshot {
  margin: 2rem 0;
}

.case-study-screenshot-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  background: var(--bg-subtle);
  border: 2px dashed var(--border-subtle);
  border-radius: 0;
  color: var(--text-muted);
  font-size: var(--fs-s);
}

.case-study-screenshot figcaption {
  margin-top: 0.75rem;
  font-size: var(--fs-s);
  color: var(--text-muted);
}

.tech-stack-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.case-study-code {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-s);
  padding: 1rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
}

.case-study-code code {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  padding: 0;
}

.case-study-code-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 3rem;
}

.case-study-code-section h2 {
  font-size: var(--fs-xl);
  margin: 0;
  line-height: 1.3;
  color: var(--text);
}

.case-study-code-section--minimal {
  margin-top: 32px;
  gap: 16px;
}

.case-study-code-section--minimal .case-study-code-block {
  padding: 24px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
}

.code-snippet-description {
  font-size: var(--fs-m);
  color: var(--text-muted);
  margin: 0;
}

.case-study-code-block {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-s);
  padding: 1.5rem;
  margin: 1rem 0;
  overflow-x: auto;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
}

.case-study-code-block code {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  padding: 0;
  white-space: pre;
}

.case-study-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 2rem 0;
  width: 100%;
}

.case-study-section:first-of-type .case-study-divider {
  display: none;
}

.case-study-details {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.case-study-stack h3 {
  font-size: var(--fs-l);
  margin: 0 0 1rem;
}

.case-study-stack .stack-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.case-study-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.case-study-links .btn {
  text-decoration: none;
}

.case-study-nav-bottom {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
}

.case-study-nav-bottom .btn {
  text-decoration: none;
}

/* Case study nav: three-column layout (8pt grid) */
.case-study-nav-bottom.case-study-nav {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.case-study-nav-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  margin: 80px auto 0;
  font-family: inherit;
  gap: 24px;
}

.nav-link-wrap {
  min-width: 0;
}

.nav-link-wrap-prev {
  text-align: left;
}

.nav-link-wrap-all {
  text-align: center;
}

.nav-link-wrap-next {
  text-align: right;
}

.case-study-nav .nav-link {
  text-decoration: none;
  color: #333;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  position: relative;
  padding-bottom: 8px;
  transition: transform 0.3s ease-in-out, color 0.3s ease-in-out;
  display: inline-block;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.case-study-nav .nav-link-placeholder {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.case-study-nav .nav-link-placeholder::after {
  display: none;
}

:root.dark .case-study-nav .nav-link {
  color: rgba(255, 255, 255, 0.85);
}

:root.dark .case-study-nav .nav-link-placeholder {
  opacity: 0.25;
}

.case-study-nav .nav-link::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 1px;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  transform-origin: center;
  background-color: currentColor;
  transition: transform 0.3s ease-in-out;
}

.case-study-nav .nav-link:hover::after,
.case-study-nav .nav-link:focus-visible::after {
  transform: translateX(-50%) scaleX(1);
}

.case-study-nav .nav-link-next:hover {
  transform: translateX(8px);
}

.case-study-nav .nav-link-prev:hover {
  transform: translateX(-8px);
}

.case-study-nav .nav-link-all:hover {
  transform: none;
}

.case-study-nav .nav-link:hover {
  color: #888;
}

:root.dark .case-study-nav .nav-link:hover {
  color: rgba(255, 255, 255, 0.6);
}

.case-study-nav .nav-link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

/* Case study nav bottom + legacy .btn-case-study: matte charcoal (excludes .case-study-links .btn) */
.btn-case-study,
.case-study-nav-bottom .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
  text-decoration: none;
  background-color: #333333;
  background-image: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.05),
    transparent
  );
  border-radius: 8px;
  padding: 12px 24px;
  color: #f0f0f0;
  font-weight: 300;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: visible;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.btn-case-study::after,
.case-study-nav-bottom .btn::after {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  border-radius: 9px;
  border: 1px solid rgba(192, 192, 192, 0.6);
  pointer-events: none;
  z-index: 1;
}

.btn-case-study:hover,
.case-study-nav-bottom .btn:hover {
  background-color: #404040;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 2px 4px rgba(0, 0, 0, 0.25);
  transform: translateY(-1px);
}

.btn-case-study:active,
.case-study-nav-bottom .btn:active {
  box-shadow:
    inset 0 0 2px rgba(0, 0, 0, 0.5),
    0 0 1px 1px rgba(160, 160, 160, 0.4);
  transform: translateY(0.5px);
}

.btn-case-study:focus-visible,
.case-study-nav-bottom .btn:focus-visible {
  outline: 2px solid rgba(192, 192, 192, 0.8);
  outline-offset: 2px;
}

/* View Case Study + hero buttons + case study Live Demo/GitHub: jet black (same as View Work) */
.links .case-study-link,
.home-main .hero__actions .btn,
.case-study-links .btn {
  background-color: #141414;
  color: #ffffff;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  border-radius: 2px;
  padding: 12px 28px;
  border: 1px solid #141414;
  background-image: none;
  box-shadow: none;
}

.links .case-study-link::after,
.home-main .hero__actions .btn::after,
.case-study-links .btn::after {
  display: none;
}

.links .case-study-link:hover,
.home-main .hero__actions .btn:hover,
.case-study-links .btn:hover {
  background-color: #2a2a2a;
  border-color: #2a2a2a;
  color: #ffffff;
  box-shadow: none;
  transform: translateY(-1px);
}

.home-main .hero__actions .btn--secondary {
  background-color: #141414;
  border-color: #141414;
  color: #ffffff;
}

/* Hero GitHub: chic minimalist link, aligned with View Work button */
.hero__actions .hero__link {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  font-size: var(--fs-m);
  font-weight: 500;
  color: #141414;
  text-decoration: none;
  text-transform: none;
  letter-spacing: normal;
  box-shadow: none;
  transition: opacity 0.2s ease;
}

.hero__actions .hero__link::after {
  display: none;
}

.hero__actions .hero__link:hover {
  opacity: 0.6;
  background: none;
  border: none;
  color: #141414;
  transform: none;
  box-shadow: none;
}

:root.dark .hero__actions .hero__link {
  color: #f0f0f0;
}

:root.dark .hero__actions .hero__link:hover {
  color: #f0f0f0;
}

@media (min-width: 700px) {
  .case-study-header {
    flex-direction: row;
    align-items: flex-start;
    gap: 3rem;
  }

  .case-study-image {
    flex: 0 0 40%;
    max-width: 500px;
  }

  .case-study-title-section {
    flex: 1;
  }

  .case-study-content {
    grid-template-columns: 1.5fr 1fr;
    align-items: start;
  }

  .case-study-details {
    position: sticky;
    top: 2rem;
  }
}

@media (min-width: 1000px) {
  .case-study-page {
    padding: 3rem 2rem 5rem;
  }

  .case-study {
    gap: 4rem;
  }

  .case-study-title {
    font-size: 2.5rem;
  }
}