:root {
  --dark: #111827;
  --gold: #b08a42;
  --gold-dark: #8f6d2f;
  --soft: #f5f1ea;
  --grey: #6b7280;
  --white: #ffffff;
  --line: #e5e7eb;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--dark);
  background: var(--white);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Anclas no ocultas bajo el header sticky */
section[id], #top { scroll-margin-top: 90px; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

header {
  padding: 24px 7%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.95);
  backdrop-filter: saturate(120%) blur(6px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  /* Fallback de texto por si la imagen no carga */
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--dark);
}

.logo img {
  height: 64px;
  width: auto;
  display: block;
}

.logo span { color: var(--gold); }

nav a {
  margin-left: 24px;
  text-decoration: none;
  color: var(--dark);
  font-size: 14px;
  font-weight: 600;
  position: relative;
  transition: color .2s;
}

nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0;
  height: 2px;
  background: var(--gold);
  transition: width .2s ease;
}

nav a:hover { color: var(--gold); }
nav a:hover::after { width: 100%; }

/* Enlace de la página activa */
nav a[aria-current="page"] { color: var(--gold); }
nav a[aria-current="page"]::after { width: 100%; }

/* Menú móvil (CSS puro, sin JS) */
.nav-toggle { display: none; }

.nav-burger {
  display: none;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
  color: var(--dark);
  user-select: none;
  padding: 4px 8px;
}
.nav-burger::before { content: "\2630"; }
.nav-toggle:checked ~ .nav-burger::before { content: "\2715"; }

.hero {
  padding: 90px 7% 80px;
  background:
    linear-gradient(rgba(17,24,39,0.76), rgba(17,24,39,0.78)),
    url('https://images.unsplash.com/photo-1486406146926-c627a92ad1ab?auto=format&fit=crop&w=1800&q=80');
  background-size: cover;
  background-position: center;
  color: var(--white);
}

.hero-content {
  max-width: 880px;
}

/* Hero compacto para subpáginas */
.page-hero {
  padding: 72px 7% 60px;
  background:
    linear-gradient(rgba(17,24,39,0.8), rgba(17,24,39,0.82)),
    url('https://images.unsplash.com/photo-1486406146926-c627a92ad1ab?auto=format&fit=crop&w=1800&q=80');
  background-size: cover;
  background-position: center;
  color: var(--white);
}

.page-hero h1 { margin: 0 0 14px; }

.page-hero p {
  max-width: 680px;
  font-size: 19px;
  color: #e5e7eb;
  margin: 0;
}

.tag {
  display: inline-block;
  padding: 8px 14px;
  background: rgba(176,138,66,0.18);
  border: 1px solid rgba(176,138,66,0.7);
  color: #f4d58d;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 22px;
}

h1 {
  font-family: var(--serif);
  font-size: clamp(38px, 6vw, 72px);
  font-weight: 600;
  line-height: 1.04;
  margin: 0 0 24px;
  letter-spacing: -1.5px;
}

.hero p {
  max-width: 720px;
  font-size: 20px;
  color: #e5e7eb;
  margin-bottom: 34px;
}

.btns {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 15px 22px;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}

.btn-primary {
  background: var(--gold);
  color: var(--dark);
}

.btn-primary:hover {
  background: var(--gold-dark);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(176,138,66,0.35);
}

.btn-secondary {
  border: 1px solid rgba(255,255,255,0.55);
  color: var(--white);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.12);
  border-color: var(--white);
  transform: translateY(-2px);
}

section {
  padding: 76px 7%;
}

.section-title {
  max-width: 780px;
  margin-bottom: 42px;
}

.section-title h2 {
  font-family: var(--serif);
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 600;
  line-height: 1.12;
  margin: 0 0 14px;
  letter-spacing: -1px;
}

.section-title p {
  color: var(--grey);
  font-size: 18px;
  margin: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.card {
  border: 1px solid var(--line);
  padding: 28px;
  border-radius: 18px;
  background: var(--white);
  box-shadow: 0 12px 30px rgba(17,24,39,0.04);
  transition: transform .2s ease, box-shadow .2s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(17,24,39,0.08);
}

.card h3 {
  margin-top: 0;
  font-size: 22px;
}

.card p {
  color: var(--grey);
  margin-bottom: 0;
}

.number {
  font-family: var(--serif);
  color: var(--gold);
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 14px;
}

.split {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 46px;
  align-items: center;
}

.panel {
  background: var(--soft);
  border-radius: 26px;
  padding: 42px;
}

.panel h2 {
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 600;
  margin-top: 0;
  line-height: 1.1;
  letter-spacing: -1px;
}

.list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.list li {
  padding: 15px 0;
  border-bottom: 1px solid rgba(17,24,39,0.12);
  font-weight: 600;
}

.list li:last-child { border-bottom: none; }

.dark {
  background: var(--dark);
  color: var(--white);
}

.dark .section-title p,
.dark .card p {
  color: #cbd5e1;
}

.dark .card {
  background: #172033;
  border-color: rgba(255,255,255,0.08);
}

.timeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.cta {
  text-align: center;
  background: linear-gradient(135deg, #111827, #252f45);
  color: var(--white);
  padding: 80px 7%;
}

.cta h2 {
  font-family: var(--serif);
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 600;
  margin: 0 0 18px;
  letter-spacing: -1px;
}

.cta p {
  max-width: 760px;
  margin: 0 auto 30px;
  color: #d1d5db;
  font-size: 18px;
}

/* Botón de llamada centrado al final de una sección */
.section-cta {
  text-align: center;
  margin-top: 64px;
}

/* ===== Galería de proyectos (proyectos.html) ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.project-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: var(--white);
  box-shadow: 0 12px 30px rgba(17,24,39,0.04);
  transition: transform .2s ease, box-shadow .2s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(17,24,39,0.08);
}

.project-card .photo {
  aspect-ratio: 4 / 3;
  background: #e9e4da;
}

.project-card .photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.project-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px;
  flex: 1;
}

.project-state {
  align-self: flex-start;
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(176,138,66,0.12);
  border: 1px solid rgba(176,138,66,0.35);
  color: var(--gold-dark);
}

.project-card h3 {
  font-family: var(--serif);
  font-size: 22px;
  margin: 2px 0 0;
}

.project-loc {
  color: var(--gold);
  font-weight: 700;
  font-size: 14px;
}

.project-body p {
  color: var(--grey);
  margin: 0;
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--grey);
  font-size: 18px;
  padding: 40px 0;
}

/* Tarjetas de categoría (índice de proyectos) */
.cats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 22px;
}

a.card {
  display: block;
  text-decoration: none;
  color: inherit;
}

.cat-icon {
  font-size: 34px;
  line-height: 1;
  margin-bottom: 12px;
}

.cat-count {
  display: inline-block;
  margin-top: 16px;
  color: var(--gold);
  font-weight: 700;
  font-size: 14px;
}

/* Enlace "volver" en subpáginas */
.back-link {
  display: inline-block;
  margin-bottom: 16px;
  color: #f4d58d;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
}

.back-link:hover { text-decoration: underline; }

/* Tarjeta de proyecto como enlace a su detalle */
a.project-card { text-decoration: none; color: inherit; }

.project-more {
  margin-top: auto;
  padding-top: 4px;
  color: var(--gold);
  font-weight: 700;
  font-size: 14px;
}

/* ===== Página de detalle de proyecto (proyecto.html) ===== */
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-top: 10px;
}

.detail-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-bottom: 40px;
}

.detail-gallery img {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  display: block;
}

.detail-gallery img:only-child {
  grid-column: 1 / -1;
  max-width: 920px;
}

.detail-body { max-width: 820px; }
.detail-body p { color: var(--grey); font-size: 18px; }

.doc-list {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: grid;
  gap: 12px;
  max-width: 640px;
}

.doc-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: var(--dark);
  font-weight: 600;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.doc-item a:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(17,24,39,0.06);
}

.doc-item .doc-ico { font-size: 22px; }
.doc-item .doc-go { margin-left: auto; color: var(--gold); font-weight: 700; }

/* Bloque de contacto */
.contact-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 34px;
  max-width: 980px;
  margin: 14px auto 0;
  text-align: left;
}

.contact-form {
  display: grid;
  gap: 14px;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: var(--white);
  font: inherit;
}

.contact-form input::placeholder,
.contact-form textarea::placeholder { color: #9aa3b2; }

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--gold);
  background: rgba(255,255,255,0.09);
  outline: none;
}

.contact-form textarea { min-height: 130px; resize: vertical; }

.contact-form button {
  justify-self: start;
  width: auto;
  font-family: var(--sans);
  border: none;
}

.direct {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
}

.direct a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--white);
  transition: transform .2s ease, background .2s ease;
}

.direct a:hover { transform: translateY(-2px); }

.direct .ico { font-size: 22px; line-height: 1; }

.direct .phone:hover,
.direct .email:hover { background: rgba(255,255,255,0.08); }

footer {
  padding: 34px 7%;
  background: #0b1020;
  color: #9ca3af;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 14px;
}

@media (max-width: 900px) {
  .nav-burger { display: block; }

  .logo img { height: 48px; }

  nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--white);
    padding: 14px 6% 22px;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 16px 30px rgba(17,24,39,0.08);
  }

  nav a { margin: 12px 0; font-size: 16px; }

  .nav-toggle:checked ~ nav { display: flex; }

  .grid,
  .split,
  .timeline,
  .projects-grid,
  .detail-gallery,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  section { padding: 56px 6%; }
  .hero { padding: 76px 6%; }
  .page-hero { padding: 56px 6%; }
}
