/*
Theme Name: Hipotecas
Theme URI: https://hipotecas.com.es
Author: David Fernandez Garcia
Description: Tema a medida para hipotecas.com.es. Catalogo de servicios juridicos de precio cerrado sobre prestamo hipotecario y vivienda.
Version: 1.2
Requires at least: 6.0
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: hipotecas
*/

:root {
    --ground: #F1F3EF;
    --surface: #FFFFFF;
    --sunk: #E7EAE4;
    --ink: #111F1B;
    --ink-soft: #435049;
    --ink-mute: #6C776F;
    --line: #D6DBD2;
    --line-soft: #E5E9E1;
    --accent: #1F5D4C;
    --accent-ink: #FFFFFF;
    --accent-soft: #E0EBE5;
    --price: #8A5A12;
    --price-soft: #F3EADA;
    --shadow-sm: 0 1px 2px rgba(17,31,27,.06);
    --shadow: 0 2px 4px rgba(17,31,27,.05), 0 12px 28px -18px rgba(17,31,27,.28);
    --display: "Petrona", Georgia, serif;
    --body: "Karla", "Segoe UI", system-ui, sans-serif;
    --r: 10px;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --ground: #101413;
      --surface: #181D1B;
      --sunk: #1E2422;
      --ink: #E9EDE8;
      --ink-soft: #B0BAB3;
      --ink-mute: #859089;
      --line: #2A322E;
      --line-soft: #232927;
      --accent: #6FBFA3;
      --accent-ink: #0E1614;
      --accent-soft: #1A2A25;
      --price: #D7A85C;
      --price-soft: #2A2318;
      --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
      --shadow: 0 2px 4px rgba(0,0,0,.35), 0 12px 28px -18px rgba(0,0,0,.8);
    }
  }
  :root[data-theme="dark"] {
    --ground: #101413; --surface: #181D1B; --sunk: #1E2422;
    --ink: #E9EDE8; --ink-soft: #B0BAB3; --ink-mute: #859089;
    --line: #2A322E; --line-soft: #232927;
    --accent: #6FBFA3; --accent-ink: #0E1614; --accent-soft: #1A2A25;
    --price: #D7A85C; --price-soft: #2A2318;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow: 0 2px 4px rgba(0,0,0,.35), 0 12px 28px -18px rgba(0,0,0,.8);
  }

  * { box-sizing: border-box; }
  body { background: var(--ground); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
  h1,h2,h3,h4 { margin: 0; text-wrap: balance; }
  p { margin: 0; }
  button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

  .shell { max-width: 60rem; margin: 0 auto; padding: 0 1.1rem 4rem; }

  /* ---------- topbar ---------- */
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .9rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap;
  }
  .brand { font-family: var(--display); font-weight: 600; font-size: 1.22rem; letter-spacing: -.01em; }
  .brand span { color: var(--accent); }
  .pledge {
    font-size: .78rem; font-weight: 600; color: var(--accent);
    background: var(--accent-soft); padding: .3rem .6rem; border-radius: 100px;
  }

  /* ---------- hero ---------- */
  .hero { padding: 2.4rem 0 1.6rem; display: flex; flex-direction: column; gap: .8rem; }
  .hero h1 { font-family: var(--display); font-weight: 500; font-size: clamp(1.95rem, 6.2vw, 3rem); line-height: 1.08; letter-spacing: -.02em; }
  .hero p { color: var(--ink-soft); font-size: 1.05rem; max-width: 34rem; }

  /* ---------- doors ---------- */
  .doors { display: grid; gap: .7rem; grid-template-columns: 1fr; margin-top: 1.4rem; }
  @media (min-width: 46rem) { .doors { grid-template-columns: repeat(3,1fr); } }
  .door {
    text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
    padding: 1.05rem 1.1rem; display: flex; flex-direction: column; gap: .3rem;
    box-shadow: var(--shadow-sm); transition: border-color .15s, transform .15s, box-shadow .15s;
  }
  .door:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
  .door[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
  .door-k { font-size: .74rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }
  .door-t { font-family: var(--display); font-size: 1.22rem; font-weight: 600; line-height: 1.2; }
  .door-d { font-size: .88rem; color: var(--ink-soft); }

  /* ---------- filter bar ---------- */
  .barwrap { position: sticky; top: 0; z-index: 20; background: var(--ground); padding: .8rem 0 .7rem; border-bottom: 1px solid var(--line); margin-top: 2.6rem; }
  .bar { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; padding-bottom: .15rem; }
  .bar::-webkit-scrollbar { display: none; }
  .chip {
    white-space: nowrap; font-size: .84rem; font-weight: 600; padding: .42rem .8rem;
    border: 1px solid var(--line); border-radius: 100px; background: var(--surface); color: var(--ink-soft);
  }
  .chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

  /* ---------- grid ---------- */
  .count { font-size: .82rem; color: var(--ink-mute); margin: 1rem 0 .7rem; }
  .grid { display: grid; gap: .7rem; grid-template-columns: 1fr; }
  @media (min-width: 40rem) { .grid { grid-template-columns: repeat(2,1fr); } }

  .card {
    text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
    padding: 1rem 1.05rem; display: flex; flex-direction: column; gap: .45rem;
    box-shadow: var(--shadow-sm); transition: border-color .15s, transform .15s, box-shadow .15s;
  }
  .card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
  .card-t { font-family: var(--display); font-size: 1.08rem; font-weight: 600; line-height: 1.25; }
  .card-d { font-size: .87rem; color: var(--ink-soft); flex: 1; }
  .card-f { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; padding-top: .5rem; border-top: 1px solid var(--line-soft); }
  .price { font-weight: 700; font-size: 1.02rem; color: var(--price); font-variant-numeric: tabular-nums; }
  .when { font-size: .76rem; color: var(--ink-mute); font-weight: 600; }

  /* ---------- detail ---------- */
  .veil { position: fixed; inset: 0; background: rgba(17,31,27,.55); z-index: 40; display: none; }
  .veil.on { display: block; }
  .sheet {
    position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto;
    background: var(--surface); border-top: 3px solid var(--accent);
    border-radius: 14px 14px 0 0; padding: 1.3rem 1.2rem 2rem; display: none;
  }
  .sheet.on { display: block; }
  @media (min-width: 46rem) {
    .sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%,-50%); width: min(34rem, 92vw); border-radius: 14px; border-top-width: 3px; }
  }
  .sheet h3 { font-family: var(--display); font-size: 1.5rem; font-weight: 600; line-height: 1.15; margin-bottom: .5rem; padding-right: 2rem; }
  .close { position: absolute; top: .85rem; right: .9rem; font-size: 1.5rem; line-height: 1; color: var(--ink-mute); padding: .2rem .45rem; }
  .lede { color: var(--ink-soft); font-size: .95rem; margin-bottom: 1rem; }
  .kv { display: flex; gap: 1.4rem; padding: .8rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
  .kv div { display: flex; flex-direction: column; gap: .1rem; }
  .kv b { font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-mute); font-weight: 700; }
  .kv span { font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
  .sub { font-size: .7rem; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-mute); font-weight: 700; margin-bottom: .45rem; }
  .sheet ul { margin: 0 0 1.2rem; padding-left: 1.1rem; display: flex; flex-direction: column; gap: .35rem; font-size: .92rem; color: var(--ink-soft); }
  .sheet li::marker { color: var(--accent); }
  .cta { display: block; width: 100%; text-align: center; background: var(--accent); color: var(--accent-ink); font-weight: 700; padding: .85rem; border-radius: var(--r); font-size: 1rem; }
  .fine { font-size: .78rem; color: var(--ink-mute); margin-top: .7rem; text-align: center; }

  /* ---------- blocks ---------- */
  .block { margin-top: 3.2rem; }
  .block h2 { font-family: var(--display); font-size: 1.55rem; font-weight: 600; padding-bottom: .55rem; border-bottom: 2px solid var(--ink); margin-bottom: 1.1rem; }
  .steps { display: grid; gap: .9rem; grid-template-columns: 1fr; }
  @media (min-width: 44rem) { .steps { grid-template-columns: repeat(3,1fr); } }
  .step { display: flex; flex-direction: column; gap: .3rem; }
  .step-n { font-family: var(--display); font-size: 1.6rem; font-weight: 600; color: var(--accent); line-height: 1; }
  .step h4 { font-size: .98rem; font-weight: 700; }
  .step p { font-size: .89rem; color: var(--ink-soft); }

  .who { background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r); padding: 1.2rem 1.25rem; display: flex; flex-direction: column; gap: .6rem; }
  .who p { font-size: .93rem; color: var(--ink-soft); }
  .who strong { color: var(--ink); }

  footer { margin-top: 3rem; padding-top: 1.2rem; border-top: 1px solid var(--line); font-size: .8rem; color: var(--ink-mute); display: flex; flex-direction: column; gap: .5rem; }

  /* ---------- paginas de texto (aviso legal, privacidad) ---------- */
  .prosa { max-width: 42rem; }
  .prosa p, .prosa li { color: var(--ink-soft); font-size: .96rem; }
  .prosa p + p, .prosa ul, .prosa ol { margin-top: .9rem; }
  .prosa h2, .prosa h3 { font-family: var(--display); font-weight: 600; margin: 1.6rem 0 .5rem; }
  .prosa h2 { font-size: 1.25rem; }
  .prosa h3 { font-size: 1.05rem; }
  .prosa a { color: var(--accent); }
  .prosa ul, .prosa ol { padding-left: 1.2rem; display: flex; flex-direction: column; gap: .35rem; }
  .prosa li::marker { color: var(--accent); }
