/* ============================================================
   nv·pipeline — design tokens
   Deep blue-slate night, warm signal amber, mono utility voice.
   ============================================================ */

:root {
  --ink-950: #0b1220;
  --ink-850: #101a2c;
  --ink-700: #161f30;
  --ink-500: #24304a;
  --mist-300: #a7b4c7;
  --mist-100: #e8edf4;
  --amber-500: #e8a33d;
  --amber-600: #c97f1a;

  /* semantic tokens — light theme default */
  --bg: #f2f4f8;
  --bg-raised: #ffffff;
  --bg-inset: #e6eaf1;
  --text: #1a2334;
  --text-muted: #55627a;
  --line: #d4dae4;
  --accent: var(--amber-600);
  --accent-soft: rgba(201, 127, 26, 0.12);
  --accent-contrast: #ffffff;
  --canvas-particle: rgba(201, 127, 26, 0.55);
  --canvas-path: rgba(26, 35, 52, 0.08);
  --shadow: 0 10px 30px rgba(16, 26, 44, 0.10);

  --font-display: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  --measure: 62ch;
  --radius: 6px;
  --pad-x: clamp(1.25rem, 5vw, 4rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--ink-950);
    --bg-raised: var(--ink-700);
    --bg-inset: var(--ink-850);
    --text: var(--mist-100);
    --text-muted: var(--mist-300);
    --line: #26324b;
    --accent: var(--amber-500);
    --accent-soft: rgba(232, 163, 61, 0.14);
    --accent-contrast: #0b1220;
    --canvas-particle: rgba(232, 163, 61, 0.7);
    --canvas-path: rgba(167, 180, 199, 0.10);
    --shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  }
}

:root[data-theme="dark"] {
  --bg: var(--ink-950);
  --bg-raised: var(--ink-700);
  --bg-inset: var(--ink-850);
  --text: var(--mist-100);
  --text-muted: var(--mist-300);
  --line: #26324b;
  --accent: var(--amber-500);
  --accent-soft: rgba(232, 163, 61, 0.14);
  --accent-contrast: #0b1220;
  --canvas-particle: rgba(232, 163, 61, 0.7);
  --canvas-path: rgba(167, 180, 199, 0.10);
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
}

:root[data-theme="light"] {
  --bg: #f2f4f8;
  --bg-raised: #ffffff;
  --bg-inset: #e6eaf1;
  --text: #1a2334;
  --text-muted: #55627a;
  --line: #d4dae4;
  --accent: var(--amber-600);
  --accent-soft: rgba(201, 127, 26, 0.12);
  --accent-contrast: #ffffff;
  --canvas-particle: rgba(201, 127, 26, 0.55);
  --canvas-path: rgba(26, 35, 52, 0.08);
  --shadow: 0 10px 30px rgba(16, 26, 44, 0.10);
}

/* ============ base ============ */

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

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

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

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

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
}
.skip-link:focus { left: 0.5rem; }

/* ============ buttons ============ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font: 500 0.95rem var(--font-body);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }

.btn-accent {
  background: var(--accent);
  color: var(--accent-contrast);
}
.btn-accent:hover { filter: brightness(1.07); }

.btn-ghost {
  border-color: var(--line);
  color: var(--text);
  background: transparent;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-small { padding: 0.45rem 0.9rem; font-size: 0.85rem; }

.pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ============ topbar ============ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0.85rem var(--pad-x);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  letter-spacing: 0.02em;
}
.brand:hover { text-decoration: none; color: var(--accent); }

.topnav {
  display: flex;
  gap: 1.5rem;
  margin-inline: auto;
}
.topnav a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}
.topnav a:hover { color: var(--accent); text-decoration: none; }

.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.icon-moon { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }
:root[data-theme="light"] .icon-sun { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .icon-moon { display: block; }
  :root:not([data-theme]) .icon-sun { display: none; }
}

@media (max-width: 720px) {
  .topnav { display: none; }
  .topbar { justify-content: space-between; }
}

/* ============ hero ============ */

.hero {
  position: relative;
  min-height: 88vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

#pipelineCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-inner {
  position: relative;
  z-index: 1;
  padding: 6rem var(--pad-x) 4rem;
  max-width: 60rem;
}

/* Portrait: B&W photo shot on black — anchored to the hero's right
   edge, fading into the ground so it reads as part of the scene. */
.hero-portrait {
  position: absolute;
  right: 0;
  bottom: 0;
  top: 0;
  z-index: 0;
  width: min(42vw, 34rem);
  overflow: hidden;
  pointer-events: none;
}
.hero-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  filter: grayscale(1);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 45%);
  mask-image: linear-gradient(to right, transparent 0%, #000 45%);
  opacity: 0.9;
}
:root[data-theme="light"] .hero-portrait img { opacity: 0.8; }
@media (max-width: 900px) {
  .hero-portrait { display: none; }
}

.eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.hero-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-stretch: 110%;
  font-size: clamp(3.2rem, 11vw, 8.5rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  text-wrap: balance;
}

.hero-thesis {
  max-width: 44ch;
  margin-top: 1.75rem;
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
  color: var(--text-muted);
}
.hero-thesis em {
  font-style: normal;
  color: var(--text);
  border-bottom: 2px solid var(--accent);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2.25rem;
}

.hero-status {
  margin-top: 2.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  min-height: 1.2em;
}
.hero-status::before { content: "$ "; color: var(--accent); }
.hero-status::after {
  content: "▌";
  color: var(--accent);
  animation: pulse 1s steps(2) infinite;
}

/* ============ spine & sections ============ */

.spine-wrap {
  position: relative;
  padding: 2rem var(--pad-x) 4rem;
  max-width: 72rem;
  margin-inline: auto;
}
.spine-wrap::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: calc(var(--pad-x) - 1.5rem);
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--line) 6%, var(--line) 94%, transparent);
}
@media (max-width: 720px) {
  .spine-wrap::before { display: none; }
}

.section { padding: 4.5rem 0; }

.section-head {
  position: relative;
  margin-bottom: 2.5rem;
}

.node {
  position: absolute;
  left: -1.5rem;
  top: 0.55rem;
  width: 9px; height: 9px;
  transform: translateX(-4px);
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
@media (max-width: 720px) { .node { display: none; } }

.stage {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.section-head h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

/* ============ about ============ */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, var(--measure)) minmax(14rem, 1fr);
  gap: 3rem;
  align-items: start;
}
@media (max-width: 860px) { .about-grid { grid-template-columns: 1fr; } }

.about-text { color: var(--text-muted); max-width: var(--measure); }

.facts {
  display: grid;
  gap: 1rem;
}
.facts > div {
  border-left: 2px solid var(--accent);
  padding-left: 1rem;
}
.facts dt {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.facts dd { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ============ experience timeline ============ */

.timeline {
  list-style: none;
  display: grid;
  gap: 1.25rem;
}

.timeline-item {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  transition: border-color 0.2s ease;
}
.timeline-item:hover { border-color: var(--accent); }

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}
.timeline-meta h3 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.timeline-org { color: var(--text-muted); font-size: 0.95rem; }
.timeline-period {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.timeline-item ul {
  list-style: none;
  display: grid;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: var(--measure);
}
.timeline-item li::before {
  content: "—";
  color: var(--accent);
  margin-right: 0.6rem;
}

/* ============ skills ============ */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.25rem;
}

.skill-card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.skill-card h3 {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}
.skill-card ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.skill-card li {
  font-size: 0.85rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-muted);
}

/* ============ projects ============ */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1.25rem;
}

.project-card {
  display: block;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  color: var(--text);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}
.project-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.project-status {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  white-space: nowrap;
}
.project-card p { color: var(--text-muted); font-size: 0.95rem; }
.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
}
.project-tech span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.project-placeholder {
  border-style: dashed;
  display: grid;
  place-content: center;
  gap: 0.5rem;
  min-height: 11rem;
  text-align: center;
}
.project-placeholder .mono { color: var(--text-muted); font-size: 0.85rem; }
.project-placeholder:hover { transform: none; }

/* ============ education ============ */

.edu-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 2.5rem;
}
@media (max-width: 860px) { .edu-grid { grid-template-columns: 1fr; } }

.edu-list { display: grid; gap: 1.25rem; align-content: start; }

.edu-card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.edu-card h3 { font-size: 1.05rem; font-weight: 700; }
.edu-card .edu-school { color: var(--accent); font-size: 0.92rem; margin-top: 0.15rem; }
.edu-card .edu-detail { color: var(--text-muted); font-size: 0.92rem; margin-top: 0.6rem; max-width: var(--measure); }
.edu-card .edu-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.sub {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.75rem;
}
.cert-list h3.sub:not(:first-child) { margin-top: 2rem; }

.cert-list ul { list-style: none; display: grid; gap: 0.75rem; }

.cert-item {
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 0.5rem;
  align-items: baseline;
}
.cert-year {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.cert-name { color: var(--text); font-weight: 500; font-size: 0.95rem; }
.cert-issuer { color: var(--text-muted); font-size: 0.82rem; margin-top: 0.1rem; }

.lang-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.lang-level { font-size: 0.85rem; color: var(--text-muted); text-align: right; }

/* ============ footer ============ */

.footer {
  border-top: 1px solid var(--line);
  padding: 5rem var(--pad-x) 3rem;
  text-align: center;
  display: grid;
  gap: 2rem;
  justify-items: center;
}
.footer-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.footer-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; }
.footer-note { font-size: 0.78rem; color: var(--text-muted); }

/* Logo lockup ships on white — present it on its own card so it
   sits comfortably on both themes. */
.footer-logo {
  width: min(15rem, 70vw);
  height: auto;
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 0.75rem;
}

/* ============ chat ============ */

.chat-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 50;
  width: 56px; height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--accent-contrast);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}
.chat-fab:hover { transform: scale(1.06); }

.chat-panel {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 60;
  width: min(26rem, calc(100vw - 2.5rem));
  height: min(34rem, calc(100vh - 5rem));
  display: flex;
  flex-direction: column;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.chat-panel[hidden] { display: none; }

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-inset);
}
.chat-title { font-family: var(--font-mono); font-weight: 700; font-size: 0.95rem; }
.chat-sub { font-size: 0.68rem; color: var(--text-muted); margin-top: 0.15rem; }

.chat-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
}
.chat-close:hover { color: var(--accent); }

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.msg {
  max-width: 88%;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-line;
}
.msg-user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-contrast);
  border-bottom-right-radius: 2px;
}
.msg-bot {
  align-self: flex-start;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-bottom-left-radius: 2px;
}
.msg-bot .cursor { color: var(--accent); animation: pulse 0.8s steps(2) infinite; }
.msg a { overflow-wrap: anywhere; }

.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1.25rem 0.75rem;
}
.chat-chips button {
  font: 500 0.75rem var(--font-body);
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.chat-chips button:hover { color: var(--accent); border-color: var(--accent); }

.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--line);
}
.chat-input {
  flex: 1;
  min-width: 0;
  font: 400 0.92rem var(--font-body);
  color: var(--text);
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
}
.chat-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ============ reveal & motion ============ */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .pulse-dot, .hero-status::after, .msg-bot .cursor { animation: none; }
  #pipelineCanvas { display: none; }
}
