@font-face {
  font-family: "Alexandria";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/assets/fonts/alexandria-arabic.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "Alexandria";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/assets/fonts/alexandria-latin.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --safe-top: env(safe-area-inset-top, 0px);
  --ink: #11130f;
  --white: #f6f4ec;
  --gold: #c8aa67;
}

* { box-sizing: border-box; }
html { background: var(--ink); scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; overflow-x: hidden; background: var(--ink); color: var(--white); font-family: "Alexandria", Arial, sans-serif; }
button, a { -webkit-tap-highlight-color: transparent; }

.gallery-header {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: calc(4.6rem + var(--safe-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(.65rem + var(--safe-top)) 1rem .65rem;
  direction: ltr;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(17,19,15,.82);
  backdrop-filter: blur(20px) saturate(1.25);
}

.gallery-brand { min-width: 0; display: flex; align-items: center; gap: .55rem; color: inherit; text-decoration: none; }
.gallery-brand img { width: 3.1rem; height: 2.3rem; object-fit: contain; }
.gallery-brand span { overflow: hidden; font: 600 .76rem/1 "Alexandria", Arial, sans-serif; letter-spacing: .2em; white-space: nowrap; }
.gallery-back, .viewer button { display: grid; place-items: center; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.06); color: white; }
.gallery-back { min-height: 3rem; flex: 0 0 auto; padding-inline: 1rem; border-radius: 999px; color: white; font-size: .72rem; text-decoration: none; }
.gallery-back svg, .viewer button svg { width: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.7; }

.gallery-grid {
  max-width: 112rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 2px;
  padding: 2px 2px calc(2rem + env(safe-area-inset-bottom, 0px));
  direction: rtl;
}

.gallery-tile {
  width: 100%;
  display: block;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: .32rem;
  background: #242821;
  cursor: zoom-in;
  aspect-ratio: auto;
}

.gallery-tile img { width: 100%; height: auto; display: block; object-fit: contain; background: #11130f; transition: transform .45s ease, opacity .3s ease; }
.gallery-tile:active img { transform: scale(.985); opacity: .84; }
.gallery-tile--featured { grid-column: 1 / -1; border-radius: .5rem; }
.gallery-tile--featured img { width: 100%; }

.viewer {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: #070807;
  color: white;
  direction: ltr;
}
.viewer::backdrop { background: #070807; }
.viewer[open] { display: block; }
.viewer__stage { position: absolute; inset: 0 0 5.85rem; width: 100%; display: grid; place-items: center; overflow: hidden; touch-action: pan-y pinch-zoom; }
.viewer__stage img { width: 100%; height: 100%; display: block; object-fit: contain; user-select: none; -webkit-user-select: none; opacity: 1; transform: translateX(0) scale(1); transition: opacity .2s ease, transform .28s cubic-bezier(.2,.75,.2,1); }
.viewer__stage.is-changing img { opacity: .25; transform: translateX(var(--slide-shift, 1.5rem)) scale(.985); }
.viewer__stage.is-zoomed { cursor: zoom-out; touch-action: none; }
.viewer__stage.is-zoomed img { transform: scale(2); transform-origin: var(--zoom-x, 50%) var(--zoom-y, 50%); cursor: zoom-out; }
.viewer button { position: fixed; z-index: 3; width: 3rem; height: 3rem; margin: 0; border-radius: 50%; cursor: pointer; }
.viewer__close { position: fixed !important; top: calc(.8rem + var(--safe-top)); right: .8rem; background: rgba(12,13,11,.62) !important; backdrop-filter: blur(12px); }
.viewer__filmstrip { position: fixed; z-index: 3; inset: auto 0 0; height: calc(5.85rem + env(safe-area-inset-bottom, 0px)); display: flex; gap: .42rem; align-items: center; overflow-x: auto; padding: .72rem 1rem calc(.72rem + env(safe-area-inset-bottom, 0px)); direction: rtl; scroll-snap-type: x proximity; scrollbar-width: none; background: linear-gradient(180deg, transparent, rgba(4,5,4,.86) 35%); }
.viewer__filmstrip::-webkit-scrollbar { display: none; }
.viewer__filmstrip button { position: relative; flex: 0 0 3.7rem; width: 3.7rem; height: 3.7rem; overflow: hidden; padding: 0; border: 1px solid rgba(255,255,255,.16); border-radius: .55rem; opacity: .55; scroll-snap-align: center; transition: opacity .2s ease, border-color .2s ease, transform .2s ease; }
.viewer__filmstrip button.is-active { border-color: var(--gold); opacity: 1; transform: translateY(-.12rem); }
.viewer__filmstrip img { width: 100%; height: 100%; display: block; object-fit: cover; }
.viewer__count { position: fixed; z-index: 4; left: 50%; bottom: calc(5.15rem + env(safe-area-inset-bottom, 0px)); translate: -50% 0; padding: .42rem .7rem; border-radius: 999px; background: rgba(12,13,11,.68); color: rgba(255,255,255,.86); font: 500 .68rem/1 "Alexandria", Arial, sans-serif; direction: ltr; white-space: nowrap; backdrop-filter: blur(12px); }

@media (min-width: 700px) {
  .gallery-header { padding-inline: 2rem; }
  .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: .45rem; gap: .45rem; }
  .gallery-tile--featured { grid-column: span 2; }
  .gallery-tile:hover img { transform: scale(1.018); }
}

@media (min-width: 1180px) { .gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
