/* ==========================================================================
   Gallery Page — Moments from the Tradition
   Extends the design tokens defined in styles.css
   ========================================================================== */

:root {
  --g-radius: 10px;
  --g-radius-sm: 6px;
  --g-shadow: 0 1px 2px rgba(28,26,22,0.04), 0 8px 24px -12px rgba(28,26,22,0.12);
  --g-shadow-hover: 0 4px 10px rgba(28,26,22,0.06), 0 16px 32px -14px rgba(28,26,22,0.18);
  --g-transition: 220ms cubic-bezier(.2,.7,.3,1);
}

body.gallery-page {
  font-family: var(--serif-body);
  transition: background-color var(--g-transition), color var(--g-transition);
}

/* Text-size scaling */
body.gallery-page.text-sm { font-size: 16.5px; }
body.gallery-page.text-md { font-size: 19px; }
body.gallery-page.text-lg { font-size: 21.5px; }

/* ---------- Dark mode ---------- */
body.gallery-page.gdark {
  --paper: #17140f;
  --paper-dim: #1f1b14;
  --ink: #f1ead9;
  --muted: #b8ad97;
  --border: rgba(198, 161, 91, 0.28);
  --uae-green-dark: #4ea36f;
  background: var(--paper);
  color: var(--ink);
}
body.gallery-page.gdark .site-header,
body.gallery-page.gdark .gutil-bar { background: #17140f; }
body.gallery-page.gdark .gcard,
body.gallery-page.gdark .gutil-fontsize,
body.gallery-page.gdark .gsearch-field,
body.gallery-page.gdark #gSort { background: #221d15; }
body.gallery-page.gdark .ghero { background: linear-gradient(180deg, #1f1b14, #17140f); }

/* ---------- Utility bar ---------- */
.gutil-bar {
  background: var(--uae-black);
  color: rgba(255,255,255,0.82);
  font-family: var(--sans);
  font-size: 12.5px;
}
.gutil-inner { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; gap: 16px; }
.gutil-left { display: flex; align-items: center; gap: 10px; }
.gutil-right { display: flex; align-items: center; gap: 16px; }
.gutil-lang { color: rgba(255,255,255,0.82); text-decoration: none; }
.gutil-lang:hover { color: var(--gold-light); }
.gutil-fontsize {
  display: flex;
  align-items: center;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 5px;
  overflow: hidden;
}
.gutil-fontsize button {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.65);
  font-family: var(--sans);
  cursor: pointer;
  padding: 3px 8px;
  font-size: 11px;
}
.gutil-fontsize button[data-size="md"] { font-size: 13px; }
.gutil-fontsize button[data-size="lg"] { font-size: 15px; }
.gutil-fontsize button.active,
.gutil-fontsize button:hover { color: var(--gold-light); background: rgba(255,255,255,0.08); }
.gutil-theme {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 5px;
  color: rgba(255,255,255,0.75);
  padding: 4px 7px;
  display: flex;
  cursor: pointer;
}
.gutil-theme:hover { color: var(--gold-light); border-color: var(--gold); }
.gutil-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 5px;
  padding: 4px 10px;
  color: rgba(255,255,255,0.55);
}
.gutil-search input {
  background: transparent;
  border: none;
  outline: none;
  color: rgba(255,255,255,0.9);
  font-family: var(--sans);
  font-size: 12.5px;
  width: 110px;
}
.gutil-search input::placeholder { color: rgba(255,255,255,0.4); }

/* ---------- Header nav-cta / active state ---------- */
.gallery-header .gnav-active {
  color: var(--uae-green-dark);
  border-bottom-color: var(--gold);
}
.gnav-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

/* ---------- Breadcrumb ---------- */
.gbreadcrumb {
  background: var(--paper-dim);
  border-bottom: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 13px;
}
.gbreadcrumb nav { display: flex; align-items: center; gap: 6px; padding: 10px 0; color: var(--muted); }
.gbreadcrumb a { color: var(--muted); text-decoration: none; }
.gbreadcrumb a:hover { color: var(--uae-green-dark); }
.gbreadcrumb svg { color: var(--muted); opacity: 0.6; flex-shrink: 0; }
.gbreadcrumb [aria-current="page"] { color: var(--ink); font-weight: 500; }

/* ---------- Hero ---------- */
.ghero { background: var(--paper-dim); border-bottom: 1px solid var(--border); overflow: hidden; }
.ghero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: stretch;
  min-height: 420px;
}
.ghero-text { padding: 64px 8px 56px 0; display: flex; flex-direction: column; justify-content: center; }
.ghero-eyebrow {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--uae-red);
  font-weight: 600;
  margin: 0 0 14px;
}
.ghero-text h1 {
  font-family: var(--serif-display);
  font-weight: 800;
  font-size: clamp(36px, 4.6vw, 56px);
  line-height: 1.08;
  margin: 0 0 18px;
  color: var(--ink);
}
.ghero-desc { font-size: 18px; color: var(--muted); max-width: 480px; margin: 0 0 32px; line-height: 1.6; }
.ghero-stats { display: flex; flex-wrap: wrap; gap: 22px 30px; }
.gstat {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--ink);
}
.gstat svg { color: var(--gold-dark); flex-shrink: 0; }
.gstat strong { font-family: var(--serif-display); font-size: 17px; margin-right: 3px; }

.ghero-image { position: relative; min-height: 340px; }
.ghero-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ghero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, var(--paper-dim) 0%, rgba(241,234,217,0.35) 28%, rgba(0,0,0,0) 55%);
}
body.gdark .ghero-overlay {
  background: linear-gradient(100deg, #1f1b14 0%, rgba(31,27,20,0.35) 28%, rgba(0,0,0,0) 55%);
}

/* ---------- Controls bar ---------- */
.gcontrols { padding: 26px 0; border-bottom: 1px solid var(--border); position: sticky; top: 77px; z-index: 30; background: rgba(250,247,240,0.96); backdrop-filter: blur(6px); }
body.gdark .gcontrols { background: rgba(23,20,15,0.96); }
.gcontrols-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.gfilters { display: flex; gap: 8px; flex-wrap: wrap; }
.gfilter {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: background var(--g-transition), color var(--g-transition), border-color var(--g-transition);
}
.gfilter:hover { border-color: var(--gold); }
.gfilter.active { background: var(--gold-dark); border-color: var(--gold-dark); color: #fff; }
.gtools { display: flex; align-items: center; gap: 10px; }
.gsearch-field {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  background: var(--paper);
  color: var(--muted);
}
.gsearch-field input {
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--ink);
  width: 170px;
}
#gSort {
  font-family: var(--sans);
  font-size: 13.5px;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

/* ---------- Gallery grid ---------- */
.ggallery { padding: 48px 0 20px; }
.ggrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 26px;
}
.gcard {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--g-radius);
  overflow: hidden;
  box-shadow: var(--g-shadow);
  transition: box-shadow var(--g-transition), transform var(--g-transition);
  display: flex;
  flex-direction: column;
}
.gcard:hover { box-shadow: var(--g-shadow-hover); transform: translateY(-3px); }
.gcard-media {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  overflow: hidden;
  background: var(--paper-dim);
}
.gcard-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 420ms cubic-bezier(.2,.7,.3,1);
}
.gcard:hover .gcard-media img { transform: scale(1.045); }
.gcard-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
}
.gcard-cat {
  display: block;
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-dark);
  font-weight: 600;
  margin-bottom: 4px;
}
.gcard-title {
  font-family: var(--serif-display);
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}
.gcard-arrow {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--gold-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--g-transition), color var(--g-transition), border-color var(--g-transition), transform var(--g-transition);
}
.gcard:hover .gcard-arrow { background: var(--gold-dark); border-color: var(--gold-dark); color: #fff; transform: translateX(2px); }
.gcard[hidden] { display: none; }

.gempty {
  text-align: center;
  font-family: var(--sans);
  color: var(--muted);
  padding: 60px 0;
}

/* ---------- Pagination ---------- */
.gpagination { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 44px 0 8px; }
.gpage-nav, .gpage-numbers button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--g-transition), color var(--g-transition), border-color var(--g-transition);
}
.gpage-nav:hover, .gpage-numbers button:hover { border-color: var(--gold); }
.gpage-numbers { display: flex; gap: 8px; }
.gpage-numbers button.active { background: var(--gold-dark); border-color: var(--gold-dark); color: #fff; }
.gpage-nav:disabled { opacity: 0.35; cursor: default; }

/* ---------- Lightbox ---------- */
.glightbox { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 200ms ease; }
.glightbox.open { opacity: 1; pointer-events: auto; }
.glb-backdrop { position: absolute; inset: 0; background: rgba(17,17,17,0.86); }
.glb-shell {
  position: relative;
  z-index: 2;
  width: min(1000px, 92vw);
  max-height: 88vh;
  display: flex;
  align-items: center;
  gap: 14px;
}
.glb-content {
  margin: 0;
  background: var(--paper);
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  max-height: 88vh;
  width: 100%;
}
.glb-content img { width: 100%; height: 100%; object-fit: cover; display: block; max-height: 88vh; }
.glb-info { padding: 32px; display: flex; flex-direction: column; gap: 10px; align-self: center; }
.glb-cat {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-dark);
  font-weight: 600;
}
.glb-info h3 { font-family: var(--serif-display); font-size: 26px; margin: 0; color: var(--ink); }
.glb-info p { font-size: 16px; color: var(--muted); line-height: 1.6; margin: 0; }
.glb-counter { font-family: var(--sans); font-size: 12.5px; color: var(--muted); margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.glb-close {
  position: absolute;
  top: -46px;
  right: 0;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.glb-nav {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
}
.glb-nav:hover, .glb-close:hover { background: var(--gold-dark); border-color: var(--gold-dark); }

/* ---------- Footer ---------- */
.gfooter { background: var(--uae-black); color: rgba(255,255,255,0.75); padding: 44px 0 0; font-family: var(--sans); }
.gfooter-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 24px; padding-bottom: 30px; border-bottom: 1px solid rgba(255,255,255,0.12); }
.gfooter-brand { display: flex; flex-direction: column; gap: 2px; }
.gfooter-name { font-family: var(--serif-display); font-size: 15px; letter-spacing: 0.03em; color: var(--paper); }
.gfooter-sub { font-size: 12px; letter-spacing: 0.08em; color: var(--gold-light); text-transform: uppercase; }
.gfooter-ar { font-size: 12.5px; color: rgba(255,255,255,0.5); }
.gfooter-links { list-style: none; display: flex; gap: 26px; margin: 0; padding: 0; }
.gfooter-links a { color: rgba(255,255,255,0.7); text-decoration: none; font-size: 13.5px; }
.gfooter-links a:hover { color: var(--gold-light); }
.gfooter-right { display: flex; align-items: center; gap: 18px; }
.gfooter-tagline { font-size: 13px; letter-spacing: 0.04em; color: rgba(255,255,255,0.6); }
.gfooter-social { display: flex; gap: 12px; }
.gfooter-social a { color: rgba(255,255,255,0.65); display: flex; }
.gfooter-social a:hover { color: var(--gold-light); }
.gfooter-bottom { padding: 18px 0 22px; font-size: 12px; color: rgba(255,255,255,0.45); text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .ggrid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 960px) {
  .ghero-grid { grid-template-columns: 1fr; min-height: 0; }
  .ghero-text { padding: 44px 0 28px; }
  .ghero-image { min-height: 260px; order: -1; }
  .glb-content { grid-template-columns: 1fr; }
  .glb-content img { max-height: 42vh; }
}
@media (max-width: 760px) {
  .ggrid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .gutil-right { gap: 10px; }
  .gutil-search { display: none; }
  .gcontrols-inner { flex-direction: column; align-items: stretch; }
  .gfilters { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .gfilter { flex-shrink: 0; }
  .gtools { justify-content: space-between; }
  .gsearch-field input { width: 100%; }
  .gnav-cta { display: none; }
  .gfooter-inner { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 520px) {
  .ggrid { grid-template-columns: 1fr; }
  .glb-shell { width: 94vw; }
  .glb-close { top: -42px; }
}
