/* ==========================================================================
   Echidna Educación – hoja de estilos de las plantillas
   Organización:
     1. Tokens (colores, tipografía, espacios) + modo oscuro
     2. Base y tipografía
     3. Utilidades de maquetación
     4. Cabecera, menú, buscador, pie (layout Base)
     5. Componentes de contenido (tarjeta, aviso, descarga, vídeo, galería…)
     6. Bloques específicos de cada página maestra
     7. Impresión
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* Marca: se mantiene el naranja de la web original (#e66a00) */
  --brand: #e66a00;
  --brand-strong: #c45800;
  --brand-ink: #a34700;          /* naranja para texto: contraste AA sobre blanco */
  --brand-soft: #fff0e3;
  --on-brand: #ffffff;

  /* Neutros cálidos */
  --bg: #fbf9f6;
  --surface: #ffffff;
  --surface-2: #f4f0ea;
  --ink: #1f1b16;
  --ink-2: #4a433b;
  --muted: #5f574e;
  --line: #e6dfd5;
  --line-strong: #cfc5b8;

  /* Color por sección: ayuda a orientarse dentro de la web */
  --c-ecosistema: #e66a00;     --c-ecosistema-ink: #a34700;   --c-ecosistema-soft: #fff0e3;
  --c-alumnado: #2b8a3e;    --c-alumnado-ink: #22702f;  --c-alumnado-soft: #e8f6eb;
  --c-docentes: #3b5bdb;    --c-docentes-ink: #3249b8;  --c-docentes-soft: #ebefff;
  --c-blog: #c2255c;         --c-blog-ink: #a51e4e;       --c-blog-soft: #fdebf1;
  --c-nosotros: #7048e8;     --c-nosotros-ink: #5f3dc4;   --c-nosotros-soft: #f1ecff;

  /* Avisos */
  --info: #1971c2;   --info-soft: #e7f1fb;
  --tip: #2b8a3e;    --tip-soft: #e8f6eb;
  --warn: #b35c00;   --warn-soft: #fff4e0;

  /* Tipografía: --font-head, --font-body, --font-mono y --font-brand las define Astro (ver astro.config.mjs) */
  --fs-base: 1.0625rem;      /* 17px: lectura cómoda en proyector y móvil */

  /* Formas */
  --radius-s: 8px;
  --radius: 14px;
  --radius-l: 22px;
  --shadow-1: 0 1px 2px rgb(31 27 22 / .06), 0 2px 8px rgb(31 27 22 / .05);
  --shadow-2: 0 4px 14px rgb(31 27 22 / .08), 0 12px 32px rgb(31 27 22 / .07);
  --focus: 0 0 0 3px var(--bg), 0 0 0 6px #1c7ed6;

  --wrap: 1200px;
  --wrap-text: 72ch;
  --gutter: clamp(16px, 4vw, 32px);
  --header-h: 68px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --brand: #ff8a2a; --brand-strong: #ffa155; --brand-ink: #ffa155; --brand-soft: #3a2413; --on-brand: #1a1209;
    --bg: #14120f; --surface: #1d1a16; --surface-2: #26221d; --ink: #f3eee7; --ink-2: #d6cfc5;
    --muted: #b2a99d; --line: #36302a; --line-strong: #4a423a;
    --c-ecosistema: #ff8a2a;  --c-ecosistema-ink: #ffa155;  --c-ecosistema-soft: #3a2413;
    --c-alumnado: #51cf66; --c-alumnado-ink: #69db7c; --c-alumnado-soft: #16301c;
    --c-docentes: #748ffc; --c-docentes-ink: #91a7ff; --c-docentes-soft: #1c2346;
    --c-blog: #f06595;      --c-blog-ink: #f783ac;      --c-blog-soft: #3a1626;
    --c-nosotros: #9775fa;  --c-nosotros-ink: #b197fc;  --c-nosotros-soft: #261c45;
    --info: #74c0fc; --info-soft: #132b40; --tip: #69db7c; --tip-soft: #16301c; --warn: #ffc078; --warn-soft: #3a2a12;
    --shadow-1: 0 1px 2px rgb(0 0 0 / .4); --shadow-2: 0 8px 28px rgb(0 0 0 / .45);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand: #ff8a2a; --brand-strong: #ffa155; --brand-ink: #ffa155; --brand-soft: #3a2413; --on-brand: #1a1209;
  --bg: #14120f; --surface: #1d1a16; --surface-2: #26221d; --ink: #f3eee7; --ink-2: #d6cfc5;
  --muted: #b2a99d; --line: #36302a; --line-strong: #4a423a;
  --c-ecosistema: #ff8a2a;  --c-ecosistema-ink: #ffa155;  --c-ecosistema-soft: #3a2413;
  --c-alumnado: #51cf66; --c-alumnado-ink: #69db7c; --c-alumnado-soft: #16301c;
  --c-docentes: #748ffc; --c-docentes-ink: #91a7ff; --c-docentes-soft: #1c2346;
  --c-blog: #f06595;      --c-blog-ink: #f783ac;      --c-blog-soft: #3a1626;
  --c-nosotros: #9775fa;  --c-nosotros-ink: #b197fc;  --c-nosotros-soft: #261c45;
  --info: #74c0fc; --info-soft: #132b40; --tip: #69db7c; --tip-soft: #16301c; --warn: #ffc078; --warn-soft: #3a2a12;
  --shadow-1: 0 1px 2px rgb(0 0 0 / .4); --shadow-2: 0 8px 28px rgb(0 0 0 / .45);
}

/* Color de acento según la sección de la página (body[data-section]) */
[data-section="ecosistema"]  { --accent: var(--c-ecosistema);  --accent-ink: var(--c-ecosistema-ink);  --accent-soft: var(--c-ecosistema-soft); }
[data-section="alumnado"] { --accent: var(--c-alumnado); --accent-ink: var(--c-alumnado-ink); --accent-soft: var(--c-alumnado-soft); }
[data-section="docentes"] { --accent: var(--c-docentes); --accent-ink: var(--c-docentes-ink); --accent-soft: var(--c-docentes-soft); }
[data-section="blog"]      { --accent: var(--c-blog);      --accent-ink: var(--c-blog-ink);      --accent-soft: var(--c-blog-soft); }
[data-section="nosotros"]  { --accent: var(--c-nosotros);  --accent-ink: var(--c-nosotros-ink);  --accent-soft: var(--c-nosotros-soft); }
body { --accent: var(--brand); --accent-ink: var(--brand-ink); --accent-soft: var(--brand-soft); }

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.65;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.18; letter-spacing: -0.01em; margin: 0 0 .5em; color: var(--ink); text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.1rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.05rem); font-weight: 750; }
h3 { font-size: 1.25rem; font-weight: 700; }
h4 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 1em; }
img, svg, video, iframe { max-width: 100%; }
img { height: auto; display: block; }

a { color: var(--brand-ink); text-decoration-thickness: .08em; text-underline-offset: .18em; }
a:hover { color: var(--brand-strong); text-decoration-thickness: .14em; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }

code, kbd, pre { font-family: var(--font-mono); font-size: .9em; font-variant-ligatures: none; } /* sin ligaduras: <= y ++ se ven tal cual se escriben */
:not(pre) > code { background: var(--surface-2); border: 1px solid var(--line); padding: .08em .38em; border-radius: 6px; }
kbd { background: var(--surface); border: 1px solid var(--line-strong); border-bottom-width: 3px; border-radius: 6px; padding: .05em .4em; font-size: .82em; }
pre { background: #1d1a16; color: #f3eee7; padding: 1.1rem 1.25rem; border-radius: var(--radius); overflow-x: auto; line-height: 1.55; }
/* Código Arduino (```arduino): colores y números de línea de Arduino IDE (ver temaArduino en astro.config.mjs) */
pre[data-language="arduino"] { background: #fff !important; color: #434f54 !important; border: 1px solid #dae3e3; counter-reset: linea; }
pre[data-language="arduino"] span { color: var(--shiki-arduino) !important; }
pre[data-language="arduino"] .line::before { counter-increment: linea; content: counter(linea); display: inline-block; width: 2ch; margin-right: 1.25rem; text-align: right; color: #95a5a6; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: var(--radius-s); font-weight: 700; }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 3. Utilidades ----------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.wrap-text { max-width: var(--wrap-text); }
.stack > * + * { margin-top: var(--stack, 1rem); }
.section { padding-block: clamp(3rem, 2rem + 4vw, 5.5rem); }
.section--tint { background: var(--surface-2); }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem 2rem; margin-bottom: 2rem; }
.section-head p { color: var(--muted); max-width: 60ch; margin: 0; }
.section-head h2 { margin: 0; }
.eyebrow { display: inline-flex; align-items: center; gap: .45rem; font-family: var(--font-head); font-weight: 700; font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: .6rem; }
.lead { font-size: clamp(1.1rem, 1rem + .4vw, 1.3rem); color: var(--ink-2); line-height: 1.55; }
.muted { color: var(--muted); }

.grid { display: grid; gap: clamp(1rem, .6rem + 1.2vw, 1.5rem); }
.grid--2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
/* Cuatro tarjetas que pasan a 2 × 2 y a una columna, sin dejar una sola en la última fila */
.grid--4-2 { grid-template-columns: 1fr; }
@media (min-width: 540px) { .grid--4-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .grid--4-2 { grid-template-columns: repeat(4, 1fr); } }

/* Botones */
.btn {
  --b-bg: var(--brand); --b-ink: var(--on-brand); --b-line: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .7rem 1.3rem; border-radius: 999px;
  background: var(--b-bg); color: var(--b-ink); border: 2px solid var(--b-line);
  font-family: var(--font-head); font-weight: 700; font-size: 1rem; line-height: 1.1;
  text-decoration: none; cursor: pointer; transition: transform .15s, background .15s, box-shadow .15s;
}
.btn:hover { color: var(--b-ink); background: var(--brand-strong); transform: translateY(-1px); text-decoration: none; }
.btn--ghost { --b-bg: transparent; --b-ink: var(--ink); --b-line: var(--line-strong); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--soft { --b-bg: var(--brand-soft); --b-ink: var(--brand-ink); }
.btn--soft:hover { background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand); }
.btn--sm { min-height: 40px; padding: .5rem 1rem; font-size: .92rem; }
.btn svg { width: 1.15em; height: 1.15em; flex: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; }

/* Iconos (SVG inline con currentColor) */
.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.2em; }

/* Etiquetas / chips */
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .28rem .7rem; border-radius: 999px; font-size: .86rem; font-weight: 700;
  background: var(--accent-soft); color: var(--accent-ink); text-decoration: none; line-height: 1.3;
  border: 1px solid transparent;
}
a.chip:hover { border-color: currentColor; color: var(--accent-ink); }
.chip--outline { background: transparent; border-color: var(--line-strong); color: var(--ink-2); }
.chip[aria-pressed="true"], .chip[aria-current] { background: var(--accent); color: var(--surface); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin: 0; }
.chip[data-section] { background: var(--accent-soft); color: var(--accent-ink); }

/* Marcador de imagen (en Astro serán <Image/> optimizadas) */
.ph {
  position: relative; display: grid; place-items: center; overflow: hidden;
  aspect-ratio: var(--ratio, 16 / 10); border-radius: var(--radius);
  background:
    radial-gradient(circle at 25% 20%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 55%),
    radial-gradient(circle at 80% 90%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 50%),
    var(--accent-soft);
  color: var(--accent-ink);
}
.ph svg { width: 30%; max-width: 110px; height: auto; opacity: .9; }
.ph__label { position: absolute; left: 10px; bottom: 8px; font-size: .74rem; font-family: var(--font-mono); opacity: .75; }

/* Migas de pan */
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: .25rem .5rem; list-style: none; margin: 0; padding: 0; font-size: .92rem; color: var(--muted); }
.breadcrumb li + li::before { content: "›"; margin-right: .5rem; color: var(--line-strong); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent-ink); text-decoration: underline; }
.breadcrumb [aria-current] { color: var(--ink); font-weight: 700; }

/* 4. Layout Base --------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner { display: flex; align-items: center; gap: 1rem; min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand:hover { color: var(--ink); }
/* Logo: erizo (nariz en el color del texto) y «EchidnaEducación» en Open Sans, como el logo original */
.brand__mark { width: 57px; height: 32px; flex: none; }
.brand__name { font-family: var(--font-brand); font-weight: 400; font-size: 1.25rem; letter-spacing: -.01em; line-height: 1; white-space: nowrap; }
.brand__echidna { color: #fe6d04; }

.nav { display: none; }
.nav__list { display: flex; align-items: center; gap: .15rem; list-style: none; margin: 0; padding: 0; }
.nav__link {
  position: relative; display: inline-flex; align-items: center; gap: .3rem;
  padding: .55rem .75rem; border-radius: 10px; color: var(--ink-2); text-decoration: none;
  font-family: var(--font-head); font-weight: 650; font-size: .98rem; background: none; border: 0; cursor: pointer; white-space: nowrap;
}
.nav__link:hover { background: var(--surface-2); color: var(--ink); }
.nav__link[aria-current="page"], .nav__link.is-active { color: var(--accent-ink); }
.nav__link[aria-current="page"]::after, .nav__link.is-active::after {
  content: ""; position: absolute; left: .75rem; right: .75rem; bottom: 3px; height: 3px; border-radius: 3px; background: var(--accent);
}
.nav__link .chev { width: .9em; height: .9em; flex: none; transition: transform .2s; }
.nav__item--has-sub { position: relative; }
.subnav {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 270px; z-index: 5;
  list-style: none; margin: 0; padding: .5rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-2);
  opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .15s, transform .15s, visibility .15s;
}
.nav__item--has-sub:hover .subnav, .nav__item--has-sub:focus-within .subnav, .nav__item--has-sub.is-open .subnav { opacity: 1; visibility: visible; transform: none; }
.nav__item--has-sub:hover .chev, .nav__item--has-sub.is-open .chev { transform: rotate(180deg); }
.subnav a { display: block; padding: .55rem .75rem; border-radius: 10px; color: var(--ink); text-decoration: none; }
.subnav a:hover { background: var(--accent-soft); }
.subnav a span { display: block; font-size: .85rem; color: var(--muted); }
.subnav strong { font-family: var(--font-head); }

.header-actions { display: flex; align-items: center; gap: .35rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  background: transparent; border: 1px solid transparent; color: var(--ink-2); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 22px; height: 22px; }
.search-trigger {
  display: none; align-items: center; gap: .5rem; min-height: 42px; padding: .4rem .6rem .4rem .8rem;
  border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted);
  font: inherit; font-size: .92rem; cursor: pointer;
}
.search-trigger:hover { border-color: var(--brand); color: var(--ink); }
.search-trigger svg { width: 18px; height: 18px; flex: none; }
.lang-switch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; font-family: var(--font-head); font-weight: 700; font-size: .82rem; }
.lang-switch a { padding: .45rem .55rem; color: var(--muted); text-decoration: none; }
.lang-switch a[aria-current] { background: var(--ink); color: var(--bg); }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}

/* Menú móvil */
.menu-toggle { display: inline-grid; }
.mobile-nav {
  position: fixed; inset: var(--header-h) 0 0 0; z-index: 49; overflow-y: auto;
  background: var(--bg); padding: 1rem var(--gutter) 3rem; border-top: 1px solid var(--line);
}
.mobile-nav[hidden] { display: none; }
.mobile-nav ul { list-style: none; margin: 0; padding: 0; }
.mobile-nav > ul > li { border-bottom: 1px solid var(--line); }
.mobile-nav a { display: flex; align-items: center; gap: .75rem; padding: .95rem .25rem; color: var(--ink); text-decoration: none; font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; }
.mobile-nav a[aria-current="page"] { color: var(--accent-ink); }
.mobile-nav .dot { width: 12px; height: 12px; border-radius: 4px; background: var(--dot, var(--brand)); flex: none; }
.mobile-nav ul ul { padding: 0 0 .75rem 1.6rem; }
.mobile-nav ul ul a { font-size: 1rem; font-weight: 600; padding: .55rem .25rem; color: var(--ink-2); }
.mobile-nav .mobile-search { width: 100%; justify-content: flex-start; display: flex; margin-bottom: .5rem; min-height: 50px; }
body.menu-open { overflow: hidden; }

@media (min-width: 1100px) {
  .nav { display: block; }
  .menu-toggle { display: none; }
  .mobile-nav { display: none !important; }
}
@media (min-width: 640px) { .search-trigger { display: inline-flex; } .search-icon-btn { display: none; } }
@media (max-width: 420px) { .brand { gap: .4rem; } .brand__mark { width: 50px; height: 28px; } .brand__name { font-size: 1.1rem; } }
@media (max-width: 359px) { .site-header__inner { gap: .75rem; } .brand__mark { width: 44px; height: 25px; } .brand__name { font-size: 1rem; } }

/* Idioma y tema: en pantallas estrechas pasan de la cabecera al menú móvil */
.mobile-prefs { display: none; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; }
.mobile-prefs .lang-switch a { display: inline-block; padding: .55rem .9rem; font-size: .9rem; }
@media (max-width: 539px) {
  .header-actions .lang-switch, .header-actions .theme-toggle { display: none; }
  .mobile-prefs { display: flex; }
}

/* Diálogo de búsqueda (Pagefind) */
.search-dialog {
  width: min(680px, calc(100vw - 24px)); max-height: min(80vh, 640px); padding: 0; margin: 10vh auto auto;
  border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2);
}
.search-dialog::backdrop { background: rgb(20 18 15 / .55); backdrop-filter: blur(3px); }
.search-dialog form { display: flex; align-items: center; gap: .6rem; padding: .9rem 1rem; border-bottom: 1px solid var(--line); }
.search-dialog input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 1.15rem; padding: .4rem; }
.search-dialog input:focus { outline: none; }
.search-dialog .results { padding: 1rem 1.25rem 1.25rem; }
.search-dialog .results h3 { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: .4rem 0 .6rem; }
.search-dialog .results ul { list-style: none; margin: 0 0 1rem; padding: 0; }
.search-dialog .results a { display: block; padding: .6rem .75rem; border-radius: 10px; text-decoration: none; color: var(--ink); }
.search-dialog .results a:hover { background: var(--surface-2); }
.search-dialog .results small { display: block; color: var(--muted); }
.search-dialog .results:empty { display: none; }
.search-dialog .results a:focus-visible { background: var(--surface-2); }
.search-dialog .results .excerpt { display: block; margin-top: .2rem; font-size: .9rem; color: var(--muted); }
.search-dialog .results mark { background: transparent; color: var(--ink); font-weight: 700; }
.search-dialog .results .search-status { margin: .2rem 0; color: var(--muted); }

/* Pie */
.site-footer { margin-top: auto; background: #1b1814; color: #e9e3da; padding-top: 3.5rem; }
.site-footer a { color: #f3eee7; text-decoration: none; }
.site-footer a:hover { color: #ffa155; text-decoration: underline; }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); padding-bottom: 2.5rem; }
.footer-grid h2 { font-size: .85rem; letter-spacing: .1em; text-transform: uppercase; color: #b8afa3; margin-bottom: 1rem; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.footer-about { grid-column: span 2; max-width: 420px; }
@media (max-width: 640px) { .footer-about { grid-column: auto; } }
.footer-about p { color: #c9c1b6; font-size: .95rem; }
.footer-about .brand { color: #fff; margin-bottom: 1rem; }
.social { display: flex; gap: .5rem; margin-top: 1rem; }
.social a { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: #2a2620; }
.social a:hover { background: var(--brand); color: #1a1209; }
.social svg { width: 20px; height: 20px; }
.licenses { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .25rem; }
.licenses span { font-size: .8rem; padding: .25rem .6rem; border-radius: 999px; border: 1px solid #4a423a; color: #d6cfc5; }
.footer-bottom { border-top: 1px solid #36302a; padding-block: 1.25rem; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; font-size: .88rem; color: #b8afa3; }

.page { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; }

/* 5. Componentes de contenido ------------------------------------------- */

/* Tarjeta */
.card {
  position: relative; display: flex; flex-direction: column; height: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l);
  overflow: hidden; transition: transform .18s, box-shadow .18s, border-color .18s;
}
.card:has(.card__link:hover), .card:has(.card__link:focus-visible) { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.card .ph { border-radius: 0; }
.card__body { display: flex; flex-direction: column; gap: .55rem; padding: 1.15rem 1.25rem 1.3rem; flex: 1; }
.card__title { font-size: 1.18rem; margin: 0; }
.card__link { color: var(--ink); text-decoration: none; }
.card__link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.card__link:focus-visible { box-shadow: none; }
.card:has(.card__link:focus-visible) { box-shadow: var(--focus); }
.card__text { color: var(--muted); margin: 0; font-size: .98rem; }
.card__meta { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: auto; padding-top: .4rem; }
.card__meta .chip { position: relative; z-index: 2; }
.card--row { flex-direction: row; }
.card--row .ph { width: 38%; flex: none; --ratio: auto; }
@media (max-width: 560px) { .card--row { flex-direction: column; } .card--row .ph { width: 100%; --ratio: 16/9; } }

/* Tarjeta de característica con icono */
.feature { padding: 1.4rem; border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--line); height: 100%; }
.feature__icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-ink); margin-bottom: 1rem; }
.feature__icon svg { width: 28px; height: 28px; }
.feature h3 { margin-bottom: .35rem; }
.feature p { color: var(--muted); margin: 0; }

/* Aviso */
.callout {
  --c: var(--info); --c-soft: var(--info-soft);
  display: grid; grid-template-columns: auto 1fr; gap: .25rem .85rem;
  padding: 1rem 1.2rem; margin: 1.5rem 0; border-radius: var(--radius);
  background: var(--c-soft); border-left: 5px solid var(--c);
}
.callout svg { width: 24px; height: 24px; color: var(--c); grid-row: span 2; margin-top: 2px; }
.callout__title { font-family: var(--font-head); font-weight: 750; color: var(--ink); }
.callout > div > :last-child { margin-bottom: 0; }
.callout--tip { --c: var(--tip); --c-soft: var(--tip-soft); }
.callout--warn { --c: var(--warn); --c-soft: var(--warn-soft); }

/* Descarga */
.download {
  display: flex; align-items: center; gap: 1rem; padding: .9rem 1rem; margin: 1rem 0;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--ink);
}
.download:hover { border-color: var(--brand); color: var(--ink); box-shadow: var(--shadow-1); }
.download__type { display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: 12px; background: var(--brand-soft); color: var(--brand-ink); font-family: var(--font-mono); font-weight: 700; font-size: .78rem; }
.download__name { font-weight: 700; display: block; }
.download__meta { font-size: .88rem; color: var(--muted); }
.download__arrow { margin-left: auto; color: var(--brand-ink); }
.download-list { display: grid; gap: .6rem; }
.download-list .download { margin: 0; }

/* Vídeo / embebido 16:9 con carga bajo demanda */
.embed { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #1b1814; margin: 1.5rem 0; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.embed__poster {
  position: absolute; inset: 0; display: grid; place-items: center; gap: .5rem; align-content: center;
  width: 100%; border: 0; cursor: pointer; color: #fff; font: inherit; text-align: center;
  background: radial-gradient(circle at 30% 30%, rgb(230 106 0 / .55), transparent 60%), linear-gradient(135deg, #2a2620, #14120f);
}
.embed__play { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 50%; background: var(--brand); color: #fff; box-shadow: 0 8px 24px rgb(0 0 0 / .35); transition: transform .15s; }
.embed__poster:hover .embed__play { transform: scale(1.06); }
.embed__play svg { width: 34px; height: 34px; margin-left: 4px; }
/* El margen centra a ojo el triángulo de «play»; el icono de presentación ya está centrado */
.embed__play svg:has(use[href="#i-slides"]) { margin-left: 0; }
.embed__caption { font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; }
.embed__note { font-size: .82rem; opacity: .8; }

/* Galería */
.gallery { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); margin: 1.5rem 0; padding: 0; list-style: none; }
.gallery figure { margin: 0; }
.gallery figcaption { font-size: .85rem; color: var(--muted); margin-top: .4rem; }
/* En el Markdown, un párrafo de solo imágenes (ver astro.config.mjs): cada una con su proporción */
.prose .gallery { padding-left: 0; align-items: start; }
.prose .gallery li + li { margin-top: 0; }
.gallery > li img { width: 100%; }

/* Figura */
figure { margin: 1.75rem 0; }
figcaption { font-size: .9rem; color: var(--muted); margin-top: .6rem; }

/* Tablas */
.table-wrap { overflow-x: auto; margin: 1.5rem 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .97rem; }
th, td { text-align: left; padding: .75rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--surface-2); font-family: var(--font-head); font-size: .88rem; letter-spacing: .03em; }
tbody tr:last-child td { border-bottom: 0; }
.pin { font-family: var(--font-mono); font-weight: 700; }
.swatch { display: inline-block; width: .85em; height: .85em; border-radius: 50%; margin-right: .45em; vertical-align: -0.05em; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .15); }

/* Prosa (contenido Markdown) */
.prose { max-width: var(--wrap-text); min-width: 0; } /* en las rejillas, que una tabla ancha no ensanche la página */
.prose > * + * { margin-top: 1.1em; }
.prose p, .prose ul, .prose ol { margin-bottom: 0; }
.prose h2 { margin-top: 1.4em; padding-top: .2em; }
.prose h3 { margin-top: 1.4em; }
.prose h2 + *, .prose h3 + * { margin-top: .6em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .35em; }
.prose li::marker { color: var(--accent); font-weight: 700; }
.prose blockquote { margin-left: 0; margin-right: 0; padding: .4rem 0 .4rem 1.3rem; border-left: 4px solid var(--accent); font-size: 1.15rem; color: var(--ink-2); font-style: italic; }
.prose img { border-radius: var(--radius); }

/* Cabecera de página interior */
.page-hero { padding-block: clamp(1.5rem, 1rem + 2vw, 2.5rem) clamp(1.25rem, 1rem + 1.25vw, 2rem); background: linear-gradient(180deg, var(--accent-soft), transparent); }
.page-hero .breadcrumb { margin-bottom: 1.5rem; }
.page-hero h1 { margin-bottom: .35em; }
.page-hero .lead { max-width: 62ch; margin: 0; }

/* Índice lateral ("En esta página") */
.toc { position: sticky; top: calc(var(--header-h) + 24px); font-size: .93rem; }
.toc h2 { font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: .75rem; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc a { display: block; padding: .35rem 0 .35rem 1rem; margin-left: -2px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--ink); }
.toc a.is-active { color: var(--accent-ink); border-left-color: var(--accent); font-weight: 700; }

.with-aside { display: grid; gap: 2.5rem; padding-block: .75rem 4rem; }
@media (min-width: 960px) {
  .with-aside { grid-template-columns: minmax(0, 1fr) 300px; gap: 4rem; }
  .with-aside--left { grid-template-columns: 220px minmax(0, 1fr); }
}
@media (max-width: 959px) { .toc { position: static; } .toc--desktop { display: none; } }

/* Navegación anterior / siguiente */
.pager { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); margin-top: 3rem; }
.pager a { display: block; padding: 1rem 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); background: var(--surface); }
.pager a:hover { border-color: var(--accent); }
.pager small { display: block; color: var(--muted); font-size: .85rem; }
.pager strong { font-family: var(--font-head); }
.pager .next { text-align: right; }

/* Ficha de datos (hardware / actividad) */
.factsheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 1.3rem 1.4rem; box-shadow: var(--shadow-1); }
.factsheet h2 { font-size: .82rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 1rem; }
.factsheet dl { margin: 0; display: grid; gap: .9rem; }
.factsheet dt { font-size: .82rem; color: var(--muted); font-weight: 700; margin-bottom: .2rem; }
.factsheet dd { margin: 0; font-weight: 600; }
.factsheet .btn { width: 100%; margin-top: 1.2rem; }
.aside-stack { display: grid; gap: 1.25rem; align-content: start; }
@media (min-width: 960px) { .aside-stack--sticky { position: sticky; top: calc(var(--header-h) + 24px); } }

/* 6. Bloques de páginas maestras ----------------------------------------- */

/* Portada · héroe */
.hero { position: relative; overflow: hidden; padding-block: clamp(2.5rem, 1.5rem + 5vw, 5.5rem); background:
  radial-gradient(900px 420px at 85% 10%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 70%),
  radial-gradient(600px 300px at 0% 100%, color-mix(in srgb, var(--c-docentes) 10%, transparent), transparent 70%); }
.hero__grid { display: grid; gap: 2.5rem; align-items: center; }
@media (min-width: 900px) { .hero__grid { grid-template-columns: 1.1fr .9fr; } }
.hero h1 { font-size: clamp(2.3rem, 1.5rem + 3.6vw, 3.9rem); margin-bottom: .4em; }
.hero h1 em { font-style: normal; color: var(--brand-ink); position: relative; white-space: nowrap; }
.hero h1 em::after { content: ""; position: absolute; left: 0; right: 0; bottom: .02em; height: .2em; background: color-mix(in srgb, var(--brand) 30%, transparent); border-radius: 4px; z-index: -1; }
.hero .lead { max-width: 52ch; margin-bottom: 1.8rem; }
.hero__badges { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-top: 1.8rem; color: var(--muted); font-size: .92rem; }
.hero__badges span { display: inline-flex; align-items: center; gap: .4rem; }
.hero__badges svg { width: 18px; height: 18px; color: var(--c-alumnado); }
.hero__art { position: relative; }
.hero__art .board { width: 100%; height: auto; filter: drop-shadow(0 24px 40px rgb(31 27 22 / .18)); }

/* Portada · placas */
/* Arriba, la imagen junto al título y la descripción; debajo, la lista y el botón a todo el ancho.
   El botón queda abajo para que las dos tarjetas lo tengan a la misma altura */
.board-card { display: grid; grid-template-rows: auto 1fr auto; gap: 1rem; padding: clamp(1.25rem, 1rem + 1.5vw, 2rem); border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--line); }
.board-card__head { display: grid; gap: 1rem; align-items: center; }
@media (min-width: 520px) { .board-card__head { grid-template-columns: 160px 1fr; } }
.board-card__head img { width: 100%; max-width: 200px; height: auto; justify-self: center; }
.board-card__head p { margin: 0; }
.board-card ul { margin: 0; padding-left: 1.2rem; color: var(--ink-2); }
.board-card > .btn { justify-self: start; }
.board-card ul li::marker { color: var(--brand); }

/* Portada · banda de comunidad */
.band { border-radius: var(--radius-l); padding: clamp(1.75rem, 1rem + 3vw, 3rem); background: #1b1814; color: #f3eee7; display: grid; gap: 1.5rem; align-items: center; overflow: hidden; position: relative; }
.band::before { content: ""; position: absolute; right: -80px; top: -80px; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, rgb(230 106 0 / .45), transparent 70%); }
@media (min-width: 860px) { .band { grid-template-columns: 1fr auto; } }
.band h2 { color: #fff; }
.band p { color: #d6cfc5; margin: 0; max-width: 60ch; }
.band .btn--ghost { --b-ink: #fff; --b-line: #6a6058; }
.band .btn--ghost:hover { background: #2a2620; }
.band > * { position: relative; }

/* Índice de sección: subsecciones + filtros */
.subsections { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .25rem; margin-top: 1.5rem; scrollbar-width: thin; }
.subsections a { flex: none; padding: .55rem 1rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; font-weight: 700; font-size: .93rem; }
.subsections a:hover { border-color: var(--accent); color: var(--accent-ink); }
.subsections a[aria-current] { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; padding: 1rem 1.2rem; margin-bottom: 1.75rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.filters fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.filters legend { float: left; margin-right: .5rem; font-weight: 700; font-size: .9rem; color: var(--muted); }
.filters button.chip { cursor: pointer; font: inherit; font-size: .86rem; font-weight: 700; }
.result-count { margin-left: auto; font-size: .9rem; color: var(--muted); }

/* Ficha hardware */
.hw-head { display: grid; gap: 2rem; align-items: center; }
@media (min-width: 860px) { .hw-head { grid-template-columns: 1fr 380px; } }
.compat { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.2rem; }
.hw-head__img { margin: 0; display: grid; place-items: center; padding: 1rem; border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--line); }
.hw-head__img img { width: auto; max-width: 100%; max-height: 280px; height: auto; }
@media (max-width: 859px) { .hw-head__img img { max-height: 200px; } }
.factsheet__pins { margin: 1.2rem 0 0; }
/* Tarjetas con imagen (componentes de la placa, hijas de un índice de sección) */
ul.img-cards { list-style: none; padding: 0; margin-top: 1.25rem; }
.indice { padding-block: .75rem 4rem; }
/* Recursos (alumnado y docentes): tipo y nivel arriba, sitio de destino al pie */
.recursos__tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; }
.recursos .card__title { font-size: 1.08rem; }
.recursos__sitio { margin: auto 0 0; padding-top: .4rem; color: var(--muted); font-size: .85rem; }
/* Recursos a todo el ancho, debajo del texto, en las páginas sin lateral (Recursos docentes) */
.prose--ancha { max-width: none; }
.recursos-ancho { padding-block: 1.5rem 4rem; }
.with-aside:has(+ .recursos-ancho) { padding-bottom: 0; }
/* Recurso sin terminar (sin url): atenuado y sin enlace */
.recursos__proximamente .post-thumb img { opacity: .45; filter: grayscale(.6); }
.recursos__proximamente .card__title, .recursos__proximamente .card__text { color: var(--muted); }
/* Recurso destacado (featured): todo el ancho del grupo; desde 860 px, imagen a la izquierda y texto a la derecha */
.recursos__destacado { grid-column: 1 / -1; }
.recursos .recursos__destacado .card__title { font-size: clamp(1.25rem, 1.05rem + .8vw, 1.6rem); }
@media (min-width: 860px) {
  .recursos__destacado { display: grid; grid-template-columns: 1.2fr 1fr; }
  .recursos__destacado .post-thumb { align-self: center; background: none; }
  .recursos__destacado .card__body { justify-content: center; padding: clamp(1.25rem, 1rem + 1.5vw, 2rem); gap: .7rem; }
}
/* Publicaciones: etiqueta de medio y tipo, y fecha al pie de la tarjeta */
.publicaciones .chip { align-self: flex-start; }
.publicaciones__fecha { margin: auto 0 0; padding-top: .4rem; color: var(--muted); font-size: .88rem; }
.indice .img-cards { margin-top: 2.5rem; }
.indice__cards-title { margin-top: 2.5rem; }
/* Título del apartado de tarjetas de la página genérica (cardsTitle) */
.tarjetas__titulo + .img-cards { margin-top: 1.25rem; }
.indice .indice__cards-title + .img-cards { margin-top: 1.25rem; }
.indice.with-aside { padding-block: .75rem 4rem; }
/* Índice lateral de los índices de sección: páginas hijas y apartados, juntos y fijos al bajar */
.toc-stack { display: grid; gap: 1.75rem; align-content: start; position: sticky; top: calc(var(--header-h) + 24px); }
.toc-stack .toc { position: static; }
@media (max-width: 959px) { .toc-stack { position: static; } }
.img-cards > li + li { margin-top: 0; }
.img-cards .card__title { margin-top: 0; font-size: 1.08rem; }
.img-cards .card__text { font-size: .92rem; }
.img-cards__img { display: grid; place-items: center; padding: 1rem; background: var(--surface-2); }
.img-cards .img-cards__img img { height: 7.5rem; width: auto; max-width: 100%; object-fit: contain; border-radius: 0; }
.factsheet__pins table { font-size: .88rem; }
.factsheet__pins th, .factsheet__pins td { padding: .5rem .6rem; }
.prose img { height: auto; }
/* Lupas sobre la placa (lupa-*.png) y detalles de la placa (detalle-*.png): un tercio de la columna,
   centradas; en móvil, 260 px. El nombre va tras «/» en la web publicada y tras «%2F» en el servidor de desarrollo */
.prose img:is([src*="/lupa-"], [src*="%2Flupa-"], [src*="/detalle-"], [src*="%2Fdetalle-"]) { display: block; margin-inline: auto; width: max(35%, min(100%, 260px)); }
/* Dibujos de piezas sueltas (pieza-*.png): la mitad que las lupas */
.prose img:is([src*="/pieza-"], [src*="%2Fpieza-"]) { display: block; margin-inline: auto; width: max(17.5%, min(100%, 130px)); }
/* Aviso de placa conectada de EchidnaML: dos tercios de su tamaño (638 px) */
.prose img:is([src*="/placa-conectada"], [src*="%2Fplaca-conectada"]) { width: min(100%, 425px); }
/* Esquema eléctrico en el lateral de la ficha */
.factsheet--schematic img { display: block; margin-inline: auto; max-height: 260px; width: auto; max-width: 100%; height: auto; border-radius: var(--radius); }
/* Bloques de EchidnaML (imágenes bloque-*.png): todos a la misma altura, sea cual sea la captura */
.prose img:is([src*="/bloque-"], [src*="%2Fbloque-"]) { height: 4rem; width: auto; max-width: 100%; object-fit: contain; object-position: left; }

/* Actividad */
.activity-code { display: inline-grid; place-items: center; min-width: 64px; height: 64px; padding: 0 .6rem; border-radius: 18px; background: var(--accent); color: var(--surface); font-family: var(--font-head); font-weight: 800; font-size: 1.3rem; }
.activity-head { display: flex; gap: 1.2rem; align-items: center; margin-bottom: 1rem; }
.activity-head h1 { margin: 0; }
.quickfacts { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); margin-top: 1.75rem; }
.quickfact { display: flex; gap: .7rem; align-items: center; padding: .8rem 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.quickfact svg { width: 26px; height: 26px; color: var(--accent-ink); flex: none; }
.quickfact small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.2; }
.quickfact strong { display: block; line-height: 1.25; }
.objectives { list-style: none; padding: 0 !important; display: grid; gap: .6rem; }
.objectives li { display: flex; gap: .7rem; align-items: start; margin: 0 !important; }
.objectives li::before { content: ""; flex: none; width: 24px; height: 24px; margin-top: 2px; border-radius: 50%; background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232b8a3e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12l4 4 8-8'/%3E%3C/svg%3E") center/16px no-repeat; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.checklist label { display: flex; gap: .65rem; align-items: start; cursor: pointer; }
.checklist input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--accent); flex: none; }
.checklist input:checked + span { text-decoration: line-through; color: var(--muted); }
.steps { counter-reset: step; list-style: none; padding: 0 !important; display: grid; gap: 1rem; }
.steps > li { counter-increment: step; position: relative; padding: 1.1rem 1.2rem 1.1rem 4.2rem; margin: 0 !important; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.steps > li::before { content: counter(step); position: absolute; left: 1.1rem; top: 1rem; display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--accent); color: var(--surface); font-family: var(--font-head); font-weight: 800; }
.steps h3 { margin: 0 0 .3rem; font-size: 1.08rem; }
.steps p { margin: 0; color: var(--ink-2); }
.challenge { display: inline-flex; gap: .3rem; align-items: center; font-size: .8rem; font-weight: 700; color: var(--warn); }
.teacher-notes { border: 2px dashed var(--line-strong); border-radius: var(--radius-l); padding: 0; background: var(--surface); }
.teacher-notes summary { cursor: pointer; padding: 1rem 1.25rem; font-family: var(--font-head); font-weight: 750; display: flex; align-items: center; gap: .6rem; list-style: none; }
.teacher-notes summary::-webkit-details-marker { display: none; }
.teacher-notes summary::after { content: "+"; margin-left: auto; font-size: 1.4rem; line-height: 1; color: var(--muted); }
.teacher-notes[open] summary::after { content: "–"; }
.teacher-notes .notes-body { padding: 0 1.25rem 1.25rem; }
.teacher-notes .notes-body > :last-child { margin-bottom: 0; }

/* Blog */
.post-head { max-width: 860px; margin-inline: auto; text-align: center; }
.post-head .breadcrumb ol { justify-content: center; }
.post-meta { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .5rem 1.25rem; color: var(--muted); font-size: .95rem; margin-top: 1.25rem; }
.post-meta .author { display: inline-flex; align-items: center; gap: .55rem; color: var(--ink); font-weight: 700; text-decoration: none; }
.avatar { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--c-nosotros-soft); color: var(--c-nosotros-ink); font-family: var(--font-head); font-weight: 800; font-size: .95rem; flex: none; }
.avatar--lg { width: 64px; height: 64px; font-size: 1.3rem; }
.post-cover { max-width: 1040px; margin: 2rem auto 0; }
.post-body { max-width: var(--wrap-text); margin: 3rem auto 0; }
.post-footer { max-width: var(--wrap-text); margin: 3rem auto 0; display: grid; gap: 1.5rem; }
.post-meta--left { justify-content: flex-start; }
/* Entrada con lateral: portada y pie alineados con el texto */
.entrada .post-cover { max-width: none; margin: 0 0 2rem; }
.entrada .post-cover img { width: 100%; height: auto; border-radius: var(--radius-l); }
.entrada .post-footer { max-width: none; margin: 3rem 0 0; }
.blog-aside__list { list-style: none; margin: 0; padding: 0; display: grid; gap: .15rem; }
/* Enlace al RSS al final del lateral del blog */
.blog-aside__rss { margin: 0; font-size: .95rem; }
.blog-aside__rss a { display: inline-flex; align-items: center; gap: .45rem; }
.blog-aside__rss svg { width: 18px; height: 18px; color: var(--accent); }
.blog-aside__list li { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; }
.blog-aside__list a { color: var(--ink); text-decoration: none; padding: .3rem 0; }
.blog-aside__list a:hover { color: var(--accent-ink); text-decoration: underline; }
.blog-aside__list a[aria-current] { color: var(--accent-ink); font-weight: 700; }
.blog-aside__list .is-sub { padding-left: 1rem; }
.blog-aside__count { color: var(--muted); font-size: .85rem; }
.blog-aside__list--recent li { display: grid; gap: 0; padding-block: .35rem; border-bottom: 1px solid var(--line); }
.blog-aside__list--recent li:last-child { border-bottom: 0; }
.blog-aside__list--recent small { color: var(--muted); font-size: .82rem; }
.blog-aside__tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.blog-aside__tags a { text-decoration: none; }
.blog-aside__tags a[aria-current] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.blog-aside__tags a[aria-current] .blog-aside__count { color: var(--accent-ink); }
.author-box { display: flex; gap: 1rem; align-items: start; padding: 1.3rem; border-radius: var(--radius-l); background: var(--surface-2); }
.author-box p { margin: .25rem 0 0; color: var(--muted); font-size: .95rem; }
/* Ficha del autor en la cabecera de su listado (/author/<id>/) */
.author-box--hero { margin-top: 1.5rem; max-width: 62ch; background: var(--surface); }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.share > span { font-weight: 700; margin-right: .25rem; }

.post-card .card__meta { color: var(--muted); font-size: .88rem; align-items: center; }
.featured-post { display: grid; gap: 0; border-radius: var(--radius-l); overflow: hidden; background: var(--surface); border: 1px solid var(--line); position: relative; margin-bottom: 2rem; }
@media (min-width: 860px) { .featured-post { grid-template-columns: 1.2fr 1fr; } .featured-post .ph { height: 100%; --ratio: auto; min-height: 320px; } }
.featured-post .ph { border-radius: 0; }
.featured-post .card__body { padding: clamp(1.25rem, 1rem + 2vw, 2.25rem); justify-content: center; gap: .8rem; }
.featured-post .card__title { font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem); }
/* Miniaturas reales de las entradas (en las maquetas son marcadores .ph): 2:1, como las portadas */
.post-thumb { aspect-ratio: 2 / 1; background: var(--surface-2); overflow: hidden; }
.post-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* Listado del blog: dos columnas de tarjetas junto al lateral, como en la web anterior */
.blog-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); align-items: start; }
.blog-list .card__meta { margin: 0; display: block; }
@media (min-width: 860px) { .featured-post .post-thumb { aspect-ratio: auto; height: 100%; min-height: 320px; } }

.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; margin-top: 3rem; }
.pagination a, .pagination span { display: inline-grid; place-items: center; min-width: 46px; height: 46px; padding: 0 .8rem; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); font-weight: 700; }
.pagination a:hover { border-color: var(--accent); color: var(--accent-ink); }
.pagination [aria-current] { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.pagination .gap { border: 0; background: none; }

.taxonomy-hero { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.taxonomy-kind { font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-ink); }

/* Página genérica · equipo (fichas de autores) */
.prose .team { list-style: none; padding: 0; margin-top: 1.5rem; }
.prose .team li + li { margin-top: 0; }
.team .avatar { object-fit: cover; }
/* Las webs largas (tecnopujol.wordpress.com) se parten para no desbordar en móvil */
.team .author-box > div { min-width: 0; overflow-wrap: anywhere; }
.team .author-box p.team__role { margin-top: 0; color: var(--ink-2); font-weight: 700; }

/* Contacto */
.form { display: grid; gap: 1.2rem; }
.form-row { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.field label { display: block; font-weight: 700; margin-bottom: .4rem; }
.field .hint { display: block; font-size: .88rem; color: var(--muted); margin-top: .35rem; }
.field input, .field textarea, .field select {
  width: 100%; min-height: 50px; padding: .7rem .9rem; border-radius: 12px;
  border: 2px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit;
}
.field textarea { min-height: 170px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent); }
.req { color: var(--brand-ink); }
.consent { display: flex; gap: .7rem; align-items: start; font-size: .95rem; }
.consent input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--brand); flex: none; }
.hp { position: absolute; left: -9999px; }
.form-card { padding: clamp(1.25rem, 1rem + 2vw, 2.25rem); border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.form-card__title { font-size: 1.4rem; }
/* Resultado del envío del formulario (y aviso si no está configurado) */
.form-status { --c: var(--info); --c-soft: var(--info-soft); margin: 0; padding: .8rem 1rem; border-radius: var(--radius); background: var(--c-soft); border-left: 5px solid var(--c); }
.form-status--ok { --c: var(--tip); --c-soft: var(--tip-soft); }
.form-status--error { --c: var(--warn); --c-soft: var(--warn-soft); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.aside-stack__title { font-size: 1.15rem; margin: 0; }
.contact-option { display: flex; gap: .9rem; padding: 1.1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.contact-option:hover { border-color: var(--brand); color: var(--ink); }
.contact-option svg { width: 26px; height: 26px; color: var(--brand-ink); flex: none; margin-top: 2px; }
.contact-option strong { display: block; font-family: var(--font-head); }
.contact-option span { color: var(--muted); font-size: .93rem; }

/* 404 */
.notfound { text-align: center; padding-block: clamp(3rem, 2rem + 6vw, 7rem); }
.notfound__art { width: min(280px, 70vw); margin: 0 auto 1.5rem; color: var(--brand); }
.notfound__code { margin: 0 0 .75rem; font-family: var(--font-head); font-weight: 800; font-size: clamp(4rem, 3rem + 6vw, 7rem); line-height: 1; color: var(--brand); letter-spacing: -.03em; }
.notfound .lead { max-width: 48ch; margin: 0 auto 2rem; }
.notfound form { display: flex; gap: .5rem; max-width: 520px; margin: 0 auto 2.5rem; }
.notfound form input { flex: 1; min-width: 0; min-height: 50px; padding: .7rem 1rem; border-radius: 999px; border: 2px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; }
.notfound form input:focus { outline: none; border-color: var(--brand); }
.notfound .chips { justify-content: center; }

/* Catálogo de plantillas (índice de la propuesta) */
.tpl-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.tpl { position: relative; display: flex; flex-direction: column; gap: .5rem; padding: 1.4rem; border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--line); }
.tpl:has(a:hover) { border-color: var(--accent); box-shadow: var(--shadow-2); }
.tpl__num { font-family: var(--font-mono); font-weight: 700; font-size: .85rem; color: var(--accent-ink); }
.tpl h2 { font-size: 1.25rem; margin: 0; }
.tpl h2 a { color: var(--ink); text-decoration: none; }
.tpl h2 a::after { content: ""; position: absolute; inset: 0; }
.tpl p { color: var(--muted); margin: 0; font-size: .97rem; }
.tpl dl { margin: .5rem 0 0; font-size: .88rem; display: grid; grid-template-columns: auto 1fr; gap: .2rem .7rem; }
.tpl dt { color: var(--muted); }
.tpl dd { margin: 0; font-weight: 600; }

/* Botón volver arriba */
.to-top { position: fixed; right: 16px; bottom: 16px; z-index: 40; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow-2); opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s; pointer-events: none; }
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.to-top svg { width: 22px; height: 22px; }

/* 7. Impresión: los docentes imprimen actividades y fichas ----------------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #f5f5f5; --ink: #000; --muted: #333; }
  .site-header, .mobile-nav, .site-footer, .to-top, .no-print, .toc, .pager, .share, .embed__poster, .search-dialog { display: none !important; }
  body { font-size: 11pt; }
  .page-hero { background: none; padding: 0 0 1rem; }
  .with-aside { display: block; padding: 0; }
  .factsheet { box-shadow: none; break-inside: avoid; margin-bottom: 1rem; }
  .steps > li, .callout, .download { break-inside: avoid; }
  .teacher-notes .notes-body { display: block !important; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .8em; color: #555; word-break: break-all; }
}

/* Ajustes de tarjetas: chips enlazables por encima del enlace de la tarjeta */
.card__body > .chip { align-self: flex-start; position: relative; z-index: 2; }
/* En móvil, la ficha rápida va antes que el texto */
@media (max-width: 959px) { .with-aside--facts-first > aside { order: -1; } }
.prose > :first-child { margin-top: 0; padding-top: 0; }
.download > span:nth-child(2) { flex: 1; min-width: 0; }
@media (max-width: 560px) { .card > .ph { aspect-ratio: 16 / 7; } }
