/* =========================================================
   Raksha Friend — Gallery page only (loaded by gallery.html)
   Uses design tokens from styles.css; does not override shared components.
   ========================================================= */

/* ---------- Hero ---------- */
.g-hero {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: clamp(440px, 72vh, 680px); display: flex; align-items: center;
  padding-block: clamp(72px, 10vw, 120px); background: var(--navy-900); color: #d5e0ee;
}
.g-hero__bg { position: absolute; inset: 0; z-index: -2; }
.g-hero__bg img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.06); animation: gHeroZoom 14s var(--ease) forwards; }
.g-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(7,20,39,.35) 0%, rgba(7,20,39,.15) 40%, rgba(7,20,39,.85) 100%),
    linear-gradient(95deg, rgba(7,20,39,.92) 0%, rgba(11,31,58,.72) 48%, rgba(4,120,87,.45) 100%);
}
.g-hero::after {
  content: ""; position: absolute; right: -120px; bottom: -160px; z-index: -1; width: 420px; height: 420px; border-radius: 50%;
  border: 1px solid rgba(16,185,129,.35); box-shadow: 0 0 0 40px rgba(16,185,129,.06), 0 0 0 90px rgba(16,185,129,.04);
}
.g-hero__inner > * { opacity: 0; transform: translateY(18px); animation: gRise .9s var(--ease) forwards; }
.g-hero__inner > :nth-child(2) { animation-delay: .08s; }
.g-hero__inner > :nth-child(3) { animation-delay: .16s; }
.g-hero__inner > :nth-child(4) { animation-delay: .26s; }
.g-hero__inner > :nth-child(5) { animation-delay: .36s; }
.g-hero h1 { color: #fff; font-size: clamp(2.5rem, 7vw, 4.8rem); line-height: 1.04; max-width: 13ch; margin-bottom: 20px; }
.g-hero h1 em { font-style: italic; color: var(--emerald-500); }
.g-hero__kicker {
  display: inline-flex; align-items: center; gap: 10px; margin-bottom: 16px;
  font-size: .8rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--emerald-500);
}
.g-hero__kicker::before { content: ""; width: 28px; height: 2px; border-radius: 2px; background: currentColor; }
.g-hero__lead { font-size: clamp(1.05rem, 1.7vw, 1.25rem); color: #c9d5e6; max-width: 520px; margin-bottom: 34px; }
.g-hero__scroll {
  display: inline-flex; align-items: center; gap: 12px; color: #fff; font-weight: 700; text-decoration: none;
  padding: 12px 20px 12px 22px; border-radius: 999px; border: 1.5px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.06); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: background-color .25s, border-color .25s;
}
.g-hero__scroll svg { width: 18px; height: 18px; transform: rotate(90deg); transition: transform .3s var(--ease); }
.g-hero__scroll:hover { color: #fff; background: rgba(16,185,129,.2); border-color: var(--emerald-500); }
.g-hero__scroll:hover svg { transform: rotate(90deg) translateX(3px); }
.g-hero a:focus-visible { outline-color: #fff; }

.g-crumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 26px; padding: 0; font-size: .88rem; font-weight: 600; }
.g-crumb li { display: inline-flex; align-items: center; gap: 8px; color: var(--emerald-500); }
.g-crumb li + li::before { content: "/"; color: rgba(255,255,255,.4); }
.g-crumb a { color: #c3d0e2; text-decoration: none; }
.g-crumb a:hover { color: #fff; text-decoration: underline; }

@keyframes gRise { to { opacity: 1; transform: none; } }
@keyframes gHeroZoom { to { transform: scale(1); } }

/* ---------- Section head ---------- */
.g-section { padding-block: clamp(64px, 8vw, 110px) clamp(56px, 7vw, 96px); }
.g-head { display: grid; gap: 14px 48px; align-items: end; margin-bottom: 32px; }
@media (min-width: 900px) { .g-head { grid-template-columns: 1.1fr .9fr; } }
.g-head h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); margin: 0; }
.g-head__lead { color: var(--muted); font-size: 1.05rem; margin: 0; max-width: 480px; }

/* ---------- Filters ---------- */
.g-filters {
  display: flex; gap: 10px; margin-bottom: clamp(28px, 4vw, 44px);
  overflow-x: auto; scroll-snap-type: x proximity; padding: 4px 2px 10px; margin-inline: -2px;
  scrollbar-width: thin;
}
@media (min-width: 900px) { .g-filters { flex-wrap: wrap; overflow: visible; } }
.g-filter {
  flex: none; scroll-snap-align: start; display: inline-flex; align-items: center; gap: 10px;
  min-height: 46px; padding: 10px 18px; border-radius: 999px; cursor: pointer;
  background: #fff; color: var(--navy-900); border: 1.5px solid var(--line);
  font-weight: 700; font-size: .92rem; white-space: nowrap;
  transition: background-color .25s, color .25s, border-color .25s, box-shadow .25s, transform .25s var(--ease);
}
.g-filter:hover { border-color: var(--emerald-500); color: var(--emerald-700); transform: translateY(-1px); }
.g-filter.is-active { background: var(--emerald-600); border-color: var(--emerald-600); color: #fff; box-shadow: 0 10px 22px -12px rgba(5,150,105,.75); }
.g-filter__count {
  min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center;
  font-size: .75rem; background: var(--sky-50); color: var(--muted);
}
.g-filter.is-active .g-filter__count { background: rgba(255,255,255,.2); color: #fff; }

/* ---------- Masonry grid ---------- */
.g-grid { list-style: none; margin: 0; padding: 0; columns: 1; column-gap: 18px; }
@media (min-width: 560px) { .g-grid { columns: 2; column-gap: 18px; } }
@media (min-width: 1000px) { .g-grid { columns: 3; column-gap: 22px; } }
.g-item { break-inside: avoid; margin-bottom: 18px; }
@media (min-width: 1000px) { .g-item { margin-bottom: 22px; } }
.g-item[hidden] { display: none; }
.g-item.is-entering { animation: gIn .5s var(--ease) both; }
@keyframes gIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

.g-card {
  position: relative; display: block; width: 100%; padding: 0; border: 0; cursor: zoom-in;
  border-radius: 20px; overflow: hidden; background: linear-gradient(135deg, var(--navy-800), var(--emerald-700));
  box-shadow: var(--shadow-sm); transition: box-shadow .4s var(--ease), transform .4s var(--ease);
}
.g-item--tall .g-card { aspect-ratio: 3 / 4; }
.g-item--wide .g-card { aspect-ratio: 10 / 7; }
.g-item--square .g-card { aspect-ratio: 1 / 1; }
.g-card img { width: 100%; height: 100%; object-fit: cover; transition: transform 1s var(--ease), filter .5s; }
.g-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 45%, rgba(7,20,39,.82) 100%);
  opacity: .75; transition: opacity .4s;
}
.g-card__meta {
  position: absolute; left: 18px; right: 60px; bottom: 16px; z-index: 1; text-align: left;
  display: flex; flex-direction: column; gap: 4px; transform: translateY(4px); transition: transform .4s var(--ease);
}
.g-card__cat {
  align-self: flex-start; font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: #fff; background: rgba(16,185,129,.9); padding: 4px 10px; border-radius: 999px;
}
.g-card__title { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; color: #fff; line-height: 1.2; }
.g-card__zoom {
  position: absolute; right: 14px; bottom: 14px; z-index: 1; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(255,255,255,.95); color: var(--navy-900);
  opacity: 0; transform: scale(.8); transition: opacity .3s, transform .3s var(--ease);
}
.g-card__zoom svg { width: 20px; height: 20px; }
.g-card:hover, .g-card:focus-visible { box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.g-card:hover img, .g-card:focus-visible img { transform: scale(1.06); }
.g-card:hover::after, .g-card:focus-visible::after { opacity: 1; }
.g-card:hover .g-card__meta, .g-card:focus-visible .g-card__meta { transform: none; }
.g-card:hover .g-card__zoom, .g-card:focus-visible .g-card__zoom { opacity: 1; transform: none; }
.g-card:focus-visible { outline: 3px solid var(--emerald-500); outline-offset: 3px; }
@media (hover: none) { .g-card__zoom { opacity: 1; transform: none; } }

.g-note { margin: 18px 0 0; text-align: center; font-size: .82rem; color: var(--muted); }

/* ---------- CTA ---------- */
.g-cta-section { padding-bottom: clamp(64px, 8vw, 110px); }
.g-cta {
  position: relative; overflow: hidden; isolation: isolate;
  display: grid; gap: 28px; align-items: center;
  padding: clamp(32px, 6vw, 72px); border-radius: var(--radius-lg); color: #c3d0e2;
  background:
    radial-gradient(520px 280px at 100% 100%, rgba(16,185,129,.45), transparent 65%),
    radial-gradient(420px 240px at 0% 0%, rgba(29,58,102,.9), transparent 70%),
    var(--navy-900);
  box-shadow: var(--shadow-lg);
}
.g-cta::before {
  content: ""; position: absolute; z-index: -1; right: 8%; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.12); box-shadow: 0 0 0 30px rgba(255,255,255,.03);
}
@media (min-width: 860px) { .g-cta { grid-template-columns: 1fr auto; } }
.g-cta__kicker { font-size: .8rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--emerald-500); margin-bottom: 10px; }
.g-cta h2 { color: #fff; font-size: clamp(1.9rem, 4vw, 2.9rem); margin-bottom: 12px; }
.g-cta__text p:last-child { margin: 0; max-width: 560px; font-size: 1.05rem; }
.g-cta__btn { min-height: 54px; padding-inline: 28px; font-size: 1rem; }
.g-cta a:focus-visible { outline-color: #fff; }
@media (max-width: 559px) { .g-cta__btn { width: 100%; } }

/* ---------- Lightbox ---------- */
body.g-lock { overflow: hidden; }
.g-lightbox {
  width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; border: 0;
  background: rgba(5,14,28,.94); color: #fff;
}
.g-lightbox::backdrop { background: rgba(5,14,28,.7); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.g-lightbox[open] { display: flex; animation: gFade .3s var(--ease); }
@keyframes gFade { from { opacity: 0; } to { opacity: 1; } }
.g-lightbox__inner { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; padding: 72px 16px 24px; }
@media (min-width: 760px) { .g-lightbox__inner { padding: 72px 96px 32px; } }
.g-lightbox__figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 16px; max-width: min(1200px, 100%); width: 100%; }
.g-lightbox__media { position: relative; display: flex; justify-content: center; width: 100%; }
.g-lightbox__img {
  max-width: 100%; max-height: calc(100dvh - 190px); width: auto; height: auto; object-fit: contain;
  border-radius: 16px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.6); background: #0f2340;
  transition: opacity .3s;
}
.g-lightbox__img.is-loading { opacity: .25; }
.g-lightbox__img.is-broken { min-width: min(560px, 90vw); min-height: 300px; }
.g-lightbox__caption { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; text-align: center; }
.g-lightbox__cat { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #fff; background: var(--emerald-600); padding: 5px 12px; border-radius: 999px; }
.g-lightbox__title { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.15rem, 2.4vw, 1.5rem); }
.g-lightbox__count { font-size: .88rem; color: #a9b6c9; }

.g-lb-btn {
  position: absolute; z-index: 2; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.2);
  transition: background-color .25s, border-color .25s, transform .25s var(--ease);
}
.g-lb-btn svg { width: 22px; height: 22px; }
.g-lb-btn:hover { background: var(--emerald-600); border-color: var(--emerald-600); }
.g-lb-btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.g-lb-close { top: 14px; right: 14px; }
.g-lb-prev, .g-lb-next { top: 50%; transform: translateY(-50%); }
.g-lb-prev { left: 20px; }
.g-lb-next { right: 20px; }
.g-lb-prev:hover { transform: translateY(-50%) translateX(-2px); }
.g-lb-next:hover { transform: translateY(-50%) translateX(2px); }
@media (max-width: 759px) {
  .g-lb-prev, .g-lb-next { top: auto; bottom: 18px; transform: none; }
  .g-lb-prev:hover, .g-lb-next:hover { transform: none; }
  .g-lb-prev { left: 16px; }
  .g-lb-next { right: 16px; }
  .g-lightbox__inner { padding-bottom: 86px; }
  .g-lightbox__img { max-height: calc(100dvh - 240px); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .g-hero__bg img { animation: none; transform: none; }
  .g-hero__inner > * { animation: none; opacity: 1; transform: none; }
  .g-item.is-entering, .g-lightbox[open] { animation: none; }
  .g-card:hover, .g-card:focus-visible { transform: none; }
  .g-card:hover img, .g-card:focus-visible img { transform: none; }
}
