:root {
  --blue-900: #052b5d;
  --blue-700: #0a4f9c;
  --blue-500: #2f86e4;
  --ink: #0d1b2a;
  --shadow: 0 14px 34px rgba(2, 24, 54, 0.16);
  --topbar-height: 170px;
}

* { box-sizing: border-box; }

html {
  scroll-padding-top: calc(var(--topbar-height) + 1rem);
}

html, body {
  margin: 0;
  padding: 0;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background: linear-gradient(155deg, #f6fbff 0%, #e9f3ff 55%, #d8ecff 100%);
}

a { color: var(--blue-700); text-decoration: none; }
a:hover { text-decoration: underline; }

.bg-decoration { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.orb { position: absolute; border-radius: 999px; filter: blur(30px); opacity: 0.45; }
.orb-a { width: 420px; height: 420px; background: #8cc8ff; top: -100px; right: -70px; animation: driftA 13s ease-in-out infinite; }
.orb-b { width: 360px; height: 360px; background: #0074db; left: -120px; bottom: -90px; animation: driftB 16s ease-in-out infinite; }
.grid-overlay {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(to right, rgba(10, 79, 156, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(10, 79, 156, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.2rem;
  background: rgba(255, 255, 255, 0.84);
  border-bottom: 1px solid rgba(10, 79, 156, 0.16);
  backdrop-filter: blur(10px);
}

.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand-logo {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--blue-500);
}
.brand strong { display: block; color: var(--blue-900); }
.brand span { display: block; font-size: 0.78rem; color: #3d5f86; }

.top-nav { display: flex; gap: 1rem; font-weight: 700; }
.top-nav a { padding: 0.25rem 0.45rem; border-radius: 8px; }
.top-nav a:hover { background: #e9f3ff; text-decoration: none; }

.social-link {
  width: 34px;
  height: 34px;
  border: 1px solid #b8d7f7;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.social-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.menu-toggle {
  display: none;
  border: none;
  background: var(--blue-700);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 1.2rem;
  cursor: pointer;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: calc(100vh - var(--topbar-height));
}
.sidebar {
  position: sticky;
  top: var(--topbar-height);
  align-self: start;
  height: calc(100vh - var(--topbar-height));
  padding: 1.4rem 1rem;
  border-right: 1px solid rgba(10, 79, 156, 0.15);
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.sidebar a {
  color: #1c3f73;
  font-weight: 700;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
}
.sidebar a:hover { background: #e5f1ff; text-decoration: none; }

.content {
  padding: 1.5rem calc(320px + 1.8rem) 1.5rem 1.5rem;
  display: grid;
  gap: 1rem;
}
.right-rail {
  position: fixed;
  right: 0;
  top: var(--topbar-height);
  width: 320px;
  height: calc(100vh - var(--topbar-height));
  padding: 1rem 1rem 1.2rem;
  border-left: 1px solid rgba(10, 79, 156, 0.15);
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(6px);
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 0.75rem;
  overflow: auto;
  z-index: 15;
}

.site-footer {
  margin-top: 1rem;
  padding: 1rem calc(320px + 1.8rem) 1.2rem 1.5rem;
  color: #2c5687;
  font-size: 0.92rem;
  border-top: 1px solid rgba(10, 79, 156, 0.16);
  background: rgba(255, 255, 255, 0.7);
}

.site-footer p {
  margin: 0.15rem 0;
}

.rail-panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(10, 79, 156, 0.14);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 0.9rem;
}

.rail-panel h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.rail-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.rail-list li {
  background: #f5faff;
  border: 1px solid #c5e0fb;
  border-radius: 12px;
  padding: 0.55rem;
}

.rail-list small {
  display: block;
  color: #3f6da2;
}

.rail-list a {
  color: #093a76;
  font-weight: 700;
  font-size: 0.92rem;
}

.rail-instagram article {
  background: #f5faff;
  border: 1px solid #c5e0fb;
  border-radius: 12px;
  padding: 0.55rem;
}

.rail-instagram h4 {
  margin: 0.2rem 0;
  font-size: 0.95rem;
}

.thumb-roll {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  padding-bottom: 0.3rem;
  -webkit-overflow-scrolling: touch;
}

.thumb-roll > * {
  flex: 0 0 auto;
}

.gallery-thumb-btn {
  appearance: none;
  cursor: pointer;
  display: block;
  padding: 0;
  background: transparent;
  scroll-snap-align: start;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #c5e0fb;
  box-shadow: var(--shadow);
  width: 165px;
  height: 110px;
}

.gallery-thumb-btn:hover {
  transform: translateY(-2px);
}

.gallery-thumb-btn:focus-visible {
  outline: 3px solid #2f86e4;
  outline-offset: 2px;
}

.gallery-thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-roll .hint {
  min-width: 240px;
}

.photo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.35rem;
  align-items: start;
}

.photo-grid > * {
  flex: 1 1 calc(20% - 0.75rem);
  min-width: 140px;
}

@supports (display: grid) {
  .photo-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(140px, 1fr));
  }

  .photo-grid > * {
    min-width: 0;
  }
}

@media (max-width: 1400px) {
  .photo-grid {
    grid-template-columns: repeat(4, minmax(130px, 1fr));
  }

  .photo-grid > * {
    flex-basis: calc(25% - 0.75rem);
    min-width: 130px;
  }
}

.history-thumb-btn {
  width: 100%;
  height: 110px;
}

.photo-grid .gallery-thumb-btn {
  width: 100%;
  max-width: 100%;
}

#historia-fotos .photo-grid {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) !important;
  align-items: stretch;
}

#historia-fotos .photo-grid .gallery-thumb-btn {
  width: 100% !important;
  height: 110px;
  min-width: 0;
}

@media (max-width: 1400px) {
  #historia-fotos .photo-grid {
    grid-template-columns: repeat(4, minmax(120px, 1fr)) !important;
  }
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(8, 23, 42, 0.88);
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.lightbox-figure {
  margin: 0;
  max-width: min(96vw, 1200px);
  max-height: calc(100vh - 100px);
  display: grid;
  gap: 0.6rem;
}

.lightbox-figure img {
  max-width: 100%;
  max-height: calc(100vh - 180px);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

.lightbox-figure figcaption {
  color: #e8f4ff;
  text-align: center;
  font-weight: 700;
}

.lightbox-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.26);
}
.hero, .panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(10, 79, 156, 0.14);
  border-radius: 22px;
  box-shadow: var(--shadow);
  scroll-margin-top: calc(var(--topbar-height) + 1rem);
}
.hero { padding: 2rem; }

.eyebrow {
  margin: 0;
  color: var(--blue-700);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 800;
}

h1, h2, h3 {
  font-family: "Bebas Neue", sans-serif;
  letter-spacing: 0.03em;
  margin: 0.35rem 0 0.75rem;
}
h1 { font-size: clamp(2rem, 4.4vw, 3.9rem); color: var(--blue-900); line-height: 0.95; }
h2 { font-size: clamp(1.7rem, 2.9vw, 2.5rem); color: #08356e; }
h3 { font-size: 1.5rem; color: #0f4a91; }

.panel { padding: 1.35rem; }
.hero-meta { margin-top: 1rem; display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 0.65rem; }
.hero-meta article {
  background: linear-gradient(130deg, #f5faff, #d8ebff);
  border: 1px solid #c0defb;
  border-radius: 14px;
  padding: 0.65rem 0.75rem;
}
.hero-meta span { font-size: 0.78rem; color: #3b6ca5; text-transform: uppercase; }
.hero-meta strong { display: block; font-size: 1rem; margin-top: 0.2rem; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.news-grid, .insta-grid { margin-top: 0.85rem; display: grid; gap: 0.8rem; }
.news-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.insta-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.card {
  padding: 0.95rem;
  border-radius: 14px;
  background: #f5faff;
  border: 1px solid #c5e0fb;
}
.card h4 { margin: 0; color: #093a76; }
.card small { color: #3f6da2; }

.news-thumb {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 10px;
  margin: 0.5rem 0;
  border: 1px solid #c5e0fb;
}

.news-content {
  margin-top: 0.5rem;
  line-height: 1.45;
}

.news-content p,
.news-content ul,
.news-content ol,
.news-content blockquote,
.news-content h3,
.news-content h4 {
  margin: 0.45rem 0;
}

.news-content ul,
.news-content ol {
  padding-left: 1.2rem;
}

.clean-list { margin: 0; padding-left: 1.1rem; }
.clean-list li { margin: 0.3rem 0; }

.inline-form, .admin-form { display: grid; gap: 0.6rem; }
.admin-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 0.8rem; }
.admin-page { max-width: 880px; margin: 0 auto; }

.text-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.text-toolbar button {
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  font-size: 0.86rem;
}

.news-delete-form {
  margin-top: 0.5rem;
}

input, textarea, button { font: inherit; }
input, textarea {
  border: 1px solid #9cc8f2;
  border-radius: 11px;
  padding: 0.65rem 0.75rem;
  background: #fff;
}
textarea { min-height: 100px; resize: vertical; }

button {
  border: none;
  border-radius: 11px;
  background: linear-gradient(135deg, #0a4f9c, #2f86e4);
  color: #fff;
  font-weight: 800;
  padding: 0.62rem 0.85rem;
  cursor: pointer;
}
button:hover { filter: brightness(1.06); }

.ghost-btn {
  display: inline-block;
  border: 1px solid #8ebdea;
  border-radius: 999px;
  background: #fff;
  color: #16508f;
  font-weight: 700;
  padding: 0.4rem 0.8rem;
}
.ghost-btn:hover { background: #ebf5ff; text-decoration: none; }

.hidden { display: none; }
.hint { color: #476f9e; font-size: 0.93rem; }

.reveal { opacity: 0; transform: translateY(16px); animation: riseIn 0.6s ease forwards; }
.reveal:nth-child(2) { animation-delay: 0.08s; }
.reveal:nth-child(3) { animation-delay: 0.14s; }
.reveal:nth-child(4) { animation-delay: 0.2s; }

@keyframes riseIn { to { opacity: 1; transform: translateY(0); } }
@keyframes driftA {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-22px, 20px); }
}
@keyframes driftB {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(18px, -16px); }
}

@media (max-width: 980px) {
  .top-nav { display: none; }
  .menu-toggle { display: inline-grid; place-items: center; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    width: min(84vw, 320px);
    transform: translateX(-110%);
    transition: transform 0.25s ease;
    z-index: 30;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 1rem; }
  .site-footer {
    padding: 1rem;
  }
  .right-rail {
    position: static;
    width: auto;
    height: auto;
    grid-template-rows: auto;
    border-left: none;
    border-top: 1px solid rgba(10, 79, 156, 0.15);
    z-index: auto;
  }
  .hero { padding: 1.2rem; }
  .hero-meta { grid-template-columns: 1fr; }
  .thumb-roll {
    gap: 0.6rem;
  }
  .gallery-thumb-btn {
    width: 140px;
    height: 96px;
  }
  .history-thumb-btn {
    height: 96px;
  }
  .photo-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  #historia-fotos .photo-grid {
    grid-template-columns: repeat(2, minmax(110px, 1fr)) !important;
  }

  .photo-grid > * {
    flex-basis: calc(50% - 0.6rem);
    min-width: 120px;
  }
}
