:root,
html[data-theme="ink"] {
  --bg: #090a0c;
  --surface: #101216;
  --surface-2: #15181e;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(212, 174, 82, 0.34);
  --text: #f3f2ee;
  --muted: #9b9ea8;
  --subtle: #666a75;
  --accent: #d4ae52;
  --accent-bg: rgba(212, 174, 82, 0.08);
  --cta-bg: #f3f2ee;
  --cta-text: #090a0c;
  --cta-hover: #ffffff;
  --drawer-bg: #101216;
  --shadow: 0 28px 72px rgba(0, 0, 0, 0.62);
}

html[data-theme="paper"] {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #efece5;
  --border: rgba(18, 20, 24, 0.11);
  --border-strong: rgba(138, 98, 22, 0.36);
  --text: #121418;
  --muted: #50545f;
  --subtle: #7c808c;
  --accent: #8a6216;
  --accent-bg: rgba(138, 98, 22, 0.07);
  --cta-bg: #121418;
  --cta-text: #f7f5f0;
  --cta-hover: #262a33;
  --drawer-bg: #ffffff;
  --shadow: 0 28px 72px rgba(18, 20, 24, 0.16);
}

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

html {
  background-color: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.62;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Scroll reading hairline */
.progress-track {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  z-index: 40;
  pointer-events: none;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.06s linear;
}

/* Page Column */
.page {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 28px 20px 72px;
}

@media (min-width: 640px) {
  .page {
    padding: 52px 24px 96px;
  }
}

/* Masthead */
.masthead {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 48px;
}

.masthead-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.author {
  display: flex;
  align-items: center;
  gap: 13px;
}

.author-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  filter: grayscale(100%) contrast(1.06);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.author-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.author-role {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

.slot-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.slot-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* Engraving */
.engraving {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.engraving-frame {
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #040507;
}

.engraving-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1572 / 664;
  object-fit: cover;
}

.engraving-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--subtle);
}

.caption-right {
  display: none;
}
@media (min-width: 520px) {
  .caption-right { display: inline; }
}

/* Sections */
.section {
  padding-top: 44px;
  margin-top: 44px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.section.hero {
  padding-top: 0;
  margin-top: 0;
  border-top: none;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.section-label,
.eyebrow {
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.section-label {
  color: var(--subtle);
}

.eyebrow {
  color: var(--accent);
}

.section-hint {
  font-size: 12px;
  color: var(--subtle);
}

.h1 {
  margin: 0;
  font-weight: 500;
  font-size: 30px;
  line-height: 1.16;
  letter-spacing: -0.028em;
  color: var(--text);
}

@media (min-width: 640px) {
  .h1 { font-size: 38px; }
}

.h2 {
  margin: 4px 0 0;
  font-weight: 500;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.022em;
  color: var(--text);
}

/* Author prose cadence */
.prose {
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 16px;
  color: var(--muted);
}

.prose p {
  margin: 0;
}

.beat {
  color: var(--text);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.mantra {
  padding: 2px 0 2px 16px;
  border-left: 2px solid var(--accent);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text);
}

@media (min-width: 640px) {
  .mantra { font-size: 22px; }
}

/* Interactive terms & actions */
.wiki-term {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 1px dashed var(--accent);
  color: var(--accent);
  font: inherit;
  font-weight: 500;
  padding: 0 0 1px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.wiki-term:hover { opacity: 0.78; }

.text-action {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
}
.text-action:hover { text-decoration: underline; }

/* Unified Hairline Editorial Lists (no box clutter) */
.list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}

.list-item {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.list-index {
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  padding-top: 3px;
}

.list-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.list-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 14px;
}

.list-title {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--text);
}

.list-text {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
}

.list-beat {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

/* Focal Container 1: Deal Ledger */
.ledger {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.ledger-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
}

.ledger-row + .ledger-row {
  border-top: 1px solid var(--border);
}

.ledger-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--subtle);
}

.ledger-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.ledger-value {
  font-variant-numeric: tabular-nums;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
  white-space: nowrap;
}

@media (min-width: 640px) {
  .ledger-value { font-size: 30px; }
}

.ledger-value.accent {
  color: var(--accent);
}

.ledger-foot {
  padding: 18px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ledger-foot p { margin: 0; }

.ledger-note {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

/* Focal Container 2: Entry / CTA */
.entry-card {
  margin-top: 48px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (min-width: 640px) {
  .entry-card { padding: 32px 28px; }
}

.entry-top {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

@media (min-width: 540px) {
  .entry-top {
    flex-direction: row;
    align-items: flex-start;
    gap: 22px;
  }
}

.entry-portrait {
  width: 100%;
  height: 220px;
  object-fit: cover;
  object-position: center 18%;
  border-radius: 6px;
  border: 1px solid var(--border);
  filter: grayscale(100%) contrast(1.05);
  flex-shrink: 0;
}

@media (min-width: 540px) {
  .entry-portrait {
    width: 136px;
    height: 168px;
  }
}

.entry-intro {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.axis {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
}

.cta-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px 20px;
  border-radius: 6px;
  background: var(--cta-bg);
  color: var(--cta-text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.cta-btn:hover { background: var(--cta-hover); }
.cta-btn:active { transform: translateY(1px); }

.cta-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  font-size: 12.5px;
  color: var(--subtle);
}

.mail-link {
  color: var(--muted);
  text-decoration: none;
}
.mail-link:hover { text-decoration: underline; }

.disclaimer {
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--subtle);
}

/* Footer */
.footer {
  margin-top: 48px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 12px;
  color: var(--subtle);
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.theme-toggle {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 10px;
  font: inherit;
  font-size: 11.5px;
  color: var(--muted);
  cursor: pointer;
}
.theme-toggle:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
}

.legal-nav button {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
}
.legal-nav button:hover {
  color: var(--text);
  text-decoration: underline;
}

/* Drawer */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.drawer[hidden] {
  display: none;
}

@media (min-width: 640px) {
  .drawer {
    align-items: center;
    padding: 20px;
  }
}

.drawer-panel {
  width: 100%;
  max-width: 560px;
  max-height: 84vh;
  overflow-y: auto;
  background: var(--drawer-bg);
  color: var(--text);
  border-top: 1px solid var(--border-strong);
  border-radius: 14px 14px 0 0;
  padding: 14px 22px 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 640px) {
  .drawer-panel {
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 24px 26px 28px;
  }
}

.drawer-handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  margin: 0 auto 4px;
}

@media (min-width: 640px) {
  .drawer-handle { display: none; }
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.drawer-title {
  margin: 6px 0 0;
  font-weight: 500;
  font-size: 20px;
  line-height: 1.24;
  letter-spacing: -0.02em;
  color: var(--text);
}

.drawer-close {
  appearance: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
.drawer-close:hover { color: var(--text); }

.drawer-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 15px;
  line-height: 1.62;
  color: var(--muted);
}

.drawer-body p { margin: 0; }
.drawer-body .d-beat { color: var(--text); font-weight: 500; }
.drawer-body .d-heading {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
}
.drawer-body .d-heading:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.drawer-body .d-meta {
  font-size: 12px;
  color: var(--subtle);
}
.drawer-body .d-accent {
  padding-left: 14px;
  border-left: 2px solid var(--accent);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
}

.drawer-links {
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.drawer-links-label {
  font-size: 11.5px;
  color: var(--subtle);
  margin-right: 4px;
}

.drawer-chip {
  appearance: none;
  background: var(--accent-bg);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 5px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
}
.drawer-chip:hover { opacity: 0.85; }
