/*
  Minimal, modern, fast. Edit tokens below to rebrand quickly.
*/

:root {
  /* Color tokens (light) */
  --bg: #0b0c10;
  --bg-elev: #101217;
  --text: #e9eef2;
  --muted: #b6c0c8;
  --surface: #151923;
  --border: #3d4655;
  --accent: #7dd3fc;
  --accent-strong: #38bdf8;
  --focus-ring: 0 0 0 3px var(--accent-strong);

  /* Sizing & rhythm */
  --radius: 16px;
  /* Slightly rounder */
  --ring: 0 0 0 2px color-mix(in oklab, var(--accent) 30%, transparent);
  --shadow: 0 10px 30px -10px color-mix(in oklab, black 50%, transparent);
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;
  --space-10: 4rem;
  --space-12: 8rem;
  --space-14: 14rem;
  --space-16: 16rem;

  /* Fonts */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', system-ui, -apple-system, sans-serif;

  color-scheme: dark light;
}

/* Light theme overrides */
html:not(.theme-dark) {
  --bg: #f8fafc;
  --bg-elev: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --surface: #ffffff;
  --border: #e2e8f0;
  --accent: #0ea5e9;
  --accent-strong: #0284c7;
}

/* Theme transition */
html.theme-transition,
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease !important;
}

/* Base */
* {
  box-sizing: border-box;
}

*:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

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

html.no-js .reveal {
  opacity: 1;
  transform: none;
}

html {
  scroll-behavior: smooth;
}

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

h1,
h2,
h3,
h4,
h5,
h6,
.logo,
.btn,
.section-title {
  font-family: var(--font-display);
}

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

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

.container {
  width: min(1100px, 92vw);
  margin-inline: auto;
}

.muted {
  color: var(--muted);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--text);
  padding: var(--space-3) var(--space-4);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.skip:focus {
  left: var(--space-4);
  top: var(--space-4);
  box-shadow: var(--ring);
}

/* Noise Overlay */
.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 900;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(160%) blur(12px);
  background: color-mix(in oklab, var(--bg) 70%, transparent);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) clamp(var(--space-4), 4vw, var(--space-6));
}

.logo {
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--accent-strong);
  background: linear-gradient(90deg, var(--accent-strong), color-mix(in oklab, var(--accent-strong), white 25%));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.site-nav {
  display: flex;
  gap: var(--space-5);
  align-items: center;
}

.site-nav a {
  opacity: 0.86;
  padding: var(--space-2) var(--space-2);
  border-radius: 8px;
}

.site-nav a[aria-current="page"] {
  opacity: 1;
  color: var(--accent-strong);
}

.site-nav a:hover {
  opacity: 1;
}

/* Theme Toggle Button */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  box-shadow: var(--ring);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  grid-area: 1 / 1;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Dark mode: show sun icon (to switch to light) */
html.theme-dark .theme-toggle .icon-sun {
  opacity: 1;
  transform: rotate(0deg);
}

html.theme-dark .theme-toggle .icon-moon {
  opacity: 0;
  transform: rotate(-90deg);
}

/* Light mode: show moon icon (to switch to dark) */
html:not(.theme-dark) .theme-toggle .icon-sun {
  opacity: 0;
  transform: rotate(90deg);
}

html:not(.theme-dark) .theme-toggle .icon-moon {
  opacity: 1;
  transform: rotate(0deg);
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--space-8);
  align-items: center;
  padding: var(--space-10) 0 var(--space-8);
}

.hero h1 {
  font-size: clamp(2rem, 4vw + 1rem, 3.1rem);
  line-height: 1.1;
  margin: 0 0 var(--space-4);
}

.hero p {
  color: var(--muted);
  font-size: 1.05rem;
}

.accent {
  color: var(--accent-strong);
}

.actions {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-5);
}

.hero-art {
  position: relative;
  aspect-ratio: 1 / 1;
  isolation: isolate;
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  width: 320px;
  height: 320px;
  margin: 0 auto;
  transform: perspective(1000px) rotateX(20deg) rotateY(-10deg);
  transform-style: preserve-3d;
  transition: transform 0.1s ease-out;
}

.grid-cell {
  background: color-mix(in oklab, var(--text) 8%, transparent);
  border-radius: 4px;
  transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

.grid-cell::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: var(--accent-strong);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.grid-cell.active {
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  transform: translateZ(10px);
  z-index: 10;
}

.grid-cell.active::after {
  opacity: 0.4;
}

.grid-cell.ripple {
  animation: ripple-effect 0.6s ease-out forwards;
}

@keyframes ripple-effect {
  0% {
    transform: scale(1);
    background: var(--accent-strong);
  }

  50% {
    transform: scale(1.2) translateZ(20px);
  }

  100% {
    transform: scale(1);
    background: color-mix(in oklab, var(--text) 8%, transparent);
  }
}

/* Sections */
section {
  padding-block: var(--space-8);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), color-mix(in oklab, var(--accent) 15%, transparent), transparent 40%);
  z-index: 1;
  opacity: 0;
  transition: opacity 0.5s;
  pointer-events: none;
}

.card:hover::before {
  opacity: 1;
}

.card:hover {
  border-color: color-mix(in oklab, var(--accent) 40%, var(--border));
}

/* Ensure content sits above the spotlight overlay */
.card>* {
  position: relative;
  z-index: 2;
}

.card h3 {
  margin-top: 0;
}

.facts,
.traits {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-2);
  color: var(--muted);
}

.featured h2 {
  margin-bottom: var(--space-5);
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
}

.project {
  display: grid;
  gap: var(--space-5);
}

.project .tags {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.project .tags span {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 20px;
  color: var(--muted);
  font-size: .85rem;
}

.card-actions {
  display: flex;
  gap: var(--space-3);
}

/* Clickable project tile */
.project-list .project-link {
  display: grid;
  gap: var(--space-5);
  text-decoration: none;
  color: inherit;
}

.project-list .card {
  transition: transform .18s ease, box-shadow .18s ease;
}

.project-list .card:hover {
  transform: translateY(-2px);
  box-shadow: var(--ring);
}

/* Detail page sections */
.detail {
  padding-block: var(--space-8);
}

.detail-section {
  padding-block: var(--space-6);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr;
  gap: var(--space-16);
  align-items: start;
}

.detail-grid-custom {
  grid-template-columns: 1fr 1fr;
  gap: var(--space-1);
}

.section-title {
  color: var(--muted);
  font-weight: 600;
  letter-spacing: .2px;
}

.section-title h2 {
  margin: 0;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  opacity: .9;
}

.section-body {
  display: grid;
  gap: var(--space-3);
  font-size: 0.875rem;
}

.detail-grid-custom .section-body {
  padding-top: var(--space-4);
}

.section-title .section-body h4 {
  margin: 0rem 0 2.25rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.section-body h3 {
  margin: 0rem 0 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.section-body p {
  margin: 0;
  color: var(--text);
}

.detail-grid-custom .section-body p {
  margin: 0;
  color: var(--text);
  font-weight: 400;
}

.section-body .sub-decision {
  padding-bottom: 2rem;
}

.section-body ul {
  padding-left: 0rem;
  margin: 0;
  font-weight: normal;
  list-style-type: circle;
}

.section-body ul li {
  margin-bottom: 1.5rem;
}

.section-body ul li.less-space {
  margin-bottom: 0.5rem;
}

.section-body ul li.less-space:last-child {
  margin-bottom: 2.5rem;
}

.back-to-top {
  width: fit-content;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
  will-change: transform;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--ring);
}

.btn.primary {
  background: var(--accent-strong);
  color: white;
  border-color: transparent;
}

.btn.ghost {
  background: transparent;
}

.btn.small {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: .9rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: var(--space-10);
  padding: var(--space-3) clamp(var(--space-4), 4vw, var(--space-6));
  background: color-mix(in oklab, var(--bg) 70%, transparent);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.social {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}

.social a {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
}

/* Reveal animations */
.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .6s ease, transform .6s ease;
}

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


/* Media/figure styles for project pages */
.media {
  margin: .5rem 0 0;
}

.media img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
}

/* Project detail page images - ensure visibility in both themes */
.detail-section > img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: 0 4px 20px -4px color-mix(in oklab, black 15%, transparent);
  cursor: zoom-in;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.detail-section > img:hover {
  box-shadow: 0 8px 30px -4px color-mix(in oklab, black 20%, transparent);
  transform: translateY(-2px);
}

/* In dark mode, add stronger shadow for contrast */
html.theme-dark .detail-section > img {
  box-shadow: 0 4px 20px -4px color-mix(in oklab, black 40%, transparent);
}

html.theme-dark .detail-section > img:hover {
  box-shadow: 0 8px 30px -4px color-mix(in oklab, black 50%, transparent);
}

.media figcaption {
  margin-top: .4rem;
  font-size: .85rem;
  color: var(--muted);
}

/* Row of images on detail pages */
.image-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  align-items: center;
}

.image-row img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
}

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

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

  .image-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-6);
  background: color-mix(in oklab, black 50%, transparent);
  z-index: 1000;
  overflow: auto;
}

.lightbox.open {
  display: flex;
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: var(--shadow);
  display: block;
  margin: var(--space-6) auto;
}

/* Footer CTA */
.footer-cta {
  text-align: center;
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--border);
}

.footer-cta h2 {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  margin-bottom: var(--space-4);
  background: linear-gradient(90deg, var(--text), var(--muted));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}