/* es-factura — calculadora IVA/IRPF: design system.
   Paleta teal + crema tomada del diseño "Moderna" del pack de plantillas
   (assets/es-factura/mockups/closeup-moderna.html, #0F766E) — una sola
   marca coherente para la herramienta, un solo color de acento (disciplina
   de diseño ya usada en el pack: un acento por producto).
   Sin frameworks, sin build step, sin peticiones externas. */

:root {
  --ink: #1f2933;
  --ink-soft: #52606d;
  --ink-faint: #829ab1;
  --paper: #faf7f2;
  --paper-alt: #f1ede2;
  --line: #e2dbc9;
  --accent: #0f766e;
  --accent-deep: #0b5c56;
  --accent-soft: #e7f3f1;
  --accent-wash: #f0f9f7;
  --white: #ffffff;
  --err: #a8442f;
  --ok: #2f7a4c;
  --shadow: 0 20px 60px -30px rgba(15, 30, 28, 0.35);
  --shadow-sm: 0 8px 24px -14px rgba(15, 30, 28, 0.35);
  --radius: 18px;
  --radius-sm: 10px;
  --font-display: "Trebuchet MS", "Segoe UI", Calibri, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --container: 1080px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; color: var(--ink); margin: 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent-deep);
}
.eyebrow::before { content: ""; width: 26px; height: 2px; background: var(--accent); }

.h1 { font-size: clamp(2rem, 3.4vw + 1rem, 3.2rem); line-height: 1.12; }
.h2 { font-size: clamp(1.7rem, 2vw + 1rem, 2.3rem); line-height: 1.18; }
.h3 { font-size: clamp(1.15rem, 0.8vw + 1rem, 1.4rem); line-height: 1.3; }
.lede { font-size: clamp(1.02rem, 0.3vw + 1rem, 1.15rem); color: var(--ink-soft); max-width: 62ch; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 26px; border-radius: 999px; font-size: 15px; font-weight: 700;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease, border-color .18s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--white); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-deep); transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent-deep); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

/* ---------- nav ---------- */
.site-nav { position: sticky; top: 0; z-index: 40; background: rgba(250, 247, 242, .92); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--line); }
.site-nav .container { display: flex; align-items: center; justify-content: space-between; height: 74px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 20px; font-weight: 800; color: var(--accent-deep); }
.brand svg { width: 24px; height: 24px; color: var(--accent); }
.brand .tagline { display: block; font-family: var(--font-body); font-size: 11px; font-weight: 500; color: var(--ink-faint); letter-spacing: 0; margin-top: 1px; }
.nav-links { display: flex; align-items: center; gap: 30px; font-size: 14.5px; color: var(--ink-soft); font-weight: 600; }
.nav-links a:hover { color: var(--accent-deep); }
.nav-cta { display: flex; align-items: center; gap: 16px; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 10px; width: 40px; height: 40px; align-items: center; justify-content: center; }
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after { content: ""; display: block; width: 18px; height: 1.5px; background: var(--ink); position: relative; transition: transform .2s ease, opacity .2s ease; }
.nav-toggle span::before { position: absolute; top: -6px; }
.nav-toggle span::after { position: absolute; top: 6px; }

/* ---------- sections ---------- */
.section { padding: 84px 0; }
.section-alt { background: var(--paper-alt); }
.section-tight { padding: 56px 0; }
.section-head { max-width: 640px; margin: 0 auto 44px; display: flex; flex-direction: column; gap: 14px; text-align: center; align-items: center; }

/* ---------- hero ---------- */
.hero { padding: 56px 0 20px; }
.hero .container { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.hero .lede { margin: 0 auto; }
.hero-badges { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--accent-deep); background: var(--accent-soft); padding: 6px 14px; border-radius: 999px; }

/* ---------- calculator ---------- */
.calc-wrap { margin-top: 34px; min-width: 0; }
.calc-card {
  background: var(--white); border: 1px solid var(--line); border-radius: 24px;
  box-shadow: var(--shadow); padding: 36px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 36px; text-align: left;
}
/* Grid items default to min-width:auto, which refuses to shrink below the
   min-content width of an <input>/<select> — on narrow viewports that pushes
   the card past the edge of the screen (real defect caught in build
   self-check, evidence/es-factura/builder-selfcheck/). min-width:0 + width:100%
   on the fields is the standard fix. */
.calc-inputs, .calc-results { min-width: 0; }
.calc-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.calc-field label { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.calc-field .hint { font-size: 12px; color: var(--ink-faint); font-weight: 400; }
.calc-field input, .calc-field select {
  font: inherit; font-size: 17px; padding: 13px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  width: 100%; min-width: 0; box-sizing: border-box;
}
.calc-field input:focus, .calc-field select:focus { outline: none; border-color: var(--accent); background: var(--white); }
.calc-field.euro { position: relative; }
.calc-field.euro input { padding-right: 42px; }
.calc-field.euro::after { content: "€"; position: absolute; right: 16px; bottom: 13px; color: var(--ink-faint); font-weight: 700; pointer-events: none; }

.calc-results { background: var(--accent-wash); border-radius: var(--radius); padding: 26px; display: flex; flex-direction: column; }
.calc-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; font-size: 14.5px; color: var(--ink-soft); border-bottom: 1px dashed var(--line); }
.calc-row:first-child { padding-top: 0; }
.calc-row span:last-child { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.calc-total { display: flex; justify-content: space-between; align-items: center; background: var(--accent); color: var(--white); border-radius: 12px; padding: 16px 18px; margin-top: 14px; font-size: 15px; font-weight: 700; }
.calc-total span:last-child { font-size: 22px; font-variant-numeric: tabular-nums; }
.calc-formula { font-size: 12px; color: var(--ink-faint); margin-top: 12px; text-align: center; }
.calc-copy-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; }

/* ---------- steps ---------- */
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.step { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; display: flex; flex-direction: column; gap: 12px; }
.step .num { font-family: var(--font-display); font-size: 14px; font-weight: 800; color: var(--accent-deep); width: 40px; height: 40px; background: var(--accent-soft); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.step p { color: var(--ink-soft); font-size: 14.5px; margin: 0; }

/* ---------- sources ---------- */
.sources-list { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.sources-list a { font-size: 14px; color: var(--accent-deep); font-weight: 600; text-decoration: underline; }
.sources-note { font-size: 13px; color: var(--ink-faint); margin-top: 14px; }

/* ---------- faq ---------- */
.faq-list { display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--line); }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary { cursor: pointer; list-style: none; padding: 20px 4px; display: flex; align-items: center; justify-content: space-between; gap: 20px; font-weight: 700; font-size: 16px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .plus { flex: none; width: 20px; height: 20px; position: relative; }
.faq-item summary .plus::before, .faq-item summary .plus::after { content: ""; position: absolute; background: var(--accent-deep); top: 50%; left: 50%; }
.faq-item summary .plus::before { width: 14px; height: 1.5px; transform: translate(-50%, -50%); }
.faq-item summary .plus::after { width: 1.5px; height: 14px; transform: translate(-50%, -50%); transition: opacity .15s ease; }
.faq-item[open] summary .plus::after { opacity: 0; }
.faq-item .faq-a { padding: 0 4px 22px; color: var(--ink-soft); font-size: 14.5px; max-width: 68ch; }
.faq-item .faq-a a { color: var(--accent-deep); text-decoration: underline; font-weight: 600; }

/* ---------- cross-link CTA to Etsy ---------- */
.crosslink-card { background: var(--ink); color: var(--paper); border-radius: 24px; padding: 48px; display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 36px; align-items: center; }
.crosslink-card h2 { color: var(--white); }
.crosslink-card p { color: #b9c6cf; }
.crosslink-card .btn-primary { background: var(--accent); }
.crosslink-card .btn-primary:hover { background: var(--accent-deep); }
.crosslink-list { display: flex; flex-direction: column; gap: 10px; margin: 16px 0 22px; }
.crosslink-list li { display: flex; gap: 10px; font-size: 14.5px; color: #cfd9df; align-items: flex-start; }
.crosslink-list li::before { content: "✓"; color: var(--accent-soft); flex: none; font-weight: 700; }
.crosslink-actions { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.crosslink-price { font-size: 13px; color: #9fb0ba; }

/* ---------- disclaimer callout ---------- */
.callout { border: 1px solid var(--line); background: var(--paper-alt); border-radius: var(--radius); padding: 22px 24px; font-size: 13.5px; color: var(--ink-soft); }
.callout strong { color: var(--ink); }

/* ---------- forms / email capture ---------- */
.consent-row { display: flex; gap: 12px; align-items: flex-start; font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.consent-row input { margin-top: 3px; }
.consent-row a { color: var(--accent-deep); text-decoration: underline; }
.form-status { font-size: 13.5px; font-weight: 600; min-height: 20px; margin-top: 8px; }
.form-status.ok { color: var(--ok); }
.form-status.err { color: var(--err); }

.capture { background: var(--ink); color: var(--paper); border-radius: 24px; padding: 52px; display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 36px; align-items: center; }
.capture h2 { color: var(--white); }
.capture p { color: #b9c6cf; }
.capture-form { display: flex; flex-direction: column; gap: 12px; }
.capture-form .row { display: flex; gap: 10px; }
.capture-form input[type="email"] { flex: 1; padding: 14px 18px; border-radius: 999px; border: 1px solid #3d4f57; background: #2a3840; color: var(--white); font: inherit; }
.capture-form input::placeholder { color: #8ea0aa; }
.capture-form .consent-row { color: #9fb0ba; }
.capture-form .consent-row a { color: var(--accent-soft); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 48px 0 28px; }
.footer-grid { display: grid; grid-template-columns: 1.3fr 0.9fr 0.9fr; gap: 28px; margin-bottom: 32px; }
.footer-brand p { color: var(--ink-faint); font-size: 13.5px; max-width: 34ch; margin-top: 10px; }
.footer-col h4 { font-family: var(--font-body); font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 12px; }
.footer-col ul { display: flex; flex-direction: column; gap: 9px; }
.footer-col a { font-size: 14px; color: var(--ink-soft); }
.footer-col a:hover { color: var(--accent-deep); }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; padding-top: 22px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-faint); flex-wrap: wrap; gap: 10px; }

/* ---------- misc ---------- */
.skip-link { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--white); padding: 10px 16px; border-radius: 8px; }
.skip-link:focus { left: 16px; top: 16px; z-index: 100; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .calc-card { grid-template-columns: minmax(0, 1fr); }
  .crosslink-card { grid-template-columns: 1fr; }
  .steps-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .capture { grid-template-columns: 1fr; padding: 36px 26px; }
}

@media (max-width: 640px) {
  .section { padding: 56px 0; }
  .section-tight { padding: 40px 0; }
  .container { padding: 0 18px; }
  .brand .tagline { display: none; }
  .nav-links, .nav-cta { display: none; }
  .nav-toggle { display: flex; }
  .calc-card { padding: 24px; }
  .crosslink-card { padding: 30px 24px; }
  .capture-form .row { flex-direction: column; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* nav mobile drawer — plain flex-wrap, no absolute positioning (avoids
   overlap/overflow bugs): when .open, the container is allowed to wrap and
   grow, and nav-links/nav-cta drop onto full-width rows below brand+toggle. */
@media (max-width: 640px) {
  .site-nav.open .container { height: auto; flex-wrap: wrap; padding-bottom: 18px; }
  .site-nav.open .nav-links {
    display: flex; flex-direction: column; gap: 2px; order: 5; flex-basis: 100%;
    padding-top: 12px; margin-top: 10px; border-top: 1px solid var(--line);
  }
  .site-nav.open .nav-links a { padding: 11px 0; width: 100%; border-bottom: 1px solid var(--line); }
  .site-nav.open .nav-cta {
    display: flex; flex-direction: column; align-items: stretch; gap: 10px;
    order: 6; flex-basis: 100%; margin-top: 12px;
  }
}
.site-nav.open .nav-toggle span { transform: rotate(45deg); }
.site-nav.open .nav-toggle span::before { transform: rotate(90deg); top: 0; }
.site-nav.open .nav-toggle span::after { opacity: 0; }
