/* ---------- tokens ---------- */
:root {
  --bg: #14120f;
  --bg-raised: #1b1813;
  --bg-inset: #100e0b;
  --hairline: #322c22;
  --hairline-soft: #241f18;

  --paper: #ece4d2;
  --paper-dim: #d9d0b9;
  --ink-on-paper: #2a2417;

  --text: #e9e1cd;
  --text-muted: #a89b81;
  --text-faint: #6f6552;

  --accent: #4c7a9c;
  --accent-strong: #7aabce;
  --accent-deep: #294256;

  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;

  --wrap: 1180px;
  --radius: 8px;
  --radius-lg: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 12px 18px;
  z-index: 100;
}
.skip-link:focus { left: 12px; top: 12px; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--paper);
}

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

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 15px;
  padding: 11px 20px;
  border-radius: var(--radius);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: #fbf8f1;
}
.btn-primary:hover { background: var(--accent-strong); }

.btn-ghost {
  background: transparent;
  border-color: var(--hairline);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--text-muted); }

.btn-text {
  background: none;
  padding: 11px 4px;
  color: var(--accent-strong);
}
.btn-text:hover { color: var(--paper); }

.btn-lg { padding: 13px 26px; font-size: 16px; }

.icon-gh { width: 16px; height: 16px; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(20, 18, 15, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline-soft);
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 68px;
}
.wordmark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 21px;
  color: var(--paper);
  text-decoration: none;
}
.site-nav {
  display: flex;
  gap: 28px;
  font-size: 14.5px;
  color: var(--text-muted);
}
.site-nav a { text-decoration: none; transition: color 0.15s ease; }
.site-nav a:hover { color: var(--paper); }
.header-cta { display: flex; gap: 10px; align-items: center; }

/* ---------- hero ---------- */
.hero { padding: 76px 0 96px; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 56px;
  align-items: center;
}
.hero-copy h1 {
  font-size: clamp(2.6rem, 5vw, 4.1rem);
  line-height: 1.03;
  margin-bottom: 22px;
}
.hero-sub {
  font-size: 18px;
  line-height: 1.65;
  color: var(--text-muted);
  max-width: 46ch;
  margin: 0 0 32px;
}
.hero-actions { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }

/* ---------- app window mockup ---------- */
.app-window {
  background: var(--bg-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 30px 70px -25px rgba(0,0,0,0.6), 0 2px 0 rgba(255,255,255,0.02) inset;
}
.app-titlebar {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--hairline);
  background: var(--bg-raised);
}
.app-titlebar-name {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-faint);
}
.app-body { display: grid; grid-template-columns: 186px 1fr; min-height: 340px; }
.app-sidebar {
  background: var(--bg-inset);
  border-right: 1px solid var(--hairline);
  padding: 18px 14px;
}
.app-sidebar-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 12px;
}
.chapter-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.chapter-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.chapter-list li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter-list li em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
}
.chapter-list li.active { background: var(--accent-deep); color: var(--paper); }
.chapter-list li.active em { color: var(--accent-strong); }
.chapter-list li.ghost { color: var(--text-faint); font-style: italic; }

.app-page {
  background: var(--paper);
  color: var(--ink-on-paper);
  padding: 34px 40px;
}
.page-heading {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 18px;
}
.app-page p {
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 1.75;
  margin: 0 0 16px;
}
.app-page p:last-child { margin-bottom: 0; }

.app-statusbar {
  border-top: 1px solid var(--hairline);
  padding: 11px 20px;
  display: flex;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--bg-raised);
}
.app-statusbar .count { font-style: normal; color: var(--accent-strong); }
.statusbar-dot { color: var(--text-faint); }
.statusbar-mode { margin-left: auto; color: var(--text-faint); }

/* ---------- sections ---------- */
.section { padding: 104px 0; border-top: 1px solid var(--hairline-soft); }
.section-head { max-width: 640px; margin-bottom: 56px; }
.section-head-center { max-width: 640px; margin-left: auto; margin-right: auto; text-align: center; }
.section-head h2 { font-size: clamp(2rem, 3.4vw, 2.7rem); line-height: 1.12; margin-bottom: 18px; }
.section-lede { color: var(--text-muted); font-size: 17px; line-height: 1.6; margin: 0; max-width: 54ch; }
.section-head-center .section-lede { margin-left: auto; margin-right: auto; }

/* ---------- toc / sumário ---------- */
.toc { list-style: none; margin: 0 0 64px; padding: 0; border-top: 1px solid var(--hairline); }
.toc li {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 20px 0;
  border-bottom: 1px solid var(--hairline);
}
.toc-num {
  font-family: var(--mono);
  color: var(--accent-strong);
  font-size: 14px;
  flex: 0 0 auto;
}
.toc-name {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--paper);
  font-size: 19px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.toc-leader {
  flex: 1 1 auto;
  border-bottom: 1px dotted var(--text-faint);
  transform: translateY(-6px);
  min-width: 24px;
}
.toc-desc {
  flex: 0 1 auto;
  color: var(--text-muted);
  font-size: 14.5px;
  max-width: 40ch;
  text-align: right;
}

/* ---------- demo toggle ---------- */
.demo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 26px;
}
.demo-title { font-family: var(--serif); font-size: 20px; color: var(--paper); margin: 0; }
.demo-tabs {
  display: inline-flex;
  background: var(--bg-raised);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}
.demo-tab {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.demo-tab.is-active { background: var(--accent-deep); color: var(--paper); }
.demo-tab:hover:not(.is-active) { color: var(--text); }

.demo-stage { position: relative; }
.demo-panel {
  display: none;
  opacity: 0;
  transform: translateY(8px);
  animation: panelIn 0.4s ease forwards;
}
.demo-panel.is-active { display: block; }
@keyframes panelIn { to { opacity: 1; transform: translateY(0); } }

.core-card {
  background: var(--bg-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 40px 44px;
  box-shadow: 0 30px 70px -25px rgba(0,0,0,0.55);
}
.core-row { padding: 18px 0; border-bottom: 1px solid var(--hairline-soft); }
.core-row:first-child { padding-top: 0; }
.core-row:last-child { border-bottom: none; padding-bottom: 0; }
.core-row label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.core-row p { margin: 0; color: var(--text); line-height: 1.6; }
.core-title { font-family: var(--serif); font-size: 26px; font-weight: 600; color: var(--paper) !important; }
.core-row-split { display: flex; gap: 48px; }
.core-stat { font-family: var(--serif); font-size: 28px; font-weight: 600; color: var(--accent-strong) !important; }

.app-window-demo { max-width: 720px; margin: 0 auto; }

/* ---------- open source ---------- */
.opensource-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 64px;
}
.opensource-grid .section-head { margin-bottom: 28px; }
.opensource-grid .btn { margin-top: 8px; }

.manifest { list-style: none; margin: 0; padding: 0; }
.manifest li {
  display: flex;
  gap: 18px;
  padding: 22px 0;
  border-bottom: 1px solid var(--hairline-soft);
}
.manifest li:first-child { padding-top: 0; }
.manifest-mark { color: var(--accent-strong); font-family: var(--mono); padding-top: 2px; }
.manifest-title { font-family: var(--serif); font-weight: 600; color: var(--paper); font-size: 17px; margin: 0 0 6px; }
.manifest-text { color: var(--text-muted); font-size: 15px; line-height: 1.6; margin: 0; }

/* ---------- platforms ---------- */
.platform-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
}
.platform-list li {
  background: var(--bg);
  padding: 52px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.platform-list svg { width: 40px; height: 40px; color: var(--accent-strong); }
.platform-list span { font-family: var(--serif); font-size: 19px; color: var(--paper); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--hairline-soft); padding: 64px 0 48px; }
.footer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px 24px; }
.footer-brand .wordmark { font-size: 20px; margin: 0 0 8px; display: block; }
.footer-tagline { color: var(--text-muted); font-size: 14.5px; margin: 0; }
.footer-links { display: flex; gap: 22px; align-items: flex-start; justify-content: flex-end; font-size: 14.5px; }
.footer-links a { text-decoration: none; color: var(--text-muted); }
.footer-links a:hover { color: var(--paper); }
.colophon {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.7;
  max-width: 62ch;
  border-top: 1px solid var(--hairline-soft);
  padding-top: 28px;
  margin: 8px 0 0;
}
.footer-fine { grid-column: 1 / -1; color: var(--text-muted); font-size: 12.5px; margin: 0; }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 48px; }
  .hero-copy { order: 1; }
  .hero-visual { order: 2; }
  .opensource-grid { grid-template-columns: 1fr; gap: 40px; }
  .app-body { grid-template-columns: 150px 1fr; }
}

@media (max-width: 720px) {
  .site-nav { display: none; }
  .hero { padding: 48px 0 64px; }
  .hero-actions { flex-direction: column; align-items: flex-start; gap: 14px; }
  .section { padding: 72px 0; }
  .app-body { grid-template-columns: 1fr; }
  .app-sidebar { border-right: none; border-bottom: 1px solid var(--hairline); }
  .app-page { padding: 26px 22px; }
  .toc li { flex-wrap: wrap; }
  .toc-leader { display: none; }
  .toc-desc { text-align: left; max-width: 100%; flex-basis: 100%; }
  .core-card { padding: 28px 24px; }
  .core-row-split { flex-direction: column; gap: 18px; }
  .platform-list { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-links { justify-content: flex-start; flex-wrap: wrap; }
  .demo-head { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 460px) {
  .header-cta .btn-ghost { display: none; }
}
