/* =========================================================
   tutorial.css · Mobile-First · sin dependencias
   ========================================================= */

:root {
  --c-bg: #ffffff;
  --c-surface: #f6f7f9;
  --c-text: #1d232b;
  --c-muted: #5b6672;
  --c-primary: #d9640a;
  --c-primary-dark: #a84c05;
  --c-border: #e3e7ec;
  --c-safety-bg: #fff1f0;
  --c-safety-bd: #d93025;
  --c-tip-bg: #eef7ee;
  --c-tip-bd: #2e7d32;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 1rem/1.7 var(--font); color: var(--c-text); background: var(--c-bg); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, p { margin: 0; }
a { color: var(--c-primary-dark); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--c-primary); outline-offset: 2px; }

/* Accesibilidad */
.skip-link { position: absolute; left: -999px; top: 0; background: #000; color: #fff; padding: .75rem 1rem; z-index: 100; }
.skip-link:focus { left: 0; }

/* Layout */
.wrap { width: 100%; max-width: 760px; margin-inline: auto; padding: 1rem; }

/* Header / footer del sitio */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.94); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--c-border); }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .75rem 1rem; max-width: 1100px; margin-inline: auto; }
.site-logo { display: inline-flex; align-items: center; gap: .45rem; font-weight: 800; font-size: 1.15rem; text-decoration: none; color: var(--c-text); }
.site-logo::before { content: ""; width: 1.6rem; height: 1.6rem; background: url("../favicon.svg") center / contain no-repeat; }
.site-logo span { color: var(--c-primary); }
.site-menu { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .95rem; }
.site-menu a { text-decoration: none; padding: .5rem 0; display: inline-block; color: var(--c-text); border-bottom: 2px solid transparent; }
.site-menu a:hover { color: var(--c-primary-dark); }
.site-menu a[aria-current="page"] { color: var(--c-primary-dark); border-bottom-color: var(--c-primary); font-weight: 600; }
.site-footer { margin-top: 3rem; padding: 1.5rem 1rem; text-align: center; background: var(--c-surface); font-size: .9rem; color: var(--c-muted); }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem 1rem; margin-bottom: .75rem; }

/* Migas de pan */
.breadcrumb { font-size: .85rem; color: var(--c-muted); margin-bottom: .75rem; }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: .25rem; }
.breadcrumb li:not(:last-child)::after { content: "›"; margin-left: .35rem; }
.breadcrumb a { color: inherit; }

/* Cabecera del artículo */
.tutorial__header { margin-bottom: 1.5rem; }
.tutorial h1 { font-size: 1.75rem; line-height: 1.2; font-weight: 800; letter-spacing: -.01em; }
.tutorial__intro { margin-top: .75rem; font-size: 1.05rem; color: var(--c-muted); }

.meta { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: 1rem; padding: .75rem; background: var(--c-surface); border-radius: var(--radius); font-size: .9rem; }
.meta__item { display: flex; flex-direction: column; }
.meta__label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--c-muted); }

.badge { display: inline-block; width: fit-content; padding: .1rem .6rem; border-radius: 99px; font-size: .8rem; font-weight: 700; color: #fff; }
.badge--facil { background: #2e7d32; }
.badge--media { background: #b87400; }
.badge--dificil { background: #c62828; }

.tutorial__hero { margin: 1.25rem 0 0; }
.tutorial__hero img { width: 100%; aspect-ratio: 8 / 5; object-fit: cover; border-radius: var(--radius); }

/* Materiales */
.materials { margin: 1.5rem 0; padding: 1.25rem; background: #fff8f0; border: 2px solid var(--c-primary); border-radius: var(--radius); }
.materials h2 { font-size: 1.3rem; margin-bottom: .75rem; }
.materials h3 { font-size: 1rem; margin-bottom: .5rem; color: var(--c-primary-dark); }
.materials__grid { display: grid; gap: 1rem; }
.checklist li { position: relative; padding: .35rem 0 .35rem 1.9rem; border-bottom: 1px dashed var(--c-border); }
.checklist li:last-child { border-bottom: 0; }
.checklist li::before { content: "✓"; position: absolute; left: 0; top: .35rem; width: 1.3rem; height: 1.3rem; line-height: 1.3rem; text-align: center; background: var(--c-primary); color: #fff; border-radius: 50%; font-size: .8rem; font-weight: 700; }

/* Pasos */
.steps { counter-reset: paso; display: grid; gap: 1.25rem; }
.step { counter-increment: paso; padding: 1.25rem 1rem; background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,.05); scroll-margin-top: 5rem; }
.step__title { display: flex; align-items: flex-start; gap: .75rem; font-size: 1.25rem; line-height: 1.3; margin-bottom: .75rem; }
.step__title::before { content: counter(paso); flex: 0 0 2.25rem; height: 2.25rem; line-height: 2.25rem; text-align: center; background: var(--c-primary); color: #fff; border-radius: 50%; font-weight: 800; font-size: 1.1rem; }
.step__content > * + * { margin-top: .85rem; }
.step__figure img { width: 100%; aspect-ratio: 8 / 5; object-fit: cover; border-radius: 8px; }
.step__figure figcaption { margin-top: .4rem; font-size: .85rem; color: var(--c-muted); }

/* Callouts */
.callout { padding: .9rem 1rem; border-left: 5px solid; border-radius: 8px; }
.callout__title { font-weight: 800; margin-bottom: .25rem; }
.callout--safety { background: var(--c-safety-bg); border-color: var(--c-safety-bd); }
.callout--tip { background: var(--c-tip-bg); border-color: var(--c-tip-bd); }

/* ADSENSE: reserva de espacio (anti-CLS). Los huecos solo se muestran cuando
   hay un ID de editor configurado en js/cookies.js (clase .ads-enabled en <html>). */
.ad-wrap { list-style: none; }
.ad-wrap, .ad-slot { display: none; }
.ads-enabled .ad-wrap, .ads-enabled .ad-slot { display: block; }
.ad-slot { margin: 1.75rem 0; text-align: center; contain: layout; }
.ad-slot__label { display: block; margin-bottom: .25rem; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--c-muted); }
.ad-slot__box { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 280px; background: var(--c-surface); border-radius: 8px; overflow: hidden; }
.ad-slot--mid .ad-slot__box { min-height: 320px; }

/* Footer del artículo */
.tutorial__footer { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--c-border); color: var(--c-muted); }

/* Portada: listado de tutoriales */
.home-hero { position: relative; margin: 0 -1rem; padding: 2.5rem 1rem 2rem; color: #fff; background: #1d232b center / cover no-repeat; overflow: hidden; }
.home-hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, rgba(20,24,30,.92) 0%, rgba(20,24,30,.7) 55%, rgba(20,24,30,.35) 100%); }
.home-hero > * { position: relative; }
.home-hero__kicker { display: inline-block; margin-bottom: .6rem; padding: .15rem .7rem; border-radius: 99px; background: var(--c-primary); font-size: .8rem; font-weight: 700; letter-spacing: .03em; }
.home-hero h1 { font-size: 1.85rem; line-height: 1.15; letter-spacing: -.01em; max-width: 18ch; }
.home-hero p { margin-top: .75rem; max-width: 46ch; color: #e6e9ed; font-size: 1.05rem; }
.home-hero__points { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; margin-top: 1.25rem; font-size: .9rem; color: #f3f4f6; }
.home-hero__points li::before { content: "✓ "; color: #ffb066; font-weight: 800; }

.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .75rem; margin-top: 2rem; }
.section-head h2 { font-size: 1.35rem; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { font: inherit; font-size: .85rem; padding: .35rem .85rem; border: 1px solid var(--c-border); border-radius: 99px; background: #fff; color: var(--c-text); cursor: pointer; }
.chip:hover { border-color: var(--c-primary); }
.chip[aria-pressed="true"] { background: var(--c-primary-dark); border-color: var(--c-primary-dark); color: #fff; }
.post-card__tag { display: inline-block; margin-bottom: .4rem; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--c-primary-dark); }
.post-card[hidden] { display: none; }
.post-card { transition: box-shadow .2s, transform .2s; }
.post-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.08); transform: translateY(-2px); }

.promise { display: grid; gap: 1rem; margin-top: 2.5rem; padding: 1.25rem; background: var(--c-surface); border-radius: var(--radius); }
.promise h2 { font-size: 1.2rem; }
.promise__grid { display: grid; gap: 1rem; }
.promise__item h3 { font-size: 1rem; }
.promise__item p { margin-top: .25rem; font-size: .92rem; color: var(--c-muted); }
.post-list { display: grid; gap: 1rem; margin-top: 1rem; }
.post-card { border: 1px solid var(--c-border); border-radius: var(--radius); overflow: hidden; background: #fff; }
.post-card a { display: block; text-decoration: none; color: inherit; }
.post-card img { width: 100%; aspect-ratio: 8 / 5; object-fit: cover; }
.post-card__body { padding: 1rem; }
.post-card h3 { font-size: 1.15rem; line-height: 1.3; }
.post-card p { margin-top: .4rem; font-size: .95rem; color: var(--c-muted); }
.post-card__meta { margin-top: .6rem; font-size: .8rem; color: var(--c-muted); }
.post-card a:hover h3 { color: var(--c-primary-dark); text-decoration: underline; }

/* Páginas de texto (legales, contacto...) */
.page h1 { font-size: 1.75rem; line-height: 1.2; margin-bottom: 1rem; }
.page h2 { font-size: 1.25rem; margin: 1.75rem 0 .5rem; }
.page p, .page ul { margin-top: .75rem; }
.page ul { list-style: disc; padding-left: 1.25rem; }
.page li + li { margin-top: .3rem; }

/* Utilidades */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.link-button { font: inherit; color: inherit; background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.button { display: inline-block; font: inherit; font-weight: 700; padding: .7rem 1.3rem; border: 2px solid var(--c-primary-dark); border-radius: 10px; background: var(--c-primary-dark); color: #fff; text-decoration: none; cursor: pointer; }
.button:hover { background: #8a3e03; border-color: #8a3e03; }
.button--ghost { background: #fff; color: var(--c-primary-dark); }
.button--ghost:hover { background: #fff8f0; color: var(--c-primary-dark); }

/* Índice de pasos dentro del tutorial */
.toc { margin: 1.5rem 0; padding: 1rem 1.25rem; border: 1px solid var(--c-border); border-radius: var(--radius); font-size: .95rem; }
.toc h2 { font-size: 1rem; margin-bottom: .5rem; }
.toc ol { list-style: decimal; padding-left: 1.25rem; }
.toc li + li { margin-top: .2rem; }

/* Relacionados */
.related { margin-top: 2rem; }
.related h2 { font-size: 1.2rem; margin-bottom: .75rem; }
.related ul { display: grid; gap: .5rem; }
.related a { display: block; padding: .75rem 1rem; border: 1px solid var(--c-border); border-radius: 10px; text-decoration: none; font-weight: 600; }
.related a:hover { border-color: var(--c-primary); }

/* Formulario de contacto */
.form { display: grid; gap: 1rem; margin-top: 1.25rem; padding: 1.25rem; background: var(--c-surface); border-radius: var(--radius); }
.form__field { display: grid; gap: .3rem; }
.form label { font-weight: 600; font-size: .95rem; }
.form input[type="text"], .form input[type="email"], .form select, .form textarea { width: 100%; font: inherit; padding: .65rem .8rem; border: 1px solid #c9d0d8; border-radius: 8px; background: #fff; color: var(--c-text); }
.form textarea { min-height: 9rem; resize: vertical; }
.form input:focus-visible, .form select:focus-visible, .form textarea:focus-visible { outline: 3px solid var(--c-primary); outline-offset: 1px; border-color: var(--c-primary); }
.form__check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400 !important; font-size: .9rem !important; }
.form__check input { margin-top: .35rem; width: 1.1rem; height: 1.1rem; accent-color: var(--c-primary-dark); }
.form__hint { font-size: .82rem; color: var(--c-muted); }
.form__honeypot { display: none; }

/* Banner de cookies */
.cookie-banner { position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 200; max-width: 560px; margin-inline: auto; padding: 1.1rem 1.25rem; background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0,0,0,.18); font-size: .92rem; }
.cookie-banner[hidden] { display: none; }
.cookie-banner h2 { font-size: 1.05rem; margin-bottom: .35rem; }
.cookie-banner__actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.cookie-banner__actions .button { flex: 1 1 8rem; padding: .55rem 1rem; text-align: center; }

/* Página 404 / gracias */
.notice { padding: 2.5rem 0 1rem; text-align: center; }
.notice__code { font-size: 4rem; font-weight: 800; line-height: 1; color: var(--c-primary); }
.notice p { margin-top: .75rem; color: var(--c-muted); }
.notice .button { margin-top: 1.5rem; }

@media (min-width: 600px) {
  .wrap { padding: 1.5rem; }
  .tutorial h1, .home-hero h1, .page h1 { font-size: 2.25rem; }
  .meta { grid-template-columns: repeat(4, 1fr); }
  .materials { padding: 1.5rem; }
  .materials__grid { grid-template-columns: 1fr 1fr; }
  .step { padding: 1.5rem; }
  .ad-slot__box { min-height: 250px; }
  .ad-slot--mid .ad-slot__box { min-height: 280px; }
  .post-list { grid-template-columns: 1fr 1fr; }
  .home-hero { margin: 0 -1.5rem; padding: 3.5rem 2rem 3rem; border-radius: 0 0 var(--radius) var(--radius); }
  .home-hero h1 { font-size: 2.6rem; }
  .promise__grid { grid-template-columns: repeat(3, 1fr); }
  .form { padding: 1.5rem; }
}

@media (min-width: 1024px) {
  .tutorial h1 { font-size: 2.6rem; }
  .step__title { font-size: 1.4rem; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .post-card { transition: none; } .post-card:hover { transform: none; } }
@media print { .ad-slot, .site-header, .site-footer, .skip-link, .cookie-banner, .related { display: none !important; } }
