/* ==========================================================================
   HipotecaJove.cat — Sistema de disseny
   Modern, minimalista, mobile-first
   ========================================================================== */

:root {
  /* Colors */
  --c-bg: #ffffff;
  --c-surface: #f7faf9;
  --c-surface-2: #eef3f1;
  --c-text: #0d1b1e;
  --c-text-muted: #566a6f;
  --c-primary: #0a7c5e;
  --c-primary-dark: #065a43;
  --c-primary-light: #e6f4ef;
  --c-accent: #f2a93b;
  --c-border: #e2e8e6;
  --c-border-strong: #c9d4d0;
  --c-success: #0a7c5e;
  --c-danger: #c73e3e;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Spacing */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4rem;
  --s-9: 6rem;

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-full: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(13, 27, 30, 0.04);
  --shadow-md: 0 4px 12px rgba(13, 27, 30, 0.06);
  --shadow-lg: 0 12px 32px rgba(13, 27, 30, 0.10);

  /* Layout */
  --container: 1160px;
  --container-narrow: 820px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--c-primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--c-text);
  line-height: 1.2;
  margin: 0 0 var(--s-4);
  letter-spacing: -0.02em;
}
h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 600; }
h4 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0 0 var(--s-4); }
.lead { font-size: 1.15rem; color: var(--c-text-muted); max-width: 60ch; }

/* Layout */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--s-4);
}
.container--narrow { max-width: var(--container-narrow); }
.section { padding: var(--s-8) 0; }
.section--sm { padding: var(--s-7) 0; }
.section--alt { background: var(--c-surface); }

/* Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--c-border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  height: 64px;
}
.nav__brand {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--c-text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.nav__brand:hover { text-decoration: none; }
.nav__brand-mark {
  width: 32px; height: 32px;
  background: var(--c-primary);
  border-radius: 8px;
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 0.9rem;
}
.nav__links {
  display: flex; align-items: center; gap: var(--s-5);
  list-style: none; margin: 0; padding: 0;
}
.nav__links a {
  color: var(--c-text);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  padding: var(--s-2) 0;
  position: relative;
}
.nav__links a:hover { color: var(--c-primary-dark); }
.nav__links a.is-active { color: var(--c-primary-dark); }
.nav__links a.is-active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 2px; background: var(--c-primary); border-radius: 2px;
}
.nav__right { display: flex; align-items: center; gap: var(--s-3); }
.lang-toggle {
  display: inline-flex; gap: 0;
  border: 1px solid var(--c-border); border-radius: var(--r-full);
  overflow: hidden; background: var(--c-bg);
  font-size: 0.82rem;
}
.lang-toggle a {
  padding: 6px 12px; color: var(--c-text-muted);
  text-decoration: none; font-weight: 600;
}
.lang-toggle a.is-active { background: var(--c-primary); color: #fff; }
.nav__toggle {
  display: none;
  width: 40px; height: 40px;
  background: transparent; border: 0;
  border-radius: var(--r-sm);
  padding: 0; align-items: center; justify-content: center;
}
.nav__toggle svg { width: 24px; height: 24px; stroke: var(--c-text); }

@media (max-width: 860px) {
  .nav__toggle { display: inline-flex; }
  .nav__links {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--c-bg); border-bottom: 1px solid var(--c-border);
    padding: var(--s-2) var(--s-4);
    transform: translateY(-8px); opacity: 0; pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
  }
  .nav__links a { padding: var(--s-3) 0; border-bottom: 1px solid var(--c-border); }
  .nav__links a:last-child { border-bottom: 0; }
  .nav[data-open="true"] .nav__links {
    transform: translateY(0); opacity: 1; pointer-events: auto;
  }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-2);
  padding: 12px 22px;
  border-radius: var(--r-full);
  font-weight: 600; font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all .18s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn--primary { background: var(--c-primary); color: #fff; }
.btn--primary:hover { background: var(--c-primary-dark); }
.btn--ghost { background: transparent; color: var(--c-text); border-color: var(--c-border-strong); }
.btn--ghost:hover { background: var(--c-surface); }
.btn--accent { background: var(--c-accent); color: #1a1200; }
.btn--accent:hover { background: #e69a1e; }
.btn--sm { padding: 8px 16px; font-size: 0.85rem; }
.btn--lg { padding: 16px 28px; font-size: 1rem; }
.btn--block { display: flex; width: 100%; }

/* Hero */
.hero {
  padding: var(--s-8) 0 var(--s-7);
  background:
    radial-gradient(900px 400px at 80% -10%, rgba(10, 124, 94, 0.12), transparent 60%),
    radial-gradient(700px 500px at 10% 10%, rgba(242, 169, 59, 0.10), transparent 60%);
  border-bottom: 1px solid var(--c-border);
}
.hero__inner {
  display: grid; grid-template-columns: 1.15fr 1fr;
  gap: var(--s-8); align-items: center;
}
@media (max-width: 860px) {
  .hero__inner { grid-template-columns: 1fr; gap: var(--s-6); }
}
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--c-primary-light);
  color: var(--c-primary-dark);
  padding: 6px 14px;
  border-radius: var(--r-full);
  font-size: 0.82rem; font-weight: 600;
  margin-bottom: var(--s-4);
}
.hero__eyebrow::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--c-primary); animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}
.hero__ctas { display: flex; gap: var(--s-3); flex-wrap: wrap; margin-top: var(--s-5); }
.hero__trust {
  display: flex; gap: var(--s-5); flex-wrap: wrap;
  margin-top: var(--s-6);
  color: var(--c-text-muted); font-size: 0.9rem;
}
.hero__trust-item { display: flex; align-items: center; gap: 8px; }
.hero__trust-item svg { width: 18px; height: 18px; color: var(--c-primary); }

/* Quick calc in hero */
.quick-calc {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: var(--s-6);
  box-shadow: var(--shadow-lg);
}
.quick-calc h3 { margin-bottom: var(--s-2); }
.quick-calc__desc { color: var(--c-text-muted); font-size: 0.9rem; margin-bottom: var(--s-4); }
.quick-calc__field { margin-bottom: var(--s-4); }
.quick-calc__field label {
  display: flex; justify-content: space-between;
  font-size: 0.85rem; font-weight: 600; color: var(--c-text-muted);
  margin-bottom: 6px;
}
.quick-calc__field label b { color: var(--c-text); font-weight: 700; }
.quick-calc__field input[type="range"] {
  width: 100%; accent-color: var(--c-primary);
}
.quick-calc__result {
  background: var(--c-primary-light);
  padding: var(--s-4);
  border-radius: var(--r-md);
  text-align: center;
  margin-bottom: var(--s-4);
}
.quick-calc__result .amount {
  font-size: 2rem; font-weight: 800; color: var(--c-primary-dark);
  letter-spacing: -0.02em; line-height: 1;
}
.quick-calc__result .label {
  display: block; font-size: 0.82rem; color: var(--c-text-muted);
  margin-top: 4px;
}

/* Cards de hipoteques */
.mortgage-grid {
  display: grid; gap: var(--s-5);
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.mortgage-card {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  display: flex; flex-direction: column;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  position: relative;
}
.mortgage-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--c-primary);
}
.mortgage-card--featured { border: 2px solid var(--c-primary); }
.mortgage-card__badge {
  position: absolute; top: -12px; left: var(--s-5);
  background: var(--c-primary); color: #fff;
  padding: 4px 12px; border-radius: var(--r-full);
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase;
}
.mortgage-card__bank {
  display: flex; align-items: center; gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.mortgage-card__logo {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  background: var(--c-surface-2);
  display: grid; place-items: center;
  font-weight: 800; color: var(--c-primary-dark);
  font-size: 1.1rem;
}
.mortgage-card__bank-info h3 { margin: 0; font-size: 1.05rem; }
.mortgage-card__bank-info span {
  font-size: 0.82rem; color: var(--c-text-muted);
}
.mortgage-card__rate {
  display: flex; align-items: baseline; gap: var(--s-2);
  padding: var(--s-4);
  background: var(--c-primary-light);
  border-radius: var(--r-md);
  margin-bottom: var(--s-4);
}
.mortgage-card__rate .value {
  font-size: 2rem; font-weight: 800; color: var(--c-primary-dark);
  line-height: 1; letter-spacing: -0.02em;
}
.mortgage-card__rate .suffix { color: var(--c-text-muted); font-size: 0.85rem; }
.mortgage-card__specs {
  list-style: none; margin: 0 0 var(--s-5); padding: 0;
  display: grid; gap: 10px;
}
.mortgage-card__specs li {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: 0.92rem;
  color: var(--c-text);
}
.mortgage-card__specs li svg {
  width: 18px; height: 18px; color: var(--c-primary); flex-shrink: 0;
}
.mortgage-card__specs li.is-muted { color: var(--c-text-muted); }
.mortgage-card__specs li.is-muted svg { color: var(--c-text-muted); }
.mortgage-card__footer { margin-top: auto; display: grid; gap: var(--s-2); }
.mortgage-card__tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.78rem;
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  padding: 3px 10px; border-radius: var(--r-full);
  width: fit-content;
}
.mortgage-card__tag--hot {
  background: #fff3dd; color: #8a5a00;
}

/* Feature grid */
.feature-grid {
  display: grid; gap: var(--s-5);
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}
.feature {
  padding: var(--s-5);
}
.feature__icon {
  width: 48px; height: 48px; border-radius: var(--r-md);
  background: var(--c-primary-light);
  display: grid; place-items: center;
  margin-bottom: var(--s-3);
}
.feature__icon svg { width: 24px; height: 24px; color: var(--c-primary-dark); }
.feature h3 { font-size: 1.1rem; margin-bottom: 8px; }
.feature p { color: var(--c-text-muted); font-size: 0.95rem; margin: 0; }

/* Forms */
.form-row { display: grid; gap: var(--s-4); }
.form-row--2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .form-row--2 { grid-template-columns: 1fr; } }
.field {
  display: flex; flex-direction: column; gap: 6px;
}
.field label {
  font-size: 0.88rem; font-weight: 600; color: var(--c-text);
}
.field input, .field select, .field textarea {
  font: inherit; width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md);
  background: var(--c-bg);
  color: var(--c-text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-light);
}
.field textarea { min-height: 120px; resize: vertical; }
.field__help { font-size: 0.8rem; color: var(--c-text-muted); }
.field__error { color: var(--c-danger); font-size: 0.85rem; display: none; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--c-border); border-radius: var(--r-lg); }
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td {
  padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--c-border);
}
.table th { background: var(--c-surface); font-weight: 700; font-size: 0.85rem; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--c-surface); }

/* Article/guide styles */
.article-hero {
  padding: var(--s-7) 0 var(--s-6);
  border-bottom: 1px solid var(--c-border);
}
.article-meta {
  display: flex; gap: var(--s-4); color: var(--c-text-muted); font-size: 0.88rem;
  flex-wrap: wrap; margin-bottom: var(--s-3);
}
.article-content { padding: var(--s-7) 0; }
.article-content h2 { margin-top: var(--s-6); }
.article-content h3 { margin-top: var(--s-5); }
.article-content ul, .article-content ol { padding-left: 1.3rem; margin-bottom: var(--s-4); }
.article-content li { margin-bottom: 6px; }
.article-content blockquote {
  border-left: 3px solid var(--c-primary);
  padding: var(--s-2) var(--s-4);
  margin: var(--s-4) 0;
  background: var(--c-primary-light);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--c-text);
}
.callout {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-primary);
  padding: var(--s-4) var(--s-5);
  border-radius: var(--r-md);
  margin: var(--s-5) 0;
}
.callout h4 { margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.callout h4 svg { width: 20px; height: 20px; color: var(--c-primary); }
.callout p { margin: 0; color: var(--c-text-muted); }

.article-grid {
  display: grid; gap: var(--s-5);
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.article-card {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  text-decoration: none;
  color: var(--c-text);
  transition: transform .2s ease, box-shadow .2s ease;
  display: flex; flex-direction: column; gap: var(--s-2);
}
.article-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.article-card__tag {
  font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--c-primary-dark); font-weight: 700;
}
.article-card h3 { margin: 0; font-size: 1.1rem; }
.article-card p { color: var(--c-text-muted); font-size: 0.92rem; margin: 0; }
.article-card__more {
  margin-top: auto; color: var(--c-primary-dark); font-weight: 600; font-size: 0.9rem;
}

/* Simulator */
.simulator {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--s-6);
  align-items: start;
}
@media (max-width: 860px) { .simulator { grid-template-columns: 1fr; } }
.simulator__panel {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-6);
}
.simulator__stat {
  display: grid; gap: 4px; padding: var(--s-4) 0;
  border-bottom: 1px solid var(--c-border);
}
.simulator__stat:last-of-type { border-bottom: 0; }
.simulator__stat .label { font-size: 0.85rem; color: var(--c-text-muted); }
.simulator__stat .value { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.01em; }
.simulator__stat--highlight .value { color: var(--c-primary-dark); font-size: 1.8rem; }

/* FAQ */
.faq { display: grid; gap: var(--s-3); }
.faq__item {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.faq__item summary {
  padding: var(--s-4) var(--s-5);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--s-3);
}
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary::after {
  content: '+'; font-size: 1.3rem; color: var(--c-primary); font-weight: 400;
}
.faq__item[open] summary::after { content: '−'; }
.faq__item > div {
  padding: 0 var(--s-5) var(--s-5);
  color: var(--c-text-muted);
}

/* Footer */
.site-footer {
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  padding: var(--s-7) 0 var(--s-5);
  margin-top: var(--s-8);
  color: var(--c-text-muted);
  font-size: 0.92rem;
}
.site-footer__grid {
  display: grid; gap: var(--s-6);
  grid-template-columns: 1.5fr repeat(3, 1fr);
  margin-bottom: var(--s-6);
}
@media (max-width: 760px) {
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .site-footer__grid { grid-template-columns: 1fr; }
}
.site-footer h4 { color: var(--c-text); font-size: 0.88rem; text-transform: uppercase; letter-spacing: 0.05em; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.site-footer a { color: var(--c-text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--c-primary-dark); }
.site-footer__bottom {
  border-top: 1px solid var(--c-border);
  padding-top: var(--s-4);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--s-3);
  font-size: 0.85rem;
}

/* Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--c-text-muted); }
.mt-0 { margin-top: 0; } .mt-4 { margin-top: var(--s-4); } .mt-6 { margin-top: var(--s-6); }
.mb-0 { margin-bottom: 0; } .mb-4 { margin-bottom: var(--s-4); } .mb-6 { margin-bottom: var(--s-6); }
.section-header { text-align: center; max-width: 640px; margin: 0 auto var(--s-6); }
.section-header .eyebrow {
  display: inline-block;
  color: var(--c-primary-dark);
  font-weight: 700; font-size: 0.82rem;
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: var(--s-2);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-5); }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

/* CTA banner */
.cta-banner {
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-dark) 100%);
  color: #fff;
  border-radius: var(--r-xl);
  padding: var(--s-7) var(--s-6);
  text-align: center;
}
.cta-banner h2 { color: #fff; margin-bottom: var(--s-2); }
.cta-banner p { color: rgba(255,255,255,0.9); max-width: 540px; margin: 0 auto var(--s-5); }
.cta-banner .btn--accent { box-shadow: 0 4px 12px rgba(0,0,0,0.15); }

/* Filters row */
.filters {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  margin-bottom: var(--s-5);
  display: flex; gap: var(--s-3); flex-wrap: wrap;
  align-items: end;
}
.filters .field { flex: 1; min-width: 160px; }

/* Update badge */
.update-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.82rem;
  color: var(--c-text-muted);
  background: var(--c-surface);
  padding: 6px 12px; border-radius: var(--r-full);
  border: 1px solid var(--c-border);
}
.update-badge::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--c-primary); flex-shrink: 0;
}

/* Success message for form */
.form-success {
  background: var(--c-primary-light);
  border: 1px solid var(--c-primary);
  color: var(--c-primary-dark);
  padding: var(--s-4);
  border-radius: var(--r-md);
  text-align: center;
  display: none;
}
.form-success.is-visible { display: block; }

/* Disclosure legal */
.legal-note {
  font-size: 0.8rem; color: var(--c-text-muted);
  background: var(--c-surface);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  margin-top: var(--s-4);
}
