/* =============================================================================
   style.css — Bufete de Ingeniería & Economía
   Sin fuentes externas (system font stack): evita transferir la IP del visitante
   a terceros (cf. LG München, 20.01.2022, Az. 3 O 17493/20 — Google Fonts).
   Sin estilos inline: compatible con CSP style-src 'self'.
   ============================================================================= */

:root {
  --navy-900: #0b2239;
  --navy-800: #0e2a47;
  --navy-700: #163a5f;
  --steel-600: #2f6690;
  --steel-100: #e7eef5;
  --amber-500: #f2a900;
  --amber-600: #d69500;
  --ink: #1b2430;
  --muted: #5b6676;
  --line: #dde3ea;
  --bg: #ffffff;
  --bg-alt: #f5f7fa;
  --ok: #1d7a46;
  --error: #b42318;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(11, 34, 57, .06), 0 8px 24px rgba(11, 34, 57, .08);
  --container: 1180px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }
body { margin: 0; font-family: var(--font); font-size: 1.0625rem; line-height: 1.65; color: var(--ink); background: var(--bg); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--steel-600); text-underline-offset: 3px; }
a:hover { color: var(--navy-800); }
h1, h2, h3 { line-height: 1.2; color: var(--navy-900); margin: 0 0 .6em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--amber-500); outline-offset: 2px; border-radius: 4px; }

.container { width: min(100% - 2rem, var(--container)); margin-inline: auto; }
.container-narrow { width: min(100% - 2rem, 780px); margin-inline: auto; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 1rem; top: -100px; background: var(--navy-800); color: #fff; padding: .6rem 1rem; z-index: 1000; border-radius: var(--radius); }
.skip-link:focus { top: 1rem; color: #fff; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .8rem 1.4rem; border-radius: var(--radius); border: 2px solid transparent; font: inherit; font-weight: 600; font-size: 1rem; text-decoration: none; cursor: pointer; transition: background .2s, color .2s, border-color .2s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-sm { padding: .5rem 1rem; font-size: .92rem; }
.btn-primary { background: var(--amber-500); color: var(--navy-900); }
.btn-primary:hover { background: var(--amber-600); color: var(--navy-900); }
.btn-outline { border-color: var(--navy-800); color: var(--navy-800); background: transparent; }
.btn-outline:hover { background: var(--navy-800); color: #fff; }
.btn-ghost { background: transparent; color: inherit; border-color: transparent; text-decoration: underline; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }

/* ---------- Cabecera ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: saturate(1.5) blur(6px); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 72px; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--navy-800); }
.brand-mark { color: var(--navy-800); display: inline-flex; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.05rem; }
.brand-text small { color: var(--muted); font-size: .78rem; }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 1.6rem; }
.main-nav a:not(.btn) { color: var(--ink); text-decoration: none; font-weight: 500; }
.main-nav a:not(.btn):hover, .main-nav a[aria-current="page"] { color: var(--steel-600); }
.main-nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; }
.nav-toggle { display: none; background: none; border: 0; width: 44px; height: 44px; cursor: pointer; position: relative; }
.nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after { display: block; width: 24px; height: 2px; background: var(--navy-800); position: absolute; left: 10px; transition: transform .2s; content: ""; }
.nav-toggle-bar { top: 21px; }
.nav-toggle-bar::before { top: -7px; left: 0; }
.nav-toggle-bar::after { top: 7px; left: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::before { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::after { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 880px) {
  .nav-toggle { display: block; }
  .main-nav { position: absolute; left: 0; right: 0; top: 72px; background: #fff; border-bottom: 1px solid var(--line); display: none; }
  .main-nav.is-open { display: block; }
  .main-nav ul { flex-direction: column; align-items: stretch; gap: 0; padding: .5rem 1rem 1rem; }
  .main-nav li a:not(.btn) { display: block; padding: .8rem 0; border-bottom: 1px solid var(--line); }
  .main-nav .btn { margin-top: .8rem; width: 100%; }
  .brand-text small { display: none; }
}

/* ---------- Hero / Perfil ---------- */
.hero { background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 100%); color: #e9eff6; padding: clamp(3rem, 7vw, 6rem) 0; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: auto -10% -40% auto; width: 520px; height: 520px; border-radius: 50%; background: radial-gradient(circle, rgba(242,169,0,.18), transparent 70%); pointer-events: none; }
.hero-grid { display: grid; grid-template-columns: 1.25fr .9fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; position: relative; z-index: 1; }
.hero h1 { color: #fff; }
.hero-lead { font-size: 1.15rem; color: #c9d6e3; max-width: 60ch; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; font-weight: 700; color: var(--amber-500); margin-bottom: .8rem; }
.section:not(.section-dark) .eyebrow, .page-hero .eyebrow { color: #8a5c00; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin: 1.8rem 0; }
.hero .btn-outline { border-color: #fff; color: #fff; }
.hero .btn-outline:hover { background: #fff; color: var(--navy-900); }
.hero-profile { margin: 0; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); border-radius: var(--radius-lg); padding: 1.4rem; text-align: center; }
.hero-profile img { width: 100%; max-width: 320px; aspect-ratio: 1; object-fit: cover; border-radius: 50%; margin: 0 auto 1.2rem; border: 4px solid var(--amber-500); background: var(--navy-700); }
.hero-profile figcaption strong { display: block; color: #fff; font-size: 1.2rem; }
.hero-profile figcaption > span { display: block; color: #b9c7d6; font-size: .95rem; margin-top: .2rem; }
.badges { list-style: none; padding: 0; margin: 1rem 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; }
.badges li { font-size: .78rem; font-weight: 600; padding: .3rem .7rem; border-radius: 999px; background: rgba(242,169,0,.15); color: #ffd772; border: 1px solid rgba(242,169,0,.35); }

@media (max-width: 880px) { .hero-grid { grid-template-columns: 1fr; } .hero-profile { order: -1; } .hero-profile img { max-width: 200px; } }

/* ---------- Redes ---------- */
.social { list-style: none; margin: 0; padding: 0; display: flex; gap: .6rem; flex-wrap: wrap; }
.social a { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid currentColor; color: inherit; transition: background .2s, color .2s; }
.social-hero a, .social-contact a, .social-footer a { color: #e9eff6; border-color: rgba(255,255,255,.35); }
.social-hero a:hover, .social-contact a:hover, .social-footer a:hover { background: var(--amber-500); color: var(--navy-900); border-color: var(--amber-500); }

/* ---------- Secciones ---------- */
.section { padding: clamp(3rem, 7vw, 5.5rem) 0; }
.section-alt { background: var(--bg-alt); }
.section-dark { background: var(--navy-900); color: #d5e0ea; }
.section-dark h2 { color: #fff; }
.section-header { max-width: 680px; margin-bottom: 2.5rem; }
.section-header p:last-child { color: var(--muted); }
.section-header-row { max-width: none; display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; }

/* ---------- Servicios ---------- */
.services-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.4rem; }
.service { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.8rem; transition: box-shadow .2s, transform .2s, border-color .2s; }
.service:hover { box-shadow: var(--shadow); transform: translateY(-3px); border-color: transparent; }
.service-icon { display: inline-flex; width: 56px; height: 56px; align-items: center; justify-content: center; border-radius: 12px; background: var(--steel-100); color: var(--steel-600); margin-bottom: 1rem; }
.service p { color: var(--muted); margin: 0; }

/* ---------- Tarjetas (noticias / proyectos) ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.6rem; }
.card { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; transition: box-shadow .2s, transform .2s; }
.card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.card-media { display: block; aspect-ratio: 16 / 10; background: var(--steel-100); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card:hover .card-media img { transform: scale(1.04); }
.card-media-placeholder { display: block; width: 100%; height: 100%; background: linear-gradient(135deg, var(--navy-700), var(--steel-600)); }
.card-body { padding: 1.3rem 1.4rem 1.5rem; display: flex; flex-direction: column; flex: 1; }
.chip { align-self: flex-start; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--steel-600); background: var(--steel-100); padding: .25rem .65rem; border-radius: 999px; margin-bottom: .8rem; }
.card-title { font-size: 1.15rem; margin-bottom: .4rem; }
.card-title a { color: var(--navy-900); text-decoration: none; }
.card-title a:hover { color: var(--steel-600); }
.card-date { font-size: .85rem; color: var(--muted); margin-bottom: .7rem; }
.card-excerpt { color: var(--muted); font-size: .97rem; flex: 1; }
.card-more { font-weight: 600; text-decoration: none; margin-top: .4rem; }

/* ---------- Paginación ---------- */
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; margin-top: 3rem; }
.pagination a { min-width: 44px; padding: .55rem .9rem; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; text-align: center; color: var(--navy-800); }
.pagination a[aria-current="page"] { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }

/* ---------- Páginas interiores ---------- */
.page-hero, .post-hero { background: var(--bg-alt); border-bottom: 1px solid var(--line); padding: 3rem 0 2.4rem; }
.page-hero p { color: var(--muted); max-width: 65ch; }
.breadcrumb { font-size: .88rem; color: var(--muted); margin-bottom: 1rem; }
.post-meta { color: var(--muted); font-size: .95rem; }
.post-cover { margin-top: 2rem; }
.post-cover img { border-radius: var(--radius-lg); width: 100%; }
.prose { padding: 2.5rem 0; }
.prose h2 { margin-top: 2rem; font-size: 1.6rem; }
.prose h3 { margin-top: 1.6rem; }
.prose img { border-radius: var(--radius); margin: 1.5rem 0; }
.prose blockquote { border-left: 4px solid var(--amber-500); margin: 1.5rem 0; padding: .4rem 1.2rem; background: var(--bg-alt); }
.prose table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: .95rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: .6rem .8rem; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.prose { overflow-wrap: break-word; }
@media (max-width: 600px) { .prose table { display: block; overflow-x: auto; } }
.prose th { background: var(--bg-alt); }
.prose code { background: var(--bg-alt); padding: .1rem .35rem; border-radius: 4px; font-size: .9em; }
.post-footer { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-bottom: 4rem; }
.legal-meta { font-size: .9rem; color: var(--muted); }

/* ---------- Contacto ---------- */
.contact-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.contact-grid > * { min-width: 0; }
.contact-card { background: #fff; color: var(--ink); border-radius: var(--radius-lg); padding: clamp(1.4rem, 3vw, 2.2rem); box-shadow: var(--shadow); }
@media (max-width: 880px) { .contact-grid { grid-template-columns: 1fr; } }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.2rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field-full { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.field label { font-weight: 600; font-size: .93rem; }
.field input, .field select, .field textarea { font: inherit; font-size: 1rem; padding: .7rem .85rem; border: 1px solid #c4ccd6; border-radius: var(--radius); background: #fff; color: var(--ink); width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--steel-600); outline: 3px solid rgba(47,102,144,.25); outline-offset: 0; }
.field input:user-invalid, .field select:user-invalid, .field textarea:user-invalid { border-color: var(--error); }
.field small { color: var(--muted); font-size: .82rem; }
.check { flex-direction: row; align-items: flex-start; gap: .65rem; }
.check input { width: 20px; height: 20px; margin-top: .2rem; flex-shrink: 0; accent-color: var(--navy-800); }
.check label { font-weight: 400; font-size: .92rem; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.turnstile-box { min-height: 0; }
.info-basica { width: 100%; border-collapse: collapse; font-size: .8rem; margin: 1.4rem 0 1rem; color: var(--muted); }
.info-basica caption { text-align: left; font-weight: 700; color: var(--ink); margin-bottom: .4rem; font-size: .85rem; }
.info-basica th, .info-basica td { border: 1px solid var(--line); padding: .35rem .55rem; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.info-basica th { width: 28%; background: var(--bg-alt); font-weight: 600; color: var(--ink); }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.form-status { margin: 0; font-size: .95rem; }
.form-status.is-ok { color: var(--ok); font-weight: 600; }
.form-status.is-error { color: var(--error); font-weight: 600; }
.form-warning { margin-top: 1rem; font-size: .85rem; color: var(--error); }

/* ---------- Pie ---------- */
.site-footer { background: var(--navy-800); color: #c3cfdb; font-size: .95rem; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 2rem; padding: 3.5rem 0 2.5rem; }
.footer-grid p { color: #a9b8c7; }
@media (max-width: 880px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-title { color: #fff; font-size: 1rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 1rem; }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.footer-links a, .footer-links .link-button { color: #c3cfdb; text-decoration: none; }
.footer-links a:hover, .footer-links .link-button:hover { color: var(--amber-500); text-decoration: underline; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); }
.footer-bottom-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .6rem; padding: 1.2rem 0; font-size: .85rem; }
.footer-bottom p { margin: 0; }
.footer-bottom a { color: #c3cfdb; }

/* ---------- Banner de cookies ---------- */
.consent { position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 100; display: flex; justify-content: center; }
.consent[hidden] { display: none; }
.consent-inner { max-width: 760px; width: 100%; background: #fff; color: var(--ink); border-radius: var(--radius-lg); box-shadow: 0 10px 40px rgba(11,34,57,.28); padding: 1.4rem 1.6rem; border: 1px solid var(--line); max-height: calc(100vh - 2rem); overflow: auto; }
.consent-title { font-size: 1.15rem; margin-bottom: .4rem; }
.consent p { font-size: .92rem; margin-bottom: .8rem; }
.consent fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
.consent-row { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; padding: .8rem 0; border-top: 1px solid var(--line); }
.consent-row p { font-size: .85rem; color: var(--muted); margin: .2rem 0 0; }
.consent-row input { width: 22px; height: 22px; accent-color: var(--navy-800); flex-shrink: 0; }
.consent-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
/* Igual prominencia para Aceptar y Rechazar (AEPD/CEPD) */
.btn-consent { background: var(--navy-800); color: #fff; min-width: 130px; }
.btn-consent:hover { background: var(--navy-900); color: #fff; }
@media (max-width: 560px) { .consent-actions .btn-consent { flex: 1 1 45%; } }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: 6rem 0; }

@media print { .site-header, .consent, .site-footer, .hero-actions { display: none !important; } }

/* Páginas de servicio (SEO) */
.page-hero .landing-lead { font-size: 1.12rem; color: var(--ink, #0e2238); max-width: 62ch; margin: .6rem 0 1.4rem; }
.service-link { display: inline-block; margin-top: .6rem; font-weight: 600; color: #8a5c00; text-decoration: none; }
.service-link:hover, .service-link:focus-visible { text-decoration: underline; }
