/* Cuánto España — one stylesheet, mobile first, no web fonts. */

:root {
  --bg: #ffffff;
  --surface: #f5f6f8;
  --text: #1a1d23;
  --muted: #4d5562;
  --border: #d5d9e0;
  --accent: #0b57d0;
  --accent-text: #ffffff;
  --good: #136c34;
  --good-bg: #e7f4ec;
  --warn: #7a4b00;
  --warn-bg: #fff3dc;
  --bad: #a1251b;
  --bad-bg: #fdecea;
  --focus: #ffbf47;
  --radius: 10px;
  --max: 46rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1e2128;
    --text: #eceef2;
    --muted: #b3bac6;
    --border: #3a3f4a;
    --accent: #8ab4ff;
    --accent-text: #0d1117;
    --good: #7fd69c;
    --good-bg: #16301f;
    --warn: #f3c66b;
    --warn-bg: #33280f;
    --bad: #ff9a90;
    --bad-bg: #3a1916;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

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

.visually-hidden {
  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-link {
  position: absolute; left: 1rem; top: -3rem;
  background: var(--accent); color: var(--accent-text);
  padding: 0.5rem 0.9rem; border-radius: var(--radius); z-index: 10;
}
.skip-link:focus { top: 0.5rem; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1rem; }

/* Header */
.site-header { border-bottom: 1px solid var(--border); }
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.5rem 1rem; padding-top: 0.75rem; padding-bottom: 0.75rem;
}
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.lang-switch {
  display: inline-block; padding: 0.3rem 0.7rem; border: 1px solid var(--border);
  border-radius: 999px; text-decoration: none; font-size: 0.95rem;
}

/* Main */
main { padding: 1.5rem 0 2.5rem; }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 0.5rem; }
h2 { font-size: 1.3rem; margin: 2rem 0 0.75rem; }
h3 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; }
.lead { color: var(--muted); margin-top: 0; }

/* Calculator list on home page */
.calc-list { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: 0.75rem; }
.calc-list a {
  display: block; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); text-decoration: none; color: var(--text);
}
.calc-list a:hover { border-color: var(--accent); }
.calc-list strong { display: block; color: var(--accent); font-size: 1.1rem; }
.calc-list span { color: var(--muted); }

/* Form */
.calc-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.field { margin: 0 0 1rem; }
.field > label, fieldset > legend { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.hint { display: block; color: var(--muted); font-size: 0.92rem; margin: -0.1rem 0 0.35rem; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; min-width: 0; }
.choices { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.choices label, .field > label.check-label { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 400; }
input[type="number"], input[type="date"], select {
  width: 100%; max-width: 22rem; min-height: 2.75rem; padding: 0.5rem 0.65rem;
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px;
}
input[type="radio"], input[type="checkbox"] { width: 1.25rem; height: 1.25rem; accent-color: var(--accent); }
.account-row { border-top: 1px dashed var(--border); padding-top: 0.75rem; margin-top: 0.25rem; }
.account-row legend { font-weight: 600; }
.grid-2 { display: grid; gap: 0 1rem; }
@media (min-width: 34rem) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.button {
  display: inline-block; min-height: 2.75rem; padding: 0.55rem 1.3rem;
  background: var(--accent); color: var(--accent-text);
  border: 0; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer;
}

[hidden] { display: none !important; }

/* Result */
.result { margin-top: 1.5rem; padding: 1.1rem 1rem; border: 2px solid var(--accent); border-radius: var(--radius); }
.result:focus { outline: 3px solid var(--focus); }
.result > h2 { margin-top: 0; }
.answer { font-size: 1.6rem; font-weight: 700; line-height: 1.25; margin: 0.25rem 0 0.25rem; }
.answer--good { color: var(--good); }
.answer--warn { color: var(--warn); }
.answer--bad { color: var(--bad); }
.answer-sub { margin: 0 0 1rem; color: var(--muted); }
.answer--prompt { font-size: 1.2rem; font-weight: 600; color: var(--text); }
.deadline { font-size: 1.3rem; font-weight: 700; margin: 0.25rem 0; }
.note { background: var(--warn-bg); color: var(--text); border-radius: 8px; padding: 0.6rem 0.8rem; }
.compare { background: var(--surface); border-radius: 8px; padding: 0.6rem 0.8rem; }

.breakdown { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.breakdown th, .breakdown td { padding: 0.5rem 0.25rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.breakdown th { text-align: left; font-weight: 400; }
.breakdown td { text-align: right; white-space: nowrap; }
.breakdown tr.total th, .breakdown tr.total td { font-weight: 700; }
.breakdown tr.sub th { padding-left: 1rem; color: var(--muted); }
.row-hint { display: block; color: var(--muted); font-size: 0.88rem; }

.notes { padding-left: 1.2rem; }
.notes li { margin-bottom: 0.4rem; }

.checklist { list-style: none; padding: 0; }
.check { position: relative; padding: 0.35rem 0 0.35rem 2rem; }
.check::before { position: absolute; left: 0; top: 0.3rem; width: 1.5rem; text-align: center; font-weight: 700; }
.check--ok::before { content: "✓"; color: var(--good); }
.check--fail::before { content: "✗"; color: var(--bad); }
.check--na::before { content: "–"; color: var(--muted); }
.check--unknown::before { content: "?"; color: var(--warn); }
.check em { color: var(--muted); font-style: normal; }

.pill { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-weight: 700; font-size: 0.92rem; }
.pill--must { background: var(--bad-bg); color: var(--bad); }
.pill--no { background: var(--good-bg); color: var(--good); }

/* Explanatory text */
.explain { margin-top: 2rem; }
.explain p, .explain li { max-width: 40rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 1.25rem 0 2rem; color: var(--muted); font-size: 0.95rem; }
.disclaimer { color: var(--text); font-weight: 600; }
.footer-brand { color: var(--text); font-weight: 700; margin-bottom: 0.25rem; }
.site-footer ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }

/* Tests page */
.test-pass { color: var(--good); }
.test-fail { color: var(--bad); font-weight: 700; }
