/* ---------------------------------------------------------------------------
   Nazım Can Araz — personal site
   Plain CSS, no build step. Colours are tokens on :root; dark mode follows the
   system unless the visitor picks a theme (stored as data-theme on <html>).
   ------------------------------------------------------------------------ */

:root {
  --bg: #f6f7f9;
  --bg-grid: rgba(11, 61, 108, 0.05);
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --text: #121a23;
  --text-2: #3b4754;
  --muted: #66727f;
  --line: #dde2e8;
  --accent: #0b5cad;          /* the CV's heading blue, brightened */
  --accent-soft: rgba(11, 92, 173, 0.1);
  --teal: #0b7f76;            /* the CV's label teal */
  --amber: #b26a00;
  --term-bg: #0d131a;
  --term-text: #cfd8e3;
  --term-dim: #7d8a99;
  --term-hi: #58d6c8;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);

  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 14px;
  --radius-sm: 8px;
  --wrap: 1120px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0e13;
    --bg-grid: rgba(120, 170, 220, 0.045);
    --surface: #11171f;
    --surface-2: #161e28;
    --text: #e7edf3;
    --text-2: #b9c4cf;
    --muted: #8593a2;
    --line: #222c38;
    --accent: #5aa9ff;
    --accent-soft: rgba(90, 169, 255, 0.12);
    --teal: #3cc8b9;
    --amber: #f0b44c;
    --term-bg: #070a0e;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0a0e13;
  --bg-grid: rgba(120, 170, 220, 0.045);
  --surface: #11171f;
  --surface-2: #161e28;
  --text: #e7edf3;
  --text-2: #b9c4cf;
  --muted: #8593a2;
  --line: #222c38;
  --accent: #5aa9ff;
  --accent-soft: rgba(90, 169, 255, 0.12);
  --teal: #3cc8b9;
  --amber: #f0b44c;
  --term-bg: #070a0e;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

/* --- base ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

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

h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }

p { margin: 0 0 1em; }

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
}
.skip:focus { top: 12px; }

/* --- top bar ------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.nav a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 15px;
  padding: 6px 10px;
  border-radius: 6px;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--accent); }

.tools { display: flex; align-items: center; gap: 6px; }

.lang, .theme-toggle {
  display: inline-grid;
  place-items: center;
  height: 34px;
  min-width: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-2);
  font: 500 13px/1 var(--font-mono);
  text-decoration: none;
  cursor: pointer;
}
.lang:hover, .theme-toggle:hover { color: var(--text); border-color: var(--muted); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
}

/* --- hero ---------------------------------------------------------------- */

.hero {
  position: relative;
  padding: 72px 0 40px;
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: -1px -1px;
}
.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 120px;
  background: linear-gradient(transparent, var(--bg));
  pointer-events: none;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--teal);
  font-size: 14px;
  letter-spacing: 0.02em;
}

.hero-name { display: flex; align-items: center; gap: 22px; margin-bottom: 22px; }
.hero-name .portrait {
  flex: none;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.hero h1 {
  font-size: clamp(36px, 4.6vw, 54px);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.lede {
  font-size: clamp(18px, 2vw, 21px);
  color: var(--text-2);
  max-width: 34em;
  margin-bottom: 10px;
}
.lede-list {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  max-width: 34em;
  font-size: clamp(16.5px, 1.7vw, 18.5px);
  color: var(--text-2);
}
.lede-list li { display: grid; grid-template-columns: 5.4em minmax(0, 1fr); align-items: baseline; padding: 6px 0; }
.lede-list li + li { border-top: 1px solid var(--line); }
.lede-list .yr { font-family: var(--font-mono); font-size: 0.78em; color: var(--teal); }

.cta { display: flex; flex-wrap: wrap; gap: 10px; }
.hero .cta .btn { padding: 0 13px; }
.hero .cta { gap: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
.btn:hover { border-color: var(--muted); transform: translateY(-1px); }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #06121f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn.primary { color: #06121f; }
}

/* the live spectrum "instrument" */
.scope {
  margin: 0;
  background: var(--term-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.scope-head, .scope-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--term-dim);
  white-space: nowrap;
  overflow: hidden;
}
.scope-head { border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.scope-head b { color: var(--term-text); font-weight: 500; }
.scope-head .chain { margin-left: auto; text-overflow: ellipsis; overflow: hidden; }
.scope-foot { border-top: 1px solid rgba(255, 255, 255, 0.06); color: var(--term-text); }
.scope-foot .hi { color: var(--term-hi); }
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3ddc84;
  box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.6);
  animation: pulse 2s infinite;
  flex: none;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(61, 220, 132, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0); }
}
#spectrum { display: block; width: 100%; height: 260px; }

.stats {
  position: relative;
  z-index: 1;
  list-style: none;
  margin: 56px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.stats li { padding: 20px 22px; }
.stats li + li { border-left: 1px solid var(--line); }
.stats strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.02em;
}
.stats span { display: block; color: var(--muted); font-size: 14.5px; line-height: 1.45; margin-top: 4px; }

/* --- sections ------------------------------------------------------------ */

.section { padding: 72px 0 16px; }

.section-head { margin-bottom: 36px; }
.section-head .num {
  display: block;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--teal);
  margin-bottom: 8px;
}
.section-head h2 { font-size: clamp(28px, 3.4vw, 36px); font-weight: 650; }
.section-head p { color: var(--muted); margin: 10px 0 0; max-width: 40em; }

/* about */
.about-text { font-size: 18px; color: var(--text-2); max-width: 44em; }
.about-text strong { color: var(--text); font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 8px 0 0; padding: 0; }
.chips li {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
}
.subhead {
  margin: 28px 0 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* experience timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: var(--line);
}
.job { position: relative; padding: 0 0 48px 44px; }
.job:last-child { padding-bottom: 0; }
.job::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.job.current::before { background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }

.job-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  margin-bottom: 2px;
}
.job-head h3 { font-size: 21px; font-weight: 650; }
.job-head .when { font-family: var(--font-mono); font-size: 13.5px; color: var(--muted); }
.job .role { color: var(--teal); font-weight: 500; margin-bottom: 10px; }
.job .role .where { color: var(--muted); font-weight: 400; }
.job p { color: var(--text-2); }
.job ul.points { margin: 0 0 14px; padding-left: 20px; color: var(--text-2); list-style: disc; }
.job ul.points li { margin: 6px 0; }
.job ul.points li::marker { color: var(--muted); }
.job ul.points strong { color: var(--text); font-weight: 600; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.tags li {
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-2);
}

/* projects */
.featured {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 40px;
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}
.kicker {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--teal);
  margin: 0 0 10px;
}
.featured h3 { font-size: 28px; font-weight: 650; margin-bottom: 14px; }
.featured p { color: var(--text-2); }
.checks { list-style: none; margin: 0 0 20px; padding: 0; color: var(--text-2); }
.checks li { position: relative; padding-left: 26px; margin: 8px 0; }
.checks li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--teal);
  border-bottom: 2px solid var(--teal);
  transform: translateY(-50%) rotate(-45deg);
}
.checks strong { color: var(--text); font-weight: 600; }

.project-links { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 20px; }
.project-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  text-decoration: none;
}
.project-links a:hover { text-decoration: underline; }
.project-links svg { width: 16px; height: 16px; }
.project-links { align-items: center; }
.try {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font: 500 15px/1 var(--font-sans);
  cursor: pointer;
}
.try[hidden] { display: none; }
.try:hover { filter: brightness(1.08); }
:root[data-theme="dark"] .try { color: #06121f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .try { color: #06121f; } }
.card-body .kicker { margin-bottom: 6px; font-size: 13px; color: var(--teal); }

.featured-visual { display: flex; flex-direction: column; justify-content: center; gap: 14px; min-width: 0; }
.featured-visual .term { font-size: 11.5px; padding: 14px 16px; }

.pipeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  align-items: stretch;
  padding: 18px 14px 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.stage { position: relative; text-align: center; padding: 0 6px; }
.stage + .stage::before {
  content: "→";
  position: absolute;
  left: -0.45em;
  top: 13px;
  color: var(--muted);
  font-family: var(--font-mono);
}
.stage .box {
  display: block;
  padding: 10px 4px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.stage.dsp .box { border-color: var(--accent); color: var(--accent); }
.stage small {
  display: block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.35;
}
.pipeline .pool {
  grid-column: 1 / -1;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.term {
  margin: 0;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--term-bg);
  color: var(--term-text);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
}
.term .dim { color: var(--term-dim); }
.term .hi { color: var(--term-hi); }
.term .prompt { color: #7fb7ff; }

.metrics {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.metrics li {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  text-align: center;
}
.metrics b { display: block; font-family: var(--font-mono); font-weight: 500; font-size: 17px; color: var(--text); }
.metrics span { font-size: 12.5px; color: var(--muted); }

/* radar playground */
.lab {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 36px;
  align-items: center;
  padding: 32px 36px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  margin-bottom: 28px;
}
.lab h3 { font-size: 20px; font-weight: 650; margin-bottom: 8px; }
.lab p { color: var(--text-2); font-size: 16px; }
.lab-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 22px; margin-bottom: 16px; }
.lab-controls label { display: block; font-size: 14px; color: var(--text-2); }
.lab-controls label span { display: flex; justify-content: space-between; gap: 8px; }
.lab-controls output { font-family: var(--font-mono); font-size: 13px; color: var(--text); white-space: nowrap; }
.lab-controls input { width: 100%; height: 26px; margin: 2px 0 0; accent-color: var(--accent); cursor: pointer; }
.lab .lab-caveat { font-size: 13.5px; color: var(--muted); margin-bottom: 12px; }
.lab-canvas { display: block; width: 100%; height: 300px; cursor: ew-resize; touch-action: pan-y; }
.lab-log {
  margin: 0;
  height: 6.6em;
  overflow: hidden;
  padding: 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font: 12px/1.6 var(--font-mono);
  color: var(--term-text);
  white-space: pre-wrap;
}
.lab-reset, .demo button {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font: 500 14px/1 var(--font-sans);
  cursor: pointer;
}
.lab-reset:hover, .demo button:hover { border-color: var(--muted); }

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.card-media {
  aspect-ratio: 16 / 9;
  background: var(--term-bg);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media svg { width: 100%; height: 100%; }
.card-media .term { width: 100%; padding: 20px 24px; border-radius: 0; background: transparent; font-size: 12.5px; }
.card-body { display: flex; flex-direction: column; flex: 1; padding: 22px 24px 24px; }
.card-body h3 { font-size: 20px; font-weight: 650; margin-bottom: 8px; }
.card-body p { color: var(--text-2); font-size: 16px; }
.card-body .tags { margin-top: auto; padding-top: 4px; }
.card-body .project-links { margin-top: 16px; }

.more-head { margin: 56px 0 14px; font-size: 20px; font-weight: 650; }
.more {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
}
.more li + li { border-top: 1px solid var(--line); }
.more a {
  display: grid;
  grid-template-columns: minmax(0, 15em) minmax(0, 1fr) auto;
  gap: 18px;
  align-items: baseline;
  padding: 14px 20px;
  color: inherit;
  text-decoration: none;
}
.more a:hover { background: var(--surface-2); }
.more .name { font-weight: 600; color: var(--text); }
.more .desc { color: var(--text-2); font-size: 15.5px; }
.more .lang-tag { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; }

/* skills */
.skills {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.skill {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.skill h3 {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}
.skill .tags li { font-size: 13px; }

/* education */
.edu {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.edu-card {
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}
.edu-card h3 { font-size: 20px; font-weight: 650; margin-bottom: 4px; }
.edu-card .meta { color: var(--teal); font-weight: 500; margin-bottom: 14px; }
.edu-card .meta .when { color: var(--muted); font-family: var(--font-mono); font-size: 13.5px; font-weight: 400; }
.edu-card dl { margin: 0; display: grid; gap: 10px; }
.edu-card dt { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.edu-card dd { margin: 2px 0 0; color: var(--text-2); }

.edu-text { color: var(--text-2); font-size: 16px; }

/* demo windows */
.demo-open { overflow: hidden; }
.demo {
  width: min(900px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  overflow: hidden auto;
}
.demo[data-name="fourier"] { width: min(1180px, calc(100vw - 32px)); }
.demo::backdrop { background: rgba(5, 9, 14, 0.72); }
.demo-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.demo-head h3 { font-size: 18px; font-weight: 650; }
.demo-body { padding: 20px; }
.demo-content { display: grid; gap: 14px; }
.demo[data-name="fourier"] .demo-body { padding: 0; }
.demo-note { margin: 0; padding: 0 20px 18px; color: var(--muted); font-size: 14px; }
.demo[data-name="fourier"] .demo-note { padding-top: 14px; }
.demo-status { margin: 0; color: var(--muted); font-size: 14.5px; }
.demo[data-name="fourier"] .demo-status { padding: 20px; }
.demo-status.error { color: #d13b3b; }
.demo-frame { display: block; width: 100%; height: min(680px, calc(100dvh - 170px)); border: 0; background: #111827; }
.demo-presets, .demo-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.demo-tabs button, .demo-presets button { font-family: var(--font-mono); font-size: 13px; }
.demo button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.demo-pane { display: grid; gap: 12px; }
.demo-pane[hidden] { display: none; }
.demo textarea, .demo input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 var(--font-mono);
  resize: vertical;
}
.demo-term { min-height: 15em; max-height: 46dvh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.demo-paper {
  display: grid;
  place-items: center;
  min-height: 200px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow-x: auto;
}
.demo-paper img { max-width: 100%; height: auto; }
.clock-face {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(6px, 2vw, 16px);
  padding: 28px 16px;
  border-radius: 14px;
  background: #14171a;
}
.clock-face svg { width: min(20%, 120px); height: auto; transform: skewX(-5deg); }
.clock-face path { fill: #2b2f33; }
.clock-face path.on { fill: #ff4d5e; filter: drop-shadow(0 0 5px rgba(255, 77, 94, 0.6)); }
.clock-colon { display: grid; gap: 26px; }
.clock-colon i { width: 12px; height: 12px; border-radius: 50%; background: #2b2f33; }
.clock-colon.on i { background: #ff4d5e; box-shadow: 0 0 10px rgba(255, 77, 94, 0.8); }
.clock-buttons { justify-content: center; touch-action: manipulation; user-select: none; -webkit-user-select: none; }

/* contact */
.contact {
  margin: 72px 0 0;
  padding: 56px;
  border-radius: 24px;
  background: var(--term-bg);
  color: var(--term-text);
  position: relative;
  overflow: hidden;
}
.contact::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(120, 170, 220, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 170, 220, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}
.contact > * { position: relative; }
.contact .num { display: block; font-size: 13px; color: var(--term-hi); margin-bottom: 8px; }
.contact h2 { color: #fff; font-size: clamp(30px, 4vw, 42px); font-weight: 650; margin-bottom: 14px; }
.contact p { color: var(--term-dim); max-width: 36em; font-size: 18px; }
.contact .cta { margin-top: 24px; }
.contact .btn { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.14); color: #fff; }
.contact .btn:hover { border-color: rgba(255, 255, 255, 0.4); }
.contact .btn.primary { background: #5aa9ff; border-color: #5aa9ff; color: #06121f; }
.contact .mail { font-family: var(--font-mono); font-size: 15px; color: var(--term-text); margin-top: 18px; }

.footer {
  padding: 40px 0 48px;
  color: var(--muted);
  font-size: 14px;
}
.footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.footer a { color: var(--muted); }

/* --- responsive ---------------------------------------------------------- */

@media (max-width: 980px) {
  .hero-grid, .featured, .lab { grid-template-columns: minmax(0, 1fr); }
  .hero-grid { gap: 40px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats li:nth-child(3) { border-left: 0; }
  .stats li:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .nav a { padding: 6px 7px; font-size: 14.5px; }
}

@media (max-width: 820px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding-top: 10px; gap: 6px 12px; }
  .tools { margin-left: auto; }
  .nav {
    order: 3;
    width: calc(100% + 48px);
    margin: 0 -24px;
    padding: 2px 18px 8px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; }
  html { scroll-padding-top: 110px; }
  .cards, .skills, .edu { grid-template-columns: minmax(0, 1fr); }
  .more a { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; }
  .more .desc { grid-column: 1 / -1; grid-row: 2; }
}

@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .nav { width: calc(100% + 32px); margin: 0 -16px; padding: 2px 10px 8px; }
  body { font-size: 16px; }
  .hero { padding: 40px 0 40px; }
  .stats { grid-template-columns: minmax(0, 1fr); margin-top: 36px; }
  .stats li + li { border-left: 0; border-top: 1px solid var(--line); }
  .section { padding-top: 64px; }
  .featured, .lab { padding: 22px 18px; }
  .lab-controls { grid-template-columns: minmax(0, 1fr); }
  .lab-canvas { height: 220px; }
  .hero-name { gap: 16px; }
  .hero-name .portrait { width: 72px; height: 72px; }
  .hero h1 { font-size: clamp(28px, 8.4vw, 36px); }
  .lede-list li { grid-template-columns: 4.6em minmax(0, 1fr); }
  .pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; }
  .stage:nth-child(3)::before { display: none; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .job { padding-left: 32px; }
  .contact { padding: 36px 22px; margin-top: 64px; border-radius: 18px; }
  #spectrum { height: 200px; }
  .brand-name { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .live-dot { animation: none; }
  .btn, .card { transition: none; }
  .btn:hover, .card:hover { transform: none; }
}

@media print {
  .topbar, .scope, .theme-toggle, .lang, .skip { display: none !important; }
  .hero { background: none; padding-top: 0; }
  .card, .featured { break-inside: avoid; box-shadow: none; }
}
