/* ── CSS Variables ──────────────────────────────────────── */
:root {
  --surface: #f2ebd4;
  --surface-trans: rgba(242, 235, 212, 0.84);
  --on-surface: #181116;
  --muted: #5f293a;
  --primary: #962739;
  --primary-glow: rgba(150, 39, 57, 0.28);
  --border: #cfb15a;
  --nav-bg: #e2cf95;

  --bg-color: #ebe2c8;
  --gutter-stripe-band: 14px;

  --elev-1: 0 2px 0 rgba(95, 41, 58, 0.1);
  --elev-card: 0 4px 32px rgba(79, 18, 48, 0.1), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

:root[data-theme="dark"] {
  --surface: #441d37;
  --surface-trans: rgba(47, 20, 38, 0.82);
  --on-surface: #f4e8cb;
  --muted: #d8be93;
  --primary: #d2b156;
  --primary-glow: rgba(210, 177, 86, 0.34);
  --border: #6d2840;
  --nav-bg: #3d1b31;

  --bg-color: #3b1a32;
}

/* ── Reset ──────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow-y: scroll;
  background-color: var(--bg-color);
  transition: background-color 0.3s ease;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: transparent;
  color: var(--on-surface);
  line-height: 1.4;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  position: relative;
  isolation: isolate;
  transition: color 0.3s ease;
}

main {
  flex: 1;
}

/* ── Gutter stripes ─────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: calc(var(--gutter-stripe-band) * 4);
  height: 100%;
  background: linear-gradient(to right,
    #cfb15a 0 var(--gutter-stripe-band),
    #c4783a var(--gutter-stripe-band) calc(var(--gutter-stripe-band) * 2),
    #962739 calc(var(--gutter-stripe-band) * 2) calc(var(--gutter-stripe-band) * 3),
    #5f293a calc(var(--gutter-stripe-band) * 3) calc(var(--gutter-stripe-band) * 4)
  );
  pointer-events: none;
  z-index: 50;
}

@media (max-width: 1200px) {
  :root { --gutter-stripe-band: 10px; }
}

@media (max-width: 900px) {
  :root { --gutter-stripe-band: 8px; }
}

@media (max-width: 768px) {
  body::before { display: none; }
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-color); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, #cfb15a, #c4783a, #962739, #5f293a);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ── Animations ─────────────────────────────────────────── */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes atomRotate {
  0%,  10% { transform: rotate(0deg); }
  15%, 25% { transform: rotate(60deg); }
  30%, 40% { transform: rotate(180deg); }
  45%, 55% { transform: rotate(120deg); }
  60%, 70% { transform: rotate(240deg); }
  75%, 85% { transform: rotate(300deg); }
  90%,100% { transform: rotate(360deg); }
}

/* ── Theme toggle ───────────────────────────────────────── */
.theme-toggle {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  padding: 0.3rem 0.65rem;
  border-radius: 0;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.theme-toggle:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.theme-toggle__label--light { display: none; }

:root[data-theme="dark"] .theme-toggle__label--dark { display: none; }
:root[data-theme="dark"] .theme-toggle__label--light { display: inline; }

/* ── Social icon base ───────────────────────────────────── */
.social-icon {
  width: 24px;
  height: 24px;
  background-color: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  display: block;
}

.icon-label { display: none; }

.icon--github .social-icon {
  mask-image: url('https://api.iconify.design/mdi:github.svg');
  -webkit-mask-image: url('https://api.iconify.design/mdi:github.svg');
}

.icon--substack .social-icon {
  mask-image: url('https://api.iconify.design/simple-icons:substack.svg');
  -webkit-mask-image: url('https://api.iconify.design/simple-icons:substack.svg');
  -webkit-mask-size: 85%;
  mask-size: 85%;
}

/* ── Navigation ─────────────────────────────────────────── */
.site-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 0;
  z-index: 20;
  pointer-events: none;
}

.site-header__inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: flex-end;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  width: auto;
  padding: 0;
  padding-top: 2.65rem;
  animation: navSlideIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-action {
  height: auto;
  padding: 0.2rem;
  border-radius: 4px;
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-action:hover {
  background: transparent;
  border: none;
  box-shadow: none;
  transform: none;
  color: var(--primary);
}

.nav-action .social-icon {
  width: 20px;
  height: 20px;
}

@media (max-width: 860px) {
  .site-header {
    position: static;
    padding: 1rem 0 1.25rem;
    pointer-events: auto;
  }

  .site-header__inner {
    padding: 0 1.5rem;
    justify-content: flex-start;
  }

  .site-nav {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.5rem 0.75rem;
    width: 100%;
    padding-top: 0;
  }

  .nav-actions {
    width: auto;
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .site-header {
    padding: 1rem 0 0;
  }

  .site-header__inner {
    padding: 0 1rem;
  }

  .site-nav {
    gap: 0.4rem;
    align-items: center;
  }
}

@media (max-width: 360px) {
  .site-header__inner {
    padding: 0 0.85rem;
  }

  .nav-actions {
    gap: 0.35rem;
  }
}

/* ── Page layout wrapper ─────────────────────────────────── */
.page-wrapper {
  display: flex;
  justify-content: center;
  padding: 2.5rem 2rem 1rem;
  width: 100%;
}

/* ── Homepage layout ─────────────────────────────────────── */
.home-layout {
  margin-top: 0.3rem;
  display: grid;
  gap: 2rem;
  width: 100%;
  max-width: 1100px;
  animation: slideIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.home-hero,
.home-section {
  padding: 0;
}

.home-hero {
  display: grid;
  gap: 1.25rem;
  padding-bottom: 0.5rem;
}

.home-section {
  border-top: 1px solid var(--border);
  padding-top: 2.5rem;
}

.home-columns {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: start;
  padding-top: 2.5rem;
}

.home-columns::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(to right, #cfb15a, #c4783a, #962739, #5f293a);
}

.home-columns .home-section {
  border-top: none;
  padding-top: 0;
}

.work-section {
  display: grid;
  gap: 0;
}

.work-section .project-entry {
  padding: 0.9rem 0;
}

.home-eyebrow,
.section-kicker {
  font-family: 'JetBrains Mono', monospace;
  color: var(--primary);
  font-size: 0.90rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-title {
  font-family: 'Limelight', cursive;
  color: var(--primary);
  font-size: clamp(3rem, 8vw, 3.75rem);
  line-height: 0.95;
}

.home-intro {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
  max-width: 45rem;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 0.6rem;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0.6rem 1.25rem;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--surface);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.button-link:hover {
  opacity: 0.85;
  transform: translateY(-2px);
}

.button-link--ghost {
  background: transparent;
  color: var(--on-surface);
  border-color: var(--border);
}

.button-link--ghost:hover {
  opacity: 1;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  display: block;
}

.btn-icon.icon--email {
  mask-image: url('https://api.iconify.design/mdi:email.svg');
  -webkit-mask-image: url('https://api.iconify.design/mdi:email.svg');
}

.btn-icon.icon--github {
  mask-image: url('https://api.iconify.design/mdi:github.svg');
  -webkit-mask-image: url('https://api.iconify.design/mdi:github.svg');
}

.btn-icon.icon--kaggle {
  mask-image: url('https://api.iconify.design/simple-icons:kaggle.svg');
  -webkit-mask-image: url('https://api.iconify.design/simple-icons:kaggle.svg');
}

.btn-icon.icon--substack {
  mask-image: url('https://api.iconify.design/simple-icons:substack.svg');
  -webkit-mask-image: url('https://api.iconify.design/simple-icons:substack.svg');
  -webkit-mask-size: 85%;
  mask-size: 85%;
}

.section-heading {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
}

.section-title {
  font-family: 'Teko', sans-serif;
  color: var(--on-surface);
  font-size: clamp(2rem, 4vw, 2.5rem);
  line-height: 0.95;
}

/* ── Project list ────────────────────────────────────────── */
.project-list {
  list-style: none;
}

.project-entry {
  display: grid;
  grid-template-columns: 2rem 1fr;
  column-gap: 1rem;
  padding: 1.25rem 0;
  position: relative;
}

.project-entry::before {
  content: '';
  position: absolute;
  left: -0.75rem;
  top: 0.75rem;
  bottom: 0.75rem;
  width: 2px;
  background: var(--primary);
  box-shadow: 0 0 6px var(--primary-glow);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.2s ease;
}

.project-entry:hover::before {
  transform: scaleY(1);
}

.project-entry:hover .project-entry__title a {
  color: var(--primary);
}

.project-index {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  padding-top: 0.35rem;
  text-align: right;
  opacity: 0.7;
}

.project-entry__body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.project-entry__meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  opacity: 0.85;
}

.project-entry__title {
  font-family: 'Teko', sans-serif;
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1.05;
}

.project-entry__title a {
  color: var(--on-surface);
  text-decoration: none;
  transition: color 0.2s ease;
}

.project-entry__title span {
  color: var(--on-surface);
}

.project-entry__desc {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 1024px) {
  .home-layout { gap: 3.25rem; }
  .home-columns { gap: 0; }
}

@media (max-width: 768px) {
  .home-layout { gap: 3rem; }
  .home-hero { gap: 1rem; }
  .home-section { padding-top: 2rem; }
  .home-intro { font-size: 0.95rem; }
}

@media (max-width: 640px) {
  .project-entry {
    grid-template-columns: 1fr;
    row-gap: 0.4rem;
  }

  .project-entry::before {
    left: 0;
  }

  .project-index {
    text-align: left;
    padding-top: 0;
  }
}

/* ── Footer ──────────────────────────────────────────────── */
.minimal-footer {
  margin-top: 3%;
  padding: 0 0 1rem;
}

.minimal-footer__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.85rem 1rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
}

.minimal-footer p {
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  opacity: 0.7;
}

.footer-atom {
  width: 28px;
  height: 28px;
  color: var(--muted);
  opacity: 0.5;
  justify-self: center;
}

.footer-atom .atom-svg {
  width: 100%;
  height: 100%;
}

.footer-socials {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.footer-social {
  display: flex;
  align-items: center;
  justify-content: center;
  height: auto;
  padding: 0.2rem;
  border-radius: 4px;
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--muted);
  opacity: 0.72;
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.footer-social:hover {
  background: transparent;
  color: var(--primary);
  opacity: 1;
}

.footer-social .social-icon {
  width: 20px;
  height: 20px;
}

@media (max-width: 480px) {
  .minimal-footer { padding: 0 0.75rem 0.75rem; }

  .minimal-footer__inner {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .footer-atom { justify-self: start; }

  .footer-socials {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}
