/* Terminal y Línea de Comandos en Linux — hoja de estilo del curso */

:root {
  --bg: #f3f1ea;
  --surface: #ffffff;
  --surface-2: #ebe8df;
  --ink: #131c28;
  --ink-soft: #4d5a6b;
  --line: #d9d5c9;
  --accent: #0f7a43;
  --accent-soft: #dff3e6;
  --amber: #b25e00;
  --amber-soft: #fff1dc;

  /* El hero y el pie son siempre oscuros, como una terminal */
  --term: #0d1520;
  --term-2: #162232;
  --term-ink: #e8eef5;
  --term-soft: #8b9bb0;
  --phosphor: #7ee787;
  --term-amber: #ffb454;

  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1018;
    --surface: #121b27;
    --surface-2: #18232f;
    --ink: #e8eef5;
    --ink-soft: #9aa9bb;
    --line: #243242;
    --accent: #7ee787;
    --accent-soft: #14301f;
    --amber: #ffb454;
    --amber-soft: #33240d;
    --term: #060b11;
  }
}

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

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

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

.page {
  max-width: 1140px;
  margin: 0 auto;
  padding: 20px 16px 0;
}

h1, h2, h3 { line-height: 1.15; margin: 0; text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); letter-spacing: -0.02em; }
p { margin: 0 0 1em; }
a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--term-amber);
  outline-offset: 3px;
  border-radius: 6px;
}

.kicker {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 40px;
  align-items: center;
  padding: clamp(28px, 5vw, 56px);
  border-radius: 22px;
  color: var(--term-ink);
  background:
    linear-gradient(rgba(126, 231, 135, 0.045) 1px, transparent 1px) 0 0 / 100% 28px,
    radial-gradient(900px 420px at 85% 0%, #1d3147 0%, transparent 60%),
    var(--term);
}

.eyebrow {
  margin: 0 0 18px;
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: var(--term-soft);
}

.prompt { color: var(--phosphor); margin-right: 6px; }

.hero h1 {
  font-size: clamp(2.2rem, 5.2vw, 3.6rem);
  letter-spacing: -0.03em;
  font-weight: 800;
}

.hero h1 span { display: block; color: var(--phosphor); }

.hero-text {
  margin: 20px 0 0;
  max-width: 56ch;
  color: #c3cfdc;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--phosphor); color: #06200f; }
.btn-primary:hover { background: #a4f2ab; }
.btn-ghost { border-color: rgba(255, 255, 255, 0.28); color: var(--term-ink); }
.btn-ghost:hover { border-color: var(--phosphor); }

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 34px 0 0;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.facts dt {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--term-amber);
}

.facts dd {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--term-soft);
}

.hero-visual {
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.hero-visual svg { display: block; width: 100%; height: auto; }

.visual-caption {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--term-soft);
}

.visual-caption span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--phosphor);
  box-shadow: 0 0 0 4px rgba(126, 231, 135, 0.2);
}

/* ---------- Secciones ---------- */

.split,
.path,
.program,
.route { margin-top: clamp(48px, 8vw, 88px); }

.split {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(24px, 5vw, 64px);
}

.split-copy p { color: var(--ink-soft); }
.split-copy strong { color: var(--ink); }

.note {
  display: grid;
  gap: 4px;
  margin-top: 24px;
  padding: 16px 18px;
  border-left: 4px solid var(--amber);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--amber-soft);
}

.note strong {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
}

.note span { font-size: 0.95rem; }

.section-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px 40px;
  margin-bottom: 28px;
}

.section-heading > p {
  margin: 0;
  max-width: 38ch;
  color: var(--ink-soft);
}

.concept-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.concept-grid article {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.concept-grid span {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
}

.concept-grid h3 { margin: 10px 0 8px; font-size: 1.15rem; }
.concept-grid p { margin: 0; font-size: 0.93rem; color: var(--ink-soft); }

/* ---------- Programa ---------- */

.program-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px 40px;
}

.program-summary {
  margin: 12px 0 0;
  max-width: 54ch;
  color: var(--ink-soft);
}

.program-summary span { font-weight: 700; color: var(--ink); }

.topic-search { flex: 1 1 280px; max-width: 380px; }

.topic-search label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.search-control {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.search-control:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-control svg {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 2;
  stroke-linecap: round;
}

.search-control input {
  flex: 1;
  min-width: 0;
  padding: 12px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
}

.search-control kbd {
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.progress-panel {
  display: grid;
  gap: 10px;
  margin: 28px 0 8px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.progress-panel > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.9rem;
}

.progress-panel span { color: var(--ink-soft); }
.progress-panel strong { font-family: var(--mono); font-size: 0.85rem; }

.progress-track {
  height: 8px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.4s ease;
}

.module { margin-top: 32px; }

.module-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 1.15rem;
}

.module-title span {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
}

.topic-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.topic {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  text-decoration: none;
  border-top: 1px solid var(--line);
  transition: background 0.15s ease;
}

.topic:first-child,
.topic.first-visible { border-top: 0; }

.topic:hover { background: var(--accent-soft); }

.topic-number {
  width: 2.6em;
  padding: 4px 0;
  border-radius: 7px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  color: var(--ink-soft);
}

.topic-copy { display: grid; gap: 2px; }
.topic-copy strong { font-size: 1rem; line-height: 1.35; }
.topic-copy small { font-size: 0.87rem; color: var(--ink-soft); }

.topic-arrow {
  color: var(--ink-soft);
  transition: transform 0.15s ease, color 0.15s ease;
}

.topic:hover .topic-arrow { transform: translateX(4px); color: var(--accent); }

.topic.visited .topic-number { background: var(--accent); color: var(--surface); }
.topic.visited .topic-arrow { color: var(--accent); }

.no-results {
  margin: 28px 0 0;
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  color: var(--ink-soft);
}

/* ---------- Ruta ---------- */

.route-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.route-level {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.route-level h3 {
  margin-bottom: 14px;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.route-level ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.route-level li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  font-size: 0.93rem;
  line-height: 1.4;
  color: var(--ink-soft);
}

.route-level li span { font-family: var(--mono); font-size: 0.82rem; }

.route-level li.current {
  margin: -6px -10px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--accent-soft);
  font-weight: 700;
  color: var(--ink);
}

.route-level li.current span { color: var(--accent); }

/* ---------- Pie ---------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: clamp(48px, 8vw, 88px);
  padding: 24px 0 32px;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
}

.footer p { margin: 0; }
.footer a { color: var(--accent); font-weight: 600; text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ---------- Páginas de tema (temaN.html) ---------- */

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 20px;
  padding: 6px 0 18px;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.topbar a { color: var(--accent); font-weight: 600; text-decoration: none; }
.topbar a:hover { text-decoration: underline; }

.lesson-hero {
  padding: clamp(26px, 5vw, 52px);
  border-radius: 22px;
  color: var(--term-ink);
  background:
    linear-gradient(rgba(126, 231, 135, 0.045) 1px, transparent 1px) 0 0 / 100% 28px,
    radial-gradient(900px 420px at 85% 0%, #1d3147 0%, transparent 60%),
    var(--term);
}

.lesson-hero h1 {
  max-width: 20ch;
  font-size: clamp(2rem, 4.6vw, 3.1rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.lesson-hero .lead {
  max-width: 62ch;
  margin: 18px 0 0;
  font-size: 1.08rem;
  color: #c3cfdc;
}

.lesson {
  max-width: 780px;
  margin: 0 auto;
  padding-top: clamp(32px, 5vw, 56px);
}

.lesson h2 {
  margin: 2.4em 0 0.7em;
  padding-top: 0.3em;
  font-size: clamp(1.45rem, 2.8vw, 1.85rem);
  scroll-margin-top: 16px;
}

.lesson h3 { margin: 1.8em 0 0.6em; font-size: 1.15rem; }
.lesson ul, .lesson ol { margin: 0 0 1em; padding-left: 1.4em; }
.lesson li { margin-bottom: 0.4em; }
.lesson li::marker { color: var(--accent); font-weight: 700; }
.lesson a { color: var(--accent); text-underline-offset: 3px; }

.lesson :not(pre) > code {
  padding: 0.12em 0.4em;
  border-radius: 6px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 0.88em;
  overflow-wrap: anywhere;
}

.toc {
  margin: 0 0 8px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.toc p {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.toc ol { margin: 0; columns: 2; column-gap: 32px; font-size: 0.95rem; }
.toc li { break-inside: avoid; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--accent); text-decoration: underline; }

.code {
  margin: 1.4em 0;
  border-radius: var(--radius);
  background: var(--term);
  border: 1px solid var(--term-2);
  overflow: hidden;
}

.code figcaption {
  padding: 8px 16px;
  border-bottom: 1px solid var(--term-2);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--term-soft);
}

.code pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--term-ink);
  tab-size: 4;
}

.code .cmd { color: var(--phosphor); }
.code .out { color: var(--term-soft); }
.code .hl { color: var(--term-amber); }

.callout {
  margin: 1.5em 0;
  padding: 16px 18px;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--accent-soft);
}

.callout.warn { border-left-color: var(--amber); background: var(--amber-soft); }
.callout > strong:first-child {
  display: block;
  margin-bottom: 4px;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.callout.warn > strong:first-child { color: var(--amber); }
.callout p:last-child { margin-bottom: 0; }

.definition {
  margin: 1.5em 0;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 1.12rem;
  line-height: 1.5;
}

.diagram {
  margin: 1.6em 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.diagram svg { display: block; width: 100%; height: auto; font-family: var(--sans); }
.diagram figcaption { margin-top: 12px; font-size: 0.88rem; color: var(--ink-soft); text-align: center; }
.diagram .box { fill: var(--surface-2); stroke: var(--line); }
.diagram .box-kernel { fill: var(--accent-soft); stroke: var(--accent); }
.diagram .txt { fill: var(--ink); }
.diagram .txt-soft { fill: var(--ink-soft); }
.diagram .txt-accent { fill: var(--accent); }
.diagram .txt-amber { fill: var(--amber); }
.diagram .edge { stroke: var(--amber); }
.diagram .fill-a { fill: var(--accent); }
.diagram .fill-b { fill: var(--amber); }
.diagram .fill-c { fill: var(--ink-soft); }
.diagram .txt-on { fill: var(--surface); }
.diagram .gap { stroke: var(--surface); stroke-width: 2; }

.table-wrap { margin: 1.4em 0; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }

.lesson table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 0.93rem; }
.lesson th, .lesson td { padding: 11px 14px; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
.lesson thead th {
  border-top: 0;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.lesson .steps { padding: 0; list-style: none; counter-reset: paso; }

.steps li {
  position: relative;
  margin: 0;
  padding: 0 0 20px 52px;
  counter-increment: paso;
}

.steps li::before {
  content: counter(paso);
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--surface);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 32px;
  text-align: center;
}

.steps li::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 36px;
  bottom: 4px;
  width: 2px;
  background: var(--line);
}

.steps li:last-child { padding-bottom: 0; }
.steps li:last-child::after { display: none; }
.steps strong { display: block; }
.steps .mode {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 8px;
  border-radius: 99px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--ink-soft);
}
.steps .mode.k { background: var(--amber-soft); color: var(--amber); }

.lesson details {
  margin: 0.7em 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.lesson summary { padding: 12px 16px; font-weight: 600; cursor: pointer; }
.lesson details > :not(summary) { margin: 0; padding: 0 16px 14px; color: var(--ink-soft); }
.lesson details > .code { margin: 0 16px 16px; padding: 0; }

.lesson .summary-list { padding: 0; list-style: none; }
.summary-list li { position: relative; padding-left: 28px; }
.summary-list li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }

.pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: clamp(40px, 6vw, 64px);
}

.pager a {
  display: grid;
  gap: 2px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.pager a:hover { border-color: var(--accent); background: var(--accent-soft); }
.pager a.next { text-align: right; }
.pager small { font-family: var(--mono); font-size: 0.76rem; color: var(--ink-soft); }
.pager strong { line-height: 1.3; }

@media (max-width: 560px) {
  .toc ol { columns: 1; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager a.next { text-align: left; }
  .steps li { padding-left: 46px; }
}

/* ---------- Adaptación ---------- */

@media (max-width: 920px) {
  .hero,
  .split { grid-template-columns: minmax(0, 1fr); }
  .concept-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .route-grid { grid-template-columns: minmax(0, 1fr); }
  .topic-search { max-width: none; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .page { padding-top: 12px; }
  .hero { border-radius: 16px; }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .concept-grid { grid-template-columns: minmax(0, 1fr); }
  .topic { gap: 12px; padding: 14px; }
  .topic-arrow { display: none; }
  .topic { grid-template-columns: auto minmax(0, 1fr); }
  .search-control kbd { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
