/* PCB: the site drawn as a KiCad schematic sheet.
   Paper with a dot grid, a double border with zone markers, net-label section
   headings, hierarchical-sheet cards, and a title block. Matches cv-pcb.tex. */
:root {
  color-scheme: light dark;
  --paper: #fbfbf8;
  --dots: rgba(31, 78, 156, 0.16);
  --surface: #ffffff;
  --text: #1b2233;
  --muted: #5a6478;
  --accent: #0b2a6f;       /* name, titles */
  --frame: #1f4e9c;        /* border, labels, title block */
  --wire: #3d7dd8;         /* wires, junctions, bullets */
  --on-wire: #ffffff;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --gutter: 18px;          /* width of the zone-marker band */
}

/* KiCad's dark schematic theme */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0d1220;
    --dots: rgba(120, 160, 255, 0.14);
    --surface: #121a2e;
    --text: #d7deee;
    --muted: #8e9ab3;
    --accent: #a9c6ff;
    --frame: #5b8def;
    --wire: #4f9cf5;
    --on-wire: #0d1220;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 64px; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image: radial-gradient(var(--dots) 1px, transparent 1.2px);
  background-size: 20px 20px;
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, .nav, .btn, .date, .chips li, .badge, .pub-year, .note, .eyebrow {
  font-family: var(--mono);
}

/* ---------- sheet border and zone markers ---------- */
.sheet {
  position: relative;
  max-width: 900px;
  margin: 28px auto;
  padding: var(--gutter);
  border: 1px solid var(--frame);
}
.sheet-inner {
  position: relative;
  border: 1px solid var(--frame);
  background: color-mix(in srgb, var(--paper) 70%, transparent);
}
.zones {
  position: absolute;
  display: flex;
  color: var(--frame);
  font: 500 10px/1 var(--mono);
}
.zones span { flex: 1; display: flex; align-items: center; justify-content: center; }
.zones-top, .zones-bottom { left: var(--gutter); right: var(--gutter); height: var(--gutter); }
.zones-top { top: 0; }
.zones-bottom { bottom: 0; }
.zones-top span + span, .zones-bottom span + span { border-left: 1px solid var(--frame); }
.zones-left, .zones-right { top: var(--gutter); bottom: var(--gutter); width: var(--gutter); flex-direction: column; }
.zones-left { left: 0; }
.zones-right { right: 0; }
.zones-left span + span, .zones-right span + span { border-top: 1px solid var(--frame); }

.container { max-width: 760px; margin: 0 auto; padding: 0 28px; }

/* ---------- nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--frame);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 52px; }
.logo { font-weight: 600; color: var(--accent); }
.nav nav { display: flex; gap: 18px; }
.nav nav a { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
.nav nav a:hover { color: var(--frame); text-decoration: none; }
.nav nav a.view-switch { color: var(--frame); border: 1px solid var(--frame); padding: 0 6px; }

/* ---------- hero ---------- */
.hero { padding: 64px 0 40px; }
.eyebrow { margin: 0; color: var(--muted); font-size: 0.85rem; }
.eyebrow::before { content: 'REF U1 \2014\00a0'; color: var(--frame); }
.hero h1 {
  margin: 4px 0 10px;
  color: var(--accent);
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.tagline { margin: 0 0 16px; font-size: 1.15rem; color: var(--muted); }
.lead { max-width: 62ch; }
.callout {
  max-width: 62ch;
  padding: 10px 14px;
  border: 1px dashed var(--frame);
  background: var(--surface);
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

.btn {
  display: inline-block;
  padding: 8px 14px;
  border: 1.5px solid var(--frame);
  background: var(--surface);
  color: var(--frame);
  font-size: 0.85rem;
  font-weight: 500;
}
.btn:hover { text-decoration: none; background: color-mix(in srgb, var(--wire) 10%, var(--surface)); }
.btn.primary { background: var(--frame); color: var(--on-wire); }
.btn.primary:hover { background: var(--wire); }

/* ---------- sections and net-label headings ---------- */
section { padding: 32px 0; }
section.hero { padding-top: 64px; }

/* Global label (tag with a pointed right end), then a wire to a junction dot */
h2 {
  display: flex;
  align-items: center;
  margin: 0 0 22px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
h2 .net {
  position: relative;
  height: 26px;
  padding: 0 14px 0 9px;  /* right padding keeps text clear of the point */
  margin-right: 13px;
  border: 1.5px solid var(--frame);
  border-right: none;
  color: var(--frame);
  line-height: 23px;
  white-space: nowrap;
  background: var(--paper);
}
h2 .net::after {
  content: '';
  position: absolute;
  top: 2.5px;
  right: -9.5px;
  width: 18px;
  height: 18px;
  border-top: 1.5px solid var(--frame);
  border-right: 1.5px solid var(--frame);
  background: var(--paper);
  transform: rotate(45deg);
}
h2::after {
  content: '';
  flex: 1;
  height: 8px;
  background:
    radial-gradient(circle, var(--wire) 3px, transparent 3.5px) right center / 8px 8px no-repeat,
    linear-gradient(var(--wire), var(--wire)) left center / calc(100% - 4px) 2px no-repeat;
}
h3 { margin: 0; font-size: 0.95rem; }

/* ---------- entries ---------- */
.item { margin-bottom: 24px; }
.item:last-child { margin-bottom: 0; }
.item-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 16px; }
.item-head h3 { color: var(--accent); }
.item-head h3 span { font-weight: 400; color: var(--muted); }
.date { color: var(--muted); font-size: 0.82rem; }
.item ul { margin: 8px 0 0; padding-left: 18px; list-style: none; }
.item li { position: relative; margin-bottom: 4px; }
.item li::before {
  content: '';
  position: absolute;
  left: -15px;
  top: 0.62em;
  width: 6px;
  height: 6px;
  background: var(--wire);
}
.sub { margin: 6px 0 0; color: var(--muted); }
.note { margin: -10px 0 16px; color: var(--muted); font-size: 0.82rem; }

/* ---------- research cards as hierarchical sheets ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 26px 18px; margin-top: 20px; }
.card { display: flex; flex-direction: column; }
.sheetname { font-size: 0.78rem; font-weight: 600; color: var(--accent); margin-bottom: 3px; }
.sheetname span { color: var(--muted); font-weight: 400; }
.sheetbody {
  position: relative;
  flex: 1;
  margin: 0;
  padding: 12px 14px;
  border: 2px solid var(--frame);
  background: var(--surface);
  font-size: 0.92rem;
  color: var(--text);
}
/* a sheet pin on the left edge */
.sheetbody::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 14px;
  width: 10px;
  height: 8px;
  background: var(--wire);
  clip-path: polygon(0 0, 60% 0, 100% 50%, 60% 100%, 0 100%);
}
.sheetfile { margin: 3px 0 0; font: 0.75rem var(--mono); color: var(--muted); }

.figure { margin: 28px 0 0; }
.figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1.5px solid var(--frame);
  background: var(--surface);
}
.figure figcaption { margin-top: 6px; color: var(--muted); font: 0.8rem var(--mono); }
.figure figcaption::before { content: 'Fig. 1 \2014\00a0'; color: var(--frame); }

/* ---------- highlights ---------- */
.news { margin: 0; padding: 0; list-style: none; }
.news li { display: flex; gap: 16px; margin-bottom: 8px; }
.news .date { flex: 0 0 44px; padding-top: 2px; color: var(--frame); }

/* ---------- publications ---------- */
.pub-year { margin: 22px 0 10px; color: var(--frame); font-size: 0.85rem; }
.pub-year:first-child { margin-top: 0; }
.pubs { margin: 0; padding: 0; list-style: none; }
.pubs li { margin-bottom: 16px; padding-left: 12px; border-left: 2px solid color-mix(in srgb, var(--wire) 45%, transparent); }
.pubs p { margin: 0; }
.pub-title { font-weight: 600; }
.pub-title a { color: var(--accent); }
.pub-authors, .pub-venue { color: var(--muted); font-size: 0.92rem; }
.pub-authors strong { color: var(--text); font-weight: 600; }
.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border: 1px solid var(--frame);
  color: var(--frame);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: 2px;
}

/* ---------- skills ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.chips li {
  padding: 3px 10px;
  border: 1.5px solid var(--frame);
  background: var(--surface);
  color: var(--frame);
  font-size: 0.8rem;
}

/* ---------- title block ---------- */
.titleblock {
  display: grid;
  grid-template-columns: 1fr auto auto;
  max-width: 560px;
  margin: 24px 0 0 auto;
  border-top: 1px solid var(--frame);
  border-left: 1px solid var(--frame);
  font: 0.75rem var(--mono);
  color: var(--text);
}
.titleblock > div { padding: 5px 10px; border-right: 1px solid var(--frame); border-bottom: 1px solid var(--frame); }
.titleblock span { color: var(--muted); }
.titleblock .tb-title { grid-column: 1 / -1; font-weight: 600; color: var(--accent); }
.titleblock > div:nth-child(5) { grid-column: span 2; }
.titleblock > div:last-child { border-right: none; }
.titleblock > div:nth-child(4) { border-right: none; }

@media (max-width: 600px) {
  :root { --gutter: 12px; }
  .sheet { margin: 8px; }
  .zones { font-size: 8px; }
  .container { padding: 0 16px; }
  .nav-inner { gap: 14px; }
  .logo { white-space: nowrap; }
  .nav nav { gap: 12px; overflow-x: auto; scrollbar-width: none; }
  .nav nav a { font-size: 0.72rem; white-space: nowrap; }
  .nav nav a.view-switch { order: -1; }  /* keep it visible before the scrolling links */
  .hero { padding-top: 40px; }
  .titleblock { grid-template-columns: 1fr 1fr; max-width: none; }
  .titleblock > div:nth-child(5) { grid-column: auto; }
  .titleblock > div:nth-child(4) { border-right: 1px solid var(--frame); }
  .titleblock > div:nth-child(odd) { border-right: none; }
}
