:root {
  --paper: #f3eee4;
  --paper-2: #e9e2d3;
  --ink: #132038;
  --ink-soft: #3b4863;
  --blue: #1d4f9c;
  --blue-soft: #d6e1f2;
  --line: rgba(29, 79, 156, 0.13);
  --stamp: #e8621c;
  --stamp-soft: #fbe3d4;
  --ok: #2d7d4f;
  --r0: #3e9a5a; --r1: #7fae3a; --r2: #d7a321; --r3: #e0701f; --r4: #c8382c;
  --card: #fbf8f2;
  --terminal: #0d1526;
  --terminal-ink: #d7e3ff;
  --shadow: 0 1px 0 rgba(19, 32, 56, 0.08), 0 10px 30px -12px rgba(19, 32, 56, 0.25);
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --radius-sm: 6px; --radius-lg: 18px;
  --gutter: clamp(16px, 4vw, 56px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #0f1626; --paper-2: #16203a; --ink: #eef1f7; --ink-soft: #aab4c8;
    --blue: #7fa8ea; --blue-soft: #1c2c4d; --line: rgba(127, 168, 234, 0.12);
    --stamp: #ff8a47; --stamp-soft: #3a2418; --card: #141d33;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.4), 0 12px 30px -12px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --paper: #0f1626; --paper-2: #16203a; --ink: #eef1f7; --ink-soft: #aab4c8;
  --blue: #7fa8ea; --blue-soft: #1c2c4d; --line: rgba(127, 168, 234, 0.12);
  --stamp: #ff8a47; --stamp-soft: #3a2418; --card: #141d33;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.4), 0 12px 30px -12px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}
.theme-toggle { font: 600 14px var(--display); display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; border: 2px solid var(--ink); background: var(--card); color: var(--ink); cursor: pointer; white-space: nowrap; transition: background 0.2s; }
.theme-toggle:hover { background: var(--blue-soft); }
.nav-right { display: flex; align-items: center; gap: 18px; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body {
  margin: 0; color: var(--ink); font-family: var(--display); font-size: 17px; line-height: 1.55;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
}
a { color: var(--blue); }
code, .mono { font-family: var(--mono); font-size: 0.9em; }
:focus-visible { outline: 3px solid var(--stamp); outline-offset: 3px; border-radius: 4px; }

/* nav */
.nav { position: sticky; top: 0; z-index: 10; display: flex; gap: 20px; align-items: center; justify-content: space-between;
  padding: 12px var(--gutter); background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; letter-spacing: -0.02em; text-decoration: none; color: var(--ink); display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 26px; height: 26px; border: 2px solid var(--ink); border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-family: var(--mono); }
.nav ul { display: flex; gap: 18px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.nav ul a { text-decoration: none; color: var(--ink-soft); font-size: 15px; }
.nav ul a:hover { color: var(--ink); }
@media (max-width: 760px) { .nav ul { display: none; } }

section { padding: clamp(56px, 9vw, 120px) var(--gutter); max-width: 1240px; margin: 0 auto; }
.eyebrow { font-family: var(--mono); font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--stamp); margin: 0 0 14px; }
h1, h2, h3 { letter-spacing: -0.03em; line-height: 1.02; margin: 0; }
h2 { font-size: clamp(36px, 5.5vw, 68px); font-weight: 800; max-width: 16ch; }
.lead { font-size: clamp(18px, 1.6vw, 22px); color: var(--ink-soft); max-width: 60ch; margin: 18px 0 0; }

/* hero */
.hero { min-height: calc(100vh - 60px); display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; gap: 36px; padding-top: 40px; }
.hero h1 { font-size: clamp(56px, 11vw, 168px); font-weight: 800; letter-spacing: -0.055em; line-height: 0.88; }
.hero h1 em { font-style: normal; color: var(--blue); position: relative; }
.hero h1 em::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0.08em; height: 0.09em; background: var(--stamp); transform-origin: left; animation: draw 1.1s var(--ease) 0.4s both; }
@keyframes draw { from { transform: scaleX(0); } }
.hero-commands { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 18px; max-width: 780px; }
.cmd-card { background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius-lg); padding: 22px 24px; box-shadow: 6px 6px 0 var(--ink); transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease); }
.cmd-card:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--ink); }
.cmd-card code { font-size: 34px; font-weight: 700; color: var(--blue); display: block; }
.cmd-card span { color: var(--ink-soft); }
.hero-foot { display: flex; gap: 28px; flex-wrap: wrap; font-family: var(--mono); font-size: 14px; color: var(--ink-soft); }
.hero-foot b { color: var(--ink); font-size: 26px; font-family: var(--display); display: block; }

/* contrast */
.versus { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin-top: 44px; border: 2px solid var(--ink); border-radius: var(--radius-lg); overflow: hidden; }
.versus > div { padding: 30px; }
.versus .bad { background: var(--paper-2); }
.versus .good { background: var(--card); border-left: 2px solid var(--ink); }
.versus h3 { font-size: 26px; margin-bottom: 14px; }
.versus ol { margin: 0; padding-left: 22px; }
.versus li { margin: 8px 0; }
.bad li::marker { color: var(--r4); } .good li::marker { color: var(--ok); font-weight: 700; }
@media (max-width: 760px) { .versus { grid-template-columns: 1fr; } .versus .good { border-left: 0; border-top: 2px solid var(--ink); } }
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 18px; margin-top: 30px; }
.rule { padding: 22px; border-radius: var(--radius-sm); background: var(--blue); color: #fff; }
.rule b { font-size: 22px; display: block; line-height: 1.1; margin-bottom: 6px; }

/* board */
.examples { display: flex; flex-wrap: wrap; gap: 10px; margin: 34px 0 10px; }
.chip { font: inherit; font-size: 15px; padding: 9px 16px; border-radius: 999px; border: 2px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; transition: background 0.2s, color 0.2s; }
.chip:hover { background: var(--blue-soft); }
.chip[aria-pressed='true'] { background: var(--ink); color: var(--paper); }
.example-bar { font-family: var(--mono); font-size: 14px; background: var(--terminal); color: var(--terminal-ink); border: 1px solid var(--line); padding: 14px 18px; border-radius: var(--radius-sm); display: flex; gap: 14px; flex-wrap: wrap; align-items: center; min-height: 52px; }
.example-bar .card-tag { color: var(--stamp); }
.example-note { color: var(--ink-soft); margin: 10px 0 0; min-height: 1.5em; }
.board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-top: 28px; counter-reset: step; }
@media (max-width: 980px) { .board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { .board { grid-template-columns: 1fr; } }
.tile { position: relative; text-align: left; font: inherit; color: inherit; cursor: pointer; background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius-sm); padding: 16px 16px 18px; min-height: 132px; display: flex; flex-direction: column; justify-content: space-between; transition: transform 0.3s var(--ease), opacity 0.3s, box-shadow 0.3s var(--ease); }
.tile:hover { transform: translateY(-3px); box-shadow: 0 6px 0 var(--ink); }
.tile .num { font-family: var(--mono); font-size: 13px; color: var(--ink-soft); }
.tile .icon { font-size: 26px; }
.tile .t { font-weight: 700; font-size: 18px; line-height: 1.15; }
.tile.gate { background: var(--stamp-soft); border-color: var(--stamp); }
.tile.gate::after { content: 'SELLO HUMANO'; position: absolute; top: 12px; right: 10px; transform: rotate(6deg); font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; color: var(--stamp); border: 2px solid var(--stamp); padding: 2px 6px; border-radius: 4px; background: var(--card); }
.tile.skipped { opacity: 0.28; transform: scale(0.97); }
.tile.active { box-shadow: 0 0 0 4px var(--blue); }
.tile.lit { animation: pop 0.5s var(--ease) both; }
@keyframes pop { 40% { transform: translateY(-6px); } }
.detail { margin-top: 26px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; border: 2px solid var(--ink); border-radius: var(--radius-lg); background: var(--card); overflow: hidden; box-shadow: var(--shadow); }
.detail .side { padding: 28px; }
.detail .side + .side { border-left: 2px dashed var(--line); background: var(--paper-2); }
@media (max-width: 760px) { .detail { grid-template-columns: 1fr; } .detail .side + .side { border-left: 0; border-top: 2px dashed var(--line); } }
.detail h3 { font-size: 32px; margin-bottom: 18px; }
.detail dl { margin: 0; display: grid; gap: 14px; }
.detail dt { font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--stamp); }
.detail dd { margin: 4px 0 0; }
.screen { font-family: var(--mono); font-size: 14px; background: var(--terminal); color: var(--terminal-ink); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; white-space: pre-wrap; word-break: break-word; }
.screen::before { content: '● ● ●'; display: block; color: #54627f; letter-spacing: 3px; font-size: 10px; margin-bottom: 10px; }

/* risk */
.risk { margin-top: 36px; display: grid; gap: 10px; }
.risk-row { display: grid; grid-template-columns: 90px 1.6fr 1fr 1fr; gap: 16px; align-items: center; padding: 14px 18px; background: var(--card); border-radius: var(--radius-sm); border-left: 10px solid var(--c); }
.risk-row b { font-family: var(--mono); font-size: 22px; color: var(--c); }
.risk-row small { display: block; font-family: var(--mono); font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.08em; }
@media (max-width: 760px) { .risk-row { grid-template-columns: 70px 1fr; } .risk-row > div:nth-child(n+3) { grid-column: 2; } }
.sizes { display: flex; align-items: flex-end; gap: 14px; margin-top: 30px; flex-wrap: wrap; }
.size { border: 2px solid var(--ink); border-radius: var(--radius-sm); display: grid; place-items: center; text-align: center; background: var(--card); padding: 8px; }
.size b { font-family: var(--mono); font-size: 20px; }
.size span { font-size: 13px; color: var(--ink-soft); }
.size.xl { border-style: dashed; color: var(--r4); background: transparent; text-decoration: line-through; }

/* skills */
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 16px; margin-top: 40px; }
.skill { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 20px; transition: border-color 0.2s, transform 0.3s var(--ease); }
.skill:hover { border-color: var(--blue); transform: translateY(-2px); }
.skill code { color: var(--blue); font-weight: 700; }
.skill h3 { font-size: 20px; margin: 8px 0 6px; }
.skill p { margin: 0; color: var(--ink-soft); font-size: 15px; }
.skill.main { grid-column: span 2; background: var(--ink); color: var(--paper); border-color: var(--ink); }
.skill.main p { color: color-mix(in srgb, var(--paper) 75%, transparent); }
.skill.main code { color: var(--stamp); font-size: 22px; }
@media (max-width: 560px) { .skill.main { grid-column: auto; } }

/* stack */
.stack { margin-top: 40px; border-top: 2px solid var(--ink); }
.stack-row { display: grid; grid-template-columns: 160px 1.2fr 1fr; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.stack-row .layer { font-family: var(--mono); font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--stamp); }
.stack-row .tool { font-weight: 700; font-size: 19px; }
.stack-row .why { color: var(--ink-soft); font-size: 15px; }
@media (max-width: 760px) { .stack-row { grid-template-columns: 1fr; gap: 4px; } }
.nope { margin-top: 24px; display: flex; gap: 10px; flex-wrap: wrap; }
.nope span { font-family: var(--mono); font-size: 13px; padding: 6px 10px; border: 1px dashed var(--ink-soft); border-radius: 4px; color: var(--ink-soft); text-decoration: line-through; }

/* course */
.course { margin-top: 40px; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.module { padding: 18px; border-radius: var(--radius-sm); background: var(--card); border: 1px solid var(--line); }
.module b { font-family: var(--mono); color: var(--blue); font-size: 30px; display: block; line-height: 1; }
.module span { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); }

/* docs */
.docs { margin-top: 40px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 16px; }
.doc { display: block; text-decoration: none; color: inherit; padding: 24px; background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius-sm); position: relative; transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease); }
.doc:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--blue); }
.doc h3 { font-size: 22px; margin-bottom: 8px; }
.doc p { margin: 0; color: var(--ink-soft); font-size: 15px; }
.doc::after { content: '→'; position: absolute; right: 20px; top: 20px; font-size: 22px; color: var(--blue); }

footer { padding: 40px var(--gutter); text-align: center; font-family: var(--mono); font-size: 13px; color: var(--ink-soft); border-top: 1px solid var(--line); }

/* doc viewer */
.reader { max-width: 820px; margin: 0 auto; padding: 40px var(--gutter) 100px; }
.reader article { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(22px, 5vw, 60px); box-shadow: var(--shadow); overflow-wrap: anywhere; }
.reader h1 { font-size: clamp(34px, 5vw, 54px); margin-bottom: 20px; }
.reader h2 { font-size: 30px; margin: 48px 0 14px; max-width: none; }
.reader h3 { font-size: 22px; margin: 32px 0 10px; }
.reader table { border-collapse: collapse; width: 100%; font-size: 15px; display: block; overflow-x: auto; }
.reader th, .reader td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.reader th { background: var(--paper-2); }
.reader blockquote { margin: 16px 0; padding: 10px 18px; border-left: 4px solid var(--stamp); background: var(--stamp-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.reader pre { background: var(--terminal); color: var(--terminal-ink); padding: 16px; border-radius: var(--radius-sm); overflow-x: auto; font-size: 14px; }
.reader :not(pre) > code { background: var(--blue-soft); padding: 1px 6px; border-radius: 4px; }
.reader hr { border: 0; border-top: 2px dashed var(--line); margin: 40px 0; }
.reader-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.reader-top button { font: inherit; font-size: 14px; padding: 8px 14px; border: 2px solid var(--ink); background: var(--card); color: var(--ink); border-radius: 999px; cursor: pointer; }
@media print { .nav, .reader-top, footer { display: none; } body { background: #fff; } .reader article { box-shadow: none; border: 0; } }

.detail-nav { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 28px; border-top: 2px solid var(--ink); background: var(--card); }
.detail-nav button { font: 700 16px var(--display); padding: 12px 20px; border-radius: 999px; border: 2px solid var(--ink); cursor: pointer; }
.detail-nav .prev { background: var(--card); color: var(--ink); }
.detail-nav .next { background: var(--ink); color: var(--paper); }
.detail-nav button:disabled { opacity: 0.3; cursor: default; }
.detail-count { font-family: var(--mono); font-size: 14px; color: var(--ink-soft); }
.gate-note { margin: 14px 0 0; padding: 10px 14px; border: 2px dashed var(--stamp); border-radius: var(--radius-sm); background: var(--stamp-soft); font-size: 15px; }
a.pick { text-decoration: none; }
@media (max-width: 560px) { .detail-nav { padding: 12px 16px; } .detail-nav button { font-size: 14px; padding: 10px 14px; } }
.brand { white-space: nowrap; }
.nav ul { flex-wrap: nowrap; }
@media (max-width: 1180px) { .nav ul { gap: 12px; } .nav ul a { font-size: 14px; } }
@media (max-width: 1020px) { .nav ul { display: none; } }
.nav ul a { white-space: nowrap; }

/* Iconos Lucide */
.i { width: 1em; height: 1em; flex: none; vertical-align: -0.14em; stroke-width: 2; }
.i-xl { width: 64px; height: 64px; }
.tile .icon { display: inline-flex; color: var(--blue); }
.tile .icon .i { width: 28px; height: 28px; stroke-width: 1.75; }
.tile.gate .icon { color: var(--stamp); }
.with-icon { display: flex; align-items: center; gap: 0.35em; }
.with-icon .i { color: var(--stamp); stroke-width: 2.25; }
.gate-note { display: flex; gap: 8px; align-items: flex-start; }
.gate-note .i { color: var(--stamp); margin-top: 3px; }
.theme-toggle .i { width: 16px; height: 16px; }
