:root{
  --bg:#ffffff;
  --text:#0f172a;
  --muted:#475569;
  --brand:#1d4ed8;
  --border:#e2e8f0;
  --card:#ffffff;
  --shadow: 0 10px 25px rgba(15, 23, 42, .06);
  --radius:18px;
  --max: 1100px;
  --pad: 22px;
  --serif: ui-serif, Georgia, "Times New Roman", Times, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}

body{
  font-family:var(--sans);
  color:var(--text);
  background:var(--bg);
  line-height:1.6;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

img, video, svg{max-width:100%; height:auto; display:block}

a{color:var(--brand); text-decoration:none}
a:hover{text-decoration:underline}

/* anti desbordes por palabras largas, urls, etc */
p, h1, h2, h3, li, a{
  overflow-wrap:anywhere;
  word-break:break-word;
}

.container{
  max-width:var(--max);
  margin:0 auto;
  padding:0 var(--pad);
}

/* =========================
   Topbar
========================= */
.topbar{
  border-bottom:1px solid var(--border);
  background:#fff;
  position:sticky;
  top:0;
  z-index:20;
}

.topbar-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px var(--pad);
}

.brand{display:flex; gap:10px; align-items:center}

.nav{
  display:flex;
  gap:14px;
  font-size:14px;
  color:var(--muted);
  flex-wrap:wrap;
}
.nav a{color:var(--muted)}

/* LOGO */
.brand-link{
  display:flex;
  align-items:center;
  text-decoration:none;
}
.brand-logo{
  height:50px;
  width:auto;
  display:block;
}

/* =========================
   Hero
========================= */
.hero{
  padding:44px 0 18px;
  border-bottom:1px solid var(--border);
  background: linear-gradient(180deg, #f8fafc, #fff);
}
.hero h2{
  font-family:var(--serif);
  font-size:44px;
  line-height:1.1;
  margin:0 0 10px;
}
.hero p{
  max-width:720px;
  margin:0 0 18px;
  color:var(--muted);
}

/* =========================
   Search (móvil OK)
========================= */
.search{
  display:flex;
  gap:10px;
  max-width:720px;
  flex-wrap:wrap;
}
.search input{
  flex:1 1 320px;
  min-width:0;
  width:100%;
  padding:12px 14px;
  border:1px solid var(--border);
  border-radius:12px;
  font-size:16px;
  line-height:1.2;
}
.search button{
  flex:0 0 auto;
  padding:12px 14px;
  border:1px solid var(--brand);
  background:var(--brand);
  color:#fff;
  border-radius:12px;
  font-weight:600;
  cursor:pointer;
  white-space:nowrap;
}
.search button:hover{filter:brightness(.95)}

/* =========================
   GRID (ARREGLADO)
   ✅ .grid SIN padding (para /tramites y relacionados)
   ✅ .grid--section CON padding (home/destacados si quieres)
========================= */
.grid{
  display:grid;
  gap:18px;
  padding:0; /* ✅ CLAVE: evita “huecos” y sensación de que faltan trámites */
  grid-template-columns:repeat(3, minmax(0, 1fr));
}

.grid--section{
  padding:26px 0 40px; /* úsalo donde quieras aire */
}

/* =========================
   Cards
========================= */
.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:18px;
  box-shadow:var(--shadow);
  -webkit-tap-highlight-color: transparent;
  transition: transform .15s ease, box-shadow .15s ease;
  color: inherit;
  text-decoration: none;
}
.card:hover{ transform: translateY(-2px); }

.card h3{margin:0 0 6px; font-size:16px}
.card p{margin:0; color:var(--muted); font-size:14px}

.card .meta{
  margin-top:10px;
  font-size:12px;
  color:var(--muted);
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  border:1px solid var(--border);
  border-radius:999px;
  padding:4px 10px;
  font-size:12px;
  color:var(--muted);
  background:#fff;
}

.section-title{font-family:var(--serif); font-size:30px; margin:28px 0 10px}
.kicker{color:var(--muted); margin:0 0 14px}

/* =========================
   Article
========================= */
.article{padding:26px 0 54px}
.article h1{font-family:var(--serif); font-size:42px; line-height:1.15; margin:0 0 10px}
.article .sub{color:var(--muted); margin:0 0 16px}

/* =========================
   Footer
========================= */
.footer{
  border-top:1px solid var(--border);
  padding:22px 0;
  color:var(--muted);
  font-size:13px;
}
.notice{font-size:13px; color:var(--muted)}

/* =========================
   Category blocks (home)
========================= */
.blocks{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:14px;
  padding:16px 0 34px;
}
.block{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:16px 18px;
  border:1px solid var(--border);
  border-radius:var(--radius);
  background:#fff;
  box-shadow:var(--shadow);
  color: inherit;
  text-decoration:none;
}
.block strong{ font-size:15px; line-height:1.2; }
.block span{ color:var(--muted); font-size:13px; }

.block .arrow{
  width:34px; height:34px;
  border-radius:999px;
  border:1px solid var(--border);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color:var(--brand);
  flex:0 0 auto;
  font-size:22px;
  line-height:1;
}

/* =========================
   Breadcrumbs
========================= */
.breadcrumbs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
  font-size:13px;
  color:var(--muted);
  margin:10px 0 14px;
}
.breadcrumbs a{ color:var(--muted); }
.breadcrumbs a:hover{ color:var(--brand); text-decoration:underline; }
.breadcrumbs .sep{ opacity:.6; }

/* =========================
   Calc
========================= */
.calc-input{
  width:100%;
  padding:10px;
  border:1px solid var(--border);
  border-radius:10px;
  font-size:14px;
}
.calc-btn{
  padding:10px;
  border:none;
  background:var(--brand);
  color:white;
  border-radius:10px;
  font-weight:600;
  cursor:pointer;
}
.calc-btn:hover{ filter:brightness(.95); }

/* =========================
   BREAKPOINTS (ÚNICOS)
========================= */
@media (max-width: 980px){
  .grid{ grid-template-columns:repeat(2, minmax(0, 1fr)); }
  .hero h2{ font-size:38px; }
}

@media (max-width: 640px){
  :root{ --pad: 16px; }

  .hero{ padding:34px 0 14px; }
  .hero h2{ font-size:34px; }

  .topbar-inner{
    flex-direction:column;
    align-items:flex-start;
    padding:12px var(--pad);
  }

  .brand-logo{ height:36px; }

  /* ✅ móvil: 1 columna SIEMPRE (pisa inline si existiera) */
  .grid{ grid-template-columns:1fr !important; }
  .blocks{ grid-template-columns:1fr; }

  /* buscador botón full width */
  .search button{ width:100%; }

  /* cards compactas */
  .card{ padding:16px; }

  /* evita “texto partido” raro en móvil */
  p, h1, h2, h3, li, a{
    word-break: normal;
    overflow-wrap: anywhere;
  }
}