/* ============================================================
   main.css — page layout, hero, scrollytelling, glass cards
   ============================================================ */

/* ---------- Typography helpers ---------- */
.label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 600;
  color: var(--primary);
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}
@media (min-width: 768px) {
  .container { padding-inline: var(--container-pad-md); }
}

/* ---------- Scroll reveal (Framer-style whileInView) ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   NAVIGATION — sticky brand + links bar
   ============================================================ */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  padding: 1.1rem 0;
  transition: background var(--dur) var(--ease), backdrop-filter var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease), padding var(--dur) var(--ease);
}
.nav.scrolled {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  padding: 0.6rem 0;
}
.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.nav__brand {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.5rem;
  letter-spacing: 0.01em;
  color: var(--text-main);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--dur) var(--ease);
}
.nav.over-hero .nav__brand { color: #fff; text-shadow: 0 1px 14px rgba(0,0,0,0.35); }

/* Links */
.nav__links {
  display: flex;
  align-items: center;
  gap: 2.1rem;
}
.nav__links a {
  position: relative;
  font-family: var(--font-body);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.3rem 0;
  transition: color var(--dur) var(--ease);
}
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: currentColor;
  opacity: 0.8;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease);
}
.nav__links a:hover { color: var(--primary); }
.nav__links a:hover::after { transform: scaleX(1); }
.nav.over-hero .nav__links a { color: rgba(255, 255, 255, 0.85); text-shadow: 0 1px 10px rgba(0,0,0,0.3); }
.nav.over-hero .nav__links a:hover { color: #fff; }

/* Mobile toggle */
.nav__toggle {
  display: none;
  color: var(--text-main);
  padding: 0.35rem;
  border-radius: 8px;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.nav.over-hero .nav__toggle { color: #fff; }
.nav__toggle:hover { background: rgba(130, 147, 126, 0.14); }

@media (max-width: 820px) {
  .nav__toggle { display: inline-flex; }
  .nav__links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    backdrop-filter: blur(20px) saturate(150%);
    /* horizontal padding only — no visible strip when collapsed */
    padding: 0 1.5rem;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: max-height var(--dur) var(--ease), opacity var(--dur) var(--ease), visibility var(--dur);
  }
  /* max-height is driven inline by JS (scrollHeight) for a reliable reveal */
  .nav.open .nav__links {
    opacity: 1;
    visibility: visible;
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
  }
  /* dropdown panel is light glass, so links stay dark even over the hero */
  .nav__links a,
  .nav.over-hero .nav__links a {
    color: var(--text-main);
    text-shadow: none;
    padding: 0.9rem 0;
    border-bottom: 1px solid rgba(44, 51, 42, 0.07);
    letter-spacing: 0.16em;
  }
  .nav__links a:last-child { border-bottom: none; }
  .nav__links a::after { display: none; }
}

/* ============================================================
   HERO — full viewport, parallax, gradient overlay
   ============================================================ */
.hero {
  position: relative;
  height: 100svh;
  min-height: 600px;
  overflow: hidden;
  display: grid;
  place-items: center;
  text-align: center;
}
.hero__bg {
  position: absolute;
  inset: -8% 0 -8% 0;
  width: 100%;
  height: 116%;
  object-fit: cover;
  z-index: 0;
  will-change: transform;
}
.hero__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(to bottom, rgba(0,0,0,0.42) 0%, rgba(0,0,0,0.10) 38%, rgba(0,0,0,0.55) 100%);
}
.hero__inner {
  position: relative;
  z-index: 2;
  color: #fff;
  padding: 0 1.5rem;
  max-width: 60rem;
}
.hero__eyebrow {
  color: rgba(255,255,255,0.92);
  margin-bottom: 1.4rem;
}
.hero__title {
  font-size: clamp(3rem, 9vw, 6rem);
  font-weight: 300;
  letter-spacing: -0.03em;
  color: #fff;
  text-shadow: 0 2px 40px rgba(0,0,0,0.35);
}
.hero__title em { font-style: italic; color: #fff; }
.hero__sub {
  margin: 1.6rem auto 0;
  max-width: 34rem;
  font-weight: 300;
  font-size: 1.05rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.9);
}
.hero__scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  color: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.hero__scroll svg { animation: bob 2s var(--ease) infinite; }
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(7px); }
}

/* ============================================================
   INTRO band
   ============================================================ */
.intro {
  padding: var(--section-gap) 0;
  text-align: center;
}
.intro__title {
  font-size: clamp(2rem, 4.5vw, 2.8rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 1rem auto 1.2rem;
  max-width: 22ch;
}
.intro__body {
  max-width: 40rem;
  margin-inline: auto;
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* ============================================================
   MAP STORY — sticky map + scrolling chapters
   ============================================================ */
.story { position: relative; }

.story__map {
  position: sticky;
  top: 0;
  height: 100svh;
  width: 100%;
  z-index: 0;
}
#map { position: absolute; inset: 0; }
.maplibregl-ctrl-attrib { font-family: var(--font-body); }

/* tonal wash to keep satellite imagery in the earthy palette */
.story__map::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(160deg, rgba(130,147,126,0.18), rgba(199,157,142,0.12));
  mix-blend-mode: multiply;
}

.story__chapters {
  position: relative;
  z-index: 2;
  margin-top: -100svh;   /* pull chapters up over the sticky map */
  padding-bottom: 6rem;
}

.chapter {
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 4rem var(--container-pad);
}
.chapter[data-side="left"]  { justify-content: flex-start; }
.chapter[data-side="right"] { justify-content: flex-end; }
@media (max-width: 760px) {
  .chapter { justify-content: center !important; padding-inline: 1.1rem; }
}

/* ---------- Glass card (Crystal Glass) ---------- */
.glass {
  width: min(440px, 100%);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-glass);
  padding: 1.9rem;
}
.glass__index {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.9rem;
}
.glass__index .num {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--accent);
  font-style: italic;
}
.glass__title {
  font-size: clamp(1.9rem, 3.4vw, 2.5rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  margin-bottom: 0.2rem;
}
.glass__coords {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 1rem;
}
.glass__caption {
  color: var(--text-main);
  font-weight: 300;
  line-height: 1.7;
  margin-bottom: 1.3rem;
}

/* ---------- Asymmetrical Tetris photo grid ---------- */
.photogrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 84px;
  gap: 8px;
}
.photogrid__item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  cursor: zoom-in;
  background: #e7e4df;
}
.photogrid__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease), filter 0.6s var(--ease);
}
.photogrid__item:hover img { transform: scale(1.06); filter: saturate(1.08); }
/* Tetris spans */
.photogrid__item.tall  { grid-row: span 2; }
.photogrid__item.wide  { grid-column: span 2; }
.photogrid__item.big   { grid-row: span 2; grid-column: span 2; }

/* ---------- Add-photo (admin) ---------- */
.addphoto {
  margin-top: 1rem;
  width: 100%;
  display: none;               /* shown only when admin authenticated */
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem;
  border: 1px dashed var(--primary);
  border-radius: 12px;
  color: var(--primary);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  background: rgba(130,147,126,0.06);
  transition: background var(--dur) var(--ease);
}
.addphoto:hover { background: rgba(130,147,126,0.14); }
body.is-admin .addphoto { display: flex; }

/* ============================================================
   CLOSING
   ============================================================ */
.closing {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: var(--section-gap) 0;
  background: var(--background);
}
.closing__title {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 300;
  font-style: italic;
  letter-spacing: -0.02em;
}
.closing__body {
  max-width: 38rem;
  margin: 1.4rem auto 0;
  color: var(--text-muted);
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
  padding: 0.85rem 1.7rem;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.btn:hover { background: var(--primary-hover); transform: translateY(-2px); }

/* ============================================================
   FOOTER — discrete admin lock
   ============================================================ */
.footer {
  position: relative;
  z-index: 2;
  background: var(--background);
  border-top: 1px solid rgba(44,51,42,0.08);
  padding: 2.5rem var(--container-pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.footer__brand { font-family: var(--font-heading); font-style: italic; font-size: 1.1rem; color: var(--text-main); }
.footer__lock {
  opacity: 0.35;
  color: var(--text-muted);
  transition: opacity var(--dur) var(--ease), color var(--dur) var(--ease);
  display: inline-flex;
  padding: 0.4rem;
}
.footer__lock:hover { opacity: 1; color: var(--primary); }
body.is-admin .footer__lock { opacity: 1; color: var(--primary); }

/* ============================================================
   MODAL (Shadcn-style dialog, crystal glass)
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 1.5rem;
}
.modal.open { display: grid; }
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(44,51,42,0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: fade 0.3s var(--ease);
}
.modal__panel {
  position: relative;
  width: min(400px, 100%);
  background: rgba(255,255,255,0.86);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-glass);
  padding: 2rem;
  animation: pop 0.35s var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }

.modal__title { font-size: 1.7rem; font-weight: 500; margin-bottom: 0.3rem; }
.modal__hint { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1.4rem; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--primary); margin-bottom: 0.4rem; font-weight: 600; }
.field input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(44,51,42,0.14);
  background: rgba(255,255,255,0.7);
  font-size: 0.95rem;
  transition: border var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(130,147,126,0.18);
}
.modal__error { color: #b4544a; font-size: 0.8rem; min-height: 1.1rem; margin-bottom: 0.4rem; }
.modal__actions { display: flex; gap: 0.7rem; margin-top: 0.6rem; }
.modal__actions .btn { margin-top: 0; flex: 1; justify-content: center; }
.btn--ghost { background: transparent; color: var(--text-main); border: 1px solid rgba(44,51,42,0.16); }
.btn--ghost:hover { background: rgba(44,51,42,0.05); transform: none; }
.modal__close {
  position: absolute;
  top: 0.9rem; right: 0.9rem;
  color: var(--text-muted);
  padding: 0.3rem;
  border-radius: 8px;
  display: inline-flex;
}
.modal__close:hover { color: var(--text-main); background: rgba(44,51,42,0.06); }

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: none;
  place-items: center;
  padding: 2rem;
  background: rgba(20,24,19,0.9);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.lightbox.open { display: grid; animation: fade 0.3s var(--ease); }
.lightbox img {
  max-width: 92vw;
  max-height: 86vh;
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  animation: pop 0.35s var(--ease);
}
.lightbox__close {
  position: absolute;
  top: 1.4rem; right: 1.6rem;
  color: #fff;
  opacity: 0.8;
  padding: 0.4rem;
  display: inline-flex;
}
.lightbox__close:hover { opacity: 1; }

/* Lucide icon defaults */
.lucide { stroke-width: 1; }
