/* Schematic: the PCB look (pcb.css) laid out as landscape KiCad sheets.
   Wide screens: one sheet at a time, blocks placed on a grid and joined by
   wires (drawn by schematic.js). Narrow screens: blocks stack, all sheets
   in order, short vertical wires between blocks. */

/* ---------- nav: sheet tabs and view links ---------- */
.nav-inner { max-width: 1400px; margin: 0 auto; padding: 0 24px; gap: 24px; }
.sheet-tabs { display: flex; gap: 6px; margin-right: auto; }
.sheet-tabs a {
  padding: 3px 10px;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sheet-tabs a span {
  display: inline-block;
  min-width: 1.4em;
  margin-right: 4px;
  border: 1px solid currentColor;
  text-align: center;
  font-size: 0.7rem;
}
.sheet-tabs a[aria-current="page"] { border-color: var(--frame); color: var(--frame); }
.nav .views { display: flex; gap: 14px; }
.nav .views a { font-size: 0.75rem; color: var(--muted); }

/* ---------- sheets ---------- */
section.sheet {
  max-width: none;
  margin: 20px auto;
  padding: var(--gutter);
}
.sheet-inner { display: flex; flex-direction: column; }
.sheet-inner > .titleblock { margin: auto 0 0 auto; }

/* Wide screens: each sheet is laid out at a fixed landscape size
   (1400 x 990, A-series proportions) and schematic.js zooms it to fit the window */
html.paged main { position: relative; overflow-x: hidden; }
html.paged .sheet:not(.active) { display: none; }
html.paged section.sheet {
  width: 1400px;
  margin: 0;
  transform-origin: top left;
}
html.paged .sheet-inner { min-height: calc(990px - 2 * var(--gutter)); }

/* ---------- canvas and blocks ---------- */
.canvas {
  position: relative;
  display: grid;
  gap: 34px 56px;
  padding: 26px 32px 30px;
  align-items: start;
}
.canvas-overview {
  grid-template-columns: 4fr 4fr 3fr;
  grid-template-areas:
    "about   highlights figure"
    "about   research   research"
    "contact research   research";
}
.canvas-publications {
  grid-template-columns: 1fr;
  grid-template-areas: "papers" "patents";
}
.canvas-experience {
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "industry education"
    "industry teaching"
    "skills   skills";
}

.block { position: relative; min-width: 0; }
.blk-name { margin: 0 0 3px; font: 600 0.78rem var(--mono); color: var(--accent); }
.blk-name span { color: var(--muted); font-weight: 400; }
.blk-body {
  position: relative;
  margin: 0;
  padding: 14px 16px;
  border: 2px solid var(--frame);
  background: var(--surface);
}
.blk-file { margin: 3px 0 0; font: 0.72rem var(--mono); color: var(--muted); }
.blk-text { margin: 0; }

/* wires layer, drawn by schematic.js */
.wires { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.wires path { fill: none; stroke: var(--wire); stroke-width: 2; }
.wires circle { fill: var(--wire); }
.wires rect { fill: var(--wire); }

/* about block: the old hero, scaled down */
.blk-body.hero { padding: 18px 20px; }
.hero h1 { font-size: clamp(2rem, 3.4vw, 2.8rem); margin: 2px 0 8px; }
.hero .tagline { font-size: 1.02rem; }
.hero .lead { font-size: 0.95rem; }
.hero .callout { font-size: 0.9rem; margin: 12px 0 0; }
.hero .actions { margin-top: 16px; }

/* research sub-sheets */
.subsheets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.subsheet { padding: 10px 12px; border: 1.5px solid var(--frame); }
.subsheet h3 { font-size: 0.8rem; color: var(--accent); margin-bottom: 4px; }
.subsheet p { margin: 0; font-size: 0.85rem; color: var(--muted); }

.figure.blk-body { padding: 8px; }
.figure img { border-width: 1px; }
.figure figcaption { font-size: 0.72rem; }

.news li { font-size: 0.92rem; }

/* entries inside blocks: sans titles wrap less than the mono ones */
.block .item { margin-bottom: 16px; }
.block .item-head h3 { font-family: var(--sans); font-size: 1rem; font-weight: 600; }
.block .item-head .date { font-size: 0.78rem; }
.block .item ul { margin-top: 6px; }
.block .item li { font-size: 0.95rem; margin-bottom: 2px; }
.block .sub { font-size: 0.95rem; }

/* publications in two columns inside their block */
.pub-columns { columns: 3; column-gap: 32px; }
.pub-columns .pub-year { break-after: avoid; }
.pub-columns .pubs li { break-inside: avoid; }
#papers .note { margin: 0 0 12px; }
#patents .blk-body { max-width: 420px; }

/* ---------- narrow screens: stack everything ---------- */
@media (max-width: 999px) {
  section.sheet { width: auto; margin: 10px; }
  .sheet-inner { aspect-ratio: auto; }
  .canvas { display: flex; flex-direction: column; gap: 34px; padding: 22px 18px 26px; }
  .wires { display: none; }
  /* a short wire from the block above, with a junction dot */
  .block + .block::before {
    content: '';
    position: absolute;
    top: -34px;
    left: 22px;
    width: 8px;
    height: 34px;
    background:
      radial-gradient(circle, var(--wire) 3px, transparent 3.5px) center bottom / 8px 8px no-repeat,
      linear-gradient(var(--wire), var(--wire)) center top / 2px calc(100% - 4px) no-repeat;
  }
  .subsheets { grid-template-columns: 1fr; }
  .pub-columns { columns: 1; }
  .sheet-inner > .titleblock { margin: 0 0 0 auto; }
}

@media (max-width: 600px) {
  .nav-inner { padding: 0 14px; gap: 12px; }
  .nav .views { display: none; }
  .sheet-tabs { overflow-x: auto; scrollbar-width: none; }
  .sheet-tabs a { white-space: nowrap; font-size: 0.7rem; padding: 3px 6px; }
  section.sheet { margin: 6px; }
}

/* ---------- Overview on wide screens: larger text to use the sheet ---------- */
@media (min-width: 1000px) {
  .canvas-overview { gap: 44px 60px; padding-top: 34px; }
  .canvas-overview .blk-name { font-size: 0.88rem; }
  .canvas-overview .blk-file { font-size: 0.8rem; }
  .canvas-overview .blk-body { padding: 18px 20px; }
  .canvas-overview .hero h1 { font-size: 3.4rem; }
  .canvas-overview .hero .eyebrow { font-size: 0.95rem; }
  .canvas-overview .hero .tagline { font-size: 1.22rem; }
  .canvas-overview .hero .lead { font-size: 1.1rem; }
  .canvas-overview .hero .callout { font-size: 1.02rem; }
  .canvas-overview .btn { font-size: 0.95rem; }
  .canvas-overview .news li { font-size: 1.08rem; }
  .canvas-overview .news .date { font-size: 0.92rem; }
  .canvas-overview .blk-text { font-size: 1.1rem; }
  .canvas-overview .subsheet { padding: 12px 14px; }
  .canvas-overview .subsheet h3 { font-size: 0.95rem; }
  .canvas-overview .subsheet p { font-size: 1rem; }
  .canvas-overview .figure figcaption { font-size: 0.82rem; }
}
