/* ==========================================================================
   Guía de Craft Drill — hoja de estilos única
   Tema: minería / carbón + ámbar. Original, responsive, sin dependencias.
   ========================================================================== */

:root {
  --coal-900: #0e1219;
  --coal-800: #151b25;
  --coal-700: #202834;
  --coal-600: #2b3544;
  --paper: #f7f5ef;
  --paper-2: #efebe1;
  --card: #ffffff;
  --ink: #1f242c;
  --ink-soft: #4b5563;
  --amber: #d9902b;
  --amber-strong: #b8721a;
  --amber-soft: #f7e7c9;
  --teal: #1f8a7a;
  --teal-soft: #e0f2ee;
  --red: #b3382c;
  --red-soft: #f8e2df;
  --green: #2c7a43;
  --green-soft: #e3f1e7;
  --line: #e4dfd3;
  --line-strong: #d8d2c2;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 20, 27, .05), 0 10px 30px -12px rgba(16, 20, 27, .16);
  --shadow-lift: 0 2px 4px rgba(16, 20, 27, .06), 0 16px 36px -14px rgba(16, 20, 27, .22);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  --wrap: 1080px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* Anclas con cabecera fija: deja aire al llegar a la sección */
:target { scroll-margin-top: 90px; }
[id] { scroll-margin-top: 90px; }

::selection { background: var(--amber-soft); color: var(--ink); }

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

a { color: var(--amber-strong); text-decoration: none; transition: color .15s ease; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Enlaces externos: indica salida del sitio */
a[target="_blank"]::after {
  content: "↗";
  font-size: .8em;
  margin-left: 3px;
  opacity: .65;
}

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

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

/* Saltar al contenido */
.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--amber); color: #000; padding: 10px 16px; z-index: 99;
  border-radius: 0 0 8px 0; font-weight: 700;
}
.skip:focus { left: 0; }

/* ===== Masthead ===== */
.masthead {
  background: rgba(14, 18, 25, .92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #e8e6e0;
  border-bottom: 3px solid var(--amber);
  position: sticky; top: 0; z-index: 50;
}
.masthead-inner {
  display: flex; align-items: center; gap: 20px;
  flex-wrap: wrap; padding-top: 13px; padding-bottom: 13px;
}
.wordmark { display: inline-flex; align-items: center; gap: 11px; color: #fff; }
.wordmark:hover { text-decoration: none; }
.wordmark-mark {
  width: 38px; height: 38px; border-radius: 10px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--amber), #f2c06a);
  color: #16140f; font-weight: 800; font-size: 15px; letter-spacing: -.02em;
  display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(217, 144, 43, .35);
}
.wordmark-text { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }

.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.nav a {
  color: #cdd3dc; padding: 8px 12px; border-radius: 8px; font-size: 15px; font-weight: 600;
  transition: background .15s ease, color .15s ease;
}
.nav a:hover { background: var(--coal-700); color: #fff; text-decoration: none; }
.nav a[aria-current="page"] { color: #16140f; background: var(--amber); }

/* ===== Hero ===== */
.hero {
  background:
    radial-gradient(1100px 420px at 85% -10%, rgba(217, 144, 43, .22), transparent 60%),
    radial-gradient(700px 300px at 0% 110%, rgba(31, 138, 122, .12), transparent 60%),
    linear-gradient(180deg, var(--coal-900), var(--coal-800));
  color: #eef0f3;
  padding: 60px 0 52px;
}
.hero-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 40px; align-items: start; }
.kicker {
  display: inline-block; font-family: var(--mono); font-size: 12.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--amber); font-weight: 700; margin: 0 0 14px;
}
.hero h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.08; margin: 0 0 16px; letter-spacing: -.02em; }
.hero h1 .game { color: var(--amber); }
.lead { font-size: 18px; color: #c9cfd8; max-width: 40em; margin: 0 0 26px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }

/* Pill de frescura (hero) */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 700; letter-spacing: .04em;
  color: var(--amber-soft); background: rgba(217, 144, 43, .14);
  border: 1px solid rgba(217, 144, 43, .45); border-radius: 999px;
  padding: 5px 13px; margin: 0 0 18px;
}
.pill::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--amber); box-shadow: 0 0 0 3px rgba(217, 144, 43, .25);
}

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--amber); color: #16140f; font-weight: 700; font-size: 15.5px;
  padding: 12px 20px; border-radius: 10px; border: 1px solid transparent;
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 4px 14px rgba(217, 144, 43, .28);
}
.btn:hover { background: #e8a43f; text-decoration: none; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(217, 144, 43, .34); }
.btn:active { transform: translateY(0); }
.btn.ghost { background: transparent; color: #e8e6e0; border-color: #3a4553; box-shadow: none; }
.btn.ghost:hover { border-color: var(--amber); color: #fff; background: rgba(217, 144, 43, .08); }

/* Hero side facts */
.hero-side {
  background: rgba(255,255,255,.04); border: 1px solid #2b3544; border-radius: var(--radius);
  padding: 22px; backdrop-filter: blur(2px);
}
.rail-label { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--amber); margin: 0 0 12px; font-weight: 700; }
.facts dl { margin: 0; }
.facts div { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px dashed #2b3544; }
.facts div:last-child { border-bottom: 0; }
.facts dt { color: #aab3c0; font-size: 14.5px; }
.facts dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.hero-note { margin: 14px 0 0; color: #8b95a3; font-size: 13.5px; }

/* ===== Page index rail ===== */
.rail { margin-top: -26px; position: relative; z-index: 1; }
.rail-box {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px 26px;
}
.rail-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 24px; }
.rail-list a { display: flex; gap: 10px; align-items: baseline; padding: 7px 2px; color: var(--ink); font-weight: 600; font-size: 15px; border-radius: 6px; transition: color .15s ease; }
.rail-list a:hover { color: var(--amber-strong); text-decoration: none; }
.rail-list a:hover .rail-no { color: var(--amber-strong); }
.rail-no { font-family: var(--mono); color: var(--amber); font-size: 12.5px; font-weight: 700; }

/* ===== Sections ===== */
section.block { padding: 52px 0; }
section.block.tint { background: var(--paper-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

h2.section-h {
  font-size: clamp(23px, 3.4vw, 30px); letter-spacing: -.02em; margin: 0 0 14px;
  display: flex; align-items: baseline; gap: 12px;
}
h2.section-h .no { font-family: var(--mono); color: var(--amber); font-size: 15px; font-weight: 700; }
h3 { font-size: 19px; margin: 0 0 6px; letter-spacing: -.01em; }
p { margin: 0 0 14px; }

.lead-para { font-size: 18px; color: var(--ink-soft); max-width: 46em; }

/* Stage list */
.stage-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 12px; }
.stage {
  display: grid; grid-template-columns: 42px 1fr; gap: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 16px 18px;
  transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease;
}
.stage:hover { border-color: var(--line-strong); box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.stage-no {
  width: 42px; height: 42px; border-radius: 50%; background: var(--coal-900); color: var(--amber);
  display: grid; place-items: center; font-weight: 800; font-family: var(--mono);
  transition: background .18s ease;
}
.stage:hover .stage-no { background: var(--amber); color: #16140f; }
.stage-body p { margin: 2px 0 0; color: var(--ink-soft); font-size: 15.5px; }
.stage-fail { color: var(--red); font-size: 14px; margin-top: 6px; }
.stage-fail::before { content: "✗ "; font-weight: 800; }

/* Path list */
.path-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 12px; }
.path { display: grid; grid-template-columns: 42px 1fr; gap: 16px; align-items: start; }
.path p { color: var(--ink-soft); margin: 0; }

/* Cards grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin-top: 20px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 20px;
  box-shadow: 0 1px 2px rgba(16,20,27,.04);
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
.card:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); border-color: var(--line-strong); }
.card h3 { margin-bottom: 8px; }
.card p { color: var(--ink-soft); font-size: 15px; margin: 0; }

/* Tables */
.tablewrap {
  overflow-x: auto; margin: 18px 0; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgba(16,20,27,.04);
  -webkit-overflow-scrolling: touch;
}
table.datatable { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 15px; }
table.datatable caption { caption-side: top; text-align: left; font-weight: 700; padding: 14px 16px 4px; }
table.datatable th, table.datatable td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.datatable thead th {
  background: var(--coal-900); color: #e8e6e0; font-size: 13.5px; letter-spacing: .02em;
  position: sticky; top: 0;
}
table.datatable tbody th { font-weight: 700; }
table.datatable tbody tr:nth-child(even) { background: #fbf9f4; }
table.datatable tbody tr:last-child td, table.datatable tbody tr:last-child th { border-bottom: 0; }
table.datatable tbody tr { transition: background .12s ease; }
table.datatable tbody tr:hover { background: var(--amber-soft); }

/* Teclas de teclado */
kbd {
  font-family: var(--mono); font-size: .88em; font-weight: 700;
  background: var(--paper-2); color: var(--ink);
  border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 6px; padding: 1px 7px; white-space: nowrap;
}

/* Callouts */
.callout { border-radius: var(--radius-sm); padding: 16px 18px; margin: 18px 0; font-size: 15.5px; }
.callout.note { background: var(--amber-soft); border-left: 4px solid var(--amber); }
.callout.tip { background: var(--teal-soft); border-left: 4px solid var(--teal); }
.callout.warn { background: var(--red-soft); border-left: 4px solid var(--red); }
.callout.ok { background: var(--green-soft); border-left: 4px solid var(--green); }
.callout b.title { display: block; font-weight: 800; margin-bottom: 4px; }

/* Breadcrumb */
.breadcrumb { font-size: 14px; color: var(--ink-soft); padding: 22px 0 0; }
.breadcrumb a { color: var(--ink-soft); }
.breadcrumb .sep { margin: 0 8px; color: #b9b2a3; }

/* Page header */
.pagehead { padding: 36px 0 8px; }
.pagehead h1 { font-size: clamp(26px, 4.4vw, 38px); letter-spacing: -.02em; margin: 0 0 12px; }
.pagehead .lead { color: var(--ink-soft); }

/* Línea de frescura bajo el título (SEO / confianza) */
.page-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  font-size: 14px; color: var(--ink-soft); margin: 4px 0 10px;
}
.page-meta .page-meta-item {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px; font-variant-numeric: tabular-nums;
}
.page-meta .page-meta-item::before { content: "◆"; color: var(--amber); font-size: 9px; }

/* Article body spacing */
.article { padding-bottom: 56px; }
.article h2 { font-size: 23px; margin: 34px 0 10px; letter-spacing: -.015em; }
.article h2:first-child { margin-top: 6px; }
.article h3 { margin: 24px 0 8px; }
.article ul, .article ol { margin: 10px 0 18px; padding-left: 24px; }
.article li { margin: 6px 0; }

/* Glossary rows */
.glossary-row { display: grid; grid-template-columns: 220px 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.glossary-row:last-child { border-bottom: 0; }
.glossary-term { font-family: var(--mono); font-weight: 700; color: var(--coal-800); }
.glossary-def { color: var(--ink-soft); }

/* FAQ details */
details.faq { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 10px 0; transition: border-color .15s ease; }
details.faq[open] { border-color: var(--line-strong); box-shadow: 0 1px 2px rgba(16,20,27,.05); }
details.faq summary { cursor: pointer; padding: 16px 18px; font-weight: 700; list-style: none; transition: color .15s ease; }
details.faq summary:hover { color: var(--amber-strong); }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::before { content: "+"; color: var(--amber); font-weight: 800; margin-right: 10px; }
details.faq[open] summary::before { content: "–"; }
details.faq .faq-body { padding: 0 18px 16px; color: var(--ink-soft); }

/* Update log */
.log dl { margin: 0; }
.log div { display: grid; grid-template-columns: 120px 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.log dt { font-family: var(--mono); color: var(--amber-strong); font-weight: 700; }
.log dd { margin: 0; color: var(--ink-soft); }

/* Tag / badge */
.tag { display: inline-block; font-family: var(--mono); font-size: 12px; padding: 3px 9px; border-radius: 6px; background: var(--coal-800); color: var(--amber); font-weight: 700; letter-spacing: .04em; }

/* Table of contents (legal/info pages) */
.toc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px 22px; margin: 20px 0; }
.toc .toc-title { font-weight: 800; margin: 0 0 10px; }
.toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 36px; }
.toc li { margin: 4px 0; font-size: 15px; }
.toc a { color: var(--ink); }
.toc a:hover { color: var(--amber-strong); }
@media (max-width: 640px) { .toc ol { columns: 1; } }

/* Two-column article layout + sticky sidebar TOC (content pages) */
.article-grid { display: grid; grid-template-columns: minmax(0,1fr) 280px; gap: 44px; align-items: start; }
.article-main { min-width: 0; }
.article-aside { position: sticky; top: 86px; }
.side-toc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px; font-size: 14.5px; box-shadow: 0 1px 2px rgba(16,20,27,.04); }
.side-toc .toc-title { font-weight: 800; margin: 0 0 10px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
.side-toc ol { margin: 0; padding: 0; list-style: none; counter-reset: sidetoc; }
.side-toc li { margin: 0; counter-increment: sidetoc; }
.side-toc a { display: block; padding: 5px 0 5px 12px; border-left: 2px solid var(--line); color: var(--ink-soft); transition: border-color .15s ease, color .15s ease; }
.side-toc a::before { content: counter(sidetoc) ". "; font-family: var(--mono); font-size: 12px; color: var(--amber); font-weight: 700; }
.side-toc a:hover { border-left-color: var(--amber); color: var(--ink); text-decoration: none; }

/* Related content nav */
.related { margin-top: 30px; border-top: 1px solid var(--line); padding-top: 22px; }
.related .related-title { font-size: 17px; margin: 0 0 12px; }
.related ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px 26px; }
.related a { font-weight: 600; }

/* References / facts */
.refs { margin-top: 26px; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px 22px; }
.refs .refs-title { font-size: 16px; margin: 0 0 10px; }
.refs ul { margin: 0; padding-left: 20px; font-size: 14.5px; color: var(--ink-soft); }
.refs li { margin: 5px 0; }

@media (max-width: 900px) {
  .article-grid { grid-template-columns: 1fr; }
  .article-aside { position: static; order: -1; }
}

/* ===== Footer ===== */
.footer {
  background: linear-gradient(180deg, var(--coal-900), #0a0d12);
  color: #b9c0ca; padding: 48px 0 40px; margin-top: 10px;
  border-top: 3px solid var(--amber);
}
.footer-name { color: #fff; font-weight: 800; font-size: 18px; margin-bottom: 14px; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-bottom: 20px; }
.footer-nav a { color: #cdd3dc; font-size: 15px; transition: color .15s ease; }
.footer-nav a:hover { color: var(--amber); }
.footer-note { font-size: 13.5px; color: #8b95a3; margin: 6px 0 0; max-width: 56em; }
.footer .contact { color: var(--amber); }

/* Utility */
.center { text-align: center; }
.muted { color: var(--ink-soft); }
.mt0 { margin-top: 0; }
.nowrap { white-space: nowrap; }

/* Responsive */
@media (max-width: 800px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero { padding: 44px 0 40px; }
  .masthead-inner { gap: 12px; }
  .nav { width: 100%; margin-left: 0; }
  .glossary-row { grid-template-columns: 1fr; gap: 4px; }
  .log div { grid-template-columns: 1fr; gap: 4px; }
  .stage, .path { grid-template-columns: 34px 1fr; gap: 12px; }
  .stage-no { width: 34px; height: 34px; font-size: 14px; }
  .rail { margin-top: 22px; }
  section.block { padding: 40px 0; }
}

/* Accesibilidad: menos movimiento */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Impresión */
@media print {
  .masthead, .footer, .nav, .hero-cta, .article-aside, .skip { display: none !important; }
  body { font-size: 12pt; background: #fff; }
  .hero { background: #fff; color: #000; }
  a { color: inherit; }
}
