: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: #6b7280;

  --border-subtle: #e5e7eb;

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

  --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);
  --link: #93c5fd;
}

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

*,
*::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.6;
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  z-index: 1000;
  padding: 1rem 1.5rem;
  background: var(--accent);
  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: 2.5rem;
}

section {
  margin-bottom: 3rem;
}

.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-block: 1.1rem;
  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.18rem;
  text-transform: uppercase;
}

.nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  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);
  }
}

.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%;
}

.hero {
  padding: 1.75rem 1.5rem;
  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: 0.75rem 0 0;
  color: var(--text-muted);
  font-size: var(--fs-m);
}

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

.work-page {
  padding-block: 2.5rem;
}

.work-intro {
  margin-bottom: 3.5rem;
  max-width: 65ch;
}

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

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

.work-section {
  margin-top: 2rem;
}

.work-filters {
  margin-bottom: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

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

.filters-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.category-filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  border: 2px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: var(--fs-m);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.filter-btn:hover {
  border-color: var(--accent);
  background: var(--bg-subtle);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

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

.stack-filters h2 {
  font-size: var(--fs-s);
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.stack-filters-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.stack-filter-btn {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: var(--fs-s);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.stack-filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.stack-filter-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

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

.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;
}

@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 #work-grid .project-card {
  padding: 1.75rem 2rem;
  gap: 1rem;
}

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

.project-card img {
  width: 100%;
  border-radius: var(--radius-s);
  background: var(--bg-subtle);
}

.work-page #work-grid .project-card img {
  border-radius: var(--radius-m);
  margin-bottom: 0.5rem;
}

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

.work-page #work-grid .project-card h2 {
  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.4rem;
}

.project-points li {
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.work-page #work-grid .project-points li {
  padding: 0.2rem 0.65rem;
  font-size: var(--fs-s);
}

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

.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;
}

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



.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 ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.skills li {
  background: var(--bg-elevated);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-m);
  border: 1px solid var(--border-subtle);
  font-size: var(--fs-s);
  color: var(--text-muted);
}

.skills li strong {
  font-weight: 600;
  color: var(--text);
}

.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 {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.btn.primary:hover {
  background: #3a55d2;
}

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

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

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

.about-bottom-images figure {
  margin: 0;
  width: 260px;
  flex-shrink: 0;
  perspective: 1100px;
}

.about-bottom-images img {
  width: 100%;
  height: auto;
  border-radius: 14px;
  object-fit: cover;
  aspect-ratio: 4 / 3;
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.12),
    0 0 0 rgba(76, 111, 255, 0);
  transition:
    transform 0.35s ease,
    box-shadow 0.35s ease,
    filter 0.35s ease,
    opacity 0.6s ease;
}

.about-bottom-images img:hover {
  transform: rotate3d(1, 1, 0, 7deg) scale(1.04);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.18),
    0 0 30px rgba(76, 111, 255, 0.28);
  filter: brightness(1.08);
}

.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: 10px;
  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-side-nav-container] {
  position: fixed;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.side-nav-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.5rem;
  width: 120px;
  background: var(--bg-elevated);
  border: 2px solid var(--border-subtle);
  border-radius: 12px;
  color: var(--text);
  font-size: var(--fs-m);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  letter-spacing: 0.02em;
}

.side-nav-btn-bg {
  position: absolute;
  inset: 0;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
  pointer-events: none;
}

.side-nav-btn-text {
  position: relative;
  z-index: 1;
  transition: color 0.3s ease, transform 0.3s ease;
}

.side-nav-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  transform: translateX(-4px);
}

.side-nav-btn:hover .side-nav-btn-bg {
  opacity: 0.1;
}

.side-nav-btn:hover .side-nav-btn-text {
  color: var(--accent);
  transform: scale(1.05);
}

.side-nav-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(76, 111, 255, 0.25);
  padding: 2rem 1.5rem;
  transform: translateY(0);
}

.side-nav-btn.active .side-nav-btn-bg {
  opacity: 0;
}

.side-nav-btn.active .side-nav-btn-text {
  color: #ffffff;
}

.side-nav-btn.active:hover {
  background: var(--accent);
  padding: 2.25rem 1.5rem;
  transform: translateX(-4px);
  box-shadow: 0 8px 28px rgba(76, 111, 255, 0.35);
}

:root.dark .side-nav-btn {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.24);
}

:root.dark .side-nav-btn:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
}

:root.environment .side-nav-btn.active {
  background: var(--accent);
  box-shadow: 0 6px 20px rgba(45, 122, 45, 0.25);
}

:root.environment .side-nav-btn.active:hover {
  box-shadow: 0 8px 28px rgba(45, 122, 45, 0.35);
}

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

.theme-toggle {
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
  font-weight: 500;
}

.theme-toggle-icon {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--accent);
  position: relative;
  flex-shrink: 0;
}

.theme-toggle-label {
  font-size: var(--fs-xs);
  letter-spacing: 0.02em;
}

.theme-toggle:hover {
  background: var(--bg-subtle);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

.theme-toggle:active {
  transform: translateY(0);
}

:root.dark .theme-toggle {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.24);
}

:root.dark .theme-toggle:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.32);
}

:root.environment .theme-toggle {
  box-shadow: 0 4px 12px rgba(45, 122, 45, 0.12);
}

:root.environment .theme-toggle:hover {
  box-shadow: 0 6px 16px rgba(45, 122, 45, 0.18);
}

.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;
}

: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: 80%;
    max-width: 360px;
    margin-inline: auto;
  }
}

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

  .nav ul {
    gap: 1rem;
  }

  main {
    width: min(100% - 1.5rem, var(--max-width));
    padding-block: 2rem;
  }

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

  .work-intro {
    margin-bottom: 2.5rem;
  }

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

  #work-grid {
    gap: 1.5rem;
  }

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

  .work-filters {
    margin-bottom: 2rem;
    gap: 1.5rem;
  }

  .category-filters {
    gap: 0.5rem;
  }

  .mobile-filter-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem 1.25rem;
    margin-top: 0.5rem;
    background: var(--bg-elevated);
    border: 2px solid var(--border-subtle);
    border-radius: 12px;
    color: var(--text);
    font-size: var(--fs-m);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
  }

  .mobile-filter-toggle:hover {
    border-color: var(--accent);
    background: var(--bg-subtle);
  }

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

  .toggle-icon {
    font-size: 1.5rem;
    font-weight: 300;
    line-height: 1;
    transition: transform 0.3s ease;
  }

  .work-filters.filters-open .toggle-icon {
    transform: rotate(0deg);
  }

  .filters-content {
    display: none;
    flex-direction: column;
    gap: 1.5rem;
    padding-top: 0.5rem;
  }

  .work-filters.filters-open .filters-content {
    display: flex;
  }

  .filter-btn {
    padding: 0.55rem 1.2rem;
    font-size: var(--fs-s);
  }

  .stack-filters-grid {
    gap: 0.4rem;
  }

  .stack-filter-btn {
    padding: 0.35rem 0.75rem;
    font-size: var(--fs-xs);
  }

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

  [data-side-nav-container] {
    right: 1rem;
    gap: 0.75rem;
  }

  .side-nav-btn {
    padding: 0.85rem 1.25rem;
    width: 100px;
    font-size: var(--fs-s);
  }

  .side-nav-btn.active {
    padding: 1.75rem 1.25rem;
    transform: translateY(0);
  }

  .side-nav-btn.active:hover {
    padding: 1.9rem 1.25rem;
    transform: translateX(-4px);
  }
}

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

@media (max-width: 480px) {
  .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-side-nav-container] {
    right: auto;
    left: 50%;
    top: auto;
    bottom: 5rem;
    transform: translateX(-50%);
    gap: 0.75rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  }

  :root.dark [data-side-nav-container] {
    background: rgba(5, 8, 22, 0.85);
  }

  :root.environment [data-side-nav-container] {
    background: rgba(240, 247, 240, 0.85);
  }

  .side-nav {
    flex-direction: row;
    gap: 0.75rem;
  }

  .side-nav-btn {
    padding: 0.85rem 1.5rem;
    width: auto;
    min-width: 100px;
    font-size: var(--fs-s);
    border-radius: 50px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .side-nav-btn:active {
    transform: translateY(-2px) scale(0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
  }

  .side-nav-btn.active {
    padding: 0.85rem 1.5rem;
    box-shadow: 0 4px 16px rgba(76, 111, 255, 0.3);
  }

  .side-nav-btn.active:hover {
    padding: 0.85rem 1.5rem;
    transform: translateY(-4px) scale(1.05);
  }

  .side-nav-btn:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  }

  .side-nav-btn:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
    transform: translateY(-4px) scale(1.05);
  }

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

  .theme-toggle {
    padding: 0.55rem 0.9rem;
    font-size: 0.75rem;
  }

  .theme-toggle-icon {
    width: 0.85rem;
    height: 0.85rem;
  }
}

.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;
  }
}

.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: var(--radius-m);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.case-study-image img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.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 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.25rem;
}

.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-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);
}

.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-stack .stack-list li {
  padding: 0.4rem 0.9rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-s);
  font-size: var(--fs-s);
  color: var(--text);
}

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

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

/* Case Study Link in Project Cards */
.links .case-study-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  font-size: var(--fs-s);
  font-weight: 500;
  background: var(--accent);
  color: #ffffff;
  text-decoration: none;
  border: 1px solid var(--accent);
  transition: background 0.2s ease, transform 0.2s ease;
}

.links .case-study-link:hover {
  background: #3a55d2;
  transform: translateY(-1px);
}

.links .case-study-link:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

@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;
  }
}