:root {
  color-scheme: light dark;
  --bg: #FBFAF6;
  --surface: #F0F3EB;
  --surface-elevated: #FFFFFF;
  --mat: #DCE8DC;
  --border: #D6DDD3;
  --text: #20352D;
  --muted: #506158;
  --cyan: #235748;
  --cyan-ink: #FFFFFF;
  --emerald: #20684F;
  --amber: #B47B2B;
  --red: #C53939;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Trebuchet MS", "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #182520;
  --surface: #202E27;
  --surface-elevated: #283930;
  --mat: #31463B;
  --border: #40534A;
  --text: #F0F1E7;
  --muted: #B0C0B6;
  --cyan: #B8E0C8;
  --cyan-ink: #182C23;
  --emerald: #A9D6BB;
  --amber: #D8AC67;
  --red: #E57373;
}

:root[data-theme="light"] {
  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.58;
  min-height: 100vh;
}

h1, h2 {
  font-family: var(--display);
  letter-spacing: -0.035em;
  line-height: 1.12;
  text-wrap: balance;
}

h3 {
  line-height: 1.2;
  text-wrap: balance;
}

p, li {
  text-wrap: pretty;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 100;
  background: var(--cyan);
  color: var(--cyan-ink);
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
}

a {
  color: var(--cyan);
  text-decoration: none;
  text-underline-offset: 0.22em;
}

a:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

code,
.mono {
  font-family: var(--mono);
  font-size: 0.88em;
  font-variant-numeric: tabular-nums;
}

code {
  background: var(--mat);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.08rem 0.38rem;
  border-radius: 4px;
}

.muted {
  color: var(--muted);
}

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

.shell {
  width: min(74rem, calc(100% - clamp(2rem, 6vw, 6rem)));
  margin: 0 auto;
}

/* Masthead homogeneizado 1:1 con CrabPDF */
.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.masthead-inner {
  min-height: 4.3rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.2rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-self: start;
  color: var(--text);
  font-family: var(--display);
  font-weight: 760;
  font-size: 1.2rem;
  letter-spacing: -0.035em;
}

.wordmark:hover {
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.85rem, 2vw, 1.75rem);
  flex-wrap: wrap;
}

.site-nav a,
.masthead-tools > a {
  padding-block: 0.4rem;
  color: var(--muted);
  font-size: 0.91rem;
  font-weight: 550;
}

.site-nav a[aria-current="page"],
.site-nav a:hover,
.masthead-tools > a:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.38em;
}

.masthead-tools {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.theme-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.theme-button:hover {
  background: var(--surface);
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
  gap: 2.5rem;
  align-items: center;
  padding: 3.8rem 0 3rem;
}

.release-label {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--cyan);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.release-label.inline {
  margin-bottom: 0;
}

.hero h1 {
  font-size: clamp(2.15rem, 4.2vw, 3.15rem);
  margin-bottom: 1rem;
}

.page-hero {
  padding: 3rem 0 2rem;
}

.page-hero h1 {
  font-size: clamp(1.95rem, 3.6vw, 2.7rem);
  margin-bottom: 0.7rem;
}

.lead {
  color: var(--muted);
  font-size: 1.03rem;
  margin-bottom: 1.5rem;
}

.actions {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.74rem 1.3rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.94rem;
  border: 1px solid transparent;
  cursor: pointer;
}

.button:hover {
  text-decoration: none;
  filter: brightness(1.06);
}

.button.primary {
  background: var(--cyan);
  color: var(--cyan-ink);
}

.button.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.button.small {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
}

.plain-link {
  color: var(--text);
  font-weight: 550;
  font-size: 0.94rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.15rem;
}

.plain-link:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  text-decoration: none;
}

.os-hint {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.hero-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.mascot-hero {
  width: min(240px, 72%);
  height: auto;
}

.hud-preview {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-size: 0.8rem;
}

.hud-bar {
  display: flex;
  justify-content: space-between;
  padding: 0.55rem 0.9rem;
  background: var(--mat);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.hud-title {
  color: var(--text);
  font-weight: 600;
}

.hud-status {
  color: var(--emerald);
  font-weight: 600;
}

.hud-row {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 0.6rem;
  align-items: center;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

.hud-row:last-child {
  border-bottom: none;
}

/* Sections */
.section {
  padding: 2.8rem 0;
  border-top: 1px solid var(--border);
}

.section-head {
  margin-bottom: 1.5rem;
}

.kicker {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--cyan);
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}

.section-head h2 {
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  margin-bottom: 0.35rem;
}

.section-head p {
  color: var(--muted);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.download-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.download-table th,
.download-table td {
  text-align: left;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.download-table th {
  font-family: var(--mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--mat);
}

.download-table tr:last-child td {
  border-bottom: none;
}

.download-table tr.os-active {
  background: color-mix(in srgb, var(--mat) 55%, transparent);
}

/* Grids & Cards */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-card {
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.nav-card:hover {
  border-color: var(--cyan);
  transform: translateY(-2px);
  text-decoration: none;
}

.card-cta {
  margin-top: auto;
  padding-top: 0.45rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--cyan);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.card h3 {
  font-size: 1.06rem;
}

.card p {
  color: var(--muted);
  font-size: 0.92rem;
}

.pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.18rem 0.52rem;
  border-radius: 5px;
  width: fit-content;
}

.pill.cyan {
  color: var(--cyan);
  background: color-mix(in srgb, var(--cyan) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--cyan) 35%, transparent);
}

.pill.emerald {
  color: var(--emerald);
  background: color-mix(in srgb, var(--emerald) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--emerald) 35%, transparent);
}

.pill.amber {
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent);
}

/* Simulator & Code */
.sim-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

.sim-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.sim-controls input,
.sim-controls select {
  background: var(--surface-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.52rem 0.65rem;
  font-family: var(--sans);
  font-size: 0.88rem;
}

.sim-controls input:focus,
.sim-controls select:focus {
  outline: none;
  border-color: var(--cyan);
}

.sim-output {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.sim-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.code-block {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
}

.code-block code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
}

.toml-preview-wrap {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Timeline & Roadmap */
.timeline {
  border-left: 2px solid var(--border);
  padding-left: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.timeline-item {
  position: relative;
}

.timeline-dot {
  position: absolute;
  left: -1.82rem;
  top: 1.35rem;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--bg);
}

.timeline-dot.done {
  background: var(--emerald);
}

.timeline-dot.next {
  background: var(--cyan);
}

.check-list {
  list-style: none;
  display: grid;
  gap: 0.42rem;
  margin-top: 0.35rem;
}

.check-list li {
  font-size: 0.92rem;
  padding-left: 1.15rem;
  position: relative;
}

.check-list li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--cyan);
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.4rem;
  flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}

.progress-bar {
  flex: 1;
  min-width: 220px;
  height: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: var(--emerald);
}

.roadmap-card.done {
  border-color: color-mix(in srgb, var(--emerald) 55%, var(--border));
}

.roadmap-card.active {
  border-color: var(--cyan);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.6rem 0;
  margin-top: 2rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  .masthead-inner {
    grid-template-columns: 1fr auto;
  }
  .site-nav {
    grid-column: 1 / -1;
    order: 3;
    padding-bottom: 0.5rem;
  }
  .hero,
  .grid-4,
  .grid-3,
  .grid-2,
  .sim-controls {
    grid-template-columns: 1fr;
  }
  .hud-row {
    grid-template-columns: auto 1fr;
  }
  .hud-row span:last-child {
    grid-column: 1 / -1;
  }
}
