/* ============================================================
   FinanzasClaras — Hoja de estilos global (mobile-first)
   ============================================================ */

:root {
  --c-primary: #0f5e46;
  --c-primary-dark: #0a4634;
  --c-primary-soft: #e6f2ed;
  --c-accent: #e8a13a;
  --c-ink: #1d2733;
  --c-muted: #5b6675;
  --c-bg: #ffffff;
  --c-bg-alt: #f4f7f6;
  --c-border: #dde5e2;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(16, 42, 34, 0.08);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--c-ink);
  background: var(--c-bg);
  line-height: 1.65;
  font-size: 1rem;
}

img { max-width: 100%; height: auto; }

a { color: var(--c-primary); }
a:hover { color: var(--c-primary-dark); }

h1, h2, h3, h4 {
  line-height: 1.25;
  color: var(--c-ink);
  margin: 1.6em 0 0.6em;
}
h1 { font-size: 1.9rem; margin-top: 0.4em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ---------- Accesibilidad ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--c-primary);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 1000;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; color: #fff; }

/* ---------- Cabecera ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--c-ink);
  font-weight: 700;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--c-primary);
  color: #fff;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}
.brand-name { font-size: 1.15rem; }
.brand-name span { color: var(--c-primary); }

.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--c-ink);
  border-radius: 2px;
}
.nav-toggle .sr-only,
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.site-nav { display: none; }
.site-nav.open {
  display: block;
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
  box-shadow: var(--shadow);
}
.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0.5rem 1rem 1rem;
}
.site-nav a {
  display: block;
  padding: 0.65rem 0.25rem;
  text-decoration: none;
  color: var(--c-ink);
  font-weight: 600;
  border-bottom: 1px solid var(--c-bg-alt);
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--c-primary); }

@media (min-width: 760px) {
  .nav-toggle { display: none; }
  .site-nav { display: block; }
  .site-nav ul { display: flex; gap: 1.4rem; padding: 0; }
  .site-nav a { border: 0; padding: 0.4rem 0; }
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(160deg, var(--c-primary-soft), #fff 70%);
  padding: 3.2rem 0 2.6rem;
  border-bottom: 1px solid var(--c-border);
}
.hero h1 { font-size: 2.1rem; max-width: 22ch; }
.hero p { font-size: 1.1rem; color: var(--c-muted); max-width: 60ch; }

.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius);
  font-weight: 700;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1.3;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-dark); color: #fff; }
.btn-outline { border-color: var(--c-primary); color: var(--c-primary); background: transparent; }
.btn-outline:hover { background: var(--c-primary); color: #fff; }
.btn-ghost { background: transparent; color: var(--c-muted); border-color: var(--c-border); }
.btn-ghost:hover { color: var(--c-ink); border-color: var(--c-muted); }

/* ---------- Secciones home ---------- */
.section { padding: 2.8rem 0; }
.section-alt { background: var(--c-bg-alt); }
.section-title { margin-top: 0; font-size: 1.6rem; }
.section-intro { color: var(--c-muted); max-width: 65ch; }

.cards {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: 1fr;
  margin-top: 1.4rem;
}
@media (min-width: 560px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .cards { grid-template-columns: repeat(3, 1fr); } }

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  background: var(--c-bg);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--c-ink);
}
.card:hover { border-color: var(--c-primary); }
.card .chip { align-self: flex-start; margin-bottom: 0.6rem; }
.card-title { font-size: 1.08rem; font-weight: 700; margin: 0 0 0.4rem; line-height: 1.35; }
.card:hover .card-title { color: var(--c-primary); }
.card-excerpt { margin: 0; color: var(--c-muted); font-size: 0.95rem; }

.chip {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: var(--c-primary-soft);
  color: var(--c-primary-dark);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---------- Artículos ---------- */
.breadcrumb {
  font-size: 0.88rem;
  color: var(--c-muted);
  margin: 1.4rem 0 0.4rem;
}
.breadcrumb a { color: var(--c-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--c-primary); text-decoration: underline; }

.article { max-width: 760px; padding-bottom: 3rem; }
.article-header { margin-bottom: 0.6rem; }
.article-header h1 { margin-top: 0.5rem; }
.article-meta {
  color: var(--c-muted);
  font-size: 0.92rem;
  margin: 0.2rem 0 1.2rem;
}
.article .lead { font-size: 1.12rem; color: var(--c-ink); }
.article p, .article li { font-size: 1.02rem; }
.article ul, .article ol { padding-left: 1.4rem; }
.article li { margin-bottom: 0.45rem; }

.callout {
  border-left: 4px solid var(--c-primary);
  background: var(--c-primary-soft);
  padding: 1rem 1.2rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.6rem 0;
}
.callout-warning { border-left-color: var(--c-accent); background: #fdf6e9; }
.callout p { margin: 0.3rem 0; }

.table-wrap { overflow-x: auto; margin: 1.4rem 0; }
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.96rem;
}
th, td {
  border: 1px solid var(--c-border);
  padding: 0.6rem 0.75rem;
  text-align: left;
  vertical-align: top;
}
th { background: var(--c-bg-alt); }

.related {
  margin-top: 2.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--c-border);
}
.related ul { list-style: none; padding: 0; }
.related li { margin-bottom: 0.6rem; }
.related a { font-weight: 600; text-decoration: none; }
.related a:hover { text-decoration: underline; }

/* ---------- Huecos de publicidad (AdSense) ---------- */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  margin: 2rem auto;
  background: #f1f4f6;
  border: 1px dashed #c3ccd4;
  border-radius: var(--radius);
  color: #9099a4;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  overflow: hidden;
}

/* ---------- Formularios ---------- */
.form-field { margin-bottom: 1.2rem; }
.form-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font: inherit;
  background: #fff;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: 2px solid var(--c-primary);
  outline-offset: 1px;
  border-color: var(--c-primary);
}
.form-check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-bottom: 1.2rem;
  font-size: 0.95rem;
}
.form-check input { margin-top: 0.3rem; }
.form-error { color: #b3261e; font-size: 0.88rem; margin-top: 0.3rem; display: none; }
.form-note { font-size: 0.9rem; color: var(--c-muted); }
.form-success {
  display: none;
  border-left: 4px solid var(--c-primary);
  background: var(--c-primary-soft);
  padding: 1rem 1.2rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.2rem 0;
}
.hp-field { position: absolute; left: -9999px; height: 0; overflow: hidden; }

/* ---------- Pie de página ---------- */
.site-footer {
  background: #10231c;
  color: #c9d6d0;
  margin-top: 3rem;
  padding: 2.6rem 0 1.4rem;
  font-size: 0.95rem;
}
.site-footer a { color: #e8f0ec; text-decoration: none; }
.site-footer a:hover { color: var(--c-accent); text-decoration: underline; }
.footer-grid {
  display: grid;
  gap: 1.8rem;
  grid-template-columns: 1fr;
}
@media (min-width: 700px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.footer-title { color: #fff; font-size: 1rem; margin: 0 0 0.7rem; }
.footer-brand .brand-name { color: #fff; margin: 0 0 0.5rem; }
.footer-brand p { margin: 0.3rem 0; max-width: 42ch; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 0.45rem; }
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  margin-top: 2rem;
  padding-top: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}
.footer-bottom p { margin: 0; }
.cookie-settings-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #e8f0ec;
  border-radius: var(--radius);
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
}
.cookie-settings-btn:hover { border-color: var(--c-accent); color: var(--c-accent); }

/* ---------- Banner y modal de cookies ---------- */
.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  background: #fff;
  border-top: 1px solid var(--c-border);
  box-shadow: 0 -4px 24px rgba(16, 42, 34, 0.16);
  padding: 1.1rem 0;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner p { margin: 0 0 0.9rem; font-size: 0.95rem; }
.cookie-banner .cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.cookie-actions .btn { font-size: 0.92rem; padding: 0.55rem 1.1rem; }

.cookie-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 950;
  background: rgba(13, 30, 24, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.cookie-modal-overlay[hidden] { display: none; }
.cookie-modal {
  background: #fff;
  border-radius: var(--radius);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.6rem;
}
.cookie-modal h2 { margin-top: 0; font-size: 1.3rem; }
.cookie-option {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin-bottom: 0.8rem;
}
.cookie-option label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  cursor: pointer;
}
.cookie-option p { margin: 0.4rem 0 0; font-size: 0.9rem; color: var(--c-muted); }
.cookie-modal .cookie-actions { margin-top: 1.1rem; display: flex; flex-wrap: wrap; gap: 0.6rem; }

/* ---------- Página 404 ---------- */
.error-page { text-align: center; padding: 4rem 0; }
.error-page .error-code {
  font-size: 4rem;
  font-weight: 800;
  color: var(--c-primary);
  margin: 0;
  line-height: 1;
}

/* ---------- Utilidades ---------- */
.text-muted { color: var(--c-muted); }
.mt-0 { margin-top: 0; }

@media (min-width: 760px) {
  h1 { font-size: 2.2rem; }
  .hero h1 { font-size: 2.6rem; }
}

@media print {
  .site-header, .site-footer, .ad-slot, .cookie-banner, .cookie-modal-overlay { display: none !important; }
}
