/* NullclineNexus build library: datasheets punched into a binder. Same visual
   language as the landing page: light page, corner glows, Orbitron capitals, and
   one accent per kind. */
:root {
  color-scheme: light;
  --bg: #fbfbfc;
  --glow-green: rgba(43, 212, 107, .22);
  --glow-blue: rgba(76, 160, 234, .22);
  --ink: #0b1220;
  --ink-2: #3c4859;
  --ink-3: #4a596f;   /* darker than a plain light page needs: it sits on the glows */
  --rule: rgba(11, 18, 32, .09);
  --rule-strong: rgba(11, 18, 32, .2);
  --focus: #1667a8;
  --board-top: #f1f3f6;
  --board-bottom: #e7ebf0;
  --accent-rgb: 11 18 32;    /* text, chips and fills */
  --glow-rgb: 148 163 184;   /* glows, tints and highlighter */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
[data-kind="Project"] { --accent-rgb: 0 117 51; --glow-rgb: 43 212 107; }
[data-kind="Challenge"] { --accent-rgb: 22 103 168; --glow-rgb: 76 160 234; }
[data-kind="Exploration"] { --accent-rgb: 109 63 196; --glow-rgb: 155 123 240; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100svh;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 820px at -6% -10%, var(--glow-green), transparent 62%),
    radial-gradient(1000px 820px at 106% 110%, var(--glow-blue), transparent 62%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
.wrap { width: min(1240px, 100% - 48px); margin-inline: auto; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

/* ---------- page header ---------- */
.site-head { padding-top: clamp(20px, 4vh, 36px); }
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 700 .78rem/1 "Orbitron", sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-decoration: none;
}
.crumb img { width: 24px; height: auto; }
.crumb svg { width: 16px; height: 16px; transition: transform .3s var(--ease); }
.crumb:hover { color: var(--ink); }
.crumb:hover svg { transform: translateX(-3px); }
.page-title {
  margin: clamp(26px, 5vh, 52px) 0 0;
  font: 700 clamp(2.4rem, 6vw, 4.4rem)/.95 "Orbitron", sans-serif;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.page-lead { margin: 16px 0 0; max-width: 56ch; font-size: 1.06rem; line-height: 1.55; color: var(--ink-2); }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  min-height: 38px;
  margin-top: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}
.page-meta { margin: 0; font-size: .86rem; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* view switch: sheets or table */
.views { display: inline-flex; margin-left: auto; padding: 3px; border-radius: 999px; background: rgb(255 255 255 / .72); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.views button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  font: 600 .8rem/1 "Inter", sans-serif;
  color: var(--ink-2);
  background: transparent;
  cursor: pointer;
  transition: background .25s, color .25s;
}
.views svg { width: 15px; height: 15px; }
.views button:hover { color: var(--ink); }
.views button[aria-pressed="true"] { color: #fff; background: var(--ink); }

/* ---------- the binder: index tabs on a board ---------- */
.binder { margin-top: 34px; }
.binder__tabs { position: relative; z-index: 1; display: flex; align-items: flex-end; flex-wrap: wrap; gap: 4px; padding: 0 22px; margin-bottom: -1px; }
.tab {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px 12px 0 0;
  font: 600 .8rem/1 "Inter", sans-serif;
  color: var(--ink-2);
  background: color-mix(in srgb, rgb(var(--glow-rgb)) 20%, #f7f8fa);
  box-shadow: inset 1px 1px 0 var(--rule-strong), inset -1px 0 0 var(--rule-strong), inset 0 -1px 0 var(--rule-strong);
  cursor: pointer;
  transition: height .3s var(--ease), background .25s, color .25s;
}
.tab:hover { height: 42px; color: var(--ink); }
.tab__dot { width: 8px; height: 8px; border-radius: 50%; background: rgb(var(--accent-rgb)); }
.tab__n { font-variant-numeric: tabular-nums; color: var(--ink-3); }
/* the open tab joins the board */
.tab[aria-pressed="true"] {
  height: 46px;
  color: var(--ink);
  background: var(--board-top);
  box-shadow: inset 1px 1px 0 var(--rule-strong), inset -1px 0 0 var(--rule-strong);
}
.tab[aria-pressed="true"] .tab__dot { box-shadow: 0 0 10px rgb(var(--glow-rgb)); }
.binder__board {
  padding: clamp(16px, 2.4vw, 30px);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--board-top), var(--board-bottom));
  box-shadow: inset 0 0 0 1px var(--rule-strong), 0 34px 60px -44px rgb(11 18 32 / .45);
}
.empty {
  margin: 0;
  padding: clamp(48px, 8vw, 88px) 24px;
  border: 2px dashed var(--rule-strong);
  border-radius: 10px;
  text-align: center;
  font: 700 .86rem/1.4 "Orbitron", sans-serif;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---------- small shared pieces ---------- */
.kind-chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font: 700 .66rem/1 "Orbitron", sans-serif;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgb(var(--accent-rgb));
  background: rgb(var(--glow-rgb) / .14);
  box-shadow: inset 0 0 0 1px rgb(var(--accent-rgb) / .3);
  white-space: nowrap;
}
.part-no { font: 600 .74rem/1 var(--mono); letter-spacing: .03em; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.status { display: inline-flex; align-items: center; gap: 7px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #1a9a4f; }
.status--wip::before { background: #d08a00; box-shadow: 0 0 0 3px rgb(208 138 0 / .2); }

/* generated covers: line art on blueprint paper */
.art-frame {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background:
    linear-gradient(rgb(var(--accent-rgb) / .06) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(90deg, rgb(var(--accent-rgb) / .06) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(160deg, rgb(var(--glow-rgb) / .14), rgb(255 255 255 / .7));
  box-shadow: inset 0 0 0 1px rgb(var(--accent-rgb) / .14);
}
.art-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.art { display: block; width: 100%; height: 100%; }
.art .a-hi { stroke: rgb(var(--accent-rgb)); }
.art .a-mid { stroke: rgb(var(--accent-rgb) / .55); }
.art .a-lo { stroke: rgb(var(--accent-rgb) / .32); stroke-width: 1.6; }
.art .a-fill { fill: rgb(var(--accent-rgb)); stroke: none; }
.art .a-paper { fill: #fff; }
.art .a-flag { fill: rgb(var(--accent-rgb) / .55); stroke: none; }

/* ---------- sheets ---------- */
.sheets { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2vw, 26px); }
.sheet {
  position: relative;
  filter: drop-shadow(0 1px 1px rgb(11 18 32 / .14)) drop-shadow(0 12px 18px rgb(11 18 32 / .08));
  transition: transform .45s var(--ease), filter .45s var(--ease);
  animation: deal .6s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
@keyframes deal { from { opacity: 0; transform: translateY(14px) rotate(.8deg); } }
.sheet:hover, .sheet:has(.sheet__link:focus-visible) {
  transform: translateY(-6px) rotate(-.6deg);
  filter: drop-shadow(0 1px 1px rgb(11 18 32 / .14)) drop-shadow(0 22px 26px rgb(var(--glow-rgb) / .5));
}
.sheet:has(.sheet__link:focus-visible) { outline: 2px solid var(--focus); outline-offset: 5px; border-radius: 8px; }

/* paper with three punched holes down the left margin; the mask makes them real
   holes, so the board shows through (and the shadow lives on .sheet, outside the mask) */
.sheet__paper {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0 20px 16px 46px;
  border-radius: 6px;
  background:
    radial-gradient(circle 8px at 22px 16%, rgb(11 18 32 / .14) 72%, transparent 78%),
    radial-gradient(circle 8px at 22px 50%, rgb(11 18 32 / .14) 72%, transparent 78%),
    radial-gradient(circle 8px at 22px 84%, rgb(11 18 32 / .14) 72%, transparent 78%),
    linear-gradient(rgb(var(--accent-rgb)), rgb(var(--accent-rgb))) 0 0 / 100% 4px no-repeat,
    #fff;
  -webkit-mask-image:
    radial-gradient(circle 6px at 22px 16%, #0000 96%, #000),
    radial-gradient(circle 6px at 22px 50%, #0000 96%, #000),
    radial-gradient(circle 6px at 22px 84%, #0000 96%, #000);
  -webkit-mask-composite: source-in;
  mask-image:
    radial-gradient(circle 6px at 22px 16%, #0000 96%, #000),
    radial-gradient(circle 6px at 22px 50%, #0000 96%, #000),
    radial-gradient(circle 6px at 22px 84%, #0000 96%, #000);
  mask-composite: intersect;
}
.sheet__strip {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0 10px;
  border-bottom: 1px solid var(--rule);
  font: 600 .74rem/1 var(--mono);
  color: var(--ink-3);
}
.sheet__title { margin: 16px 0 0; font: 700 1.22rem/1.1 "Orbitron", sans-serif; letter-spacing: .02em; text-transform: uppercase; }
/* the whole sheet is the link; a highlighter sweeps the title on hover */
.sheet__link {
  color: inherit;
  text-decoration: none;
  background: linear-gradient(rgb(var(--glow-rgb) / .4), rgb(var(--glow-rgb) / .4)) 0 90% / 0% 42% no-repeat;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background-size .5s var(--ease);
}
.sheet__link::after { content: ""; position: absolute; inset: 0; border-radius: 6px; }
.sheet__link:focus-visible { outline: none; }
.sheet:hover .sheet__link, .sheet__link:focus-visible { background-size: 100% 42%; }
.sheet__kind { margin: 10px 0 0; }
.sheet__fig { margin: 16px 0 0; }
.sheet__fig .art-frame { aspect-ratio: 16 / 9; }
.sheet__fig figcaption { margin-top: 7px; font: 600 .68rem/1 var(--mono); letter-spacing: .03em; color: var(--ink-3); }
.sheet__summary { margin: 14px 0 0; font-size: .9rem; line-height: 1.5; color: var(--ink-2); }
.sheet__specs { width: 100%; margin-top: 14px; border-collapse: collapse; font-size: .82rem; }
.sheet__specs th, .sheet__specs td { padding: 7px 0; border-top: 1px solid var(--rule); text-align: left; vertical-align: top; }
.sheet__specs th { width: 30%; padding-right: 12px; font: 600 .68rem/1.5 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.sheet__specs td { font-weight: 600; }
.sheet__foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 16px; }
.sheet__go {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 700 .72rem/1 "Orbitron", sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgb(var(--accent-rgb));
}
.sheet__go svg { width: 14px; height: 14px; transition: transform .35s var(--ease); }
.sheet:hover .sheet__go svg { transform: translateX(4px); }
.barcode { width: 92px; height: 26px; fill: var(--ink); opacity: .75; }

/* a single build gets one wide datasheet */
.sheets.is-single { grid-template-columns: minmax(0, 1fr); }
.sheet--full .sheet__paper {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  grid-template-rows: auto auto auto auto auto 1fr;
  grid-template-areas: "strip strip" "fig title" "fig kind" "fig summary" "fig specs" "fig foot";
  column-gap: clamp(24px, 3.4vw, 48px);
  padding: 0 clamp(22px, 3vw, 40px) 24px 58px;
}
.sheet--full .sheet__strip { grid-area: strip; padding-top: 20px; }
.sheet--full .sheet__title { grid-area: title; margin-top: 22px; font-size: clamp(1.5rem, 2.6vw, 2.2rem); }
.sheet--full .sheet__kind { grid-area: kind; }
.sheet--full .sheet__fig { grid-area: fig; display: flex; flex-direction: column; margin-top: 22px; }
.sheet--full .sheet__fig .art-frame { flex: 1; aspect-ratio: auto; min-height: 280px; }
.sheet--full .sheet__summary { grid-area: summary; font-size: 1rem; }
.sheet--full .sheet__specs { grid-area: specs; }
.sheet--full .sheet__foot { grid-area: foot; align-self: end; }

/* ---------- table view ---------- */
.ledger__scroll { overflow-x: auto; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 1px var(--rule-strong); }
.ledger__scroll:focus-visible { outline-offset: 3px; }
.ledger__table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: .9rem; }
.ledger__table th, .ledger__table td { padding: 12px 16px; border-bottom: 1px solid var(--rule); text-align: left; white-space: nowrap; }
.ledger__table tbody tr:last-child > * { border-bottom: 0; }
.ledger__table thead th { padding: 0; background: #f6f7f9; }
.ledger__table thead th:first-child { border-top-left-radius: 12px; }
.ledger__table thead th:last-child { border-top-right-radius: 12px; }
.sort {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  font: 700 .68rem/1 "Orbitron", sans-serif;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-align: left;
  color: var(--ink-3);
  background: transparent;
  cursor: pointer;
}
.sort:hover { color: var(--ink); }
.sort:focus-visible { outline-offset: -3px; }
.sort svg { width: 12px; height: 12px; opacity: .35; transition: transform .25s var(--ease), opacity .25s; }
th[aria-sort] .sort { color: var(--ink); }
th[aria-sort] .sort svg { opacity: 1; }
th[aria-sort="ascending"] .sort svg { transform: rotate(180deg); }
.ledger__table tbody tr { transition: background .2s; }
.ledger__table tbody tr:hover { background: rgb(var(--glow-rgb) / .1); }
.ledger__table tbody th { font-weight: 600; }
.ledger__link { color: var(--ink); text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0% 1px no-repeat; transition: background-size .35s var(--ease); }
.ledger__link:hover, .ledger__link:focus-visible { background-size: 100% 1px; }
.ledger__table td { color: var(--ink-2); }

.site-foot { padding: 48px 0 28px; font-size: .78rem; color: var(--ink-3); }

@media (max-width: 1080px) { .sheets { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) {
  .sheet--full .sheet__paper { display: flex; padding: 0 20px 16px 46px; }
  .sheet--full .sheet__fig .art-frame { aspect-ratio: 16 / 9; min-height: 0; }
}
@media (max-width: 640px) {
  .wrap { width: calc(100% - 36px); }
  .sheets { grid-template-columns: minmax(0, 1fr); }
  .binder__tabs { flex-wrap: nowrap; overflow-x: auto; padding: 0 12px; gap: 3px; scrollbar-width: none; }
  .tab { flex: none; padding: 0 11px; gap: 6px; }
  .tab__n, .tab__dot { display: none; }
  /* phones get a shorter sheet: figure strip, summary and the link; the details are on the build's page */
  .sheets:not(.is-single) .sheet__specs, .sheets:not(.is-single) .sheet__fig figcaption { display: none; }
  .sheets:not(.is-single) .sheet__fig .art-frame { aspect-ratio: 5 / 2; }
  .sheet__title { font-size: 1.08rem; }

  /* table view: sort chips on top, one stacked row per build */
  .ledger__scroll { overflow: visible; }
  .ledger__table, .ledger__table thead, .ledger__table tbody { display: block; min-width: 0; }
  .ledger__table thead { padding: 12px; border-bottom: 1px solid var(--rule); border-radius: 12px 12px 0 0; background: #f6f7f9; }
  .ledger__table thead tr { display: flex; flex-wrap: wrap; gap: 6px; }
  .ledger__table thead th, .ledger__table thead th:first-child, .ledger__table thead th:last-child { display: block; padding: 0; border: 0; border-radius: 0; background: none; }
  .ledger__table thead [data-col="context"] { display: none; }
  .sort { width: auto; padding: 9px 12px; border-radius: 999px; background: #fff; box-shadow: inset 0 0 0 1px var(--rule-strong); }
  th[aria-sort] .sort { color: #fff; background: var(--ink); box-shadow: none; }
  .ledger__table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "no kind" "title title" "term status";
    gap: 8px 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--rule);
  }
  .ledger__table tbody tr:last-child { border-bottom: 0; }
  .ledger__table tbody tr > *, .ledger__table tbody tr:last-child > * { display: block; padding: 0; border: 0; white-space: normal; }
  .ledger__table tbody td:nth-child(1) { grid-area: no; align-self: center; }
  .ledger__table tbody th { grid-area: title; font-size: 1rem; }
  .ledger__table tbody td:nth-child(3) { grid-area: kind; }
  .ledger__table tbody td:nth-child(4) { display: none; }
  .ledger__table tbody td:nth-child(5) { grid-area: term; font-size: .84rem; }
  .ledger__table tbody td:nth-child(6) { grid-area: status; font-size: .84rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .sheet__paper, .kind-chip, .tab, .views button, .sort { border: 1px solid CanvasText; }
}
