/* ==========================================================================
   FYS Cerrajeros Málaga · hoja de estilos
   --------------------------------------------------------------------------
   Dos estilos intercambiables mediante <html data-theme="...">:
     laton    Noche y latón (oscuro, dorado, titulares con serifa)
     tarjeta  Como la tarjeta de visita (papel claro, tinta negra, palo seco)
   Todo el color sale de las variables de :root; no hay colores sueltos en
   los componentes salvo en la escena 3D, que siempre es oscura.
   ========================================================================== */

@font-face {
  font-family: "Outfit";
  src: url("../fonts/outfit-latin.woff2") format("woff2");
  font-weight: 300 800;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --font-sans: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
  --wa: #1fae57;
  --wa-ink: #ffffff;
  --radius: 14px;
  --header-h: 68px;
  --callbar-h: 0px;
}

/* ---- Estilo A · Noche y latón ---- */
:root,
:root[data-theme="laton"] {
  color-scheme: dark;
  --font-display: "Fraunces", Georgia, serif;
  --display-weight: 500;
  --display-tracking: -0.015em;
  --display-case: none;
  --bg: #0b0d10;
  --bg-alt: #101318;
  --surface: #161a21;
  --line: rgba(255, 255, 255, 0.1);
  --ink: #f4f1ea;
  --ink-2: #c3c6cd;
  --ink-3: #9197a1;
  --accent: #d6aa42;
  --accent-strong: #e7c066;
  --accent-ink: #15110a;
  --accent-line: rgba(214, 170, 66, 0.45);
  --todo: #ff9f6b;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

/* ---- Estilo B · Como la tarjeta ---- */
:root[data-theme="tarjeta"] {
  color-scheme: light;
  --font-display: "Outfit", system-ui, sans-serif;
  --display-weight: 300;
  --display-tracking: -0.01em;
  --display-case: none;
  --bg: #f5f3ee;
  --bg-alt: #ebe8e1;
  --surface: #ffffff;
  --line: rgba(20, 20, 22, 0.16);
  --ink: #141416;
  --ink-2: #3d3f44;
  --ink-3: #62656c;
  --accent: #141416;
  --accent-strong: #000000;
  --accent-ink: #ffffff;
  --accent-line: rgba(20, 20, 22, 0.55);
  --todo: #b3420b;
  --shadow: 0 14px 40px rgba(20, 20, 22, 0.12);
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; scroll-padding-top: calc(var(--header-h) + 12px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  padding-bottom: var(--callbar-h);
}
h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
svg { display: block; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: var(--accent-ink); }

.wrap { width: min(100% - 2.5rem, 1240px); margin-inline: auto; }
.wrap--narrow { width: min(100% - 2.5rem, 860px); }
.mono { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }
.fine { font-size: 0.85rem; color: var(--ink-3); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 0.6rem 1rem; border-radius: 8px; }
.skip-link:focus { top: 1rem; }

h1, h2, h3 { font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: var(--display-tracking); line-height: 1.12; text-wrap: balance; }
h1 { font-size: clamp(2rem, 4.1vw, 3.25rem); }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.75rem); }
h3 { font-size: 1.3rem; }
h1 em { font-style: italic; color: var(--accent-strong); }
:root[data-theme="tarjeta"] h1 em { font-style: normal; font-weight: 600; }
:root[data-theme="tarjeta"] h3 { font-weight: 500; }
p { text-wrap: pretty; }

.eyebrow { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-strong); }
:root[data-theme="tarjeta"] .eyebrow { color: var(--ink-3); }

/* ---- Botones ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  min-height: 48px; padding: 0.7rem 1.2rem;
  border: 1px solid transparent; border-radius: 12px;
  font-weight: 500; font-size: 1rem; line-height: 1.2; text-decoration: none; white-space: nowrap;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, translate 0.2s;
}
.btn svg { width: 1.1em; height: 1.1em; flex: none; }
.btn b { font-weight: 700; }
.btn--lg { min-height: 56px; padding-inline: 1.5rem; font-size: 1.05rem; }
@media (max-width: 420px) { .btn { white-space: normal; text-align: center; } }
.btn--sm { min-height: 40px; padding: 0.45rem 0.9rem; font-size: 0.9rem; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--accent-strong); }
.btn--ghost { border-color: var(--accent-line); background: transparent; color: var(--ink); }
.btn--ghost:hover { border-color: var(--accent-strong); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.btn--wa { background: var(--wa); color: var(--wa-ink); }
.btn--wa:hover { background: color-mix(in srgb, var(--wa) 86%, black); }
@media (prefers-reduced-motion: no-preference) { .btn:hover { translate: 0 -1px; } .btn:active { translate: 0 0; } }

.link-btn {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px;
  background: none; border: 0; padding: 0; margin-top: auto;
  color: var(--accent-strong); font-weight: 500; text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 5px;
}
.link-btn svg { width: 1.1em; height: 1.1em; transition: translate 0.2s; }
.link-btn:hover svg { translate: 4px 0; }

/* ---- Datos pendientes (solo en modo revisión) ---- */
.todo {
  display: inline-block; padding: 0.1rem 0.5rem; margin: 0.1rem 0.15rem;
  border: 1px dashed var(--todo); border-radius: 6px;
  color: var(--todo); font: 500 0.72rem/1.5 var(--font-mono); letter-spacing: 0.03em; text-transform: uppercase;
  vertical-align: middle; scroll-margin-top: 40vh;
}
.todo::before { content: "✎ "; }
.todo.is-flash { background: color-mix(in srgb, var(--todo) 25%, transparent); }
:root:not([data-review]) .todo { border: 0; padding: 0; color: inherit; font: inherit; text-transform: none; letter-spacing: 0; }
:root:not([data-review]) .todo::before { content: none; }

/* ---- Barra de revisión ---- */
.review { display: none; background: #ffb27d; color: #14100c; font-size: 0.85rem; }
:root[data-review] .review { display: block; }
.review__inner { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.2rem; padding-block: 0.45rem; position: relative; }
.review__title { margin-right: auto; }
.review__group { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.review__label { font-weight: 600; }
.review__btn { min-height: 32px; padding: 0.2rem 0.7rem; border: 1px solid rgba(0, 0, 0, 0.55); border-radius: 999px; background: transparent; color: inherit; font-size: 0.82rem; }
.review__btn[aria-pressed="true"] { background: #14100c; color: #fff; }
.review__todos summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; gap: 0.3rem; }
.review__todos summary::after { content: "▾"; }
.review__todos ol {
  position: absolute; right: 0; top: 100%; z-index: 60; width: min(100%, 520px); max-height: 60vh; overflow: auto;
  margin: 0; padding: 0.8rem 1rem 0.8rem 2.2rem; list-style: decimal;
  background: #fff; color: #14100c; border-radius: 0 0 12px 12px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.review__todos li { padding: 0.25rem 0; }
.review__todos a { color: inherit; }

/* ---- Cabecera ---- */
.header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header__inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 0.8rem; text-decoration: none; color: var(--ink); }
.brand__key { width: 58px; height: 24px; stroke-width: 3; color: var(--accent-strong); flex: none; }
.brand__text { display: grid; line-height: 1.15; }
.brand__name { font-family: var(--font-sans); font-size: 1.05rem; font-weight: 300; letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap; }
.brand__name b { font-weight: 700; }
.brand__sub { font-size: 0.72rem; color: var(--ink-3); letter-spacing: 0.04em; }
.nav { display: none; gap: 1.6rem; font-size: 0.92rem; }
.nav a { color: var(--ink-2); text-decoration: none; padding-block: 0.6rem; white-space: nowrap; }
.nav a:hover { color: var(--accent-strong); }
.header__contact { display: none; align-items: center; gap: 1rem; }
.header__phones { display: grid; text-align: right; font-weight: 600; font-size: 0.92rem; line-height: 1.3; font-variant-numeric: tabular-nums; }
.header__phones a { text-decoration: none; }
.header__phones a:hover { color: var(--accent-strong); }
@media (min-width: 720px) { .header__contact { display: flex; } }
@media (min-width: 1180px) { .nav { display: flex; } }

/* ---- Hero ---- */
.hero { padding-block: clamp(2rem, 4.5vw, 4rem); position: relative; overflow: clip; }
.hero__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.5rem; align-items: center; }
.hero__copy { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.2rem; justify-items: start; }
.lead { font-size: clamp(1.02rem, 1.5vw, 1.2rem); color: var(--ink-2); max-width: 60ch; }
.lead strong { color: var(--ink); font-weight: 600; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 0.75rem; width: 100%; }
.hero__cta .btn { flex: 1 1 240px; }
.hero__cta .btn--wa { flex: 0 1 auto; }
.hero__facts { display: grid; gap: 0.5rem; padding-top: 1.2rem; border-top: 1px solid var(--line); width: 100%; color: var(--ink-2); font-size: 0.95rem; }
.hero__facts .mono { color: var(--accent-strong); margin-right: 0.5rem; }
:root[data-theme="tarjeta"] .hero__facts .mono { color: var(--ink-3); }
.hero__hours { font-size: 0.9rem; }
.hero__visual { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
.hero__key { width: min(100%, 520px); aspect-ratio: 240 / 100; stroke-width: 1.6; color: var(--accent-strong); opacity: 0.9; justify-self: center; }
@media (min-width: 960px) {
  .hero__grid { grid-template-columns: 1.25fr 1fr; gap: 4rem; }
  .hero__cta .btn { flex: 0 1 auto; }
}

/* ---- Huecos de foto ---- */
.photo-slot {
  position: relative; display: grid; place-content: center; justify-items: center; gap: 0.8rem;
  aspect-ratio: 4 / 3; padding: 1.2rem; text-align: center;
  border: 1.5px dashed var(--accent-line); border-radius: var(--radius);
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, color-mix(in srgb, var(--ink) 4%, transparent) 14px 15px),
    var(--surface);
  color: var(--ink-2);
}
.photo-slot > svg { width: 34px; height: 34px; color: var(--accent-strong); }
.photo-slot figcaption { display: grid; gap: 0.35rem; justify-items: center; font-size: 0.86rem; line-height: 1.4; max-width: 34ch; }
.photo-slot b { color: var(--ink); font-weight: 600; font-size: 0.95rem; }
.photo-slot code { font: 0.72rem var(--font-mono); color: var(--ink-3); background: color-mix(in srgb, var(--ink) 7%, transparent); padding: 0.15rem 0.45rem; border-radius: 5px; overflow-wrap: anywhere; }
.photo-slot--hero { aspect-ratio: 3 / 2; }
.photo-slot--portrait { aspect-ratio: 1; }

/* ---- Secciones ---- */
.section { padding-block: clamp(3.5rem, 8vw, 7rem); }
.section--alt { background: var(--bg-alt); border-block: 1px solid var(--line); }
.section__head { display: grid; gap: 0.9rem; max-width: 62ch; margin-bottom: clamp(2rem, 4vw, 3.5rem); }
.section__head > p:last-child { color: var(--ink-2); font-size: 1.05rem; }

/* ---- Servicios ---- */
.services { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.service { display: flex; flex-direction: column; gap: 0.8rem; padding: 1.8rem 1.6rem; background: var(--bg); }
.service p { color: var(--ink-2); }
.service__num { color: var(--accent-strong) !important; }
:root[data-theme="tarjeta"] .service__num { color: var(--ink-3) !important; }
.service__price { font-size: 0.92rem; padding-top: 0.6rem; border-top: 1px solid var(--line); }
.service__price b { color: var(--ink); font-weight: 600; }
.service--shop { background: var(--surface); }

/* ---- Precios ---- */
.pricing { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; }
@media (min-width: 960px) { .pricing { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3rem; align-items: start; } }
.price-table dl > div { display: flex; justify-content: space-between; align-items: baseline; gap: 1.5rem; padding: 0.95rem 0; border-bottom: 1px solid var(--line); }
.price-table dt { color: var(--ink-2); }
.price-table dd { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right; }
.price-table .fine { margin-top: 1rem; }
.draft-note { margin-bottom: 0.4rem; }
.compare { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.3rem, 3vw, 2rem); display: grid; gap: 1rem; box-shadow: var(--shadow); }
.compare > p { color: var(--ink-2); font-size: 0.95rem; }
.compare table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.compare th { text-align: left; font: 500 0.75rem var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); padding: 0.5rem 0.6rem 0.5rem 0; }
.compare td { padding: 0.7rem 0.6rem 0.7rem 0; border-top: 1px solid var(--line); vertical-align: top; width: 50%; }
.compare td:first-child { color: var(--ink-3); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink-3) 50%, transparent); }
.compare td:last-child { color: var(--ink); font-weight: 500; }

/* ---- Galería y equipo ---- */
.gallery { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
.team { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
@media (min-width: 820px) { .team { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.5rem; } }
.person { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; gap: 1.4rem; align-items: start; }
.person > div { display: grid; gap: 0.5rem; }
.person p { color: var(--ink-2); }
.person .photo-slot { padding: 0.7rem; }
.person .photo-slot figcaption { font-size: 0.74rem; }
.person .photo-slot b { font-size: 0.8rem; }
@media (max-width: 480px) { .person { grid-template-columns: 1fr; } .person .photo-slot { max-width: 220px; } }
.honesty { margin-top: 2.5rem; padding: 1.2rem 1.4rem; border-left: 2px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; color: var(--ink-2); max-width: 78ch; }
.honesty .mono { display: block; margin-bottom: 0.3rem; color: var(--accent-strong); }
:root[data-theme="tarjeta"] .honesty .mono { color: var(--ink); }

/* ---- Zonas ---- */
.zones { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; }
@media (min-width: 960px) { .zones { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 3rem; align-items: start; } }
.map { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.map__tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0.7rem; border-bottom: 1px solid var(--line); }
.tab { min-height: 40px; display: inline-flex; align-items: center; padding: 0.3rem 0.9rem; border: 1px solid var(--line); border-radius: 999px; background: transparent; font-size: 0.86rem; text-decoration: none; color: var(--ink-2); }
.tab:hover { border-color: var(--accent-line); color: var(--ink); }
.tab.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.map__view { position: relative; }
.map__view[hidden] { display: none; }
.map__view svg { width: 100%; height: auto; }
.map__view iframe { display: block; width: 100%; height: 400px; border: 0; }
.map__rings circle { stroke: var(--line); stroke-dasharray: 3 6; }
.map__sea { fill: color-mix(in srgb, #4d8fd1 16%, transparent); stroke: color-mix(in srgb, #4d8fd1 45%, transparent); }
.map__sealabel { fill: var(--ink-3); font: 11px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.map__dots g { cursor: pointer; }
.map__dots circle { fill: color-mix(in srgb, var(--accent) 30%, transparent); stroke: var(--accent-strong); stroke-width: 1.5; transition: fill 0.2s; }
.map__dots .hub { stroke-width: 2.5; }
.map__dots text { fill: var(--ink-2); font: 12px var(--font-sans); }
.map__dots g:hover circle, .map__dots g.is-active circle { fill: var(--accent-strong); }
.map__dots g.is-active text { fill: var(--ink); font-weight: 600; }
.map__note { padding: 0.5rem 1rem 0.7rem; font-size: 0.68rem; }
.map__address { padding: 0.8rem 1rem; border-top: 1px solid var(--line); font-size: 0.9rem; }
.zone-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.1rem; justify-items: start; }
.pills { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pill { min-height: 44px; padding: 0.4rem 1rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 0.92rem; color: var(--ink-2); transition: border-color 0.2s, color 0.2s, background-color 0.2s; }
.pill:hover { border-color: var(--accent-line); color: var(--ink); }
.pill.is-active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--ink); font-weight: 500; }
.zone-selected { color: var(--ink-2); }
.zone-selected b { color: var(--ink); }

/* ---- Asistente de presupuesto ---- */
.assistant { display: grid; gap: 1.8rem; padding: clamp(1.3rem, 4vw, 2.5rem); background: var(--surface); border: 1px solid var(--accent-line); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow); transition: box-shadow 0.4s; }
.assistant.is-flash { box-shadow: 0 0 0 3px var(--accent-strong), var(--shadow); }
.assistant fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.assistant legend, .assistant label { display: block; padding: 0; margin-bottom: 0.7rem; font-weight: 500; font-size: 1.05rem; }
.assistant legend .mono, .assistant label .mono { color: var(--accent-strong); font-size: 0.9rem; margin-right: 0.3rem; }
:root[data-theme="tarjeta"] .assistant .mono { color: var(--ink-3); }
.choices { display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.choices--3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 480px) { .choices--3 { grid-template-columns: 1fr; } }
.choice { min-height: 50px; padding: 0.6rem 1rem; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink-2); transition: border-color 0.2s, color 0.2s, background-color 0.2s; }
.choice:hover { border-color: var(--accent-line); }
.choice.is-active { border-color: var(--accent); color: var(--ink); background: color-mix(in srgb, var(--accent) 12%, var(--bg)); font-weight: 500; }
.choice.is-active::before { content: "● "; color: var(--accent-strong); font-size: 0.7em; vertical-align: middle; }
.field select { width: 100%; min-height: 50px; padding: 0.6rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.assistant__out { display: grid; gap: 0.9rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.assistant__out blockquote { padding: 1rem 1.1rem; border-radius: 12px 12px 12px 2px; background: color-mix(in srgb, var(--wa) 14%, var(--bg)); border: 1px solid color-mix(in srgb, var(--wa) 35%, transparent); color: var(--ink); }
.assistant__cta { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.assistant__cta .btn { flex: 1 1 200px; }

/* ---- Preguntas ---- */
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.2rem 0; min-height: 44px; cursor: pointer; list-style: none; font-size: 1.1rem; font-weight: 500; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 300 1.5rem var(--font-mono); color: var(--accent-strong); transition: rotate 0.25s; }
.faq details[open] summary::after { rotate: 45deg; }
.faq details p { padding-bottom: 1.3rem; color: var(--ink-2); max-width: 70ch; }

/* ---- Pie ---- */
.footer { padding-block: 3.5rem; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 0.93rem; }
.footer__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
@media (min-width: 820px) { .footer__grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.footer__grid > div:first-child { display: grid; gap: 0.8rem; align-content: start; }
.footer nav { display: grid; gap: 0.1rem; align-content: start; }
.footer nav a { text-decoration: none; padding-block: 0.4rem; }
.footer nav a:hover { color: var(--accent-strong); }
.footer__phones { font-weight: 600; color: var(--ink); font-size: 1.05rem; }
.footer__phones a { text-decoration: none; }
.footer__legal { display: grid; gap: 0.6rem; align-content: start; }

/* ---- Barra fija de llamada en móvil ---- */
.callbar { display: none; }
@media (max-width: 719px) {
  :root { --callbar-h: 72px; }
  .callbar {
    position: fixed; inset: auto 0 0 0; z-index: 55; display: flex; gap: 0.5rem; height: var(--callbar-h);
    padding: 0.6rem 0.75rem calc(0.6rem + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
  }
  .callbar .btn { flex: 1; min-height: 0; padding-inline: 0.4rem; font-size: 0.92rem; font-weight: 600; font-variant-numeric: tabular-nums; }
  .callbar__wa { flex: 0 0 52px !important; }
  .callbar__wa svg { width: 1.5em; height: 1.5em; }
}

/* ==========================================================================
   EL BOMBÍN POR DENTRO · escena 3D guiada por scroll
   La escena siempre es oscura, también en el estilo "tarjeta".
   ========================================================================== */
.story {
  color-scheme: dark;
  --bg: #0b0d10; --surface: #161a21; --line: rgba(255, 255, 255, 0.12);
  --ink: #f4f1ea; --ink-2: #c8cbd1; --ink-3: #979ca6;
  --accent: #d6aa42; --accent-strong: #e7c066; --accent-ink: #15110a; --accent-line: rgba(214, 170, 66, 0.45);
  position: relative; background: var(--bg); color: var(--ink);
  border-block: 1px solid var(--line);
}
:root[data-theme="tarjeta"] .story { --accent: #f4f1ea; --accent-strong: #ffffff; --accent-ink: #141416; --accent-line: rgba(255, 255, 255, 0.45); }
.story .eyebrow { color: var(--accent-strong); }

.badge { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.3rem 0.75rem; border: 1px solid var(--line); border-radius: 999px; font: 500 0.72rem var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #e0a23c; }
.badge[data-state="open"] { color: #7fe0a8; border-color: rgba(127, 224, 168, 0.4); }
.badge[data-state="open"]::before { background: #4fd68b; }

.chapter { display: grid; gap: 0.7rem; }
.chapter p { color: var(--ink-2); }
.chapter__num { color: var(--accent-strong) !important; }
.chapter__hint { color: var(--ink-3); white-space: nowrap; }

.tokens { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
.token { display: flex; align-items: center; gap: 0.7rem; min-height: 56px; padding: 0.5rem 0.8rem; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--surface) 82%, transparent); color: var(--ink-2); transition: border-color 0.2s, background-color 0.2s, translate 0.2s; touch-action: manipulation; }
.token svg { width: 48px; height: 20px; flex: none; stroke-width: 4; color: var(--key, var(--accent-strong)); }
.token span { display: grid; line-height: 1.25; }
.token b { color: var(--ink); font-weight: 600; font-size: 0.95rem; }
.token small { font-size: 0.75rem; color: var(--ink-3); }
.token:hover { border-color: var(--accent-line); }
.token.is-active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.token.is-dragging { opacity: 0.45; }
#token-urgencias { --key: #e7c066; }
#token-bombin { --key: #dfe5ec; }
#token-cambio { --key: #e9a27a; }
#token-comunidad { --key: #9cc9a4; }
.token-ghost { position: fixed; left: 0; top: 0; z-index: 90; width: 120px; height: 50px; pointer-events: none; stroke-width: 3; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.6)); }
.token-result { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.7rem; padding: 0.8rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--surface) 82%, transparent); font-size: 0.92rem; }
.token-result p { flex: 1 1 200px; }
.token-result b { color: var(--ink); display: block; }

.tool { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 40px; padding: 0.3rem 0.8rem; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--bg) 70%, transparent); color: var(--ink-2); font: 0.72rem var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none; }
.tool:hover { color: var(--ink); border-color: var(--accent-line); }
.tool svg { width: 1.1em; height: 1.1em; }

.part-label { position: absolute; left: 0; top: 0; opacity: 0; will-change: transform, opacity; font: 0.68rem var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: #f4f1ea; white-space: nowrap; }
.part-label i { position: absolute; left: -3px; top: -3px; width: 6px; height: 6px; border-radius: 50%; background: #ffd97a; box-shadow: 0 0 0 4px rgba(255, 217, 122, 0.18); }
.part-label span { position: absolute; top: -0.75em; left: 34px; padding: 0.1rem 0.4rem; background: rgba(11, 13, 16, 0.72); border-radius: 4px; }
.part-label span::before { content: ""; position: absolute; top: 50%; right: 100%; width: 26px; height: 1px; background: rgba(255, 217, 122, 0.7); }
.part-label--l span { left: auto; right: 34px; }
.part-label--l span::before { right: auto; left: 100%; }
@media (max-width: 699px) {
  .part-label { font-size: 0.58rem; }
  .part-label span, .part-label--l span { left: 0; right: auto; top: 10px; translate: -50% 0; }
  .part-label span::before { display: none; }
  .part-label--wide { display: none; }
}

/* --- Versión estática (por defecto): lista de capítulos, sin escena --- */
.story--static { padding-block: clamp(3.5rem, 8vw, 7rem); }
.story--static .story__stage, .story--static .story__bar, .story--static .rail, .story--static #story-pause, .story--static #story-sound { display: none; }
.story--static .story__hud { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 2rem; }
.story--static .chapters { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.story--static .chapter--keys { grid-column: 1 / -1; max-width: 640px; }
.story--static .chapter__hint { display: none; }
.story--static .story__tools { margin-top: 2rem; }

/* --- Versión fijada (la activa site.js cuando hay WebGL y se permite movimiento) --- */
.story--pinned { height: 620vh; view-timeline: --story block; }
.story--pinned .story__pin { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.story--pinned .story__stage { position: absolute; inset: 0; background: radial-gradient(60% 55% at 62% 52%, rgba(214, 170, 66, 0.1), transparent 70%); }
.story--pinned .story__stage canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; }
.story--pinned .story__stage canvas:active { cursor: grabbing; }
.story__labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.story__loading { position: absolute; left: 50%; top: 50%; translate: -50% -50%; }
.story__loading[hidden] { display: none; }
.story--pinned .story__bar { position: absolute; left: 0; right: 0; top: var(--header-h); z-index: 3; height: 2px; background: var(--accent-strong); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); }
.story--pinned .story__ui { position: absolute; inset: 0; margin-inline: auto; pointer-events: none; }
.story--pinned .story__ui > * { pointer-events: auto; }
.story--pinned .story__hud { position: absolute; left: 0; right: 0; top: calc(var(--header-h) + 1.4rem); display: flex; justify-content: space-between; align-items: center; gap: 1rem; pointer-events: none; }
.story--pinned .chapters { position: absolute; left: 0; bottom: calc(var(--callbar-h) + 4.2rem); width: min(100%, 420px); pointer-events: none; }
.story--pinned .chapter { position: absolute; left: 0; bottom: 0; width: 100%; opacity: 0; visibility: hidden; translate: 0 14px; transition: opacity 0.45s, translate 0.45s, visibility 0s 0.45s; }
.story--pinned .chapter.is-active { opacity: 1; visibility: visible; translate: 0 0; transition-delay: 0.1s, 0.1s, 0s; pointer-events: auto; }
.story--pinned .chapter h3 { font-size: clamp(1.35rem, 2.6vw, 2.1rem); }
.story--pinned .story__pin::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to top, rgba(11, 13, 16, 0.92) 0%, rgba(11, 13, 16, 0.5) 28%, transparent 50%); }
.story--pinned .story__ui { z-index: 2; }
.story--pinned .rail { position: absolute; right: 0; top: 50%; translate: 0 -50%; display: none; gap: 0.9rem; color: var(--ink-3); }
.story--pinned .rail li { display: flex; align-items: center; justify-content: flex-end; gap: 0.6rem; transition: color 0.3s; }
.story--pinned .rail li::after { content: ""; width: 14px; height: 1px; background: currentColor; transition: width 0.3s; }
.story--pinned .rail li.is-active { color: var(--accent-strong); }
.story--pinned .rail li.is-active::after { width: 34px; }
.story--pinned .story__tools { position: absolute; right: 0; bottom: calc(var(--callbar-h) + 1.2rem); display: flex; gap: 0.4rem; }
@media (min-width: 900px) {
  .story--pinned .rail { display: grid; }
  .story--pinned .chapters { bottom: 4.5rem; }
  .story--pinned .story__pin::after { background: linear-gradient(to right, rgba(11, 13, 16, 0.85) 0%, rgba(11, 13, 16, 0.35) 30%, transparent 48%); }
}
@media (max-width: 899px) {
  .story--pinned .story__tools { left: 0; right: auto; }
  .story--pinned .chapters { bottom: calc(var(--callbar-h) + 4.4rem); }
  .story--pinned .chapter p { font-size: 0.95rem; }
  .story--pinned .token { min-height: 50px; padding: 0.35rem 0.6rem; }
  .story--pinned .token svg { width: 34px; }
  .story--pinned .token small { display: none; }
}

/* Barra de progreso: nativa con animaciones ligadas al scroll donde existen;
   en el resto de navegadores site.js escribe la variable --p. */
@supports ((animation-timeline: scroll()) and (animation-range: 0% 100%)) {
  @keyframes story-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  .story--pinned .story__bar {
    animation: story-progress linear both;
    animation-timeline: --story;
    animation-range: contain 0% contain 100%;
  }
}

/* Entrada suave de bloques al aparecer: decorativa, solo si el usuario no ha pedido reducir movimiento. */
@media (prefers-reduced-motion: no-preference) {
  @supports ((animation-timeline: scroll()) and (animation-range: 0% 100%)) {
    @keyframes reveal { from { opacity: 0; translate: 0 22px; } to { opacity: 1; translate: 0 0; } }
    .reveal {
      animation: reveal linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 55%;
    }
  }
}
