/* =====================================================================
   Encuestas ASG · Grupo Elecnor
   Estilo alineado con www.grupoelecnor.com: azul marino #0C0C4E, naranja #E67300,
   titulares Barlow, texto Open Sans, botones rectos en mayúsculas.
   Fuentes autoalojadas (OFL) en /assets/fonts — sin llamadas a terceros.
   ===================================================================== */
@font-face { font-family: "Barlow"; font-weight: 300; font-style: normal; font-display: swap; src: url("../fonts/barlow-latin-300-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/open-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/open-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/open-sans-latin-700-normal.woff2") format("woff2"); }

:root {
  --navy: #0c0c4e;
  --navy-2: #1b1b6b;
  --orange: #e67300;
  --orange-logo: #f47c00;
  --blue: #004f86;
  --lavender: #bcbce0;
  --lavender-soft: #ececf7;
  --ink: #333333;
  --ink-soft: #5c5c6e;
  --line: #d9d9e3;
  --bg: #f6f6f6;
  --white: #ffffff;
  --error: #b42318;
  --error-soft: #fdecea;
  --ok: #1e7b47;
  --blk-ambiental: #2e7d32;
  --blk-social: #c45f00;
  --blk-gobernanza: #0c0c4e;
  --blk-especificos: #004f86;
  --shadow: 0 2px 12px rgba(12, 12, 78, .08);
  --focus: 0 0 0 3px rgba(230, 115, 0, .55);
  --f-head: "Barlow", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Open Sans", "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--f-body); font-size: 16px; line-height: 1.6;
  color: var(--ink); background: var(--bg);
  display: flex; flex-direction: column; min-height: 100vh;
}
main { flex: 1; padding-bottom: 56px; }
img { max-width: 100%; height: auto; }
a { color: var(--blue); }
a:hover { color: var(--orange); }
h1, h2, h3 { font-family: var(--f-head); font-weight: 500; color: var(--navy); line-height: 1.2; margin: 0 0 .6em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: none; box-shadow: var(--focus); }
[hidden] { display: none !important; }
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* ---------- Barra superior (naranja, como la web del Grupo) ---------- */
.topbar { background: var(--orange); color: #fff; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; min-height: 32px; gap: 12px; }
.topbar a { color: #fff; text-decoration: none; }
.topbar a:hover { text-decoration: underline; color: #fff; }
.lang-switch { display: flex; gap: 2px; flex-wrap: wrap; }
.lang-switch a { padding: 4px 10px; opacity: .85; }
.lang-switch a.is-active { opacity: 1; background: rgba(255, 255, 255, .22); text-decoration: none; }

/* ---------- Cabecera ---------- */
.site-header { background: #fff; box-shadow: 0 1px 0 var(--line); position: relative; z-index: 5; }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 78px; gap: 16px; }
.brand { display: inline-flex; }
.brand-logo { height: 52px; width: auto; }
.header-back { font-size: .85rem; color: var(--navy); text-decoration: none; font-weight: 600; }
.header-back:hover { color: var(--orange); }

/* ---------- Hero ---------- */
.hero { background: var(--navy); color: #fff; padding: 64px 0 56px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--orange); }
.hero-sm { padding: 36px 0 32px; }
.hero-title { font-family: var(--f-head); font-weight: 300; color: #fff; font-size: clamp(1.8rem, 1.2rem + 2.6vw, 3.1rem); margin: 0; max-width: 22ch; }
.hero-sm .hero-title { font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2.1rem); max-width: 40ch; }
.kicker { font-family: var(--f-body); text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; font-weight: 700; color: var(--orange-logo); margin-bottom: 12px; }

/* ---------- Home ---------- */
.home { padding-top: 40px; }
.intro { max-width: 780px; font-size: 1.05rem; }
.intro .lead { font-family: var(--f-head); font-size: 1.45rem; font-weight: 400; color: var(--navy); line-height: 1.35; }
.profile-picker { margin-top: 36px; }
.choose-title { font-size: 1.25rem; font-weight: 600; }
.profile-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 16px; }
.profile-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 104px;
  padding: 22px 24px; background: #fff; border-left: 5px solid var(--orange); box-shadow: var(--shadow);
  text-decoration: none; color: var(--navy); transition: background .2s, color .2s, transform .2s;
}
a.profile-btn:hover, a.profile-btn:focus-visible { background: var(--navy); color: #fff; transform: translateY(-2px); }
.profile-btn-label { font-family: var(--f-head); font-size: 1.3rem; font-weight: 500; line-height: 1.2; }
.profile-btn-arrow { font-size: 1.6rem; color: var(--orange); }
.profile-btn-split { flex-direction: column; align-items: stretch; justify-content: center; gap: 12px; }
.profile-btn-variants { display: flex; gap: 8px; flex-wrap: wrap; }
.profile-btn-variants a {
  flex: 1; text-align: center; text-decoration: none; text-transform: uppercase; letter-spacing: .08em;
  font-size: .8rem; font-weight: 700; padding: 10px 12px; border: 1px solid var(--navy); color: var(--navy);
}
.profile-btn-variants a:hover { background: var(--navy); color: #fff; }

/* ---------- Tarjetas / avisos ---------- */
.survey-wrap { padding-top: 28px; }
.card { background: #fff; box-shadow: var(--shadow); padding: clamp(20px, 4vw, 40px); margin-bottom: 24px; }
.notice { background: var(--lavender-soft); padding: 12px 16px; }
.alert { padding: 14px 16px; margin-bottom: 16px; font-weight: 600; }
.alert-error { background: var(--error-soft); color: var(--error); border-left: 4px solid var(--error); }
.prompt { font-weight: 600; color: var(--navy); }
.field-error { color: var(--error); font-weight: 600; font-size: .9rem; margin: 8px 0 0; }
.field-error::before { content: "⚠ "; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.privacy-note { font-size: .82rem; color: var(--ink-soft); margin: 16px 0 0; }

/* ---------- Progreso ---------- */
.progress { margin-bottom: 18px; }
.progress-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); margin: 0 0 6px; font-weight: 700; }
.progress-track { height: 4px; background: var(--line); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--orange); transition: width .35s ease; }
.progress-steps { display: flex; justify-content: space-between; list-style: none; margin: 10px 0 0; padding: 0; font-size: .8rem; color: var(--ink-soft); }
.progress-steps li { flex: 1; text-align: center; }
.progress-steps .is-current { color: var(--navy); font-weight: 700; }
.progress-steps .is-done { color: var(--orange); }
@media (max-width: 600px) { .progress-steps { display: none; } }

/* ---------- Pasos ---------- */
.js .step { display: none; }
.js .step.is-active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.step > h2 { font-size: 1.6rem; }
.step-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.step-nav .btn:only-child { margin-left: auto; }
.no-js .step-nav [data-next], .no-js .step-nav [data-prev] { display: none; }
.no-js .step-nav { border: 0; padding: 0; margin: 0; }

/* ---------- Botones (rectos, mayúsculas) ---------- */
.btn {
  appearance: none; border: 1px solid transparent; border-radius: 0; cursor: pointer;
  font-family: var(--f-body); font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  padding: 14px 28px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-sm { padding: 9px 16px; font-size: .72rem; }
.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-primary:hover { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-ghost { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn-ghost:hover { background: var(--navy); color: #fff; }
.link-btn { appearance: none; background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: none; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Preguntas ---------- */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.q { margin: 0 0 26px; }
.q > legend, .conditional > label { font-weight: 700; color: var(--navy); margin-bottom: 10px; padding: 0; display: block; }
.q[aria-invalid="true"] .opt span { border-color: var(--error); }
.options { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { position: relative; }
.opt input, .topic input, .rate input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opt span {
  display: inline-block; padding: 11px 20px; border: 1px solid var(--line); cursor: pointer; background: #fff;
  transition: all .15s; user-select: none; min-height: 44px;
}
.opt span:hover { border-color: var(--navy); }
.opt input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.opt input:focus-visible + span, .topic input:focus-visible + span, .rate input:focus-visible + span { box-shadow: var(--focus); }
.conditional { margin-top: 12px; }
.conditional input[type="text"], textarea {
  width: 100%; max-width: 100%; font: inherit; padding: 11px 12px; border: 1px solid var(--line); background: #fff; border-radius: 0;
}
.conditional input[type="text"] { max-width: 420px; }
.conditional input:focus, textarea:focus { border-color: var(--navy); outline: none; box-shadow: var(--focus); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--error); }
.chars { font-size: .8rem; color: var(--ink-soft); margin: 4px 0 0; text-align: right; }

/* ---------- Temas ASG ---------- */
.counter { display: inline-block; font-weight: 700; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; background: var(--lavender-soft); color: var(--navy); padding: 7px 14px; position: sticky; top: 8px; z-index: 2; box-shadow: 0 2px 6px rgba(12,12,78,.12); }
.counter.is-full { background: var(--orange); color: #fff; }
.limit-msg { color: var(--blk-social); font-weight: 600; font-size: .9rem; }
.topic-block { margin-top: 24px; }
.block-title { font-family: var(--f-body); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; padding-left: 10px; border-left: 4px solid currentColor; margin-bottom: 10px; }
.block-ambiental { color: var(--blk-ambiental); }
.block-social { color: var(--blk-social); }
.block-gobernanza { color: var(--blk-gobernanza); }
.block-especificos { color: var(--blk-especificos); }
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 8px; }
.topic { position: relative; display: block; }
.topic span {
  display: flex; align-items: center; gap: 12px; min-height: 54px; height: 100%;
  padding: 10px 14px; border: 1px solid var(--line); cursor: pointer; background: #fff; transition: all .15s;
}
.topic span::before { content: ""; flex: none; width: 20px; height: 20px; border: 2px solid var(--lavender); background: #fff center/14px no-repeat; }
.topic span:hover { border-color: var(--navy); }
.topic input:checked + span { border-color: var(--navy); background: var(--lavender-soft); font-weight: 600; color: var(--navy); }
.topic input:checked + span::before {
  background-color: var(--navy); border-color: var(--navy);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3 3 7-7' fill='none' stroke='%23fff' stroke-width='2.2'/%3E%3C/svg%3E");
}
.topic.is-disabled span { opacity: .45; cursor: not-allowed; }
.topic.is-disabled span:hover { border-color: var(--line); }

/* ---------- Nivel de gestión ---------- */
.scale-legend { list-style: none; padding: 14px 18px; margin: 0 0 20px; background: var(--bg); font-size: .9rem; display: grid; gap: 4px; border-left: 4px solid var(--orange); }
.scale-legend strong { display: inline-block; width: 1.4em; color: var(--orange); }
.ratings { display: grid; gap: 14px; }
.rating { border: 1px solid var(--line); padding: 14px 16px 16px; }
.rating.is-missing { border-color: var(--error); background: var(--error-soft); }
.rating > legend { font-family: var(--f-head); font-size: 1.1rem; font-weight: 500; color: var(--navy); padding: 0 6px; margin-left: -6px; }
.rating-options { display: grid; grid-template-columns: repeat(4, 1fr) 1.3fr; gap: 6px; margin-top: 4px; }
.rate { position: relative; }
.rate span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 2px;
  min-height: 66px; height: 100%; padding: 6px; border: 1px solid var(--line); cursor: pointer; background: #fff;
  font-size: .76rem; line-height: 1.25; color: var(--ink-soft); transition: all .15s;
}
.rate span b { font-family: var(--f-head); font-size: 1.3rem; font-weight: 500; color: var(--navy); }
.rate span:hover { border-color: var(--navy); }
.rate input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.rate input:checked + span b { color: #fff; }
.rate-ns span { font-style: italic; }
@media (max-width: 680px) {
  .rating-options { grid-template-columns: 1fr; }
  .rate span { flex-direction: row; justify-content: flex-start; text-align: left; min-height: 44px; gap: 10px; padding: 8px 12px; font-size: .85rem; }
  .rate span b { min-width: 1.2em; }
}

/* ---------- Mensajes / legales ---------- */
.message { text-align: center; margin-top: 48px; padding: 56px 24px; }
.message .check { width: 64px; height: 64px; margin-bottom: 12px; }
.message .check circle { fill: var(--lavender-soft); stroke: var(--navy); stroke-width: 2; }
.message .check path { fill: none; stroke: var(--orange); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.legal { padding-top: 32px; }
.legal > * { max-width: 860px; }
.legal h2 { font-size: 1.35rem; margin-top: 1.6em; }
.legal-updated { color: var(--ink-soft); font-size: .85rem; }
.table-wrap { overflow-x: auto; margin-bottom: 1em; }
.legal-table { width: 100%; border-collapse: collapse; background: #fff; font-size: .9rem; }
.legal-table th, .legal-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.legal-table th { background: var(--navy); color: #fff; font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- Pie (azul marino, como la web del Grupo) ---------- */
.site-footer { background: var(--navy); color: #fff; padding: 32px 0; font-size: .78rem; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-logo { width: 136px; height: auto; }
.footer-legal { text-align: right; }
.footer-copy { margin: 0 0 6px; opacity: .85; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 22px; justify-content: flex-end; }
.footer-links a, .footer-links .link-btn { color: #fff; font-weight: 600; text-decoration: none; }
.footer-links a:hover, .footer-links .link-btn:hover { color: var(--orange-logo); text-decoration: underline; }
@media (max-width: 680px) { .footer-inner { flex-direction: column; align-items: flex-start; } .footer-legal { text-align: left; } .footer-links { justify-content: flex-start; } }

/* ---------- Cookies ---------- */
.cookie-banner {
  position: fixed; left: 16px; bottom: 16px; z-index: 50; max-width: 480px; width: calc(100% - 32px);
  background: #fff; box-shadow: 0 6px 30px rgba(12, 12, 78, .25); border-top: 4px solid var(--orange);
}
.cookie-banner-inner { padding: 22px 24px; font-size: .85rem; }
.cookie-title { font-size: 1.3rem; margin-bottom: .4em; }
.cookie-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cookie-actions .btn { flex: 1 1 auto; }
.cookie-panel { border: 0; padding: 0; max-width: 560px; width: calc(100% - 32px); box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.cookie-panel::backdrop { background: rgba(12, 12, 78, .55); }
.cookie-panel-inner { padding: 26px 28px; font-size: .9rem; }
.cookie-cat { border: 1px solid var(--line); padding: 12px 14px; margin-bottom: 10px; }
.cookie-cat p { margin: 6px 0 0; color: var(--ink-soft); font-size: .85rem; }
.cookie-cat-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--navy); }
.cookie-always { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--ok); }
.cookie-policy-link { margin: 12px 0 0; font-size: .82rem; }
.switch { appearance: none; width: 44px; height: 24px; background: var(--line); border-radius: 12px; position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch:checked { background: var(--navy); }
.switch:checked::after { left: 23px; }
.switch:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Barra DEV (solo APP_ENV=dev) ---------- */
.devbar { position: fixed; right: 12px; bottom: 12px; z-index: 40; font: 600 12px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; }
.devbar summary { list-style: none; cursor: pointer; background: #c00; color: #fff; padding: 6px 12px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.devbar summary::-webkit-details-marker { display: none; }
.devbar-body { position: absolute; right: 0; bottom: 100%; margin-bottom: 6px; background: #222; padding: 8px; display: grid; gap: 2px; min-width: 200px; box-shadow: 0 4px 16px rgba(0,0,0,.35); }
.devbar a, .devbar button { color: #9fe; text-decoration: none; padding: 5px 8px; background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.devbar button { background: var(--orange); color: #fff; margin-bottom: 4px; }
.devbar a:hover { background: #444; color: #fff; }
.btn-dev { background: #222; color: #9fe; border-color: #222; }
.btn-dev:hover { background: #444; color: #fff; }
.dev-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .topbar, .site-header, .site-footer, .step-nav, .progress, .cookie-banner, .devbar { display: none; }
  .js .step { display: block; }
}
