/* ============================================================
   GuíaTrámites — style.css
   Mobile-first | No dependencias externas | Core Web Vitals
   ============================================================ */

/* === CUSTOM PROPERTIES === */
:root {
  --primary:        #1a3a5c;
  --primary-dark:   #0f2035;
  --primary-light:  #2a5a8c;
  --accent:         #e8a020;
  --bg:             #ffffff;
  --bg-light:       #f5f5f5;
  --text:           #2c2c2c;
  --text-muted:     #666666;
  --border:         #e0e0e0;
  --success:        #2e7d32;
  --warning:        #e65100;
  --link:           #1a3a5c;
  --link-hover:     #2a5a8c;

  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --max-w:       1100px;
  --content-w:   760px;
  --sidebar-w:   280px;
  --gap:         2rem;

  --radius-sm: 3px;
  --radius:    6px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.10);
  --shadow:    0 2px 8px rgba(0,0,0,.12);

  --transition: 0.18s ease;
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  min-height: 100vh;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); }
a:hover { color: var(--link-hover); }
ul, ol { padding-left: 1.5rem; }
table { border-collapse: collapse; width: 100%; }

/* === TOP INFO BAR === */
.top-bar {
  background: var(--primary-dark);
  color: rgba(255,255,255,.85);
  text-align: center;
  font-size: 0.75rem;
  padding: 0.4rem 1rem;
  letter-spacing: 0.02em;
}

/* === HEADER === */
header {
  background: var(--primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.logo {
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.logo span { color: var(--accent); }
nav ul {
  list-style: none;
  padding: 0;
  display: flex;
  gap: 0.1rem;
  flex-wrap: wrap;
}
nav a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  white-space: nowrap;
}
nav a:hover, nav a[aria-current="page"] {
  background: rgba(255,255,255,.18);
  color: #fff;
}
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid rgba(255,255,255,.4);
  color: #fff;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: var(--font);
}

/* === CONTAINER === */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1rem;
}

/* === BREADCRUMB === */
.breadcrumb {
  font-size: 0.8rem;
  padding: 0.7rem 0 0;
  color: var(--text-muted);
}
.breadcrumb ol {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  align-items: center;
}
.breadcrumb li + li::before { content: "›"; margin-right: 0.2rem; color: var(--text-muted); }
.breadcrumb a { color: var(--link); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb [aria-current="page"] { color: var(--text-muted); }

/* === MAIN === */
main { padding: 1.25rem 0 3rem; }

/* === CONTENT GRID (artículo + sidebar) === */
.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  align-items: start;
}
@media (min-width: 1024px) {
  .content-grid {
    grid-template-columns: var(--content-w) var(--sidebar-w);
  }
}

/* === ARTICLE TYPOGRAPHY === */
article h1 {
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 1.25;
  color: var(--primary);
  margin: 0.75rem 0 0.7rem;
  font-weight: 700;
}
article h2 {
  font-size: clamp(1.15rem, 3vw, 1.4rem);
  color: var(--primary);
  margin: 2rem 0 0.7rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--primary-light);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
article h3 {
  font-size: 1.05rem;
  color: var(--primary);
  margin: 1.25rem 0 0.45rem;
  font-weight: 600;
}
article p { margin-bottom: 1rem; }
article ul, article ol { margin-bottom: 1rem; }
article li { margin-bottom: 0.3rem; }
article strong { color: var(--primary); }

/* Tablas */
article table { margin: 1.25rem 0; font-size: 0.9rem; }
article th {
  background: var(--primary);
  color: #fff;
  padding: 0.55rem 0.8rem;
  text-align: left;
  font-weight: 600;
}
article td { padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--border); }
article tr:nth-child(even) td { background: var(--bg-light); }

/* === CAJA DE ACTUALIZACIÓN === */
.update-box {
  background: var(--bg-light);
  border-left: 4px solid var(--primary-light);
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.update-box strong { color: var(--primary); }

/* === CAJAS DE AVISO === */
.highlight-box {
  background: #e8f0f8;
  border: 1px solid #b8ccdf;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
}
.highlight-box p:last-child { margin-bottom: 0; }

.warning-box {
  background: #fff8e1;
  border-left: 4px solid var(--warning);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.9rem 1.1rem;
  margin: 1.25rem 0;
}
.warning-box p:last-child { margin-bottom: 0; }

/* === AVISO LEGAL === */
.legal-notice {
  background: var(--bg-light);
  border-left: 4px solid var(--primary);
  padding: 1rem 1.25rem;
  margin: 2.25rem 0 1.5rem;
  font-size: 0.875rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.legal-notice p:last-child { margin-bottom: 0; }
.legal-notice strong { display: block; margin-bottom: 0.3rem; color: var(--primary); font-size: 0.9375rem; }

/* === SLOTS ADSENSE === */
.ad-slot {
  background: var(--bg-light);
  border: 1px dashed var(--border);
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1.5rem 0;
  border-radius: var(--radius);
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.ad-slot-sidebar { min-height: 250px; }

/* === ARTÍCULOS RELACIONADOS (bloque final) === */
.related-articles {
  border-top: 2px solid var(--primary-light);
  margin-top: 2rem;
  padding-top: 1.25rem;
}
.related-articles h2 {
  font-size: 1.05rem;
  color: var(--primary);
  margin: 0 0 0.75rem;
  border: none;
  padding: 0;
}
.related-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 480px) { .related-grid { grid-template-columns: 1fr; } }
.related-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  text-decoration: none;
  color: var(--text);
  font-size: 0.875rem;
  transition: box-shadow var(--transition);
}
.related-card:hover { box-shadow: var(--shadow-sm); color: var(--text); }
.related-card strong { display: block; color: var(--primary); margin-bottom: 0.2rem; }

/* === SIDEBAR === */
aside {
  position: sticky;
  top: 4.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.sidebar-box {
  background: var(--bg-light);
  border-radius: var(--radius);
  padding: 1.1rem;
}
.sidebar-box h3 {
  font-size: 0.875rem;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 0.65rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar-list li { border-bottom: 1px solid var(--border); }
.sidebar-list li:last-child { border-bottom: none; }
.sidebar-list a {
  display: block;
  padding: 0.45rem 0;
  font-size: 0.825rem;
  text-decoration: none;
  color: var(--link);
  line-height: 1.4;
}
.sidebar-list a:hover { text-decoration: underline; }

/* === FAQ ACORDEÓN === */
.faq-list { list-style: none; padding: 0; margin: 0; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 0.8rem 0;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--primary);
  user-select: none;
  list-style: none;
  gap: 0.5rem;
}
.faq-question::-webkit-details-marker { display: none; }
.faq-icon {
  flex-shrink: 0;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--primary-light);
  transition: transform var(--transition);
}
.faq-item.open .faq-icon { transform: rotate(45deg); }
.faq-answer {
  display: none;
  padding: 0 0 0.9rem;
  font-size: 0.9375rem;
  line-height: 1.65;
}
.faq-item.open .faq-answer { display: block; }

/* === FUENTES OFICIALES === */
.sources-list {
  list-style: none;
  padding: 0;
}
.sources-list li {
  padding: 0.3rem 0 0.3rem 1.3rem;
  position: relative;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
}
.sources-list li:last-child { border-bottom: none; }
.sources-list li::before {
  content: "↗";
  position: absolute;
  left: 0;
  color: var(--primary-light);
  font-size: 0.8rem;
  top: 0.45rem;
}
.sources-list a { text-decoration: none; }
.sources-list a:hover { text-decoration: underline; }

/* === HOMEPAGE HERO === */
.hero {
  background: var(--primary);
  color: #fff;
  padding: 3.5rem 1rem 3rem;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  line-height: 1.2;
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.hero p {
  font-size: clamp(1rem, 2vw, 1.15rem);
  opacity: 0.9;
  max-width: 580px;
  margin: 0 auto;
}

/* === GRID DE CATEGORÍAS (home) === */
.section-title {
  font-size: 1.35rem;
  color: var(--primary);
  margin: 2.25rem 0 1rem;
  font-weight: 700;
}
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.1rem;
  margin-bottom: 2.5rem;
}
.category-card {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: box-shadow var(--transition), transform var(--transition);
}
.category-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  color: var(--text);
}
.category-card-icon { font-size: 1.9rem; }
.category-card h2 {
  font-size: 1.05rem;
  color: var(--primary);
  margin: 0;
  border: none;
  padding: 0;
  font-weight: 600;
}
.category-card p { font-size: 0.85rem; color: var(--text-muted); margin: 0; }

/* === LISTA DE ARTÍCULOS (páginas hub) === */
.article-list {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
}
.article-list li { border-bottom: 1px solid var(--border); }
.article-list a {
  display: block;
  padding: 0.85rem 0;
  text-decoration: none;
  color: var(--primary);
  font-weight: 500;
  font-size: 1rem;
}
.article-list a:hover { text-decoration: underline; }
.article-list .meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.15rem;
  font-weight: 400;
}

/* === HUB CARDS === */
.hub-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}
@media (min-width: 600px) { .hub-grid { grid-template-columns: 1fr 1fr; } }
.hub-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  text-decoration: none;
  color: var(--text);
  background: var(--bg);
  transition: box-shadow var(--transition);
}
.hub-card:hover { box-shadow: var(--shadow); color: var(--text); }
.hub-card h3 {
  font-size: 1rem;
  color: var(--primary);
  margin: 0 0 0.35rem;
  font-weight: 600;
}
.hub-card p { font-size: 0.85rem; color: var(--text-muted); margin: 0; }

/* === ELEMENTOS DE CONFIANZA (E-E-A-T) === */
.trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 2.5rem;
}
.trust-item {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.trust-item .trust-icon { font-size: 1.5rem; margin-bottom: 0.4rem; }
.trust-item h3 { font-size: 0.9rem; color: var(--primary); margin: 0 0 0.25rem; }
.trust-item p { font-size: 0.8rem; color: var(--text-muted); margin: 0; }

/* === FORMULARIO DE CONTACTO === */
.contact-form { max-width: 580px; }
.form-group { margin-bottom: 1.2rem; }
.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.3rem;
  font-size: 0.9375rem;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  font-family: var(--font);
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,58,92,.12);
}
.form-group textarea { height: 130px; resize: vertical; }
.btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.72rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font);
  cursor: pointer;
  font-weight: 500;
  transition: background var(--transition);
}
.btn:hover { background: var(--primary-light); }
.form-success {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  color: var(--success);
  display: none;
}

/* === FOOTER === */
footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,.8);
  padding: 2.5rem 1rem 1.25rem;
  margin-top: 3rem;
}
.footer-grid {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.footer-col h3 {
  color: #fff;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.8rem;
}
.footer-col ul { list-style: none; padding: 0; }
.footer-col li { margin-bottom: 0.4rem; }
.footer-col a {
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: 0.85rem;
}
.footer-col a:hover { color: #fff; }
.footer-disclaimer {
  max-width: var(--max-w);
  margin: 1rem auto 0;
  font-size: 0.75rem;
  color: rgba(255,255,255,.4);
  text-align: center;
  line-height: 1.6;
}
.footer-bottom {
  max-width: var(--max-w);
  margin: 0.75rem auto 0;
  font-size: 0.78rem;
  color: rgba(255,255,255,.45);
  text-align: center;
}
.footer-bottom a { color: rgba(255,255,255,.45); text-decoration: none; }
.footer-bottom a:hover { color: rgba(255,255,255,.75); }

/* === COOKIE BANNER === */
.cookie-banner {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--primary-dark);
  color: rgba(255,255,255,.9);
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  z-index: 999;
  box-shadow: 0 -2px 12px rgba(0,0,0,.25);
}
.cookie-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.cookie-inner p { margin: 0; flex: 1; min-width: 220px; }
.cookie-inner a { color: var(--accent); }
.btn-sm {
  background: var(--accent);
  color: var(--primary-dark);
  border: none;
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-sm:hover { opacity: .9; }

/* === RESPONSIVE NAV === */
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  nav { order: 3; width: 100%; }
  nav ul {
    display: none;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.5rem 0;
  }
  nav ul.open { display: flex; }
  nav a { display: block; padding: 0.5rem 0.7rem; }
}

/* === PÁGINA SOBRE NOSOTROS === */
.author-card {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  background: var(--bg-light);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.25rem 0;
  flex-wrap: wrap;
}
.author-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.8rem;
  flex-shrink: 0;
}
.author-info h3 { font-size: 1.05rem; color: var(--primary); margin: 0 0 0.3rem; }
.author-info p { font-size: 0.875rem; color: var(--text-muted); margin: 0; }

/* === IMPRIMIR === */
@media print {
  .top-bar, header, .ad-slot, .ad-slot-sidebar, footer,
  .related-articles, .cookie-banner, aside { display: none !important; }
  main { padding: 0; }
  article { max-width: 100%; }
}
