/* ==========================================================================
   Stonebridge English - core.css
   Tokens de diseño + base + componentes reutilizables (público y admin).
   Paleta y tipografía: docs/01-estrategia-marketing-ux.md §5. Mobile-first.
   Los módulos añaden SU css en public/assets/<modulo>/ y reutilizan estos tokens (var(--navy), etc.).
   ========================================================================== */
:root {
  /* Paleta de marca (medida sobre el escudo oficial: azul #263683, rojo #E62835, blanco). Roadmap v3. */
  --navy: #263683;      /* azul Stonebridge: títulos, header, botón secundario */
  --night: #18235C;     /* azul profundo: footer, hero oscuro */
  --brick: #E62835;     /* rojo del escudo: SOLO gráficos/ladrillos/franjas (con texto blanco no llega a AA en 16px) */
  --red: #D81E2B;       /* rojo CTA accesible (blanco 5:1). Un botón rojo por pantalla */
  --red-d: #B5141F;
  --blue: #2F47B8;      /* enlaces, foco, interacción (7.6:1 sobre blanco) */
  --sky: #B4BEF2;       /* enlaces sobre oscuro */
  --lav: #8F8DBE;       /* lavanda de las franjas de marca */
  --lav-l: #C7C4DF;
  --gold: #F5B942;      /* estrellas de reseñas / energía sobre azul (NO texto sobre blanco) */
  --green: #1E7F5C;     /* éxito / WhatsApp */
  --ink: #161A3A;       /* texto principal */
  --slate: #545A78;     /* texto secundario */
  --mist: #F3F3FA;      /* superficies alternas (niebla lavanda) */
  --line: #DCDDEE;      /* bordes */
  --white: #fff;
  --muted-dark: #C3C8EA;
  --danger-bg: #FDECEE; --danger-fg: #8F1A27;
  --success-bg: #E6F4EE; --success-fg: #14563E;
  --warning-bg: #FFF4D6; --warning-fg: #5C4300;
  --info-bg: #ECEEFB; --info-fg: #263683;

  /* Niveles MCER (siempre con texto A1..C2, nunca solo color) */
  --lvl-a1: #5B78E0; --lvl-a2: #2F47B8; --lvl-b1: #1E7F5C; --lvl-b2: #263683; --lvl-c1: #D81E2B; --lvl-c2: #18235C;

  /* Forma y sombras */
  --r: 12px; --r-lg: 20px; --pill: 999px;
  --shadow: 0 6px 24px rgba(24, 35, 92, .08);
  --shadow-h: 0 16px 40px rgba(24, 35, 92, .16);

  /* Tipografía */
  --font-h: 'Zilla Slab', 'Rockwell', Georgia, serif;          /* display: slab con itálica, pariente del wordmark */
  --font-b: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-c: 'Barlow Condensed', 'Arial Narrow', sans-serif;  /* rótulos en mayúsculas (bandas de marca) */

  /* Layout */
  --max: 1180px; --gut: 16px; --hdr: 68px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--hdr) + 16px); }
body { margin: 0; font-family: var(--font-b); font-size: 16px; line-height: 1.6; color: var(--ink); background: #fff; -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-h); color: var(--navy); line-height: 1.08; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.012em; }
h1 em, h2 em { font-style: italic; color: var(--brick); }
.on-dark h1 em, .on-dark h2 em, .sec--navy h2 em, .sec--night h2 em { color: #FF5A63; }
h1 { font-size: clamp(2rem, 5.6vw + .6rem, 3.25rem); }
h2 { font-size: clamp(1.5rem, 3vw + .8rem, 2.25rem); }
h3 { font-size: 1.3rem; font-weight: 700; line-height: 1.2; }
p { margin: 0 0 1em; }
a { color: var(--blue); text-underline-offset: 3px; }
a:hover { color: var(--navy); }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 6px; }
.on-dark :focus-visible { outline-color: var(--sky); }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; left: 8px; top: -60px; z-index: 200; background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px; transition: top .15s; }
.skip:focus { top: 8px; color: #fff; }

/* ---- Estructura ---------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gut); }
.sec { padding: 56px 0; }
.sec--mist { background: var(--mist); }
.sec--navy { background: var(--navy); color: #fff; }
.sec--night { background: var(--night); color: #fff; }
.sec--navy h1, .sec--night h1, .sec--navy h2, .sec--night h2, .sec--navy h3, .sec--night h3 { color: #fff; }
.sec__head { max-width: 680px; margin-bottom: 32px; }
.sec__head--center { margin-inline: auto; text-align: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font: 700 .95rem/1 var(--font-c); letter-spacing: .1em; text-transform: uppercase; color: var(--red-d); margin-bottom: 12px; }
.eyebrow::before { content: ""; width: 22px; height: 8px; flex: none; background: linear-gradient(90deg, var(--brick) 0 30%, transparent 30% 36%, var(--brick) 36% 66%, transparent 66% 72%, var(--brick) 72%); border-radius: 1px; }
.on-dark .eyebrow, .sec--navy .eyebrow, .sec--night .eyebrow { color: #FF8A90; }
.lead { font-size: 1.0625rem; color: var(--slate); }
.sec--navy .lead, .sec--night .lead { color: var(--muted-dark); }
.muted { color: var(--slate); }
.small { font-size: .875rem; }
.center { text-align: center; }

.grid { display: grid; gap: 20px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.row--between { justify-content: space-between; }

/* Etiqueta "Ejemplo": contenido ficticio de la demo */
.tag-ex { display: inline-flex; align-items: center; gap: 4px; font: 600 .6875rem/1 var(--font-b); letter-spacing: .04em; text-transform: uppercase; background: #FFF1CC; color: #5C4300; border: 1px solid #E9C96A; border-radius: var(--pill); padding: 4px 8px; vertical-align: middle; white-space: nowrap; }

/* ---- Botones -------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 26px; border-radius: var(--pill); border: 2px solid transparent; font: 600 1rem/1.2 var(--font-b); text-decoration: none; cursor: pointer; transition: background .18s, color .18s, border-color .18s, box-shadow .18s; text-align: center; }
.btn:active { transform: translateY(1px); }
.btn--red { background: var(--red); color: #fff; box-shadow: 0 6px 18px rgba(214, 40, 57, .28); }
.btn--red:hover { background: var(--red-d); color: #fff; }
.btn--navy { background: var(--navy); color: #fff; }
.btn--navy:hover { background: var(--night); color: #fff; }
.btn--blue { background: var(--blue); color: #fff; }
.btn--blue:hover { background: #1858AE; color: #fff; }
.btn--gold { background: var(--gold); color: var(--night); }
.btn--gold:hover { background: #FFCB5F; color: var(--night); }
.btn--ghost { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn--ghost:hover { background: var(--navy); color: #fff; }
.btn--ghost-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .6); }
.btn--ghost-light:hover { background: #fff; color: var(--navy); border-color: #fff; }
.btn--sm { min-height: 40px; padding: 0 16px; font-size: .9375rem; }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--blue); text-decoration: none; min-height: 44px; }
.link:hover { text-decoration: underline; }

/* ---- Tarjetas ------------------------------------------------------------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 24px; box-shadow: var(--shadow); }
.card--flat { box-shadow: none; }
.card--hover { transition: box-shadow .2s, transform .2s; }
.card--hover:hover { box-shadow: var(--shadow-h); transform: translateY(-2px); }
.card__title { margin: 0 0 6px; font-size: 1.125rem; }
.card__meta { color: var(--slate); font-size: .875rem; margin-bottom: 12px; }

/* ---- Formularios ---------------------------------------------------------- */
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field label, .label { font-weight: 600; font-size: .9375rem; color: var(--ink); }
.input, .select, .textarea { width: 100%; min-height: 48px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: var(--r); background: #fff; transition: border-color .15s, box-shadow .15s; }
.textarea { min-height: 120px; resize: vertical; }
.input:hover, .select:hover, .textarea:hover { border-color: #b7c4d8; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(30, 111, 217, .25); }
.input[aria-invalid="true"], .field--error .input, .field--error .select, .field--error .textarea { border-color: var(--red); }
.field__hint { color: var(--slate); font-size: .8125rem; }
.field__error { color: var(--danger-fg); font-size: .875rem; font-weight: 500; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .9375rem; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--navy); }

/* ---- Tablas ---------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table thead th { background: var(--mist); color: var(--navy); font-weight: 600; font-size: .8125rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafcff; }

/* ---- Badges ---------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--pill); font: 600 .75rem/1.4 var(--font-b); background: var(--mist); color: var(--navy); border: 1px solid var(--line); white-space: nowrap; }
.badge--success { background: var(--success-bg); color: var(--success-fg); border-color: #b7dfcc; }
.badge--danger { background: var(--danger-bg); color: var(--danger-fg); border-color: #f3b7be; }
.badge--warning { background: var(--warning-bg); color: var(--warning-fg); border-color: #E9C96A; }
.badge--info { background: var(--info-bg); color: var(--info-fg); border-color: #b5d1f7; }
.badge--navy { background: var(--navy); color: #fff; border-color: var(--navy); }
.lvl { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; padding: 2px 10px; border-radius: 8px; font: 700 .8125rem/1.5 var(--font-h); color: #fff; }
.lvl--a1 { background: var(--lvl-a1); color: var(--night); }
.lvl--a2 { background: var(--lvl-a2); } .lvl--b1 { background: var(--lvl-b1); } .lvl--b2 { background: var(--lvl-b2); }
.lvl--c1 { background: var(--lvl-c1); } .lvl--c2 { background: var(--lvl-c2); box-shadow: inset 0 0 0 2px var(--gold); }

/* ---- Alertas --------------------------------------------------------------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r); border: 1px solid; font-size: .9375rem; margin-bottom: 16px; }
.alert--success { background: var(--success-bg); color: var(--success-fg); border-color: #b7dfcc; }
.alert--error, .alert--danger { background: var(--danger-bg); color: var(--danger-fg); border-color: #f3b7be; }
.alert--warning { background: var(--warning-bg); color: var(--warning-fg); border-color: #E9C96A; }
.alert--info { background: var(--info-bg); color: var(--info-fg); border-color: #b5d1f7; }
.alert__close { margin-left: auto; background: none; border: 0; cursor: pointer; font-size: 1.25rem; line-height: 1; color: inherit; opacity: .7; }
.alert__close:hover { opacity: 1; }

/* ---- Utilidades ------------------------------------------------------------ */
.mt-0 { margin-top: 0 !important; } .mb-0 { margin-bottom: 0 !important; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.text-right { text-align: right; }
.progress { height: 10px; background: var(--line); border-radius: var(--pill); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--blue); border-radius: inherit; }

@media (min-width: 768px) {
  :root { --gut: 24px; }
  .sec { padding: 80px 0; }
  body { font-size: 17px; }
}

/* ---- Marca (escudo + wordmark) compartida por público, admin, runner y errores ---- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand__shield { width: 44px; height: 44px; flex: none; }
.brand__word { display: inline-flex; }
.brand__word img { width: 148px; height: auto; }
.brand__word-light { display: none; }
.brand--light .brand__word-dark, .admin__brand .brand__word-dark, .side__brand .brand__word-dark, .on-dark .brand .brand__word-dark { display: none; }
.brand--light .brand__word-light, .admin__brand .brand__word-light, .side__brand .brand__word-light, .on-dark .brand .brand__word-light { display: block; }
