@font-face {
  font-family: Figtree;
  src: url('/assets/fonts/figtree-latin.woff2') format('woff2');
  font-weight: 300 900;
  font-display: swap;
}

:root {
  --blue: #1d4ed8;
  --blue-dark: #1e3a8a;
  --blue-soft: #eff4ff;
  --ink: #0f172a;
  --muted: #526077;
  --line: #e2e8f0;
  --white: #fff;
  --error: #b42318;
  --radius: 14px;
}

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

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

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font: 400 1.0625rem/1.65 Figtree, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

[hidden] { display: none !important; }

a { color: var(--blue); text-underline-offset: 2px; }
a:hover { color: var(--blue-dark); }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; font-weight: 700; margin: 0; }
h1 { font-size: clamp(1.95rem, 5.5vw, 2.75rem); }
ul, ol { padding: 0; margin: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }

.wrap { width: 100%; max-width: 1040px; margin-inline: auto; padding-inline: 16px; }
.narrow { max-width: 820px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip { position: absolute; left: 8px; top: -60px; background: var(--white); padding: 8px 12px; z-index: 10; }
.skip:focus { top: 8px; }

/* Cabecera */
.site-header { border-bottom: 1px solid var(--line); background: var(--white); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; position: relative; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; font-size: 1.15rem; text-decoration: none; letter-spacing: -0.01em; }
.logo:hover { color: var(--ink); }
.menu-button { display: none; width: 44px; height: 44px; align-items: center; justify-content: center; background: none; border: 0; cursor: pointer; }
.menu { display: flex; gap: 24px; }
.menu a { display: block; padding: 6px 0; color: var(--muted); font-size: 0.98rem; font-weight: 500; text-decoration: none; }
.menu a:hover { color: var(--blue); }

/* Portada */
.hero { padding: clamp(40px, 9vw, 80px) 0 clamp(28px, 5vw, 44px); text-align: center; }
.hero h1 { max-width: 15em; margin-inline: auto; }
.lead { color: var(--muted); font-size: 1.15rem; margin: 14px auto 0; max-width: 40em; }
.hero .lead { max-width: 33em; }

.search {
  display: flex; align-items: center; gap: 10px; max-width: 540px; margin: 28px auto 0; padding: 0 16px;
  border: 1.5px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--white);
  box-shadow: 0 6px 20px -12px rgb(15 23 42 / 0.25);
}
.search:focus-within { border-color: var(--blue); }
.search svg { flex: none; }
.search input { flex: 1; min-width: 0; height: 54px; border: 0; outline: 0; background: none; color: var(--ink); font-size: 1.05rem; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search-status { min-height: 1.6em; margin: 12px 0 0; color: var(--muted); font-size: 0.95rem; }

.tool-group { margin-bottom: 36px; }
.tool-group h2 { font-size: 1.2rem; margin-bottom: 14px; }
.tool-group h2 a { color: var(--ink); text-decoration: none; }
.tool-group h2 a:hover { color: var(--blue); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card {
  display: flex; gap: 14px; align-items: flex-start; height: 100%; padding: 16px;
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card:hover { border-color: var(--blue); color: var(--ink); box-shadow: 0 8px 22px -16px rgb(29 78 216 / 0.6); }
.card-glyph {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px;
  background: var(--blue-soft); color: var(--blue); font-weight: 700;
}
.card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-text strong { font-weight: 600; line-height: 1.3; }
.card-text span { color: var(--muted); font-size: 0.95rem; line-height: 1.4; }

.promise { margin: 56px 0 64px; padding-top: 36px; border-top: 1px solid var(--line); }
.promise h2 { font-size: 1.35rem; margin-bottom: 20px; }
.promise ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 24px; }
.promise li { color: var(--muted); }
.promise strong { display: block; color: var(--ink); font-weight: 600; }

/* Migas y cabecera de página */
.breadcrumbs { padding-top: 16px; font-size: 0.92rem; color: var(--muted); }
.breadcrumbs ol { display: flex; flex-wrap: wrap; }
.breadcrumbs li:not(:last-child)::after { content: '/'; margin: 0 8px; color: var(--line); }
.breadcrumbs a { color: var(--muted); }
.page-head { padding: 18px 0 24px; }
.page-head .lead { margin-inline: 0; }

/* Calculadora */
.calc {
  display: grid; grid-template-columns: 1fr; border: 1px solid var(--line); border-radius: 18px;
  overflow: hidden; background: var(--white); box-shadow: 0 16px 40px -32px rgb(15 23 42 / 0.5);
}
.calc-inputs { padding: 20px 16px; min-width: 0; }
.calc-result { padding: 20px 16px; background: var(--blue-soft); min-width: 0; }
.calc fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

.modes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.mode { cursor: pointer; }
.mode input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mode span {
  display: block; padding: 8px 13px; min-height: 40px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); font-size: 0.93rem; font-weight: 500; line-height: 1.5;
}
.mode span:hover { border-color: var(--blue); }
.mode input:checked + span { background: var(--blue); border-color: var(--blue); color: var(--white); }
.mode input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

.field { margin-bottom: 16px; }
.field label, .row-field > span { display: block; margin-bottom: 5px; font-size: 0.95rem; font-weight: 600; }
.field small { display: block; margin-top: 5px; color: var(--muted); font-size: 0.87rem; line-height: 1.4; }

input[type='text'], input[type='date'], input[type='time'], select {
  display: block; width: 100%; min-height: 46px; padding: 9px 12px; background: var(--white);
  border: 1.5px solid var(--line); border-radius: 10px; font-size: 16px; font-variant-numeric: tabular-nums;
}
input:focus, select:focus { border-color: var(--blue); outline: 0; box-shadow: 0 0 0 3px rgb(29 78 216 / 0.14); }

.input-suffix { position: relative; display: block; }
.input-suffix input { padding-right: 52px; }
.input-suffix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 0.95rem; pointer-events: none; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  min-height: 38px; padding: 4px 13px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--white); color: var(--blue); font-size: 0.93rem; font-weight: 600; cursor: pointer;
}
.chip:hover { border-color: var(--blue); }

.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; cursor: pointer; font-size: 0.97rem; }
.check input { flex: none; width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--blue); }

.link-button, .soft-button {
  min-height: 42px; padding: 6px 2px; border: 0; background: none; color: var(--blue);
  font-size: 0.95rem; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.soft-button {
  padding: 6px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); text-decoration: none;
}
.soft-button:hover { border-color: var(--blue); }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

/* Filas de horas */
.day-row { padding: 10px 0; border-top: 1px solid var(--line); }
.day-row:first-of-type { border-top: 0; padding-top: 0; }
.day-name { margin: 0 0 6px; font-weight: 600; font-size: 0.95rem; }
.day-grid { display: grid; grid-template-columns: 1fr 1fr 74px; gap: 8px; }
.row-field > span { margin-bottom: 3px; font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.day-grid input { padding-inline: 8px; }

/* Filas de aparatos */
.appliance { padding: 14px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 12px; }
.appliance-head { display: flex; align-items: center; justify-content: space-between; min-height: 32px; margin-bottom: 6px; font-weight: 600; font-size: 0.95rem; }
.appliance-head .link-button { min-height: 32px; padding: 0; }
.appliance-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }

/* Resultado */
.result-label { margin: 0; color: var(--blue-dark); font-weight: 600; font-size: 0.97rem; overflow-wrap: anywhere; }
.result-value {
  margin: 2px 0 12px; color: var(--blue-dark); font-size: clamp(1.9rem, 6vw, 2.4rem); line-height: 1.15; font-weight: 700;
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.result-empty, .result-error { margin: 0; color: var(--muted); }
.result-error { color: var(--error); font-weight: 500; }
.result-rows { margin: 0; }
.result-rows div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-top: 1px solid rgb(29 78 216 / 0.15); }
.result-rows dt { color: var(--muted); font-size: 0.96rem; }
.result-rows dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.result-note { margin: 12px 0 0; color: var(--muted); font-size: 0.87rem; line-height: 1.45; }
.result-table { margin-top: 12px; max-height: 300px; overflow: auto; border-radius: 10px; background: var(--white); }
.result-table table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.result-table th, .result-table td { padding: 7px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.result-table th { position: sticky; top: 0; background: var(--white); font-weight: 600; }
.result-table th:first-child, .result-table td:first-child { text-align: left; }
.noscript { grid-column: 1 / -1; margin: 0; padding: 12px 16px; color: var(--error); }

/* Anuncios: espacio reservado para que la página no salte al cargar */
.ad { margin: 32px 0; text-align: center; }
.ad-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 0.75rem; letter-spacing: 0.04em; }
.ad ins, .ad-preview { min-height: 250px; }
.ad-preview { display: grid; place-items: center; border: 1.5px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 0.9rem; }
.ad:has(ins[data-ad-status='unfilled']) { display: none; }

/* Texto */
.prose { padding: 16px 0 8px; }
.prose h2 { font-size: 1.5rem; margin: 34px 0 10px; }
.prose h3 { font-size: 1.13rem; margin: 22px 0 6px; }
.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 22px; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin-bottom: 6px; }
.prose table { width: 100%; margin-bottom: 16px; border-collapse: collapse; font-size: 0.96rem; }
.prose th, .prose td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { font-weight: 600; }
.table-scroll { overflow-x: auto; }
.formula { margin: 0 0 14px; padding: 12px 14px; background: var(--blue-soft); border-radius: 10px; font-weight: 600; overflow-wrap: anywhere; }
.example { padding: 14px 16px; margin-bottom: 12px; border-left: 3px solid var(--blue); background: #f8fafc; border-radius: 0 10px 10px 0; }
.example h3 { margin-top: 0; }
.example p:last-child { margin-bottom: 0; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { padding: 13px 0; font-weight: 600; cursor: pointer; }
.faq details > div { padding-bottom: 8px; color: #334155; }
.disclaimer { margin-top: 24px; color: var(--muted); font-size: 0.93rem; }
.updated { color: var(--muted); font-size: 0.9rem; }
.pending { background: #fef3c7; padding: 0 4px; border-radius: 4px; }
.info-table { margin-top: 8px; font-size: 0.92rem; }
.info-table caption { text-align: left; font-weight: 700; padding-bottom: 6px; }
.info-table th { width: 32%; }
.consent-box { margin: 28px 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--blue-soft); }
.consent-box h2 { margin-top: 0; }
.consent-status { margin: 10px 0 0; min-height: 1.5em; color: var(--muted); font-size: 0.93rem; }

.related { padding-bottom: 48px; }
.related h2 { font-size: 1.25rem; margin: 24px 0 14px; }

/* Contacto */
.contact-form { max-width: 520px; }
.contact-form textarea {
  display: block; width: 100%; min-height: 150px; padding: 10px 12px; font: inherit; font-size: 16px;
  border: 1.5px solid var(--line); border-radius: 10px; resize: vertical;
}
.contact-form textarea:focus { border-color: var(--blue); outline: 0; box-shadow: 0 0 0 3px rgb(29 78 216 / 0.14); }
.primary-button {
  min-height: 46px; padding: 8px 22px; border: 0; border-radius: 10px; background: var(--blue);
  color: var(--white); font-weight: 600; cursor: pointer;
}
.primary-button:hover { background: var(--blue-dark); }

/* Pie */
.site-footer { margin-top: 24px; padding: 36px 0 20px; background: #f8fafc; border-top: 1px solid var(--line); font-size: 0.96rem; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }
.footer-title { margin: 0 0 8px; font-weight: 700; }
.site-footer li a { display: inline-block; padding: 4px 0; color: var(--muted); text-decoration: none; }
.site-footer li a:hover { color: var(--blue); text-decoration: underline; }
.footer-note { margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.88rem; }
.footer-note p { margin: 0 0 4px; }

@media (min-width: 760px) {
  .calc { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  .calc-inputs, .calc-result { padding: 24px; }
  .calc-result { position: relative; }
  .day-grid { grid-template-columns: 1fr 1fr 80px; }
}

@media (max-width: 759px) {
  .menu-button { display: inline-flex; margin: 0 -10px 0 auto; }
  .menu {
    display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 5; flex-direction: column;
    gap: 0; padding: 6px 16px 12px; background: var(--white); border-bottom: 1px solid var(--line);
  }
  .menu.is-open { display: flex; }
  .menu a { padding: 11px 0; font-size: 1.02rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
