/* transactology.dev — light-academia + HUD overlay
 * palette: cream #f5f0e8 / paper #d4c8b0 / teal #4ecdc4 #45b7aa
 *          text #2a2520 / muted #7a6e60 / dark #1a2332 / amber #e8a830
 * fonts: DM Sans, Libre Baskerville, Fira Mono
 */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream: #f5f0e8;
  --paper: #d4c8b0;
  --teal: #4ecdc4;
  --teal-deep: #45b7aa;
  --ink: #2a2520;
  --muted: #7a6e60;
  --navy: #1a2332;
  --amber: #e8a830;
}

html, body {
  background: var(--cream);
  color: var(--ink);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

body { overflow-x: hidden; }

::selection { background: var(--teal); color: var(--navy); }

/* ============================================================
   COMMAND DECK
   ============================================================ */
.command-deck {
  position: relative;
  height: 100vh;
  min-height: 720px;
  background: var(--cream);
  overflow: hidden;
}

.ruled-paper {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 23px,
    rgba(212, 200, 176, 0.45) 23px,
    rgba(212, 200, 176, 0.45) 24px
  );
  pointer-events: none;
}

/* HUD panels — corner positioned, sharp angle clip */
.hud-panel {
  position: absolute;
  width: 240px;
  padding: 18px 20px 16px;
  border: 1px solid var(--teal);
  background: rgba(78, 205, 196, 0.05);
  box-shadow: 0 0 20px rgba(78, 205, 196, 0.12), inset 0 0 0 1px rgba(78, 205, 196, 0.04);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: "Fira Mono", monospace;
  opacity: 0;
  transform: translateY(8px);
  animation: hud-in 700ms ease-out forwards;
}

.hud-tl { top: 36px; left: 36px; animation-delay: 200ms; }
.hud-tr { top: 36px; right: 36px; animation-delay: 350ms; text-align: right; align-items: flex-end; }
.hud-bl { bottom: 36px; left: 36px; animation-delay: 500ms; }
.hud-br { bottom: 36px; right: 36px; animation-delay: 650ms; text-align: right; align-items: flex-end; }

@keyframes hud-in {
  to { opacity: 1; transform: translateY(0); }
}

.hud-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--teal-deep);
  text-transform: uppercase;
}

.hud-metric {
  font-family: "DM Sans", sans-serif;
  font-size: 30px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.hud-unit {
  font-size: 14px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 4px;
  letter-spacing: 0;
}

.hud-caption {
  font-size: 12px;
  color: var(--muted);
  font-family: "Libre Baskerville", serif;
  font-style: italic;
  letter-spacing: 0.02em;
}

/* Center title block */
.deck-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  max-width: 720px;
  padding: 0 24px;
}

.deck-eyebrow {
  display: inline-block;
  font-family: "Fira Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--teal-deep);
  text-transform: uppercase;
  margin-bottom: 22px;
  padding: 4px 10px;
  border: 1px solid var(--teal);
  background: rgba(78, 205, 196, 0.06);
}

.deck-title {
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  font-size: clamp(40px, 8vw, 92px);
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin-bottom: 18px;
}

.deck-tld {
  color: var(--amber);
  font-style: italic;
  font-weight: 400;
}

.deck-sub {
  font-size: 18px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto 36px;
}

.deck-pointer {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: "Fira Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--teal-deep);
  text-transform: uppercase;
}

.pointer-line {
  width: 56px;
  height: 1px;
  background: var(--teal);
  position: relative;
}
.pointer-line::after {
  content: "";
  position: absolute;
  right: 0;
  top: -3px;
  width: 7px;
  height: 7px;
  border-right: 1px solid var(--teal);
  border-bottom: 1px solid var(--teal);
  transform: rotate(45deg);
}

/* ============================================================
   LEDGER (stagger blocks)
   ============================================================ */
.ledger {
  position: relative;
  background: var(--cream);
  padding: 140px 0 160px;
}

.ledger::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 23px,
    rgba(212, 200, 176, 0.35) 23px,
    rgba(212, 200, 176, 0.35) 24px
  );
  pointer-events: none;
}

.ledger-inner {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 48px;
  display: flex;
  flex-direction: column;
  gap: 90px;
}

.block {
  position: relative;
  max-width: 720px;
  padding: 30px 36px 36px;
  background: rgba(245, 240, 232, 0.85);
  border: 1px solid rgba(122, 110, 96, 0.18);
  border-top: 1px solid var(--teal);
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.block.is-in { opacity: 1; transform: translateY(0); }

.block-left { align-self: flex-start; transform: translateY(30px) translateX(-20px); }
.block-right { align-self: flex-end; transform: translateY(30px) translateX(20px); }
.block.is-in.block-left,
.block.is-in.block-right { transform: translateY(0) translateX(0); }

.block-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.block-tri {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px 0 6px 9px;
  border-color: transparent transparent transparent var(--teal);
}

.block-label {
  font-family: "Fira Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--teal-deep);
  text-transform: uppercase;
}

.block-title {
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  font-size: clamp(24px, 3.2vw, 34px);
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 14px;
}

.block-body {
  color: var(--ink);
  margin-bottom: 18px;
}

.block-body em { color: var(--amber); font-style: italic; }
.block-body code {
  font-family: "Fira Mono", monospace;
  font-size: 14px;
  background: rgba(78, 205, 196, 0.1);
  padding: 1px 6px;
  border-radius: 2px;
  color: var(--navy);
}

.block-code {
  background: var(--navy);
  color: #d4e9e6;
  font-family: "Fira Mono", monospace;
  font-size: 13.5px;
  line-height: 1.7;
  padding: 18px 22px;
  border-left: 2px solid var(--teal);
  overflow-x: auto;
}

.block-list {
  list-style: none;
  display: grid;
  gap: 8px;
  font-family: "Fira Mono", monospace;
  font-size: 13.5px;
}

.block-list li {
  display: grid;
  grid-template-columns: 200px 1fr;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(122, 110, 96, 0.3);
}

.li-key {
  color: var(--teal-deep);
  letter-spacing: 0.08em;
}

.li-val {
  color: var(--muted);
  font-family: "Libre Baskerville", serif;
  font-size: 14px;
  font-style: italic;
}

/* ============================================================
   VISUALIZATION (dark island)
   ============================================================ */
.viz {
  position: relative;
  background: var(--navy);
  color: #d4e9e6;
  padding: 110px 48px 90px;
  overflow: hidden;
  min-height: 80vh;
}

.viz-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(78, 205, 196, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(78, 205, 196, 0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, #000 0%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 0%, transparent 80%);
}

.viz-head {
  position: relative;
  max-width: 720px;
  margin: 0 auto 50px;
  text-align: center;
}

.viz-tag {
  font-family: "Fira Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--teal);
  text-transform: uppercase;
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--teal);
  background: rgba(78, 205, 196, 0.06);
  margin-bottom: 18px;
}

.viz-title {
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: #f5f0e8;
  margin-bottom: 14px;
}

.viz-sub {
  color: rgba(245, 240, 232, 0.7);
  font-size: 16px;
}

.viz-canvas {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  aspect-ratio: 1000/480;
  border: 1px solid rgba(78, 205, 196, 0.3);
  background: rgba(78, 205, 196, 0.02);
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
}

#viz-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* SVG element styles set in JS too, but defaults */
#viz-svg .edge {
  stroke: var(--teal);
  stroke-width: 1;
  fill: none;
  stroke-dasharray: 5 5;
  opacity: 0.55;
}

#viz-svg .pulse {
  stroke: var(--amber);
  stroke-width: 1.5;
  fill: none;
  opacity: 0.9;
}

#viz-svg .node {
  fill: var(--navy);
  stroke: var(--teal);
  stroke-width: 1.5;
  cursor: pointer;
  transition: stroke 200ms, fill 200ms;
}

#viz-svg .node:hover,
#viz-svg .node.is-active {
  fill: var(--teal);
  stroke: var(--amber);
}

#viz-svg .node-label {
  font-family: "Fira Mono", monospace;
  font-size: 10px;
  fill: rgba(245, 240, 232, 0.55);
  letter-spacing: 0.1em;
  pointer-events: none;
}

.viz-card {
  position: absolute;
  min-width: 180px;
  padding: 12px 14px;
  border: 1px solid var(--teal);
  background: rgba(26, 35, 50, 0.95);
  font-family: "Fira Mono", monospace;
  font-size: 11px;
  color: rgba(245, 240, 232, 0.85);
  letter-spacing: 0.08em;
  pointer-events: none;
  display: grid;
  gap: 6px;
  box-shadow: 0 0 30px rgba(78, 205, 196, 0.18);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.viz-card[hidden] { display: none; }

.card-id { color: var(--teal); text-transform: uppercase; }
.card-id em { color: var(--amber); font-style: normal; }

.card-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.card-row span { color: rgba(245, 240, 232, 0.5); text-transform: uppercase; }
.card-row b { color: #f5f0e8; font-weight: 500; }

.viz-foot {
  position: relative;
  max-width: 1100px;
  margin: 28px auto 0;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  font-family: "Fira Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.viz-readout {
  display: flex;
  gap: 10px;
  padding: 6px 12px;
  border: 1px solid rgba(78, 205, 196, 0.4);
  background: rgba(78, 205, 196, 0.04);
}

.viz-readout span { color: rgba(245, 240, 232, 0.45); }
.viz-readout b { color: var(--teal); font-weight: 500; }

/* ============================================================
   SHELF
   ============================================================ */
.shelf {
  position: relative;
  background: var(--cream);
  padding: 120px 0 80px;
  overflow: hidden;
}

.shelf::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 23px,
    rgba(212, 200, 176, 0.3) 23px,
    rgba(212, 200, 176, 0.3) 24px
  );
  pointer-events: none;
}

.shelf-head {
  position: relative;
  max-width: 720px;
  margin: 0 auto 56px;
  padding: 0 48px;
  text-align: center;
}

.shelf-eyebrow {
  font-family: "Fira Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--teal-deep);
  text-transform: uppercase;
  display: inline-block;
  margin-bottom: 14px;
}

.shelf-title {
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  font-size: clamp(28px, 4.5vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: 12px;
}

.shelf-sub {
  color: var(--muted);
  font-size: 16px;
}

.shelf-rail {
  position: relative;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: thin;
  scrollbar-color: var(--teal) var(--cream);
  padding: 0 48px 24px;
}

.shelf-rail::-webkit-scrollbar { height: 6px; }
.shelf-rail::-webkit-scrollbar-track { background: rgba(122,110,96,0.12); }
.shelf-rail::-webkit-scrollbar-thumb { background: var(--teal); }

.shelf-row {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 30px 0 20px;
  width: max-content;
  border-bottom: 4px solid var(--ink);
  position: relative;
}

.shelf-row::before {
  content: "";
  position: absolute;
  bottom: 4px;
  left: -48px;
  right: -48px;
  height: 2px;
  background: rgba(122, 110, 96, 0.35);
}

.spine {
  width: 56px;
  height: 240px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 18px 6px;
  border-top: 6px solid var(--teal);
  border-bottom: 1px solid rgba(0,0,0,0.15);
  box-shadow: 1px 0 0 rgba(0,0,0,0.05), inset -1px 0 0 rgba(255,255,255,0.25);
  transition: transform 250ms ease-out, height 250ms ease-out, background 250ms;
  cursor: pointer;
  flex-shrink: 0;
}

.spine:hover {
  transform: translateY(-12px);
  height: 256px;
  background: var(--cream);
  border-top-color: var(--amber);
}

.spine-title {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-align: left;
  color: var(--ink);
}

.spine-author {
  font-family: "Fira Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--muted);
  text-transform: uppercase;
  text-align: center;
  line-height: 1.4;
  word-break: break-word;
}

/* Spine color variations — pull from palette */
.spine-1 { background: #d4c8b0; border-top-color: #4ecdc4; }
.spine-2 { background: #1a2332; border-top-color: #e8a830; }
.spine-2 .spine-title { color: #f5f0e8; }
.spine-2 .spine-author { color: rgba(245,240,232,0.6); }
.spine-3 { background: #45b7aa; border-top-color: #1a2332; }
.spine-3 .spine-title { color: #1a2332; }
.spine-4 { background: #f5f0e8; border-top-color: #7a6e60; }
.spine-5 { background: #e8a830; border-top-color: #1a2332; }
.spine-6 { background: #7a6e60; border-top-color: #4ecdc4; }
.spine-6 .spine-title { color: #f5f0e8; }
.spine-6 .spine-author { color: rgba(245,240,232,0.7); }
.spine-7 { background: #d4c8b0; border-top-color: #45b7aa; }
.spine-8 { background: #4ecdc4; border-top-color: #2a2520; }
.spine-8 .spine-title { color: #1a2332; }
.spine-9 { background: #2a2520; border-top-color: #e8a830; }
.spine-9 .spine-title { color: #f5f0e8; }
.spine-9 .spine-author { color: rgba(245,240,232,0.6); }
.spine-10 { background: #f5f0e8; border-top-color: #4ecdc4; }

.colophon {
  position: relative;
  max-width: 720px;
  margin: 70px auto 0;
  padding: 0 48px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: "Fira Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}

.colo-mark {
  width: 14px;
  height: 14px;
  background: var(--teal);
  flex-shrink: 0;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 60%, 0 100%);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 880px) {
  .hud-panel { width: 180px; padding: 12px 14px 10px; }
  .hud-tl, .hud-bl { left: 16px; }
  .hud-tr, .hud-br { right: 16px; }
  .hud-tl, .hud-tr { top: 18px; }
  .hud-bl, .hud-br { bottom: 18px; }
  .hud-metric { font-size: 22px; }

  .ledger { padding: 90px 0 110px; }
  .ledger-inner { padding: 0 24px; gap: 60px; }
  .block { padding: 24px 22px 28px; }

  .viz { padding: 80px 20px 60px; }
  .block-list li { grid-template-columns: 1fr; gap: 4px; }

  .shelf { padding: 90px 0 60px; }
  .shelf-head { padding: 0 24px; }
  .shelf-rail { padding: 0 24px 20px; }
  .colophon { padding: 0 24px; }
}

@media (max-width: 560px) {
  .hud-panel { width: 140px; }
  .hud-metric { font-size: 18px; }
  .hud-caption { font-size: 11px; }
  .deck-sub { font-size: 16px; }
}
