/* =====================================================
   FUNDACIÓN LA PIEDAD — DESIGN SYSTEM 2025
   Dark Premium Theme · Glassmorphism · Modern UI
   ===================================================== */

/* ── TOKENS ── */
:root {
  /* Core palette */
  --bg:            #090e0e;
  --bg-2:          #0d1515;
  --surface:       rgba(255, 255, 255, 0.045);
  --surface-light: rgba(255, 255, 255, 0.07);
  --surface-solid: #111b1b;
  --glass:         rgba(15, 26, 26, 0.72);

  /* Brand */
  --brand:         #2dc88b;
  --brand-dim:     rgba(45, 200, 139, 0.18);
  --brand-glow:    rgba(45, 200, 139, 0.35);
  --gold:          #d4a85a;
  --gold-dim:      rgba(212, 168, 90, 0.18);

  /* Text */
  --text:          #e8f0ee;
  --text-2:        #9db5b0;
  --text-3:        #5a7572;

  /* Borders */
  --line:          rgba(255, 255, 255, 0.08);
  --line-brand:    rgba(45, 200, 139, 0.22);

  /* Shadows */
  --shadow-sm:     0 2px 12px rgba(0,0,0,0.35);
  --shadow-md:     0 8px 32px rgba(0,0,0,0.45);
  --shadow-lg:     0 24px 64px rgba(0,0,0,0.55);
  --shadow-brand:  0 8px 32px rgba(45, 200, 139, 0.2);

  /* Layout */
  --radius-sm:     10px;
  --radius:        16px;
  --radius-lg:     24px;
  --container:     1180px;
  --header-h:      72px;
}

/* ── RESET ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: 'Playfair Display', Georgia, serif;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

a {
  color: inherit;
  text-decoration: none;
}

img { display: block; }

/* ── CONTAINER ── */
.container {
  width: min(var(--container), 100% - 3rem);
  margin-inline: auto;
}

/* =====================================================
   HEADER
   ===================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-h);
  transition: background 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease;
}

.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.site-header.is-scrolled::before {
  background: rgba(9, 14, 14, 0.88);
  border-color: var(--line);
  backdrop-filter: blur(18px) saturate(1.2);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
  z-index: 1;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.logo-text {
  background: linear-gradient(135deg, #e8f0ee, var(--brand));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid var(--line-brand);
  box-shadow: 0 0 0 4px var(--brand-dim);
  flex-shrink: 0;
  transition: box-shadow 0.25s ease;
}

.logo:hover .logo-mark {
  box-shadow: 0 0 0 6px var(--brand-dim), 0 0 20px var(--brand-glow);
}

.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── NAV ── */
.main-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.nav-link {
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.44rem 0.85rem;
  border-radius: 999px;
  transition: color 0.2s ease, background 0.2s ease;
  position: relative;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--text);
  background: var(--surface-light);
}

.nav-link.active {
  color: var(--brand);
  background: var(--brand-dim);
}

/* ── HAMBURGER ── */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: var(--surface-light);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 8px;
}

.hamburger-line {
  display: block;
  width: 20px;
  height: 1.8px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
  opacity: 0;
}
.menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* =====================================================
   HERO
   ===================================================== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: flex-end;
  padding-bottom: 5rem;
}

/* Background image + overlays */
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  filter: saturate(0.7) brightness(0.55);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right,  rgba(9,14,14,0.85) 0%, rgba(9,14,14,0.3) 60%, rgba(9,14,14,0.15) 100%),
    linear-gradient(to top, rgba(9,14,14,0.95) 0%, rgba(9,14,14,0.4) 50%, rgba(9,14,14,0.1) 100%);
}

.hero-grain {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px;
  pointer-events: none;
}

/* Glowing orbs */
.orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  filter: blur(80px);
  animation: orbFloat 8s ease-in-out infinite alternate;
}

.orb-1 {
  width: 500px;
  height: 500px;
  top: -10%;
  left: -8%;
  background: radial-gradient(circle, rgba(45,200,139,0.12), transparent 70%);
  animation-delay: 0s;
}

.orb-2 {
  width: 400px;
  height: 400px;
  bottom: 5%;
  right: 10%;
  background: radial-gradient(circle, rgba(212,168,90,0.1), transparent 70%);
  animation-delay: -4s;
}

@keyframes orbFloat {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(20px, -30px) scale(1.08); }
}

/* Hero content */
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 680px;
}

.eyebrow-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--brand-dim);
  border: 1px solid var(--line-brand);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--brand);
  margin-bottom: 1.4rem;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}

.hero-title {
  font-size: clamp(2.6rem, 6vw, 5rem);
  font-weight: 700;
  line-height: 1.05;
  margin-bottom: 1.4rem;
  color: #ffffff;
}

.hero-title em {
  font-style: italic;
  background: linear-gradient(135deg, var(--brand) 0%, #7fe7c0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-text {
  color: rgba(232,240,238,0.75);
  font-size: clamp(1rem, 2vw, 1.12rem);
  max-width: 56ch;
  margin-bottom: 2rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 999px;
  padding: 0.78rem 1.5rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand), #1fa872);
  color: #050e0b;
  box-shadow: var(--shadow-brand);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(45,200,139,0.35);
  filter: brightness(1.06);
}

.btn-ghost {
  background: var(--surface-light);
  border: 1px solid var(--line);
  color: var(--text);
  backdrop-filter: blur(8px);
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.15);
  transform: translateY(-2px);
}

/* ── METRICS ── */
.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.metric-card {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  backdrop-filter: blur(12px);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.metric-card:hover {
  border-color: var(--line-brand);
  background: rgba(45,200,139,0.06);
}

.metric-value {
  display: block;
  font-family: 'Playfair Display', serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--brand);
  line-height: 1;
  margin-bottom: 0.3rem;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-2);
  line-height: 1.3;
}

/* ── SCROLL HINT ── */
.hero-scroll-hint {
  position: absolute;
  bottom: 2rem;
  right: 2.5rem;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.scroll-line {
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, transparent, var(--brand));
  animation: scrollLine 2s ease-in-out infinite;
}

@keyframes scrollLine {
  0%   { transform: scaleY(0); transform-origin: top; }
  50%  { transform: scaleY(1); transform-origin: top; }
  51%  { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

.scroll-label {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  writing-mode: vertical-lr;
}

/* =====================================================
   SECTIONS
   ===================================================== */
.section {
  position: relative;
  padding: 5rem 0;
}

.section-bg-accent {
  position: absolute;
  top: -60px;
  right: -80px;
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(45,200,139,0.04), transparent 70%);
  pointer-events: none;
}

.section-header {
  margin-bottom: 2rem;
}

/* ── EYEBROW ── */
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  color: var(--brand);
  margin-bottom: 0.7rem;
}

.eyebrow-light {
  color: rgba(45,200,139,0.8);
}

/* ── SPLIT LAYOUT ── */
.split {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ── HISTORIA 3-COL GRID ── */
.historia-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr 1.3fr 1fr;
  align-items: stretch;
}

/* ── HISTORIA PHOTO ── */
.historia-photo {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  align-self: stretch;
}

.historia-photo-frame {
  position: relative;
  width: 100%;
  flex: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  min-height: 420px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.35s ease,
              border-color 0.35s ease;
}

.historia-photo-frame:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--line-brand);
  border-color: var(--line-brand);
}

.historia-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  min-height: 420px;
  filter: saturate(0.85) brightness(0.95);
  transition: filter 0.4s ease, transform 0.4s ease;
}

.historia-photo-frame:hover .historia-photo-img {
  filter: saturate(1) brightness(1);
  transform: scale(1.03);
}

.historia-photo-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(9,14,14,0.75) 0%, rgba(9,14,14,0.1) 45%, transparent 100%),
    linear-gradient(135deg, rgba(45,200,139,0.06) 0%, transparent 50%);
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.historia-photo-frame:hover .historia-photo-overlay {
  opacity: 0.6;
}

.historia-photo-caption {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  padding: 0.75rem 0.2rem 0;
  border-top: none;
}

.historia-photo-label {
  font-family: 'Playfair Display', serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}

.historia-photo-year {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, transparent 60%);
  pointer-events: none;
}

.card:hover {
  border-color: rgba(255,255,255,0.14);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.card-accent-bar {
  width: 36px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brand), #7fe7c0);
  margin-bottom: 1.2rem;
}

.card-accent-bar.accent-gold {
  background: linear-gradient(90deg, var(--gold), #f0c878);
}

.card h2 {
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  color: var(--text);
  margin-bottom: 0.9rem;
}

.card p {
  color: var(--text-2);
  font-size: 0.97rem;
  line-height: 1.7;
}

.card p + p {
  margin-top: 0.85rem;
}

/* ── TIMELINE ── */
.timeline {
  list-style: none;
  display: grid;
  gap: 0;
}

.timeline-item {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 0.8rem;
  align-items: center;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
  transition: background 0.2s ease;
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-item:hover {
  background: var(--surface-light);
  border-radius: 8px;
  margin: 0 -0.5rem;
  padding-inline: 0.5rem;
}

.timeline-year {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--gold);
}

.timeline-body {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.93rem;
  color: var(--text-2);
}

.timeline-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
}

/* =====================================================
   LEGADO (DARK SECTION)
   ===================================================== */
.section-dark {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(45,200,139,0.07) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 30%, rgba(212,168,90,0.05) 0%, transparent 60%),
    linear-gradient(135deg, #0c1a1a 0%, #091010 100%);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.legado-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

.narrow {
  max-width: 680px;
  position: relative;
  z-index: 1;
}

.legado-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--brand-dim);
  border: 1px solid var(--line-brand);
  color: var(--brand);
  margin-bottom: 1.4rem;
}

.section-dark h2 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  color: var(--text);
  margin-bottom: 1rem;
}

.section-dark p {
  color: var(--text-2);
  font-size: 1rem;
  line-height: 1.75;
}

.legado-divider {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, var(--brand), transparent);
  margin-top: 2rem;
  border-radius: 2px;
}

/* =====================================================
   ENTITIES
   ===================================================== */
.entity-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}

.entity-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.9rem;
  color: var(--text-2);
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.entity-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--brand-dim), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.entity-item:hover {
  border-color: var(--line-brand);
  color: var(--text);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--line-brand);
}

.entity-item:hover::after {
  opacity: 1;
}

.entity-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--brand-dim);
  border: 1px solid var(--line-brand);
  color: var(--brand);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: background 0.25s ease;
}

.entity-item:hover .entity-icon {
  background: rgba(45,200,139,0.25);
}

.entity-item span {
  position: relative;
  z-index: 1;
  line-height: 1.4;
}

/* ── MUSEUM ── */
.museum-highlight {
  border: 1px solid rgba(212, 168, 90, 0.25);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(212,168,90,0.08) 0%, rgba(45,200,139,0.05) 100%);
  padding: 1.8rem 2rem;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1),
              border-color 0.3s ease,
              box-shadow 0.3s ease;
  display: block;
}

.museum-highlight:hover {
  border-color: rgba(212, 168, 90, 0.5);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(212, 168, 90, 0.15);
}

.museum-highlight::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,168,90,0.5), transparent);
}

.museum-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.museum-text .eyebrow {
  color: var(--gold);
}

.museum-text h3 {
  font-size: clamp(1.25rem, 2.5vw, 1.7rem);
  color: var(--text);
  margin-bottom: 0.6rem;
}

.museum-text p {
  color: var(--text-2);
  font-size: 0.93rem;
  max-width: 52ch;
  line-height: 1.7;
}

.museum-badge {
  flex-shrink: 0;
  color: var(--gold);
  opacity: 0.6;
}

/* =====================================================
   FOOTER
   ===================================================== */
.site-footer {
  position: relative;
  border-top: 1px solid var(--line);
  padding: 2rem 0;
  overflow: hidden;
}

.footer-glow {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: 120px;
  background: radial-gradient(ellipse, rgba(45,200,139,0.06), transparent 70%);
  pointer-events: none;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  position: relative;
  z-index: 1;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.footer-logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.footer-logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(0.3);
}

.footer-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.footer-tagline {
  font-size: 0.78rem;
  color: var(--text-3);
}

.footer-credit {
  font-size: 0.82rem;
  color: var(--text-3);
}

.footer-credit a {
  color: var(--brand);
  font-weight: 600;
  transition: opacity 0.2s ease;
}

.footer-credit a:hover {
  opacity: 0.75;
}

/* =====================================================
   ANIMATIONS
   ===================================================== */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.delay {
  transition-delay: 0.15s;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1024px) {
  .entity-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .menu-toggle {
    display: flex;
  }

  .main-nav {
    position: absolute;
    top: calc(var(--header-h) + 4px);
    right: 1rem;
    left: 1rem;
    background: rgba(13, 21, 21, 0.96);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
    padding: 0.8rem;
    display: grid;
    gap: 0.3rem;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
  }

  .main-nav.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .nav-link {
    border-radius: var(--radius-sm);
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
  }

  .split {
    grid-template-columns: 1fr;
  }

  .historia-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto auto;
  }

  .historia-photo {
    grid-column: 1 / -1;
    order: 3;
  }

  .historia-photo-frame {
    min-height: 240px;
  }

  .historia-photo-img {
    min-height: 240px;
  }

  .museum-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .museum-badge {
    display: none;
  }

  .hero-scroll-hint {
    display: none;
  }
}

@media (max-width: 640px) {
  .container {
    width: min(var(--container), 100% - 2rem);
  }

  .hero {
    align-items: center;
    padding-bottom: 3rem;
    padding-top: var(--header-h);
  }

  .hero-metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .entity-grid {
    grid-template-columns: 1fr;
  }

  .historia-grid {
    grid-template-columns: 1fr;
  }

  .historia-photo {
    order: unset;
    grid-column: unset;
  }

  .historia-photo-frame {
    min-height: 220px;
  }

  .historia-photo-img {
    min-height: 220px;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .footer-brand {
    flex-direction: column;
    align-items: center;
  }
}

@media (max-width: 420px) {
  .hero-title {
    font-size: 2.2rem;
  }

  .hero-metrics {
    grid-template-columns: 1fr;
  }
}

/* =====================================================
   LIGHTBOX (IMAGE VIEWER)
   ===================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(9, 14, 14, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  padding: 2rem;
}

.lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: var(--surface-light);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  z-index: 10;
  line-height: 1;
}

.lightbox-close:hover {
  background: var(--brand-dim);
  border-color: var(--brand);
  color: var(--brand);
  transform: scale(1.05);
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.lightbox.is-open .lightbox-content {
  transform: scale(1);
}

.lightbox-content img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}

.lightbox-caption {
  font-family: 'Playfair Display', serif;
  color: var(--text);
  font-size: 1rem;
  text-align: center;
  margin-top: 0.5rem;
}
