/* Temas: se elige con <body class="theme-N"> desde config.php */
:root,
.theme-1 {
  --primary: #1f3a6b; --primary-dark: #14264a; --accent: #1d5fc4; --on-accent: #fff;
  --bg: #f3f5f8; --surface: #fff; --text: #1c2430; --muted: #4f5b6b; --line: #d8dee6;
}
.theme-2 {
  --primary: #1f4d3a; --primary-dark: #14362a; --accent: #8a5a1c; --on-accent: #fff;
  --bg: #f6f1e7; --surface: #fffdf8; --text: #25302a; --muted: #55604f; --line: #ddd3bf;
}
.theme-3 {
  --primary: #7a1f35; --primary-dark: #561425; --accent: #7a1f35; --on-accent: #fff;
  --bg: #f1f0f0; --surface: #fff; --text: #2a2a2e; --muted: #585860; --line: #dcdada;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; line-height: 1.6; color: var(--text); background: var(--bg); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; }
h2 { font-size: clamp(1.6rem, 4vw, 2.1rem); color: var(--primary); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.container { width: min(1120px, 100% - 32px); margin-inline: auto; }
.icon { width: 1.25em; height: 1.25em; flex: none; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--primary); color: #fff; padding: 8px 14px; z-index: 100; }
.skip-link:focus { left: 8px; top: 8px; }

/* Botones */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: 8px; font-weight: 600; text-decoration: none; border: 2px solid transparent; cursor: pointer; font-size: 1rem; font-family: inherit; line-height: 1.2; transition: background .15s, color .15s; }
.btn-access { background: var(--accent); color: var(--on-accent); }
.btn-access:hover { filter: brightness(1.12); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: #fff; border-color: #fff; }
.btn-ghost:hover { background: #fff; color: var(--primary-dark); }

/* Header */
.site-header { position: fixed; inset: 0 0 auto 0; z-index: 50; background: var(--surface); transition: box-shadow .2s; }
.site-header.scrolled { box-shadow: 0 2px 12px rgba(0, 0, 0, .12); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 72px; gap: 16px; }
.brand img { width: 190px; height: auto; }
.main-nav { display: flex; align-items: center; gap: 24px; }
.main-nav ul { display: flex; gap: 22px; list-style: none; margin: 0; padding: 0; }
.main-nav ul a { color: var(--text); text-decoration: none; font-weight: 500; padding: 6px 0; }
.main-nav ul a:hover { color: var(--primary); text-decoration: underline; }
.nav-toggle { display: none; background: none; border: 0; padding: 10px; cursor: pointer; }
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--primary); margin: 5px 0; transition: transform .2s, opacity .2s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Hero */
.hero { position: relative; color: #fff; padding: 140px 0 96px; min-height: 78vh; display: flex; align-items: center; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; background: linear-gradient(105deg, var(--primary-dark) 8%, rgba(0, 0, 0, .35) 100%), url("../img/foto1.svg") center / cover; }
.hero-content { position: relative; max-width: 720px; margin-left: max(16px, calc((100% - 1120px) / 2)); margin-right: 16px; width: auto; }
.hero-kicker { text-transform: uppercase; letter-spacing: .12em; font-size: .85rem; font-weight: 600; opacity: .9; }
.hero h1 { font-size: clamp(2.1rem, 6vw, 3.4rem); color: #fff; }
.hero-sub { font-size: 1.15rem; max-width: 560px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 28px; }

/* Secciones */
.section { padding: 72px 0; }
.section-alt { background: var(--surface); }
.section-title { text-align: center; margin-bottom: 40px; }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.about-media img, .photo-pair img, .contact-photo { border-radius: 12px; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.history { margin-top: 28px; padding-left: 18px; border-left: 4px solid var(--accent); }
.history h3 { color: var(--primary); }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 26px; }
.section-alt .card { background: var(--bg); }
.card h3 { color: var(--primary); }
.card p { color: var(--muted); margin: 0; }
.card-icon { display: inline-flex; width: 48px; height: 48px; align-items: center; justify-content: center; border-radius: 10px; background: var(--primary); color: #fff; margin-bottom: 14px; }
.card-icon .icon { width: 26px; height: 26px; }
.photo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 40px; }

.buildings { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.buildings li { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.buildings .icon { color: var(--primary); width: 28px; height: 28px; }
.buildings strong, .buildings span { display: block; }
.buildings span { color: var(--muted); font-size: .92rem; }

/* Contacto */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.contact-list { list-style: none; padding: 0; margin: 0 0 24px; }
.contact-list li { display: flex; gap: 12px; align-items: center; padding: 8px 0; }
.contact-list .icon { color: var(--primary); }
.contact-form { display: grid; gap: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.field input, .field textarea { width: 100%; padding: 12px 14px; border: 1px solid #8a95a3; border-radius: 8px; font: inherit; background: #fff; color: var(--text); }
.field textarea { resize: vertical; }
.contact-form .btn { justify-self: start; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.alert-ok { background: #e3f4e8; color: #145a2a; border: 1px solid #9ad2ab; }
.alert-error { background: #fbe6e6; color: #8a1c1c; border: 1px solid #e3a3a3; }
.map-wrap { margin-top: 48px; }
.map-wrap iframe { width: 100%; height: 360px; border: 0; border-radius: 12px; }

/* Footer */
.site-footer { background: var(--primary-dark); color: #fff; padding: 48px 0 20px; }
.site-footer a { color: #fff; }
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 32px; }
.footer-grid img { width: 220px; margin-bottom: 12px; }
.footer-slogan { opacity: .85; }
.footer-contact { list-style: none; margin: 0; padding: 0; }
.footer-contact li { padding: 4px 0; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 32px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .25); font-size: .9rem; opacity: .9; }

/* Responsive */
@media (max-width: 900px) {
  .cards, .buildings { grid-template-columns: repeat(2, 1fr); }
  .about-grid, .contact-grid { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .main-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 16px 20px; box-shadow: 0 8px 16px rgba(0, 0, 0, .12); }
  .main-nav.open { display: flex; }
  .main-nav ul { flex-direction: column; gap: 0; }
  .main-nav ul a { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .main-nav .btn { justify-content: center; }
  .brand img { width: 160px; }
  .hero { padding: 112px 0 64px; }
  .section { padding: 52px 0; }
}
@media (max-width: 560px) {
  .cards, .buildings, .photo-pair { grid-template-columns: 1fr; }
  .hero-actions .btn { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
