/* ── Tokens ── */
:root {
  --red:    #E63946;
  --blue:   #1D3557;
  --yellow: #FFD166;
  --white:  #F8F9FA;
  --black:  #111111;
  --gray:   #6C757D;
  --light-gray: #DEE2E6;

  --bg: var(--white);
  --surface: #FFFFFF;
  --ink: var(--black);
  --muted: var(--gray);
  --rule: var(--light-gray);
  --accent: var(--red);
  --accent2: var(--blue);
  --accent3: var(--yellow);
  --card-bg: #FFFFFF;
  --hero-bg: var(--blue);
  --hero-ink: var(--white);
  --hero-muted: rgba(255,255,255,0.65);
  --footer-bg: var(--black);
  --footer-ink: rgba(255,255,255,0.7);
  --focus-ring: var(--red);
}
[data-theme="dark"] {
  --bg: #1A1A1A;
  --surface: #222222;
  --ink: #E8E8E8;
  --muted: #999999;
  --rule: #333333;
  --accent: #FF6B6B;
  --accent2: #4A7CB5;
  --accent3: #FFD166;
  --card-bg: #222222;
  --hero-bg: #0D1B2A;
  --hero-ink: #E8E8E8;
  --hero-muted: rgba(255,255,255,0.55);
  --footer-bg: #0A0A0A;
  --footer-ink: rgba(255,255,255,0.6);
  --focus-ring: #FF6B6B;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { opacity: 0.8; }
img { max-width: 100%; display: block; }

/* ── Theme switcher ── */
.theme-switcher {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  display: flex;
  gap: 0.25rem;
  background: var(--surface);
  border: 2px solid var(--rule);
  padding: 0.25rem;
}
.theme-btn {
  font: inherit;
  font-size: 0.85rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  color: var(--muted);
  transition: color 0.15s;
}
.theme-btn[aria-pressed="true"] {
  color: var(--ink);
  background: var(--rule);
}

/* ── Hero ── */
.hero {
  position: relative;
  background: var(--hero-bg);
  color: var(--hero-ink);
  padding: 5rem 1.5rem 4rem;
  overflow: hidden;
  min-height: 60vh;
  display: flex;
  align-items: center;
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 64rem;
  margin: 0 auto;
  width: 100%;
}
.hero-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--hero-muted);
  margin-bottom: 0.75rem;
}
.hero h1 {
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}
.hero h1 .tnum {
  font-feature-settings: "tnum";
  color: var(--yellow);
}
.hero-tagline {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--hero-muted);
  max-width: 36rem;
}

/* Hero shapes */
.hero-shapes { position: absolute; inset: 0; pointer-events: none; }
.shape {
  position: absolute;
  opacity: 0.12;
}
.shape-circle {
  width: 20vw; height: 20vw;
  border-radius: 50%;
  background: var(--yellow);
  top: -5vw; right: 5vw;
}
.shape-rect {
  width: 12vw; height: 12vw;
  background: var(--red);
  bottom: 2vw; right: 20vw;
  transform: rotate(15deg);
}
.shape-triangle {
  width: 0; height: 0;
  border-left: 8vw solid transparent;
  border-right: 8vw solid transparent;
  border-bottom: 14vw solid var(--blue);
  top: 15%; left: -3vw;
  opacity: 0.08;
}

/* ── Section label ── */
.section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--muted);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-label .num {
  font-feature-settings: "tnum";
  color: var(--accent);
  font-weight: 700;
}

/* ── Research cards ── */
.research {
  padding: 4rem 1.5rem;
  max-width: 64rem;
  margin: 0 auto;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.5rem;
}
.card {
  position: relative;
  background: var(--card-bg);
  border: 3px solid var(--rule);
  padding: 2rem 1.5rem 1.5rem;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
  transform: translate(-3px, -3px);
  box-shadow: 6px 6px 0 rgba(0,0,0,0.1);
}
.card-shape {
  position: absolute;
  top: 0; right: 0;
  width: 3rem; height: 3rem;
}
.card-red .card-shape { background: var(--red); }
.card-blue .card-shape { background: var(--blue); }
.card-yellow .card-shape { background: var(--yellow); }
.card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}
.card p {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
}

/* ── About ── */
.about {
  padding: 4rem 1.5rem;
  max-width: 64rem;
  margin: 0 auto;
}
.about-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}
.about-text p {
  margin-bottom: 1rem;
  font-size: 0.95rem;
}
.stat-row {
  display: flex;
  gap: 2rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 3px solid var(--rule);
}
.stat-num {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
}
.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* About diagram */
.about-diagram {
  position: relative;
  aspect-ratio: 1 / 1;
  max-width: 20rem;
  margin: 0 auto;
}
.diag-circle {
  position: absolute;
  border-radius: 50%;
  border: 3px solid var(--rule);
}
.diag-c1 {
  width: 70%; height: 70%;
  top: 15%; left: 15%;
  border-color: var(--red);
}
.diag-c2 {
  width: 45%; height: 45%;
  top: 27.5%; left: 27.5%;
  border-color: var(--blue);
}
.diag-line {
  position: absolute;
  background: var(--rule);
  height: 3px;
  transform-origin: left center;
}
.diag-l1 {
  width: 50%; top: 50%; left: 0;
  transform: rotate(-30deg);
  background: var(--yellow);
}
.diag-l2 {
  width: 50%; top: 50%; left: 50%;
  transform: rotate(30deg);
  background: var(--yellow);
}
.diag-dot {
  position: absolute;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
}
.diag-d1 { top: 30%; left: 20%; }
.diag-d2 { top: 65%; left: 55%; }
.diag-d3 { top: 40%; left: 70%; }

/* ── Publications ── */
.pubs {
  padding: 4rem 1.5rem;
  max-width: 64rem;
  margin: 0 auto;
}
.pub-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.pub-list li {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
}
.pub-year {
  grid-row: 1 / 4;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent);
  padding-top: 0.15rem;
}
.pub-title {
  font-weight: 600;
  font-size: 0.95rem;
}
.pub-authors {
  font-size: 0.85rem;
  color: var(--muted);
}
.pub-journal {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--muted);
}

/* ── Contact ── */
.contact {
  padding: 4rem 1.5rem;
  max-width: 64rem;
  margin: 0 auto;
}
.contact-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
}
.form-row {
  margin-bottom: 1rem;
}
.form-row label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.3rem;
}
.form-row input,
.form-row textarea {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  padding: 0.6rem 0.75rem;
  border: 2px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s;
}
.form-row input:focus,
.form-row textarea:focus {
  border-color: var(--accent);
  outline: none;
}
.btn-submit {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.7rem 1.5rem;
  background: var(--accent);
  color: var(--white);
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  letter-spacing: 0.02em;
}
.btn-submit:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 rgba(0,0,0,0.15);
}
.form-status {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.contact-info {
  font-size: 0.9rem;
  line-height: 1.7;
}
.contact-info p { margin-bottom: 1rem; }
.contact-info a { font-weight: 500; }

/* ── Footer ── */
footer {
  background: var(--footer-bg);
  color: var(--footer-ink);
  padding: 2rem 1.5rem;
}
.footer-inner {
  max-width: 64rem;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.footer-meta { font-size: 0.85rem; }
footer .attribution { font-size: 0.75rem; opacity: 0.7; }
footer .attribution a { color: var(--footer-ink); }

/* ── Responsive ── */
@media (max-width: 640px) {
  .about-layout,
  .contact-layout {
    grid-template-columns: 1fr;
  }
  .about-diagram {
    max-width: 14rem;
  }
  .stat-row {
    gap: 1rem;
    flex-wrap: wrap;
  }
  .pub-list li {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
  }
  .pub-year {
    grid-row: auto;
    margin-bottom: 0.25rem;
  }
  .hero {
    padding: 3rem 1.5rem 2.5rem;
    min-height: 50vh;
  }
  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
