/* Calculadora de Pintura — estilos. Móvil primero, sin fuentes externas. */
:root {
  --bg: #fbf7f0;
  --surface: #ffffff;
  --ink: #1f2933;
  --muted: #56626d;
  --line: #e4dccd;
  --brand: #0b6b74;
  --brand-dark: #084f56;
  --brand-soft: #e3f1f2;
  --accent: #c0391f;
  --accent-dark: #9f2e18;
  --sun: #f4b942;
  --sun-soft: #fff3d6;
  --danger: #b3261e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31, 41, 51, 0.06), 0 4px 14px rgba(31, 41, 51, 0.05);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body { margin: 0; font: 17px/1.6 var(--font); color: var(--ink); background: var(--bg); }
[hidden] { display: none !important; }
img, svg { max-width: 100%; height: auto; }
a { color: var(--brand-dark); text-underline-offset: 2px; }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; box-shadow: 0 0 0 5px var(--brand-dark); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: 10px 14px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); font-weight: 400; }
.print-only { display: none; }

/* Cabecera */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; padding-top: 10px; padding-bottom: 6px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.12rem; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand svg { width: 34px; height: 34px; flex: none; }
.main-nav { flex: 1 1 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.main-nav::-webkit-scrollbar { display: none; }
.main-nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0 0 4px; white-space: nowrap; }
.main-nav a { display: block; padding: 8px 12px; border-radius: 999px; text-decoration: none; color: var(--ink); font-size: 0.95rem; }
.main-nav a:hover { background: var(--brand-soft); }
.main-nav a[aria-current='page'] { background: var(--brand); color: #fff; }
@media (min-width: 900px) { .main-nav { flex: 1 1 auto; } .main-nav ul { justify-content: flex-end; } }

/* Tipografía de contenido */
main { display: block; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.015em; margin: 1.6em 0 0.5em; }
h1 { font-size: clamp(1.75rem, 5.5vw, 2.6rem); margin-top: 0; }
h2 { font-size: clamp(1.35rem, 3.8vw, 1.75rem); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }
p, ul, ol, dl { margin: 0 0 1em; }
.prose { max-width: 720px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: 0.35em; }
.lead { font-size: 1.15rem; color: var(--muted); }
.hero { padding-top: 26px; padding-bottom: 14px; }
.hero p.lead { max-width: 640px; margin-bottom: 0.4em; }
.breadcrumb { font-size: 0.9rem; color: var(--muted); margin-top: 14px; }
.breadcrumb a { color: var(--muted); }
.formula { background: var(--brand-soft); border-left: 4px solid var(--brand); padding: 10px 14px; border-radius: 6px; font-weight: 600; overflow-x: auto; }
.callout { background: var(--sun-soft); border-left: 4px solid var(--sun); padding: 10px 14px; border-radius: 6px; }
.note { font-size: 0.93rem; color: var(--muted); }
.note.warn { color: #7a4b00; background: var(--sun-soft); padding: 8px 12px; border-radius: 8px; }
.pending { background: #fde8e6; border: 1px dashed var(--danger); color: #7d1a14; padding: 1px 6px; border-radius: 4px; font-weight: 600; }
.legal-banner { background: #fde8e6; border: 1px solid var(--danger); color: #7d1a14; padding: 12px 14px; border-radius: 10px; margin: 0 0 1.4em; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px; border-radius: 12px; border: 2px solid transparent; font: 600 1rem/1.2 var(--font); cursor: pointer; text-decoration: none; text-align: center; transition: background 0.15s, color 0.15s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--brand-dark); border-color: var(--brand); }
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand-dark); }
.btn-quiet { background: transparent; color: var(--muted); text-decoration: underline; }
.btn-quiet:hover { color: var(--ink); }
.btn-sm { min-height: 40px; padding: 6px 14px; font-size: 0.93rem; }
.btn-lg { min-height: 56px; font-size: 1.15rem; flex: 1 1 260px; }
.btn-block { width: 100%; }
.btn-disabled { background: #efe9dc; color: var(--muted); border-color: var(--line); cursor: not-allowed; font-weight: 500; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* Calculadora */
.calc-shell { margin-top: 10px; margin-bottom: 30px; }
#calculadora:not(.ready)::before { content: 'Cargando la calculadora…'; display: block; padding: 30px 0; color: var(--muted); }
.calc-form, .results { max-width: 780px; margin: 0 auto; }
.step { margin: 0 0 22px; }
.step > h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 1.25rem; }
.num { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 1rem; flex: none; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin: 0 0 14px; }
.room-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.room-head h3 { margin: 0; font-size: 1.1rem; }
.field { margin: 0 0 14px; border: 0; padding: 0; min-width: 0; }
.field > label, fieldset.field > legend { display: block; font-weight: 600; margin-bottom: 6px; padding: 0; }
input[type='text'], select { width: 100%; min-height: 50px; padding: 10px 12px; font: 1.05rem/1.2 var(--font); color: var(--ink); background: #fff; border: 2px solid #c9bfae; border-radius: 10px; }
select { appearance: auto; }
input[type='text']:focus, select:focus { border-color: var(--brand); }
input[aria-invalid='true'] { border-color: var(--danger); background: #fff6f5; }
.input-unit { position: relative; }
.input-unit input { padding-right: 52px; }
.unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; font-size: 0.95rem; }
.hint { font-size: 0.9rem; color: var(--muted); margin: 6px 0 0; }
.field-error { color: var(--danger); font-size: 0.92rem; font-weight: 600; margin: 6px 0 0; }
.grid-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0 12px; }
.grid-fields.one { grid-template-columns: 1fr; max-width: 420px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; min-height: 48px; padding: 8px 18px; border: 2px solid #c9bfae; border-radius: 999px; background: #fff; font-weight: 600; cursor: pointer; }
.chip input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip input:focus-visible + span { outline: 3px solid var(--sun); outline-offset: 2px; box-shadow: 0 0 0 5px var(--brand-dark); }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 2px solid var(--brand); border-radius: 12px; overflow: hidden; margin: 4px 0 14px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 48px; padding: 6px 8px; font-weight: 600; font-size: 0.95rem; color: var(--brand-dark); }
.seg input:checked + span { background: var(--brand); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--sun); outline-offset: -3px; }
.check { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; padding: 6px 0; cursor: pointer; font-weight: 600; }
.check input { width: 24px; height: 24px; margin: 2px 0 0; flex: none; accent-color: var(--brand); }
.openings { background: #faf6ee; border-radius: 10px; padding: 12px; margin: 4px 0 12px; }
.openings h4 { margin: 0 0 8px; font-size: 1rem; }
.opening-list { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 10px; }
.opening { display: grid; grid-template-columns: 1fr 1fr 80px; gap: 0 10px; align-items: end; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 10px 2px; }
.opening .opening-kind { grid-column: 1 / -1; }
.opening-remove { grid-column: 1 / -1; justify-self: end; margin-bottom: 6px; }
@media (min-width: 640px) {
  .opening { grid-template-columns: 110px 1fr 1fr 80px auto; }
  .opening .opening-kind { grid-column: auto; }
  .opening-remove { grid-column: auto; margin-bottom: 14px; }
}
.room-summary { margin: 8px 0 0; padding: 10px 12px; background: var(--brand-soft); border-radius: 10px; font-size: 0.95rem; }
.format-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.format { display: grid; grid-template-columns: 90px 1fr; gap: 0 12px; align-items: center; border-bottom: 1px solid var(--line); padding: 4px 0; }
.format .field { margin-bottom: 6px; }
.format .field > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.format-custom { grid-template-columns: 1fr 1fr; align-items: end; }
.format-custom .field > label { position: static; width: auto; height: auto; clip: auto; font-size: 0.9rem; }
.error-summary { background: #fde8e6; border: 2px solid var(--danger); color: #7d1a14; border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; }
.error-summary ul { margin: 6px 0 0; padding-left: 1.2em; }
.error-summary a { color: inherit; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 18px 0; }

/* Resultados */
.results h2 { margin-top: 0; }
.results h3 { margin-top: 1.8em; }
.hero-grid { display: grid; gap: 12px; grid-template-columns: 1fr; margin-bottom: 8px; }
@media (min-width: 560px) { .hero-grid { grid-template-columns: 1fr 1fr; } }
.hero-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.hero-card.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.hero-card.muted-card { background: #f4efe4; box-shadow: none; }
.hero-label { font-size: 0.88rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.85; }
.hero-value { font-size: 2rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.hero-value.sm { font-size: 1.45rem; }
.hero-sub { font-size: 0.92rem; opacity: 0.9; }
.summary { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px; }
.summary > div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.summary > div:last-child { border-bottom: 0; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; text-align: right; font-weight: 600; }
.summary .total dt { color: var(--ink); font-weight: 700; }
.summary .total { background: var(--sun-soft); margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th[scope='row'], thead th:first-child { text-align: left; }
thead th { background: #f4efe4; font-size: 0.85rem; }
tfoot th, tfoot td { font-weight: 700; background: var(--sun-soft); border-bottom: 0; }
tr.hl th, tr.hl td { background: var(--brand-soft); font-weight: 700; }
.tags { display: block; font-weight: 400; font-size: 0.8rem; color: var(--muted); }
.table-wrap td, .table-wrap th { white-space: nowrap; }

/* Páginas de contenido */
.cols { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .cols { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .cols.three { grid-template-columns: repeat(3, 1fr); } }
.link-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.link-card:hover { border-color: var(--brand); }
.link-card strong { display: block; color: var(--brand-dark); margin-bottom: 2px; }
.link-card span { font-size: 0.93rem; color: var(--muted); }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin: 0 0 8px; padding: 0 14px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 12px 0; min-height: 44px; }
.faq details[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.example { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px 6px; margin: 0 0 1em; }
.example h3, .example h4 { margin-top: 0.9em; }
.section { padding-top: 8px; padding-bottom: 12px; }

/* Afiliación y anuncios */
.affiliate { background: #faf6ee; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 26px 0; }
.affiliate h3 { margin: 0 0 4px; }
.affiliate .disclosure { font-size: 0.88rem; color: var(--muted); margin: 0 0 12px; }
.aff-grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .aff-grid { grid-template-columns: 1fr 1fr; } }
.aff-item { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.aff-item h4 { margin: 0 0 2px; font-size: 1rem; }
.aff-item p { font-size: 0.9rem; color: var(--muted); margin: 0 0 8px; }
.aff-item .btn-row .btn { min-height: 40px; font-size: 0.9rem; padding: 6px 12px; }
.badge { display: inline-block; font-size: 0.72rem; background: var(--sun-soft); color: #7a4b00; border-radius: 6px; padding: 1px 6px; font-weight: 700; margin-left: 4px; }
.ad-slot { margin: 24px auto; max-width: 780px; text-align: center; min-height: 100px; }
.ad-preview { border: 2px dashed #b9ae9a; border-radius: 10px; color: var(--muted); font-size: 0.85rem; display: grid; place-items: center; }

/* Pie */
.site-footer { margin-top: 40px; background: #17313a; color: #d7e4e6; padding: 28px 0; font-size: 0.93rem; }
.site-footer a { color: #fff; }
.site-footer ul { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 0; margin: 0 0 14px; }
.site-footer .btn-link { background: none; border: 0; color: #fff; text-decoration: underline; font: inherit; cursor: pointer; padding: 0; }
.site-footer p { margin: 0 0 10px; max-width: 760px; }

/* Aviso de cookies */
.cookie-banner { position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; background: #fff; border-top: 3px solid var(--brand); box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.18); max-height: 92vh; overflow-y: auto; }
.cookie-inner { max-width: 860px; margin: 0 auto; padding: 14px 16px 16px; }
.cookie-inner h2 { margin: 0 0 4px; font-size: 1.15rem; }
.cookie-inner p { font-size: 0.93rem; margin: 0 0 10px; }
.cookie-prefs { margin: 0 0 10px; }
.cookie-prefs .check { font-weight: 400; font-size: 0.93rem; min-height: 0; }
.cookie-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cookie-actions .btn { flex: 1 1 150px; }

/* Impresión y PDF del navegador: solo resultados */
@media print {
  body { background: #fff; font-size: 11pt; }
  .site-header, .site-footer, .cookie-banner, .ad-slot, .no-print, .skip, .hero, .prose, .breadcrumb, .section, .calc-form, #calc-form-wrap, .affiliate, .affiliate-slot, [data-print='hide'] { display: none !important; }
  .print-only { display: block; }
  .print-head { border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 10px; font-size: 12pt; }
  .results { max-width: none; }
  .results[hidden] { display: none !important; }
  .hero-card, .hero-card.primary { background: #fff !important; color: #000 !important; border: 1px solid #000; box-shadow: none; }
  .summary, .table-wrap, .card { box-shadow: none; border-color: #999; }
  .table-wrap { overflow: visible; }
  th, td { white-space: normal; padding: 4px 6px; }
  tr, .hero-card, .summary > div { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}
