/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #FBF3E7;
  --bg-card: #FFFFFF;
  --paper: #FFFDF8;
  --text: #2B2013;
  --text-soft: #6B5D48;
  --line: #E6D8C0;
  --line-soft: #EFE4CE;

  --accent: #F2994A;
  --accent-strong: #B5560C;
  --accent-soft: #FDECD3;
  --accent-dark: #D97B2B;

  /* Colores de serie para la gráfica: identifican categorías, no valoran */
  --serie-consumo: #D97B2B;
  --serie-produccion: #2F7D8C;

  /* Solo para errores reales del formulario */
  --bad: #C0392B;
  --bad-bg: #FCEAE7;
  --bad-line: #ECC0B8;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --display: "Manrope", var(--sans);
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  overscroll-behavior-y: none;
}
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; line-height: 1.1; letter-spacing: -0.01em; color: var(--text); }
ul, ol { list-style: none; padding: 0; }
::selection { background: var(--accent-soft); color: var(--accent-strong); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* =============================================================
   3. Utilities
   ============================================================= */
.container { max-width: 760px; margin-inline: auto; padding-inline: 1.25rem; }

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--text); color: #fff;
  z-index: 9999; border-radius: 8px; font-weight: 600;
  transition: top .2s var(--ease-out);
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   4. Header
   ============================================================= */
.site-header { padding-block: 1.1rem; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.brand {
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--display); font-weight: 800; font-size: 1.15rem;
  color: var(--accent-strong);
}

/* =============================================================
   5. Hero
   ============================================================= */
.hero { padding-block: 1rem 1.5rem; text-align: center; }
.hero h1 {
  font-size: clamp(1.9rem, 5.5vw, 2.7rem);
  font-weight: 800;
  max-width: 18ch;
  margin-inline: auto;
}
.hero .subtitle {
  margin-top: .85rem;
  font-size: 1.08rem;
  color: var(--text-soft);
  max-width: 46ch;
  margin-inline: auto;
}

/* =============================================================
   6. Tool card
   ============================================================= */
.tool-wrap { padding-bottom: 1.5rem; }

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 12px 32px -18px rgba(43, 32, 19, 0.25);
}
@media (min-width: 540px) { .tool-card { padding: 2rem; } }

.step-question {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.3rem;
  text-align: center;
  margin-bottom: 1.2rem;
}

.solar-choice { display: grid; gap: .75rem; }
@media (min-width: 540px) { .solar-choice { grid-template-columns: 1fr 1fr; } }

.btn-choice {
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  padding: 1.4rem 1rem;
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
  font-weight: 700;
  font-size: 1.02rem;
  text-align: center;
  transition: border-color .18s var(--ease-out), transform .18s var(--ease-out), background .18s var(--ease-out);
}
.btn-choice:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-2px); }
.btn-choice svg { color: var(--accent-strong); }

.link-change-solar {
  display: inline-block;
  font-size: .88rem;
  color: var(--text-soft);
  margin-bottom: 1.25rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-change-solar span { font-weight: 700; color: var(--text); }

.field-group {
  border: 0;
  padding: 0;
  margin-bottom: 1.4rem;
}
.field-group legend {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.05rem;
  margin-bottom: .9rem;
  padding: 0;
  color: var(--accent-strong);
}

.field { margin-bottom: 1.1rem; }
.field label {
  display: block;
  font-weight: 600;
  font-size: .95rem;
  margin-bottom: .4rem;
}
.field-optional { font-weight: 500; color: var(--text-soft); }
.field input {
  width: 100%;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  padding: .8rem .9rem;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--text);
  transition: border-color .15s var(--ease-out);
}
.field input:focus { border-color: var(--accent); }
.field input::placeholder { color: var(--line); font-weight: 500; }

.help { margin-top: .5rem; }
.help summary {
  cursor: pointer;
  font-size: .88rem;
  font-weight: 600;
  color: var(--accent-strong);
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.help summary::before { content: "💡"; font-size: .9em; }
.help summary::-webkit-details-marker { display: none; }
.help-body {
  margin-top: .7rem;
  padding: .9rem;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}
.help-body p { font-size: .92rem; margin-bottom: .7rem; color: var(--text); }
.help-img { width: 100%; max-width: 280px; margin-inline: auto; border-radius: 8px; }

.form-error {
  background: var(--bad-bg);
  border: 1px solid var(--bad-line);
  color: var(--bad);
  padding: .8rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .92rem;
  margin-bottom: 1rem;
}

.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: .55rem;
  width: 100%;
  padding: 1rem 1.2rem;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 1.08rem;
  border-radius: var(--radius-md);
  transition: background .18s var(--ease-out), transform .12s var(--ease-out);
}
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  width: 100%;
  padding: .9rem 1.1rem;
  background: var(--paper);
  border: 2px solid var(--line);
  color: var(--text);
  font-weight: 700;
  border-radius: var(--radius-md);
  transition: border-color .18s var(--ease-out);
}
.btn-secondary:hover { border-color: var(--accent); }

/* =============================================================
   7. Result card
   ============================================================= */
.result-card {
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.4rem;
  background: var(--accent-soft);
  border: 2px solid var(--line);
  margin-bottom: 1.4rem;
  text-align: center;
}
.result-brand {
  font-family: var(--display);
  font-weight: 800;
  font-size: .82rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent-strong);
  margin-bottom: .9rem;
}
.result-row {
  display: flex; align-items: baseline; justify-content: space-between;
  padding-block: .5rem;
  border-bottom: 1px dashed var(--line);
}
.result-row:last-of-type { border-bottom: 0; }
.result-label { font-weight: 600; color: var(--text-soft); font-size: .98rem; }
.result-value { font-family: var(--display); font-weight: 800; font-size: 1.4rem; }

/* Gráfica comparativa — colores de categoría, nunca de "bien" o "mal" */
.result-chart {
  margin-top: 1.1rem;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  text-align: left;
}
.chart-bar {
  display: grid;
  grid-template-columns: 5.5rem 1fr auto;
  align-items: center;
  gap: .6rem;
  margin-bottom: .7rem;
}
.chart-bar:last-of-type { margin-bottom: 0; }
.chart-bar-label { font-size: .85rem; font-weight: 600; color: var(--text-soft); }
.chart-bar-track {
  height: 22px;
  background: var(--line-soft);
  border-radius: 6px;
  overflow: hidden;
}
.chart-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 6px;
  transition: width .5s var(--ease-out);
}
.chart-bar-fill--consumo { background: var(--serie-consumo); }
.chart-bar-fill--produccion { background: var(--serie-produccion); }
.chart-bar-value {
  font-family: var(--display);
  font-weight: 800;
  font-size: .95rem;
  white-space: nowrap;
}
.chart-note {
  margin-top: .9rem;
  padding-top: .7rem;
  border-top: 1px dashed var(--line);
  font-size: .9rem;
  color: var(--text-soft);
  font-weight: 600;
}

/* Datos de contexto */
.result-facts {
  margin-top: 1rem;
  display: grid;
  gap: .45rem;
  text-align: left;
}
.result-facts > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: .88rem;
}
.result-facts dt { color: var(--text-soft); }
.result-facts dd { margin: 0; font-weight: 700; }

.result-foot { margin-top: 1rem; font-size: .78rem; color: var(--text-soft); }

.result-actions { display: grid; gap: .7rem; }
.link-reset {
  text-align: center;
  font-size: .92rem;
  color: var(--text-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: .3rem;
}

.privacy-badge {
  margin-top: 1.2rem;
  font-size: .85rem;
  color: var(--text-soft);
  text-align: center;
}

/* =============================================================
   8. Ad slots
   ============================================================= */
.ad-slot {
  min-height: 90px;
  margin-block: 1.6rem;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-soft);
  font-size: .8rem;
  letter-spacing: .08em;
  font-weight: 700;
  background: repeating-linear-gradient(135deg, var(--line-soft), var(--line-soft) 10px, transparent 10px, transparent 20px);
}
.ad-slot--leaderboard { min-height: 100px; }
.ad-slot--incontent { min-height: 250px; }

.corner-ad {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 500;
  width: 200px;
  background: var(--bg-card);
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-md);
  padding: .9rem 1rem 1rem;
  box-shadow: 0 12px 30px -14px rgba(43,32,19,.35);
}
.corner-ad-close {
  position: absolute; top: .35rem; right: .5rem;
  font-size: 1.1rem; line-height: 1; color: var(--text-soft);
  width: 24px; height: 24px;
}
.corner-ad-tag { font-size: .7rem; font-weight: 800; letter-spacing: .08em; color: var(--accent-strong); }
.corner-ad p { font-size: .85rem; color: var(--text-soft); margin-top: .3rem; }

.ad-dialog {
  border: 0; border-radius: var(--radius-lg);
  padding: 0; max-width: 340px; width: 90vw;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,.4);
}
.ad-dialog::backdrop { background: rgba(43,32,19,.45); }
.ad-dialog-body {
  min-height: 200px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
  padding: 2rem 1.5rem;
  background: repeating-linear-gradient(135deg, var(--line-soft), var(--line-soft) 10px, var(--bg) 10px, var(--bg) 20px);
}
.ad-dialog-tag { font-weight: 800; letter-spacing: .08em; color: var(--accent-strong); font-size: .85rem; }
.ad-dialog-close {
  position: absolute; top: .6rem; right: .7rem;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--bg-card); font-size: 1.2rem; line-height: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

/* =============================================================
   9. Content sections
   ============================================================= */
section.container { padding-block: 1.75rem; }
.how h2, .seo-text h2, .audiences h2, .faq h2 {
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  text-align: center;
  margin-bottom: 1.4rem;
}

.how-steps { display: grid; gap: 1.4rem; }
@media (min-width: 720px) { .how-steps { grid-template-columns: repeat(3, 1fr); } }
.how-steps li { text-align: center; }
.how-steps svg { margin-inline: auto; color: var(--accent-strong); margin-bottom: .7rem; }
.how-steps h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.how-steps p { font-size: .92rem; color: var(--text-soft); }

.seo-text { max-width: 680px; }
.seo-text p { margin-bottom: 1rem; color: var(--text-soft); }
.seo-text strong { color: var(--text); }

.audiences-grid { display: grid; gap: 1rem; }
@media (min-width: 640px) { .audiences-grid { grid-template-columns: 1fr 1fr; } }
.audience-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.2rem;
}
.audience-card h3 { font-size: 1rem; margin-bottom: .4rem; color: var(--accent-strong); }
.audience-card p { font-size: .92rem; color: var(--text-soft); }

.faq details {
  border-bottom: 1px solid var(--line);
  padding-block: .9rem;
}
.faq summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.3rem; color: var(--accent-strong); flex-shrink: 0; }
.faq details[open] summary::after { content: "–"; }
.faq p { margin-top: .6rem; color: var(--text-soft); font-size: .95rem; }

.legal-note { padding-block: 1rem 2rem; }
.legal-note p { font-size: .8rem; color: var(--text-soft); text-align: center; }

/* =============================================================
   10. Footer
   ============================================================= */
.site-footer { border-top: 1px solid var(--line); padding-block: 1.4rem; margin-top: 1rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; justify-content: space-between; font-size: .85rem; color: var(--text-soft); }
.footer-links { display: flex; gap: 1rem; }
.footer-links a:hover { text-decoration: underline; }

/* =============================================================
   11. Simple pages (privacidad / aviso-legal)
   ============================================================= */
.simple-page { max-width: 680px; margin-inline: auto; padding: 2rem 1.25rem 3rem; }
.simple-page h1 { font-size: 1.8rem; margin-bottom: 1rem; }
.simple-page h2 { font-size: 1.2rem; margin-top: 1.6rem; margin-bottom: .6rem; }
.simple-page p, .simple-page li { color: var(--text-soft); margin-bottom: .8rem; }
.simple-page a { color: var(--accent-strong); text-decoration: underline; }
.back-link { display: inline-block; margin-bottom: 1.5rem; font-weight: 600; color: var(--accent-strong); }

/* =============================================================
   12. Responsive
   ============================================================= */
@media (min-width: 540px)  { .container { padding-inline: 1.75rem; } }
@media (min-width: 960px)  { body { font-size: 18px; } }
