/* VOICE   work: a student research write-up, dark by request
   IDEA    a chip datasheet: the portfolio drawn as a die floorplan, sections joined by circuit traces
   PICTURE hero chip package with one block per theme and signals running along the bond wires
   COLOUR  near-black ground, light ink; themes: gold semis, blue core, coral defense, violet quantum
   TYPE    Space Grotesk 600 + Inter, JetBrains Mono for tickers
   LAYOUT  laptop: title left, chip right, key figures below; phone: title, chip, figures stacked */

:root {
  color-scheme: dark;
  --bg: #0a0c11;
  --bg-2: #0f1219;
  --surface: #141922;
  --surface-2: #1b212d;
  --ink: #e9ecf3;
  --ink-soft: #a9b1c1;
  --muted: #7d8599;
  --line: #232a38;
  --line-strong: #323b4e;
  --accent: #8cbcff;
  --core: #6fa8ff;
  --semi: #f2b84b;
  --def: #ff7a66;
  --qtm: #a98cff;
  --aqua: #2ed3a0;
  --display: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

.core { --c: var(--core); }
.semi { --c: var(--semi); }
.def { --c: var(--def); }
.qtm { --c: var(--qtm); }

* { box-sizing: border-box; min-width: 0; }
html { scroll-behavior: smooth; background: var(--bg); }

body {
  margin: 0;
  overflow-x: clip;
  background:
    radial-gradient(760px 520px at 82% -4%, rgba(242, 184, 75, 0.08), transparent 62%),
    radial-gradient(760px 520px at -8% 4%, rgba(111, 168, 255, 0.09), transparent 62%),
    var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }
a { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(140, 188, 255, 0.35); overflow-wrap: anywhere; }
a:hover { border-bottom-color: var(--accent); }
em { color: var(--ink); }
code { font-family: var(--mono); font-size: 0.86em; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; color: var(--ink); }
::selection { background: rgba(242, 184, 75, 0.35); color: #fff; }

/* ---------- navigation ---------- */
nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(10, 12, 17, 0.74);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
nav ul { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0 auto; padding: 10px 24px; max-width: 1100px; font-size: 14px; }
nav li a { display: inline-block; color: var(--ink-soft); border: 1px solid transparent; padding: 5px 12px; border-radius: 999px; transition: color 0.2s, background 0.2s, border-color 0.2s; }
nav li a:hover { color: var(--ink); background: var(--surface); border-color: var(--line-strong); }

/* ---------- layout ---------- */
header, main, footer { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
header { padding-top: 68px; padding-bottom: 48px; position: relative; }
/* thin bar split like the equal-weight portfolio: 3 core, 3 semis, 1 defense, 3 quantum */
header::before {
  content: "";
  position: absolute;
  top: 0; left: 24px; right: 24px; height: 3px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, var(--core) 0 30%, var(--semi) 30% 60%, var(--def) 60% 70%, var(--qtm) 70% 100%);
}

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

.kicker {
  display: inline-block;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 20px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(140, 188, 255, 0.06);
}

h1, h2, h3, h4 { font-family: var(--display); color: var(--ink); text-wrap: balance; }
h1 {
  font-size: clamp(38px, 5.2vw, 60px);
  line-height: 1.05;
  margin: 0 0 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, #ffffff 0%, #b8c2d6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
h2 { font-size: clamp(26px, 3.3vw, 34px); line-height: 1.15; margin: 0 0 16px; font-weight: 600; letter-spacing: -0.02em; }
h3 { font-size: 20px; font-weight: 600; margin: 36px 0 10px; letter-spacing: -0.01em; }
.lead { font-size: 19px; color: var(--ink-soft); max-width: 560px; margin: 0; line-height: 1.6; }
p, li { max-width: 740px; }
p { color: var(--ink-soft); }
p strong, li strong { color: var(--ink); font-weight: 600; }
ul { padding-left: 20px; }
li { margin-bottom: 8px; color: var(--ink-soft); }

/* ---------- the chip ---------- */
.chip-wrap { position: relative; isolation: isolate; }
.chip-wrap::before {
  content: "";
  position: absolute;
  inset: 10%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(242, 184, 75, 0.16), rgba(169, 140, 255, 0.06) 60%, transparent);
  filter: blur(18px);
}
.chip { display: block; width: 100%; height: auto; max-width: 560px; margin-left: auto; }
.chip .bn { font: 600 17px var(--display); fill: var(--ink); }
.chip .bt { font: 500 13.5px var(--mono); fill: var(--ink-soft); }
.blk > rect:first-child { fill: color-mix(in srgb, var(--c) 12%, #121722); stroke: var(--c); stroke-opacity: 0.75; stroke-width: 1.2; }
.blk use { color: var(--c); }
.traces path { fill: none; stroke: var(--c); stroke-width: 2; stroke-opacity: 0.5; }
.traces circle { fill: var(--c); }
.traces .pulse { stroke-opacity: 1; stroke-width: 3.2; stroke-linecap: round; stroke-dasharray: 16 84; animation: flow 2.8s linear infinite; }
@keyframes flow { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }

/* ---------- sections joined by a trace with a via ---------- */
section { padding: 60px 0; position: relative; }
section::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, var(--semi), var(--line) 160px); }
section::after { content: ""; position: absolute; top: -4px; left: 0; width: 9px; height: 9px; border-radius: 50%; background: var(--bg); border: 2px solid var(--semi); }

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--semi);
  font: 600 14px/1.3 var(--display);
  margin: 0 0 10px;
}
.step::before {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23f2b84b' stroke-width='1.4' stroke-linecap='round'%3E%3Crect x='4' y='4' width='8' height='8' rx='1.5'/%3E%3Cpath d='M6.5 1v3M9.5 1v3M6.5 12v3M9.5 12v3M1 6.5h3M1 9.5h3M12 6.5h3M12 9.5h3'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* ---------- headline numbers ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin: 44px 0 0; }
.tile { background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); border-radius: 14px; padding: 20px 20px 18px; transition: border-color 0.25s, transform 0.25s; }
.tile:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.tile .number { font: 700 clamp(26px, 3vw, 32px)/1.1 var(--display); letter-spacing: -0.02em; white-space: nowrap; color: var(--ink); }
.tile .label { color: var(--ink-soft); font-size: 14px; line-height: 1.45; margin-top: 10px; }

/* ---------- theme cards ---------- */
.themes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 18px 0 10px; }
.theme { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 18px 16px; transition: border-color 0.25s; }
.theme:hover { border-color: color-mix(in srgb, var(--c) 45%, var(--line)); }
.theme .ico { width: 30px; height: 30px; color: var(--c); }
.theme h4 { font-size: 17px; font-weight: 600; line-height: 1.2; margin: 12px 0 4px; }
.theme .tick { font: 500 13px var(--mono); color: var(--c); margin: 0 0 10px; }
.theme .desc { font-size: 14.5px; line-height: 1.5; margin: 0 0 16px; flex: 1; }
.vol .track { position: relative; height: 6px; border-radius: 3px; background: var(--surface-2); }
.vol .track span { position: absolute; top: 0; bottom: 0; min-width: 6px; border-radius: 3px; background: var(--c); }
.vol p { font-size: 13px; color: var(--ink-soft); margin: 8px 0 0; white-space: nowrap; }
.note { font-size: 13.5px; color: var(--muted); }

/* ---------- callouts, formulas ---------- */
.question {
  background: linear-gradient(135deg, rgba(111, 168, 255, 0.1), rgba(111, 168, 255, 0.03));
  border: 1px solid rgba(140, 188, 255, 0.24);
  border-radius: 14px;
  padding: 20px 24px;
  margin: 24px 0;
  font-size: 19px;
  line-height: 1.6;
  max-width: 820px;
  color: var(--ink);
}
.question strong { color: var(--accent); }
.answer { background: linear-gradient(135deg, rgba(46, 211, 160, 0.12), rgba(46, 211, 160, 0.03)); border-color: rgba(46, 211, 160, 0.3); }
.answer strong { color: var(--aqua); }
.formula {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-left: 2px solid var(--semi);
  border-radius: 10px;
  padding: 16px 22px;
  margin: 18px 0;
  font-family: "Cambria Math", Cambria, Georgia, serif;
  font-size: 19px;
  color: var(--ink);
  max-width: 800px;
  overflow-x: auto;
}
.formula .where { display: block; font-family: "Inter", system-ui, sans-serif; font-size: 14px; color: var(--muted); margin-top: 8px; }

/* ---------- figures: matplotlib PNGs are white, so they sit on a light card inside a dark panel ---------- */
figure { margin: 30px 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
figure img { display: block; width: 100%; height: auto; border-radius: 10px; background: #fff; padding: 8px; }
figure.narrow { max-width: 700px; }
figcaption { color: var(--muted); font-size: 14px; margin: 12px 6px 4px; max-width: 760px; line-height: 1.55; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 22px 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
caption { text-align: left; color: var(--ink-soft); font-size: 14px; padding: 14px 16px 10px; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
thead th { color: var(--muted); font-weight: 600; font-size: 13px; background: var(--bg-2); border-bottom: 1px solid var(--line-strong); }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.2s; }
tbody tr:hover { background: rgba(140, 188, 255, 0.05); }
td { color: var(--ink); }
td.left, th.left { text-align: left; white-space: normal; color: var(--ink-soft); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 10px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 2px 10px 2px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }

footer { padding-top: 30px; padding-bottom: 70px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }
footer p { color: var(--muted); }

/* ---------- narrow screens ---------- */
@media (max-width: 900px) {
  .themes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .chip { margin: 0 auto; max-width: 480px; }
  .lead { max-width: none; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  header, main, footer { padding: 0 16px; }
  header { padding-top: 48px; }
  header::before { left: 16px; right: 16px; }
  nav ul { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 8px 12px; }
  nav li { flex: none; }
  section { padding: 44px 0; }
  table { font-size: 13px; }
  th, td { padding: 8px 8px; }
  figure { padding: 8px; }
}
@media (max-width: 480px) {
  .themes { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .traces .pulse { display: none; }
  html { scroll-behavior: auto; }
  .tile, .tile:hover { transform: none; transition: none; }
}
