:root {
  color-scheme: dark;
}

body {
  margin: 0;
  font-family: 'Instrument Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  transition: background .4s, color .4s;
  --bg: #0a0b10;
  --bg2: #12141c;
  --fg: #e9eaf0;
  --fg2: #9a9eae;
  --line: rgba(233, 234, 240, .1);
  --blue: #4b6df5;
  --blue-soft: rgba(75, 109, 245, .14);
  --pos: #f5a83b;
  --card: #0e1017;
  --scrim: rgba(10, 11, 16, .5);
}

body.light {
  color-scheme: light;
  --bg: #f7f7f4;
  --bg2: #ecece8;
  --fg: #14151b;
  --fg2: #5b5e6b;
  --line: rgba(20, 21, 27, .12);
  --blue: #2647d6;
  --blue-soft: rgba(38, 71, 214, .09);
  --pos: #b06400;
  --card: #ffffff;
  --scrim: rgba(247, 247, 244, .44);
}

a { color: var(--fg); text-decoration: none; }
a:hover { color: var(--blue); }
::selection { background: var(--blue); color: #fff; }
html { scroll-behavior: smooth; }

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

@media (max-width: 930px) {
  nav[data-desknav] { display: none !important; }
  button[data-burger] { display: grid !important; }
}

@media (max-width: 640px) {
  #hero-content { grid-template-columns: 1fr !important; }
  #hero-content > div:last-child { justify-self: center !important; width: min(220px, 60vw) !important; margin-top: 8px; }
}

.nav-link { color: var(--fg2); }
.nav-link:hover { color: var(--fg); }

.icon-btn:hover { color: var(--fg); border-color: var(--fg2); }

.mnav-link {
  font-family: 'Space Grotesk';
  font-size: clamp(14px, 4.1vw, 18px);
  font-weight: 500;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transform: translateX(24px);
  transition: opacity .4s, transform .4s;
  color: var(--fg);
  display: block;
}
.mnav-link--last { border-bottom: none; }

.case-study-link { transition: padding-left .3s ease; }
.case-study-link:hover { padding-left: 10px; }

.card-link { transition: border-color .25s ease, transform .25s ease; }
.card-link:hover { border-color: var(--fg2); transform: translateY(-3px); }

.footer-link:hover { color: var(--fg); }

.writing-track, .side-projects-track {
  display: flex; gap: 18px; overflow-x: auto; scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.writing-track::-webkit-scrollbar, .side-projects-track::-webkit-scrollbar { display: none; }
.writing-card, .side-project-card {
  scroll-snap-align: start;
  opacity: .55;
  transition: opacity .5s cubic-bezier(.22,.61,.36,1);
}
.writing-card.is-active, .side-project-card.is-active { opacity: 1; }

.carousel-controls { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }
.carousel-dots { display: flex; justify-content: center; gap: 8px; }
.carousel-dot {
  width: 7px; height: 7px; border-radius: 50%; border: none; background: var(--line);
  cursor: pointer; padding: 0; transition: background .2s ease, width .2s ease;
}
.carousel-dot.is-active { background: var(--blue); width: 18px; border-radius: 4px; }
.carousel-arrow {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; color: var(--fg2);
  cursor: pointer; transition: color .2s ease, border-color .2s ease, transform .15s ease;
  flex: 0 0 auto;
}
.carousel-arrow:hover { color: var(--fg); border-color: var(--fg2); }
.carousel-arrow:active { transform: scale(.92); }

.highlights-track {
  display: flex; gap: 20px; overflow-x: auto; scroll-snap-type: x proximity;
  padding: 24px max(24px, calc(50vw - 34ch)) 28px; scrollbar-width: none;
}
.highlights-track::-webkit-scrollbar { display: none; }
.highlight-card {
  flex: 0 0 clamp(240px, 62vw, 420px);
  scroll-snap-align: center;
  opacity: .4;
  transform: scale(.92);
  transition: opacity .5s cubic-bezier(.22,.61,.36,1), transform .5s cubic-bezier(.22,.61,.36,1);
  border-radius: 16px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
}
.highlight-card.is-active { opacity: 1; transform: scale(1); }
.highlight-image, .highlight-image-placeholder {
  width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block; background: var(--bg2);
}
.highlight-caption { padding: 16px 18px 20px; }
.highlight-title { font-family: 'Space Grotesk'; font-weight: 600; font-size: 16px; display: block; }
.highlight-desc { margin: 6px 0 0; font-size: 13.5px; color: var(--fg2); line-height: 1.5; }

.highlights-controls { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 2px; }
.highlights-dots { display: flex; justify-content: center; gap: 8px; }
.highlights-dot {
  width: 7px; height: 7px; border-radius: 50%; border: none; background: var(--line);
  cursor: pointer; padding: 0; transition: background .2s ease, width .2s ease;
}
.highlights-dot.is-active { background: var(--blue); width: 18px; border-radius: 4px; }
.highlights-arrow {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; color: var(--fg2);
  cursor: pointer; transition: color .2s ease, border-color .2s ease, transform .15s ease;
  flex: 0 0 auto;
}
.highlights-arrow:hover { color: var(--fg); border-color: var(--fg2); }
.highlights-arrow:active { transform: scale(.92); }

/* data-reveal / data-magnet / mesh canvas initial state are set by home.js
   so the reduced-motion branch can skip them entirely rather than un-doing CSS. */

.rich-text p { margin: 0 0 1em; }
.rich-text p:last-child { margin-bottom: 0; }
.rich-text ul, .rich-text ol { margin: 0 0 1em; padding-left: 1.3em; }
.rich-text a { color: var(--blue); text-decoration: underline; }
.rich-text strong { font-weight: 700; }
.rich-text h2, .rich-text h3, .rich-text h4, .rich-text h5, .rich-text h6 {
  font-family: 'Space Grotesk'; font-weight: 600; letter-spacing: -.01em; color: var(--fg);
  margin: 1.4em 0 .5em; line-height: 1.3;
}
.rich-text h2:first-child, .rich-text h3:first-child, .rich-text h4:first-child,
.rich-text h5:first-child, .rich-text h6:first-child { margin-top: 0; }
.rich-text h2 { font-size: 1.5em; }
.rich-text h3 { font-size: 1.3em; }
.rich-text h4 { font-size: 1.15em; }
.rich-text h5 { font-size: 1.05em; }
.rich-text h6 { font-size: 1em; text-transform: uppercase; letter-spacing: .04em; color: var(--fg2); }

.gallery-img { cursor: zoom-in; }
.lightbox-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 200;
  align-items: center; justify-content: center; padding: 24px; cursor: zoom-out;
}
.lightbox-overlay.is-open { display: flex; }
.lightbox-overlay img { max-width: 100%; max-height: 100%; border-radius: 8px; object-fit: contain; }
