/* ============================================================
   MAAG Arquitectura — Estilo corporativo sobrio (claro/oscuro)
   ============================================================ */

/* ---------- 1. Variables: tema claro ---------- */
:root,
[data-theme="light"] {
  --bg: #ffffff;
  --bg-alt: #f6f6f4;
  --bg-card: #ffffff;
  --ink: #1a1a1a;
  --ink-soft: #4a4a4a;
  --ink-muted: #767676;
  --rule: #1a1a1a;
  --rule-soft: #e2e2e2;
  --accent: #1f4e5f;
  --accent-hover: #163a47;
  --accent-soft: #e8eff1;
  --on-accent: #ffffff;
  --error-bg: #fdf3f3;
  --error-border: #f0cccc;
  --error-text: #7a1c1c;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --measure: 1080px;
  --radius: 6px;
}

/* ---------- 2. Variables: tema oscuro ---------- */
[data-theme="dark"] {
  --bg: #0f1112;
  --bg-alt: #171a1c;
  --bg-card: #141719;
  --ink: #f0f1f1;
  --ink-soft: #c4c8ca;
  --ink-muted: #8a9094;
  --rule: #f0f1f1;
  --rule-soft: #2a2f32;
  --accent: #6fb3c4;
  --accent-hover: #8ac5d4;
  --accent-soft: #1a2a30;
  --on-accent: #0f1112;
  --error-bg: #2a1616;
  --error-border: #4a2222;
  --error-text: #ffb4b4;
}

/* ---------- 3. Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  color-scheme: light dark;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.2s ease, color 0.2s ease;
}

img { max-width: 100%; display: block; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--accent-hover); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 4. Utilidades ---------- */
.container {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.container.page-narrow { max-width: 760px; }

.eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.75rem;
}

.section { padding: 4.5rem 0; }
.section-alt { background: var(--bg-alt); transition: background-color 0.2s ease; }

.section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  color: var(--ink);
}

.section-lead {
  font-size: 1.05rem;
  color: var(--ink-soft);
  max-width: 60ch;
  margin: 0 0 2rem;
}

.page-title {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}

/* ---------- 5. Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--rule-soft);
  transition: background-color 0.2s ease;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.9rem 1.5rem;
}

.brand { display: inline-flex; align-items: center; text-decoration: none; }
.logo { width: auto; height: 38px; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}
.site-nav a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
}
.site-nav a:hover { color: var(--accent); }
.site-nav a.is-active { color: var(--accent); }

.nav-cta {
  padding: 0.5rem 1rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent) !important;
}
.nav-cta:hover { background: var(--accent); color: var(--on-accent) !important; }

.theme-toggle {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule-soft);
  border-radius: 50%;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.2s ease;
  padding: 0;
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { line-height: 1; display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: inline; }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }

/* ---------- 6. Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-soft);
}
.btn-ghost:hover { border-color: var(--ink); }
.btn:disabled { opacity: 0.6; cursor: wait; }

.link-arrow {
  display: inline-block;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 0.5rem;
}
.link-arrow:hover { color: var(--accent-hover); }

/* ---------- 7. Hero ---------- */
.hero {
  padding: 5rem 0 4.5rem;
  background: var(--bg);
}
.hero-inner { max-width: 760px; }
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 1.25rem;
  color: var(--ink);
}
.hero .lead {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 55ch;
  margin: 0 0 2rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* ---------- 8. Servicios ---------- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.service {
  padding: 1.75rem;
  background: var(--bg-card);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, background-color 0.2s ease;
}
.service:hover { border-color: var(--accent); }

.service-num {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}
.service h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  letter-spacing: -0.01em;
}
.service-sub {
  font-size: 0.88rem;
  font-style: italic;
  color: var(--ink-muted);
  margin: 0 0 0.85rem;
}
.service p { color: var(--ink-soft); margin: 0 0 1rem; }
.service ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule-soft);
  padding-top: 0.85rem;
}
.service li {
  font-size: 0.88rem;
  color: var(--ink-soft);
  padding-left: 1rem;
  position: relative;
  margin-bottom: 0.3rem;
}
.service li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
}

/* ---------- 9. Proyecto destacado ---------- */
.featured {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 3rem;
  align-items: center;
}
.featured-media {
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--bg-alt);
}
.featured-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.featured-body h2 {
  font-size: clamp(1.4rem, 2.5vw, 1.8rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}
.featured-body p {
  color: var(--ink-soft);
  margin: 0 0 1rem;
}

/* ---------- 10. CTA ---------- */
.cta-block { text-align: center; max-width: 640px; }
.cta-block h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin: 0 0 0.75rem;
}
.cta-block p {
  color: var(--ink-soft);
  margin: 0 0 1.5rem;
}

/* ---------- 11. Equipo ---------- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.team-member {
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, background-color 0.2s ease;
}
.team-member h3 {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.35rem;
}
.team-member .role {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.75rem;
}
.team-member p {
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin: 0 0 0.85rem;
}
.team-member a {
  font-size: 0.88rem;
  font-weight: 600;
}
.team-note {
  font-size: 0.82rem;
  color: var(--ink-muted);
  font-style: italic;
  margin: 0;
}

/* ---------- 12. Formulario ---------- */
.form-wrap { max-width: 760px; }

.form-error {
  margin: 0 0 1.5rem;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  color: var(--error-text);
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: var(--radius);
}

form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.field { display: flex; flex-direction: column; }
.field-full { grid-column: 1 / -1; }
.field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.35rem;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
  transition: border-color 0.15s ease, background-color 0.2s ease;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.field textarea { resize: vertical; min-height: 110px; }

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.5rem;
}
.legal {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin: 0;
}
.legal a { color: var(--ink-soft); text-decoration: underline; }

.form-alt {
  margin-top: 1.5rem;
  font-size: 0.88rem;
  color: var(--ink-muted);
}

.hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ---------- 13. Footer ---------- */
.site-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--rule-soft);
  padding: 3rem 0 1.5rem;
  transition: background-color 0.2s ease;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-logo { width: auto; height: 34px; margin-bottom: 0.75rem; }
.footer-brand p {
  font-size: 0.9rem;
  color: var(--ink-muted);
  margin: 0;
}
.footer-col h3 {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 0.75rem;
}
.footer-col p {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin: 0 0 0.4rem;
}
.footer-col a { color: var(--ink-soft); }
.footer-col a:hover { color: var(--accent); }

.footer-bottom {
  border-top: 1px solid var(--rule-soft);
  padding-top: 1.25rem;
  font-size: 0.8rem;
  color: var(--ink-muted);
  text-align: center;
}
.footer-bottom p { margin: 0; }

/* ---------- 14. Timeline (trayectoria) ---------- */
.timeline { display: grid; gap: 2rem; }
.timeline-item {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: 1rem;
  align-items: start;
}
.timeline-num {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  padding-top: 0.2rem;
}
.timeline-item h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}
.timeline-item p {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin: 0;
}

/* ---------- 15. Responsive ---------- */
@media (max-width: 900px) {
  .featured { grid-template-columns: 1fr; gap: 2rem; }
  .featured-media { max-width: 400px; margin: 0 auto; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .header-inner { padding: 0.75rem 1.25rem; }
  .site-nav { display: none; }
  .logo { height: 34px; }

  .hero { padding: 3.5rem 0 3rem; }
  .section { padding: 3rem 0; }

  .services-grid { grid-template-columns: 1fr; }
  .team-grid { grid-template-columns: 1fr; }
  form { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column; align-items: stretch; }

  .footer-grid { grid-template-columns: 1fr; }

  .timeline-item { grid-template-columns: 2.5rem 1fr; }
}

/* ---------- 16. Impresión ---------- */
@media print {
  @page { margin: 2cm; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .site-header, .site-footer, .hero-actions, .nav-cta, .theme-toggle, .form-wrap, #formulario { display: none; }
  a { color: #000; text-decoration: underline; }
  .section, .section-alt { padding: 1rem 0; background: transparent; }
  .service, .team-member { border: 1px solid #ddd; page-break-inside: avoid; }
  .featured { grid-template-columns: 1fr; }
}

/* ---------- 17. Documento legal ---------- */
.legal-doc h2 {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 2rem 0 0.5rem;
}
.legal-doc p {
  font-size: 1rem;
  color: var(--ink-soft);
  margin: 0 0 1rem;
}
.legal-update {
  margin-top: 2.5rem;
  font-size: 0.82rem;
  color: var(--ink-muted);
}