/* ==========================================================================
   cyborgresearcher.com — design system
   Terminal teal: near-black ink / warm off-white, teal accent, mono flourishes
   ========================================================================== */

/* ---- Fonts (self-hosted, variable) ---- */
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-var.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-var.woff2") format("woff2-variations");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-var-italic.woff2") format("woff2-variations");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono-var.woff2") format("woff2-variations");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* ---- Tokens ---- */
:root {
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --w-prose: 46rem;
  --w-wide: 69rem;
  --radius: 10px;

  /* Light theme (default, also used when JS is unavailable) */
  --bg: #fafaf7;
  --bg-raised: #ffffff;
  --text: #1a1d21;
  --muted: #57636e;
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.1);
  --border: #e2e2d9;
  --shadow: 0 1px 3px rgba(20, 24, 28, 0.07);
  color-scheme: light;
}

/* Dark theme via system preference (no stored choice) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1117;
    --bg-raised: #151b23;
    --text: #e6e8ea;
    --muted: #9ba3ab;
    --accent: #2dd4bf;
    --accent-soft: rgba(45, 212, 191, 0.09);
    --border: #232a33;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

/* Dark theme via explicit toggle */
:root[data-theme="dark"] {
  --bg: #0e1117;
  --bg-raised: #151b23;
  --text: #e6e8ea;
  --muted: #9ba3ab;
  --accent: #2dd4bf;
  --accent-soft: rgba(45, 212, 191, 0.09);
  --border: #232a33;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

/* ---- Reset & base ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-sans);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.6em;
}

h1 {
  font-size: clamp(2.3rem, 6.5vw, 3.6rem);
  font-weight: 720;
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(1.45rem, 3.5vw, 1.85rem);
  font-weight: 680;
}

h3 {
  font-size: 1.12rem;
  font-weight: 640;
}

p {
  margin: 0 0 1.1em;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  transition: text-decoration-color 120ms ease;
}

a:hover {
  text-decoration-color: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--accent-soft);
  padding: 0.12em 0.35em;
  border-radius: 4px;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

/* ---- Utility ---- */
.wrap {
  max-width: var(--w-wide);
  margin-inline: auto;
  padding-inline: clamp(1.1rem, 4vw, 2rem);
}

.prose {
  max-width: var(--w-prose);
}

.mono {
  font-family: var(--font-mono);
}

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

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin: 0 0 0.9rem;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  transition: top 150ms ease;
}

.skip-link:focus {
  top: 1rem;
}

/* ---- Header / nav ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-block: 0.7rem;
}

.brand {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.brand .brand-cursor {
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 600;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.15rem, 1.5vw, 0.55rem);
  flex-wrap: wrap;
}

.site-nav a {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 520;
  color: var(--muted);
  text-decoration: none;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.site-nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 640;
}

.theme-toggle {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  width: 2.1rem;
  height: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 0.3rem;
}

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

.theme-toggle svg {
  width: 1.05rem;
  height: 1.05rem;
}

.icon-sun {
  display: none;
}

[data-theme="dark"] .icon-sun {
  display: block;
}

[data-theme="dark"] .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun {
    display: block;
  }
  :root:not([data-theme="light"]) .icon-moon {
    display: none;
  }
}

/* ---- Hero ---- */
.hero {
  padding-block: clamp(3.5rem, 9vw, 6.5rem) clamp(2rem, 5vw, 3.5rem);
}

.hero .tagline {
  font-family: var(--font-mono);
  font-size: clamp(0.8rem, 2.4vw, 0.95rem);
  color: var(--muted);
  margin: 0 0 1.4rem;
}

.hero .tagline .accent {
  color: var(--accent);
}

.cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 0.18em;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: blink 1.15s steps(2, start) infinite;
}

@keyframes blink {
  to {
    visibility: hidden;
  }
}

.hero .lede {
  font-size: clamp(1.12rem, 2.6vw, 1.28rem);
  line-height: 1.6;
  max-width: 44rem;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.8rem;
}

.btn {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.94rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--accent);
  transition: transform 120ms ease, background 120ms ease;
}

.btn-solid {
  background: var(--accent);
  color: var(--bg);
}

.btn-ghost {
  color: var(--accent);
  background: transparent;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-ghost:hover {
  background: var(--accent-soft);
}

/* ---- Sections & cards ---- */
.section {
  padding-block: clamp(2rem, 5vw, 3.2rem);
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.1rem;
  margin-top: 1.4rem;
}

@media (min-width: 44rem) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 62rem) {
  .card-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  transition: border-color 140ms ease, transform 140ms ease;
}

.card:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  transform: translateY(-2px);
}

.card h3 {
  margin: 0;
}

.card h3 a {
  color: var(--text);
  text-decoration: none;
}

.card h3 a:hover {
  color: var(--accent);
}

.card .card-kicker {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--accent);
  letter-spacing: 0.05em;
  margin: 0;
}

.card p {
  margin: 0;
  font-size: 0.98rem;
  color: var(--muted);
}

.card .card-body {
  color: var(--text);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.14rem 0.55rem;
  white-space: nowrap;
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  padding-top: 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
}

.status-note {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}

/* ---- Project list (research page) ---- */
.project {
  border-left: 2px solid var(--border);
  padding: 0.1rem 0 0.1rem 1.25rem;
  margin-bottom: 2rem;
}

.project:hover {
  border-left-color: var(--accent);
}

.project .project-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.2rem 0 0.5rem;
}

.project p {
  max-width: var(--w-prose);
}

.project p:last-child {
  margin-bottom: 0;
}

/* ---- Publications ---- */
.pub-list {
  list-style: none;
  padding: 0;
  margin: 1.2rem 0 0;
  max-width: 52rem;
}

.pub-list li {
  padding: 0 0 1.15rem 1.25rem;
  border-left: 2px solid var(--border);
  margin-bottom: 1.15rem;
}

.pub-list li:hover {
  border-left-color: var(--accent);
}

.pub-title {
  margin: 0 0 0.15rem;
}

.pub-detail {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.pub-year {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
}

/* ---- Contact ---- */
.contact-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  max-width: 30rem;
}

.contact-list a {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  padding: 0.85rem 1.1rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 560;
  transition: border-color 140ms ease;
}

.contact-list a:hover {
  border-color: var(--accent);
}

.contact-list .label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  min-width: 5.2rem;
}

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: clamp(3rem, 8vw, 5rem);
  padding-block: 2rem 2.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 2rem;
  justify-content: space-between;
  align-items: center;
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--accent);
}

.footer-mark {
  color: var(--accent);
}

/* ---- 404 ---- */
.terminal {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.7rem;
  max-width: 36rem;
  line-height: 1.9;
}

.terminal .prompt {
  color: var(--accent);
}

/* ---- Motion preferences ---- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .cursor {
    animation: none;
  }
  .card,
  .card:hover,
  .btn,
  .btn:hover {
    transition: none;
    transform: none;
  }
}
