/* ── DESIGN TOKENS ── */
:root {
  --red: #97161d;
  --red-light: #c12028;
  --red-muted: #f5e8e8;
  --ink: #1a1a1a;
  --ink-2: #3d3d3d;
  --ink-3: #6b6b6b;
  --rule: #e2e2e2;
  --bg: #faf9f7;
  --white: #ffffff;
  --mono: 'DM Mono', monospace;
  --serif: 'DM Serif Display', serif;
  --sans: 'DM Sans', sans-serif;
}

/* ── RESET ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  overflow-x: hidden;
}

/* ── TYPOGRAPHY ── */
h1 {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--ink);
}

h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 1rem;
}

h3 {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink-2);
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

p { margin-bottom: 1rem; color: var(--ink-2); }

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

ul {
  list-style: none;
  padding-left: 0;
}

ul li {
  margin-bottom: 0.4rem;
  font-size: 0.92rem;
  color: var(--ink-2);
}

strong { font-weight: 500; color: var(--ink); }
em { font-style: italic; }

/* ── NAV ── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250,249,247,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
  padding: 0 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav-logo {
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--ink);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--red); }

/* ── LAYOUT ── */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 3rem 2.5rem;
}

.page-header {
  max-width: 800px;
  margin: 0 auto;
  padding: 3rem 2.5rem 1.5rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 1rem;
}

.page-header .page-tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.page-header .page-tag::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 1px;
  background: var(--red);
}

.page-header h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.1;
}

/* ── SECTION RULE ── */
.section-rule {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  margin-top: 2.5rem;
}

.section-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
  white-space: nowrap;
}

.section-rule::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* ── CONTENT SECTIONS ── */
.content-section {
  margin-bottom: 3rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--rule);
}

.content-section:last-child {
  border-bottom: none;
}

/* ── BULLETS ── */
.arrow-list { list-style: none; padding: 0; }
.arrow-list li {
  padding-left: 1.25rem;
  position: relative;
  margin-bottom: 0.6rem;
  font-size: 0.92rem;
  color: var(--ink-2);
  line-height: 1.65;
}
.arrow-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--red);
  font-size: 0.75rem;
  top: 0.15rem;
}

/* ── TAGS / BADGES ── */
.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.68rem;
  background: #f3f3f1;
  color: var(--ink-3);
  padding: 0.2rem 0.55rem;
  border-radius: 2px;
  letter-spacing: 0.04em;
  margin-right: 0.3rem;
  margin-bottom: 0.3rem;
}

.badge {
  display: inline-block;
  background: var(--red-muted);
  color: var(--red);
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.25rem 0.65rem;
  border-radius: 2px;
  letter-spacing: 0.04em;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.4rem;
  border-radius: 3px;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--red);
  color: #fff;
}
.btn-primary:hover { background: var(--red-light); text-decoration: none; }

.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
}
.btn-outline:hover { border-color: var(--ink-3); background: var(--white); text-decoration: none; }

/* ── TABLES ── */
.table-wrapper {
  overflow-x: auto;
  margin-top: 1rem;
  margin-bottom: 2rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  font-size: 0.88rem;
}

th, td {
  padding: 0.7rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--rule);
}

th {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: #f7f6f4;
  font-weight: 400;
}

td { color: var(--ink-2); }

tr:last-child td { border-bottom: none; }
tr:hover td { background: #f9f8f6; }

/* ── GRAPH PAGE ── */
.graph-container {
  position: relative;
  height: calc(100vh - 56px);
  background-color: #fdfdfd;
  overflow: hidden;
  cursor: crosshair;
}

.sidebar {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 150px;
  background-color: var(--ink);
  border-radius: 4px;
  padding: 1rem;
  z-index: 10;
}

.sidebar-button {
  background-color: var(--red);
  color: white;
  padding: 0.6rem 1rem;
  border-radius: 3px;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background-color 0.2s;
  display: block;
}

.sidebar-button:hover { background-color: var(--red-light); text-decoration: none; }

.button-off {
  background-color: #555;
  color: #ccc;
}

.node {
  position: absolute;
  width: 40px;
  height: 40px;
  background-color: var(--red);
  color: white;
  text-align: center;
  line-height: 40px;
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  z-index: 2;
}

.edge {
  position: absolute;
  height: 2px;
  background-color: var(--ink-3);
  z-index: 1;
  transform-origin: 0 0;
  pointer-events: none;
}

/* ── SCROLL REVEAL ── */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ── RESPONSIVE ── */
@media (max-width: 700px) {
  nav { padding: 0 1.25rem; }
  .nav-links { display: none; }
  .container { padding: 2rem 1.25rem; }
  .page-header { padding: 2rem 1.25rem 1rem; }
}