/* ═══════════════════════════════════════════════════════════
   INSIDE YOUR COMPUTER — Interactive Explainer
   Set in The Personal Archive's system (see DESIGN.md): paper and ink,
   Cabin for what you scan, Libre Baskerville for what you read, hairline
   rules instead of cards, and the Technology ink (marigold) as the one
   fill that marks a selection. Class names are unchanged so
   computer_parts_script.js keeps working.
   ═══════════════════════════════════════════════════════════ */

:root {
  --paper:   #FBFAF7;
  --paper2:  #F1EEE8;
  --ink:     #1C1A17;
  --ink2:    #1C1A17;
  --ink3:    #5E574F;
  --ink4:    #5E574F;
  --rule:    #DCD6CD;
  --series:  var(--pa-series, #EDB625);
  --on-series: var(--pa-on-series, #1C1A17);

  /* The incumbent colour names, kept for inline references: every one is now
     the Technology ink, used only as a fill. */
  --cream:   var(--paper2);
  --cream2:  var(--paper2);
  --cream3:  var(--rule);
  --rust:    var(--series);
  --rust2:   var(--series);
  --teal:    var(--series);
  --teal2:   var(--series);
  --gold:    var(--series);
  --gold2:   var(--series);
  --blue:    var(--series);
  --blue2:   var(--series);
  --purple:  var(--series);
  --green:   var(--series);
  --green2:  var(--series);

  --font-display: "Cabin", "Gill Sans", "Gill Sans MT", "Segoe UI", sans-serif;
  --font-body:    "Libre Baskerville", Baskerville, Georgia, serif;
  --font-mono:    var(--font-display);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

.container *, .container *::before, .container *::after,
.nav-wrap *, .nav-wrap *::before, .nav-wrap *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::selection { background: #F7CFB2; color: #1C1A17; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* ── LAYOUT ── */
.container {
  max-width: 66rem;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
}

/* ── TITLE BLOCK ── */
.hero {
  padding: clamp(2rem, 6vw, 4rem) 0 clamp(1.5rem, 4vw, 2.25rem);
  border-bottom: 1px solid var(--rule);
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 1.45rem + 2.8vw, 3.6rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.022em;
  margin-bottom: 1rem;
  text-wrap: balance;
}
.hero-title em { font-style: normal; }

.hero-sub {
  max-width: 36ch;
  font-size: clamp(1.15rem, 1rem + 0.6vw, 1.45rem);
  line-height: 1.5;
}

.hero-lesson {
  margin-top: 1rem;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  color: var(--ink3);
}

.hero-meta {
  max-width: 39rem;
  margin-top: 1.25rem;
  border-top: 1px solid var(--rule);
}
.hero-meta > div {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.98rem;
}
.hero-meta dt { font-family: var(--font-display); font-weight: 700; font-size: 0.9375rem; }
.hero-meta dd { margin: 0; font-variant-numeric: tabular-nums; }

/* ── PAGE TABS ── */
.nav-wrap {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.nav-inner {
  max-width: 66rem;
  margin: 0 auto;
  padding: 0.6rem clamp(1rem, 4vw, 2.5rem);
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.nav-btn {
  min-height: 2.75rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.2s var(--ease-out), background-color 0.2s var(--ease-out);
}
.nav-btn .nav-dot { display: none; }
.nav-btn:hover { border-color: var(--ink); }
.nav-btn.active { border-color: var(--series); background: var(--series); color: var(--on-series); }

/* ── PAGES ── */
.page { display: none; padding: clamp(2rem, 6vw, 3.5rem) 0 clamp(3rem, 7vw, 5rem); }
.page.active { display: block; }

/* ── SECTION HEADING ── */
.sec-label { display: none; }

.sec-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.85rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
}

.sec-desc {
  max-width: 39rem;
  margin-bottom: 2rem;
}

/* ── BLOCKS (formerly cards): an ink rule above, no box ── */
.card {
  margin-bottom: 2.25rem;
  padding: 1rem 0 0;
  border-top: 1px solid var(--ink);
}

.card-lbl {
  margin-bottom: 0.9rem;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
}

.card p { max-width: 39rem; }

/* ── COMPONENT CHOOSER ── */
.comp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.comp-card {
  padding: 0.9rem 1rem 1rem;
  border: 1px solid var(--rule);
  background: var(--paper);
  cursor: pointer;
  transition: border-color 0.2s var(--ease-out), background-color 0.2s var(--ease-out);
}
.comp-card:hover { border-color: var(--ink); }
.comp-card.selected { border-color: var(--series); background: var(--series); color: var(--on-series); }
.comp-card.selected .comp-short { color: inherit; }
.comp-card.selected .comp-tag { border-color: var(--on-series); color: inherit; }

.comp-icon, .detail-icon { display: none; }

.comp-name {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.2rem;
}
.comp-short {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--ink3);
}

/* Category tags: neutral, square, on paper. */
.comp-tag, .badge, .mb-info-tag, .step-part {
  display: inline-block;
  margin-top: 0.6rem;
  padding: 0.05rem 0.45rem;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink3);
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.badge, .step-part { margin-top: 0; }

/* ── DETAIL PANEL ── */
.detail-panel {
  margin-bottom: 2rem;
  padding: clamp(1.25rem, 4vw, 2rem);
  background: var(--paper2);
  border-top: 1px solid var(--ink);
}

.detail-header { margin-bottom: 0.9rem; }
.detail-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}
.detail-subtitle .comp-tag { margin-top: 0.35rem; }

.detail-body { max-width: 39rem; margin-bottom: 1.25rem; }

.detail-sub {
  margin: 1.5rem 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 1.5rem;
  border-top: 1px solid var(--rule);
}
@media (max-width: 36rem) { .detail-grid { grid-template-columns: 1fr; } }

.detail-tile { padding: 0.7rem 0; border-bottom: 1px solid var(--rule); }
.dt-label { font-family: var(--font-display); font-size: 0.875rem; font-weight: 700; margin-bottom: 0.15rem; }
.dt-val { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.dt-desc { font-size: 0.9375rem; color: var(--ink3); line-height: 1.5; }

.type-list { border-top: 1px solid var(--rule); }
.type-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--rule);
}
.type-marker { width: 0.6rem; height: 0.6rem; margin-top: 0.5rem; flex: none; background: var(--series); }
.type-name { font-family: var(--font-display); font-weight: 700; }
.type-desc { font-size: 0.9375rem; color: var(--ink3); line-height: 1.55; }

/* ── MOTHERBOARD DIAGRAM: a board drawn in ink on paper ── */
.mb-diagram {
  position: relative;
  aspect-ratio: 4 / 3;
  max-height: 32rem;
  overflow: hidden;
  border: 1px solid var(--ink);
  background: var(--paper2);
  user-select: none;
}

.mb-bg { display: none; }

.mb-component {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.2rem;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-display);
  text-align: center;
  line-height: 1.15;
  cursor: pointer;
  transition: background-color 0.2s var(--ease-out);
}
.mb-component:hover { background: #FFFFFF; outline: 1px solid var(--ink); }
.mb-component.mb-active { background: var(--series); color: var(--on-series); outline: 2px solid var(--ink); z-index: 2; }
.mb-l1 { font-size: 0.6875rem; font-weight: 700; }
.mb-l2 { font-size: 0.625rem; font-weight: 500; }

.mb-edge {
  position: absolute;
  font-family: var(--font-display);
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--ink3);
  pointer-events: none;
}

.mb-info-panel {
  min-height: 5rem;
  margin-top: 0.9rem;
  padding: 1rem 0 0;
  border-top: 1px solid var(--rule);
}
.mb-info-tag { margin: 0 0 0.4rem; }
.mb-info-name { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; margin-bottom: 0.25rem; }
.mb-info-text { max-width: 39rem; }

.mb-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0 1.5rem;
  margin: 0.5rem 0 0;
  border-top: 1px solid var(--rule);
}
.mb-list-item {
  padding: 0.6rem 0.4rem;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  transition: background-color 0.2s var(--ease-out);
}
.mb-list-item:hover { background: var(--paper2); }
.mb-list-item.mb-active-item { background: var(--series); color: var(--on-series); }
.mb-list-item.mb-active-item .mb-list-sub { color: inherit; }
.mb-dot { display: none; }
.mb-list-name { font-family: var(--font-display); font-weight: 700; }
.mb-list-sub { font-family: var(--font-display); font-size: 0.875rem; color: var(--ink3); }

/* ── ARCHITECTURE FLOW ── */
.flow-node {
  display: inline-grid;
  gap: 0.1rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--ink) !important;
  background: var(--paper) !important;
  color: var(--ink);
  font-family: var(--font-display);
  white-space: nowrap;
}
.flow-node .fn-label { font-size: 0.8125rem; font-weight: 600; color: var(--ink3); }
.flow-node .fn-name { font-size: 1rem; font-weight: 700; }
.flow-node .fn-desc { font-size: 0.8125rem; color: var(--ink3); }

.flow-arrow { padding: 0 0.25rem; font-family: var(--font-display); font-size: 1.1rem; color: var(--ink3); }

/* ── SCENARIOS ── */
.scenario-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.25rem; }
.s-tab {
  min-height: 2.75rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s var(--ease-out), background-color 0.2s var(--ease-out);
}
.s-tab:hover { border-color: var(--ink); }
.s-tab.active { border-color: var(--series); background: var(--series); color: var(--on-series); }

.scenario-panel {
  padding: clamp(1.25rem, 4vw, 2rem);
  background: var(--paper2);
  border-top: 1px solid var(--ink);
}
.sp-title { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; margin-bottom: 0.35rem; }
.sp-desc { max-width: 39rem; margin-bottom: 1.25rem; }

.step-list { border-top: 1px solid var(--ink); }
.step-item {
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--rule);
}
.step-num { font-family: var(--font-display); font-weight: 700; color: var(--ink3); font-variant-numeric: tabular-nums; }
.step-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; line-height: 1.35; }
.step-part { margin-left: 0.35rem; vertical-align: 0.1em; }
.step-desc { margin-top: 0.2rem; font-size: 0.98rem; }

/* ── TABLES ── */
.cmp-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; line-height: 1.5; }
.cmp-table th {
  padding: 0.6rem 0.75rem 0.6rem 0;
  border-bottom: 1px solid var(--ink);
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 700;
  text-align: left;
  vertical-align: bottom;
}
.cmp-table td {
  padding: 0.7rem 0.75rem 0.7rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.cmp-table .cn { font-family: var(--font-display); font-weight: 700; white-space: nowrap; }

/* ── CALLOUTS: a boxed note, no side stripe ── */
.callout {
  max-width: 39rem;
  margin: 1.5rem 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--ink);
  background: var(--paper);
  font-size: 0.98rem;
}
.callout strong { color: var(--ink); }

/* ── GRIDS AND TILES ── */
.grid2, .grid3 { display: grid; gap: 0 1.5rem; border-top: 1px solid var(--rule); }
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 40rem) { .grid2, .grid3 { grid-template-columns: 1fr; } }

.tile { padding: 0.75rem 0; border-bottom: 1px solid var(--rule); }
.tile-lbl { font-family: var(--font-display); font-size: 0.875rem; font-weight: 700; color: var(--ink3); margin-bottom: 0.15rem; }
.tile-val { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; margin-bottom: 0.15rem; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 0.9375rem; color: var(--ink3); line-height: 1.5; }

/* ── PAGE NAV ── */
.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}
.btn {
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s var(--ease-out);
}
.btn:hover { border-color: var(--ink); }
.btn-primary { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: #3A3630; }

/* ── RESPONSIVE ── */
@media (max-width: 36rem) {
  .hero-meta > div { grid-template-columns: 1fr; gap: 0; }
  .comp-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ── ADDED STRUCTURE ── */
.table-wrap { overflow-x: auto; }

.flow-map { display: grid; gap: 0.6rem; }
.flow-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.flow-via { font-family: var(--font-display); font-size: 0.9375rem; font-weight: 600; color: var(--ink3); }

/* Memory hierarchy: capacity drawn as width, all in the one ink. */
.hier { display: grid; gap: 0.45rem; border-top: 1px solid var(--rule); padding-top: 0.75rem; }
.hier-row {
  display: grid;
  grid-template-columns: 6rem minmax(4rem, 1fr) minmax(0, 1.6fr);
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-display);
}
.hier-label { font-size: 0.9375rem; font-weight: 700; }
.hier-track { height: 1.1rem; }
.hier-bar { width: calc(var(--size) * 100%); min-width: 3px; height: 100%; background: var(--series); }
.hier-desc { font-size: 0.875rem; color: var(--ink3); font-variant-numeric: tabular-nums; }
@media (max-width: 36rem) {
  .hier-row { grid-template-columns: 5rem 1fr; }
  .hier-desc { grid-column: 1 / -1; }
}

.vocab {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0 1.5rem;
  border-top: 1px solid var(--rule);
}
