/* ==========================================================================
   PasoFácil · estilos
   ========================================================================== */

:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --surface-2: #f3efe7;
  --text: #1f2328;
  --muted: #5d6670;
  --border: #e7e1d6;
  --brand: #c2410c;
  --brand-hover: #9a3412;
  --brand-soft: #fff1e7;
  --accent: #0f766e;
  --accent-soft: #e6f6f3;
  --warn: #92400e;
  --warn-soft: #fef6e0;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(31, 35, 40, .04), 0 6px 20px rgba(31, 35, 40, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --surface: #1d2024;
    --surface-2: #24282d;
    --text: #e9e7e3;
    --muted: #a3abb4;
    --border: #2f343a;
    --brand: #fb8c4b;
    --brand-hover: #fdae7e;
    --brand-soft: #34231a;
    --accent: #4fd1c0;
    --accent-soft: #15302d;
    --warn: #f7c768;
    --warn-soft: #33290f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-hover); }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.6rem); margin: .2em 0 .4em; }
h2 { font-size: clamp(1.35rem, 3vw, 1.6rem); }

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

.wrap { max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 780px; }
.section { padding-top: 28px; padding-bottom: 28px; }
.center { text-align: center; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 10;
  background: var(--brand); color: #fff; padding: 8px 14px; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 12px; }

/* ---------- Cabecera ---------- */

.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 16px; padding-top: 12px; padding-bottom: 12px; }

.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.3rem; letter-spacing: -0.02em;
  color: var(--text); text-decoration: none; flex-shrink: 0;
}
.logo:hover { color: var(--text); }

.search { display: flex; position: relative; }
.search input {
  width: 100%; font: inherit; font-size: 1rem; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 10px 48px 10px 18px;
}
.search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search button {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border: 0; border-radius: 50%;
  background: var(--brand); color: #fff; cursor: pointer;
  display: grid; place-items: center;
}
.search button:hover { background: var(--brand-hover); }
@media (prefers-color-scheme: dark) { .search button { color: #1d2024; } }

.search-header { margin-left: auto; width: min(360px, 100%); }

.cat-nav { border-top: 1px solid var(--border); }
.cat-nav-wrap { position: relative; }
.cat-nav-inner {
  position: relative; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding-top: 8px; padding-bottom: 8px; cursor: grab; user-select: none;
}
.cat-nav-inner::-webkit-scrollbar { display: none; }
.cat-nav-inner.arrastrando { cursor: grabbing; }
.cat-nav-inner.arrastrando a { pointer-events: none; }

/* Degradado en el borde que indica que hay más categorías */
.cat-nav-wrap.mas-izq .cat-nav-inner { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 56px); mask-image: linear-gradient(to right, transparent 0, #000 56px); }
.cat-nav-wrap.mas-der .cat-nav-inner { -webkit-mask-image: linear-gradient(to left, transparent 0, #000 56px); mask-image: linear-gradient(to left, transparent 0, #000 56px); }
.cat-nav-wrap.mas-izq.mas-der .cat-nav-inner {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);
}

.cat-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
  font-size: 1.4rem; line-height: 1; display: grid; place-items: center; padding: 0 0 3px; cursor: pointer;
}
.cat-arrow[hidden] { display: none; }
.cat-arrow:hover { color: var(--brand); border-color: var(--brand); }
.cat-arrow-left { left: 8px; }
.cat-arrow-right { right: 8px; }
/* En pantallas táctiles se desliza con el dedo: sin flechas */
@media (hover: none) { .cat-arrow { display: none !important; } }
.cat-nav a {
  flex-shrink: 0; padding: 6px 12px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-size: .95rem; white-space: nowrap;
}
.cat-nav a:hover, .cat-nav a[aria-current] { background: var(--brand-soft); color: var(--brand); }

@media (max-width: 640px) {
  .header-inner { flex-wrap: wrap; }
  .search-header { width: 100%; margin-left: 0; }
}

/* ---------- Portada ---------- */

.hero {
  background:
    radial-gradient(circle at 15% 20%, var(--brand-soft), transparent 55%),
    radial-gradient(circle at 85% 80%, var(--accent-soft), transparent 50%);
  padding: 56px 0 48px;
  text-align: center;
}
.hero h1 { font-size: clamp(2rem, 5.5vw, 3.2rem); max-width: 20ch; margin: 0 auto .35em; }
.hero h1 span { color: var(--brand); }
.hero p { color: var(--muted); font-size: 1.12rem; max-width: 60ch; margin: 0 auto 26px; }
.search-hero { max-width: 560px; margin: 0 auto; }
.search-hero input { padding: 15px 56px 15px 22px; font-size: 1.05rem; background: var(--surface); box-shadow: var(--shadow); }
.search-hero button { width: 46px; height: 46px; right: 5px; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.cat-card {
  display: flex; flex-direction: column; gap: 4px; padding: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.cat-card:hover { color: var(--text); transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--brand); }
.cat-icon { font-size: 2rem; line-height: 1; margin-bottom: 6px; }
.cat-name { font-weight: 700; }
.cat-count { color: var(--muted); font-size: .9rem; }

/* ---------- Tarjetas ---------- */

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card { overflow: hidden; }
.card-link { display: flex; flex-direction: column; height: 100%; color: var(--text); text-decoration: none; }
.card-img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-2); }
.card-img-icono { display: grid; place-items: center; font-size: 3.2rem; background: linear-gradient(135deg, var(--brand-soft), var(--accent-soft)); }
.card-body { display: flex; flex-direction: column; flex: 1; padding: 18px 20px 20px; }
.card-link:hover { color: var(--text); }
.card h3 { font-size: 1.15rem; margin: 12px 0 8px; }
.card-link:hover h3 { color: var(--brand); }
.card p { color: var(--muted); font-size: .95rem; margin: 0 0 14px; flex: 1; }
.card-meta { font-size: .88rem; color: var(--muted); }

.chip {
  align-self: flex-start; display: inline-block;
  background: var(--brand-soft); color: var(--brand);
  font-size: .82rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; text-decoration: none;
}

/* ---------- Cabecera de página y migas ---------- */

.breadcrumbs { padding-top: 20px; font-size: .9rem; }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin-right: 6px; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs [aria-current] { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40ch; }

.page-head { margin: 10px 0 26px; }
.lead { color: var(--muted); font-size: 1.12rem; max-width: 70ch; }
.empty { color: var(--muted); }

/* ---------- Tutorial ---------- */

.tut-head { max-width: 800px; padding: 14px 0 6px; }
.tut-head .lead { margin-top: 0; }
.tut-meta { list-style: none; padding: 0; margin: 18px 0 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.tut-meta li {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 12px; font-size: .9rem;
}
.byline { color: var(--muted); font-size: .92rem; margin: 6px 0 0; }

.tut-image { margin: 20px 0 0; }
.tut-image { max-width: 900px; }
.tut-image img { border-radius: var(--radius); display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-2); }
.tut-image figcaption { font-size: .8rem; color: var(--muted); margin-top: 6px; }
.tut-image figcaption a { color: var(--muted); }

.tut-layout { display: grid; gap: 40px; padding: 24px 0 8px; }
@media (min-width: 1000px) {
  .tut-layout { grid-template-columns: minmax(0, 1fr) 260px; }
}
.tut-body { max-width: 760px; min-width: 0; }

.tut-side { order: -1; }
@media (min-width: 1000px) { .tut-side { order: 0; } }
.toc {
  position: sticky; top: 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; font-size: .93rem;
}
.toc-title { font-weight: 700; margin: 0 0 8px; }
.toc ol { margin: 0; padding-left: 20px; }
.toc li { margin: 5px 0; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--brand); text-decoration: underline; }

.needs {
  display: grid; gap: 4px 28px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 22px 12px; margin-bottom: 28px;
}
.needs h2 { font-size: 1.15rem; margin: 16px 0 8px; }
.needs small { font-weight: 400; color: var(--muted); }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { margin: 0; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0; cursor: pointer; }
.checklist input { margin-top: 6px; width: 17px; height: 17px; accent-color: var(--accent); flex-shrink: 0; }
.checklist input:checked + span { text-decoration: line-through; color: var(--muted); }

/* ---------- Texto de los artículos ---------- */

.prose { font-size: 1.06rem; line-height: 1.75; }
.prose h2 { margin: 1.9em 0 .6em; scroll-margin-top: 16px; }
.prose h3 { font-size: 1.18rem; margin: 1.6em 0 .4em; scroll-margin-top: 16px; }
.prose p, .prose ul { margin: 0 0 1.1em; }
.prose ul { padding-left: 1.3em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--brand); }
.prose code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; font-size: .92em; }
.prose img { border-radius: var(--radius-sm); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }

ol.pasos { list-style: none; counter-reset: paso; padding: 0; margin: 0 0 1.4em; }
ol.pasos > li {
  counter-increment: paso; position: relative;
  padding: 14px 18px 14px 64px; margin: 0 0 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
ol.pasos > li::before {
  content: counter(paso);
  position: absolute; left: 16px; top: 14px;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 800; font-size: .98rem;
  display: grid; place-items: center; line-height: 1;
}
@media (prefers-color-scheme: dark) { ol.pasos > li::before { color: #1d2024; } }
ol.pasos ul { margin: .5em 0 0; padding-left: 1.2em; }

.callout { border-radius: var(--radius); padding: 14px 18px; margin: 0 0 1.4em; border: 1px solid; }
.callout > :last-child { margin-bottom: 0; }
.callout-title { font-weight: 700; margin: 0 0 4px !important; }
.callout-consejo { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.callout-aviso { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.callout-aviso .callout-title { color: var(--warn); }
.callout-nota { background: var(--surface-2); border-color: var(--border); }

.ad-slot { margin: 1.6em 0; min-height: 280px; }

.related { border-top: 1px solid var(--border); margin-top: 20px; }

/* ---------- Varios ---------- */

.button {
  display: inline-block; background: var(--brand); color: #fff; font-weight: 600;
  padding: 11px 22px; border-radius: 999px; text-decoration: none; margin-top: 18px;
}
.button:hover { background: var(--brand-hover); color: #fff; }
.big-emoji { font-size: 4rem; margin: 10px 0 0; }
.search-page { margin: 0; }

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

.site-footer { margin-top: 48px; background: var(--surface); border-top: 1px solid var(--border); font-size: .94rem; color: var(--muted); }
.footer-grid { display: grid; gap: 28px; grid-template-columns: 2fr 1fr 1fr; padding-top: 36px; padding-bottom: 24px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > :first-child { grid-column: 1 / -1; } }
.footer-logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.1rem; color: var(--text); margin: 0 0 8px; }
.footer-title { font-weight: 700; color: var(--text); margin: 0 0 8px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 6px 0; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--brand); text-decoration: underline; }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 16px; padding-bottom: 24px; font-size: .88rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .cat-card { transition: none; }
}
