/* Weightome: Scientific Atlas & Monograph Stylesheet (Sister to Cleft Labs)
   Zero third-party fonts, zero external CDNs, zero cookies, 100% DSGVO-clean. */

:root {
  --paper: #f7f6f2;
  --sheet: #ffffff;
  --surface-alt: #efede6;
  --ink: #111315;
  --ink-soft: #373c44;
  --muted: #5d646e;
  --rule: #dddad2;
  --rule-strong: #b8b3a6;
  --accent: #0f5257;
  --accent-hover: #0a3c40;
  --accent-tint: #e8f1f1;
  --amber: #a15c07;
  --crimson: #991b1b;
  --emerald: #166534;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, Cambria, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --max-w: 1180px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
}

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

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 28px;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 30;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 66px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.wordmark:hover {
  text-decoration: none;
  color: var(--ink);
}

.wordmark-text {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.wordmark-parent {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  border-left: 1px solid var(--rule-strong);
  padding-left: 11px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.site-nav a {
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 500;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--ink);
  text-decoration: underline;
}

.nav-parent-link {
  font-family: var(--font-mono);
  font-size: 11.5px !important;
  color: var(--accent) !important;
  border: 1px solid var(--accent);
  padding: 4px 10px;
}

.nav-parent-link:hover {
  background: var(--accent);
  color: #ffffff !important;
  text-decoration: none !important;
}

/* Hero */
.hero {
  padding: 64px 0 48px;
  border-bottom: 1px solid var(--rule);
}

.kicker {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.1rem, 4vw, 3.15rem);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  max-width: 24ch;
}

.hero-lead {
  font-size: 17px;
  color: var(--ink-soft);
  max-width: 68ch;
  margin: 0 0 24px;
}

.hero-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  padding-top: 18px;
  border-top: 1px solid var(--rule);
}

.hero-meta-bar strong {
  color: var(--ink);
  font-weight: 600;
}

/* Ledger */
.ledger {
  background: var(--sheet);
  border-bottom: 1px solid var(--rule);
}

.ledger-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ledger-cell {
  padding: 22px 20px 22px 0;
  border-right: 1px solid var(--rule);
}

.ledger-cell:not(:first-child) {
  padding-left: 20px;
}

.ledger-cell:last-child {
  border-right: none;
  padding-right: 0;
}

.ledger-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.ledger-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 24px;
  font-weight: 600;
  margin: 5px 0 3px;
  color: var(--ink);
}

.ledger-sub {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

/* Sections */
.section {
  padding: 60px 0;
  border-bottom: 1px solid var(--rule);
}

.section-sheet {
  background: var(--sheet);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}

.section-head h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 400;
  margin: 0;
  line-height: 1.2;
}

.section-index {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Figures Grid */
.figures-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.figure-card {
  background: var(--sheet);
  border: 1px solid var(--rule);
  padding: 20px 22px 18px;
}

.figure-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}

.figure-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.figure-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.figure-svg {
  width: 100%;
  display: block;
  overflow: visible;
}

.figure-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 10px;
  height: 3px;
  display: inline-block;
}

.figure-readout {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  min-height: 20px;
}

/* Specimen Cutout Gallery */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  align-items: center;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--rule-strong);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
}

.filter-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.filter-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.cutout-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.cutout-card {
  background: var(--sheet);
  border: 1px solid var(--rule);
  padding: 16px;
  cursor: pointer;
  transition: border-color 140ms ease;
}

.cutout-card:hover {
  border-color: var(--ink);
}

.cutout-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.cutout-weight-exc {
  color: var(--emerald);
  font-weight: 600;
}

.cutout-weight-inh {
  color: var(--crimson);
  font-weight: 600;
}

.cutout-card img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--rule);
  background: #0d1014;
}

.cutout-specs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.cutout-specs strong {
  display: block;
  color: var(--ink);
  font-weight: 600;
}

/* Atlas & Benchmark Tables */
.atlas-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
  justify-content: space-between;
}

.atlas-input,
.atlas-select {
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 8px 12px;
}

.atlas-input {
  min-width: 260px;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--rule);
  background: var(--sheet);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data-table th,
table.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  white-space: nowrap;
}

table.data-table th {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--paper);
  font-weight: 600;
}

table.data-table td.num,
table.data-table th.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

table.data-table tbody tr:hover {
  background: var(--paper);
}

.good { color: var(--emerald); font-weight: 600; }
.warn { color: var(--amber); }
.bad { color: var(--crimson); }

.ei-bar-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ei-bar {
  width: 68px;
  height: 6px;
  background: #e5d2d2;
  position: relative;
  display: inline-block;
}

.ei-bar-fill {
  height: 100%;
  background: var(--accent);
}

/* Equation & Calibration Grid */
.method-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 32px;
}

.equation-box {
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  padding: 18px 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  margin: 16px 0;
  overflow-x: auto;
}

/* Lightbox Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 19, 21, 0.78);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.modal.open {
  display: flex;
}

.modal-panel {
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  max-width: 960px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  padding: 24px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.modal-close {
  background: var(--ink);
  color: #ffffff;
  border: none;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
}

/* Legal Document Pages */
.legal-main {
  padding: 56px 0 80px;
}

.legal-sheet {
  max-width: 780px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  padding: 44px 48px;
}

.legal-sheet h1 {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 400;
  margin: 8px 0 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}

.legal-sheet h2 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 400;
  margin: 30px 0 10px;
}

.legal-sheet p,
.legal-sheet li {
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.68;
}

.address-block {
  font-style: normal;
  background: var(--paper);
  border-left: 2px solid var(--accent);
  padding: 14px 18px;
  margin: 14px 0 20px;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ink);
}

/* Footer */
.site-footer {
  padding: 36px 0 48px;
  font-size: 13px;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-links {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--ink-soft);
}

.footer-meta {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

@media (max-width: 920px) {
  .ledger-grid,
  .figures-grid,
  .cutout-grid,
  .method-grid {
    grid-template-columns: 1fr;
  }

  .ledger-cell {
    border-right: none;
    border-bottom: 1px solid var(--rule);
    padding: 18px 0 !important;
  }

  .ledger-cell:last-child {
    border-bottom: none;
  }

  .cutout-specs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wordmark-parent {
    display: none;
  }

  .legal-sheet {
    padding: 28px 22px;
  }
}
