/* =========================================================
   Badr Al Safaa Medical Centre — Gallery (master / album grouping)
   Built from Figma file "Badr-Al-Safaa", frame 526:5114
   Loads after style.css + about.css (shared top bar & nav) and footer.css.
   ========================================================= */
.page-gallery { background: #000; }

/* ---------- Hero: ARCHIVES ---------- */
.gal-hero { position: relative; overflow: hidden; height: 505px; background: #000; }
.gal-hero::before { /* campus photo, dimmed and desaturated as in the design */
  content: ""; position: absolute; inset: 0;
  background: var(--gal-hero-img, url('../assets/gallery-hero.jpg')) no-repeat 27.46% 80% / 119.72% auto;
  opacity: 0.27; filter: saturate(0.5);
}
.gal-hero::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 28%, rgba(0,0,0,0) 72%, rgba(0,0,0,0.65) 100%),
    linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 55%, rgba(0,0,0,0.4) 80%, rgba(0,0,0,0.92) 100%);
}
.gal-hero__inner {
  position: relative; z-index: 1; height: 100%; width: min(1184px, calc(100% - 32px)); margin-inline: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.gal-hero__badge {
  display: inline-flex; align-items: center; height: 29px; padding: 0 16px;
  border: 1px solid rgba(212, 175, 55, 0.3); border-radius: 999px; background: rgba(212, 175, 55, 0.1);
  font-weight: 600; font-size: 10px; line-height: 14px; letter-spacing: 0.8px; color: #e8c33a;
}
.gal-hero__title {
  margin-top: 28.5px; font-family: var(--f-serif); font-weight: 700; font-size: 54px; line-height: 60px; color: #fff;
}
.gal-hero__rule {
  display: block; width: 48px; height: 2px; margin-top: 4px;
  background: linear-gradient(90deg, rgba(212,160,23,0) 0%, #d4a017 50%, rgba(212,160,23,0) 100%);
}
.gal-hero__lead {
  margin-top: 15px; max-width: 660px; font-weight: 300; font-size: 14px; line-height: 20px; letter-spacing: 0.7px; color: #aeaeb0;
}

/* ---------- Portfolio (albums) ---------- */
.portfolio { background: #000; padding: 68px 0 72px; }
.portfolio__head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  padding-bottom: 13px; border-bottom: 1px solid #191919;
}
.portfolio__eyebrow { font-size: 11px; line-height: 16px; letter-spacing: 1.2px; color: #bca07b; }
.portfolio__title { margin-top: 0; font-family: var(--f-serif); font-weight: 400; font-size: 32px; line-height: 34px; color: #f8f7f5; }
.portfolio__count { margin-bottom: 0; font-size: 12px; line-height: 16px; letter-spacing: 1.2px; color: #9f9f9f; white-space: nowrap; }

.album-grid {
  margin-top: 24px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px;
}
.album { position: relative; }
.album[hidden] { display: none; }
.album__link {
  position: relative; display: block; height: 446px; overflow: hidden; border-radius: 4px; background: #111;
  isolation: isolate;
}
.album__img {
  position: absolute; left: 0; top: -40px; width: 100%; height: 553px; object-fit: cover;
  transition: transform .6s cubic-bezier(.2,.7,.2,1);
}
.album__link::after {
  content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.63); transition: background-color .35s ease;
}
.album__body {
  position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  padding: 0 16px 8px; text-align: center;
}
.album__title { font-weight: 600; font-size: 24px; line-height: 32px; letter-spacing: 0.3px; color: #fff; text-transform: uppercase; }
.album__rule { display: block; width: 24px; height: 1px; background: rgba(231, 220, 200, 0.65); transition: width .35s ease, background-color .35s ease; }
.album__link:hover .album__img, .album__link:focus-visible .album__img { transform: scale(1.04); }
.album__link:hover::after, .album__link:focus-visible::after { background: rgba(0, 0, 0, 0.5); }
.album__link:hover .album__rule, .album__link:focus-visible .album__rule { width: 48px; background: #d4a017; }
.album__link:focus-visible { outline: 2px solid #e6ca65; outline-offset: 3px; }

.portfolio__more { margin-top: 26px; display: flex; justify-content: center; }
.btn-more {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px; width: 204px; height: 36px;
  border: 1px solid #282627; border-radius: 999px; background: #171614;
  font-weight: 500; font-size: 16px; line-height: 20px; color: #dfdedc; transition: border-color .2s, background-color .2s;
}
.btn-more svg { color: #c3986e; transition: transform .25s; }
.btn-more:hover { border-color: #4a4235; background: #1e1c19; }
.btn-more[aria-expanded="true"] svg { transform: rotate(180deg); }
.btn-more[hidden] { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .album__link { height: 400px; }
  .album__img { height: 124%; top: -9%; }
  .album__title { font-size: 20px; line-height: 28px; }
}
@media (max-width: 860px) {
  .album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .gal-hero__lead br { display: none; }
}
@media (max-width: 640px) {
  .gal-hero { height: auto; padding: 72px 0; }
  .gal-hero::before { background-size: cover; background-position: 30% 70%; }
  .gal-hero__title { font-size: 44px; line-height: 50px; }
  .gal-hero__badge { height: auto; padding: 6px 14px; }
  .portfolio { padding: 48px 0 56px; }
  .portfolio__title { font-size: 26px; line-height: 34px; }
  .album-grid { grid-template-columns: minmax(0, 1fr); }
  .album__link { height: 340px; }
}

/* ---------- "+ Add Event" (shown to signed-in admins only) ---------- */
.portfolio__add {
  height: 44px; padding: 0 24px; border-radius: 6px; background: rgba(236,192,43,0.14); border: 1px solid rgba(236,192,43,0.3);
  font-weight: 700; font-size: 12px; line-height: 16px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--gold);
  white-space: nowrap; transition: background-color .2s;
}
.portfolio__add:hover { background: rgba(236,192,43,0.24); }
.portfolio__add[hidden], .portfolio__count[hidden] { display: none; }

/* ---------- Add Gallery Event modal ---------- */
.ae-modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.ae-modal[hidden] { display: none; }
.ae-modal__backdrop { position: absolute; inset: 0; background: rgba(5,6,8,0.78); backdrop-filter: blur(4px); }
.ae-card {
  position: relative; width: min(768px, 100%); max-height: calc(100vh - 48px); overflow-y: auto; display: flex; flex-direction: column;
  background: #0e1014; border: 1px solid rgba(197,154,69,0.4); box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); color: #e5e7eb;
}
.ae-card::before { content: ""; position: sticky; top: 0; display: block; height: 4px; flex: 0 0 4px; background: linear-gradient(90deg, #c59a45, #ecc02b, #c59a45); z-index: 1; }
.ae-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px 32px 16px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.ae-card__kicker { font-weight: 500; font-size: 10px; line-height: 15px; letter-spacing: 2.5px; color: #c59a45; }
.ae-card__title { margin-top: 2px; font-family: var(--f-serif); font-weight: 400; font-size: 24px; line-height: 32px; color: #f4ede2; }
.ae-card__close { width: 34px; height: 36px; font-size: 20px; line-height: 20px; color: #9ca3af; transition: color .2s; }
.ae-card__close:hover { color: #fff; }
.ae-card__body { padding: 32px 32px 0; display: flex; flex-direction: column; gap: 24px; }
.ae-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.ae-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ae-label { font-weight: 500; font-size: 10px; line-height: 15px; letter-spacing: 1px; color: #8f94a6; }
.ae-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 2px; }
.ae-staged { font-size: 10px; line-height: 15px; color: #c59a45; }
.ae-input {
  width: 100%; height: 38px; padding: 0 14px; border-radius: 0; background: #14151a; border: 1px solid rgba(38,40,51,0.8);
  font: 400 12px/16px var(--f-sans); color: #e5e7eb; outline: none; color-scheme: dark; transition: border-color .2s;
}
.ae-input::placeholder { color: #6b7280; }
.ae-input:focus { border-color: rgba(197,154,69,0.7); }
.ae-select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239ca3af' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
.ae-textarea { height: 66px; padding: 8px 14px; resize: vertical; }
.ae-field.is-invalid .ae-input, .ae-drop.is-invalid { border-color: #d14343; }
.ae-drop { padding: 24px; display: flex; flex-direction: column; align-items: center; text-align: center; background: #121318; border: 2px dashed #262833; transition: border-color .2s, background-color .2s; }
.ae-drop.is-over { border-color: #c59a45; background: #16171d; }
.ae-drop__btn {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 16px; margin-bottom: 12px; background: #14151a; border: 1px solid rgba(197,154,69,0.6);
  font-weight: 600; font-size: 12px; line-height: 16px; letter-spacing: 1.2px; color: #c59a45;
}
.ae-drop__btn:hover { background: #1b1c22; }
.ae-drop__text { font-weight: 500; font-size: 12px; line-height: 16px; color: #d1d5db; }
.ae-link { font: inherit; color: #c59a45; }
.ae-link:hover { text-decoration: underline; }
.ae-drop__hint { margin-top: 4px; font-size: 10px; line-height: 15px; letter-spacing: 0.5px; color: #8f94a6; }
.ae-previews { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; list-style: none; margin: 0; padding: 0; }
.ae-previews:empty { display: none; }
.ae-preview { position: relative; aspect-ratio: 226 / 170; background: #14151a; border: 1px solid #262833; overflow: hidden; }
.ae-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ae-preview__name { position: absolute; left: 4px; bottom: 4px; max-width: calc(100% - 8px); padding: 2px 6px; background: rgba(0,0,0,0.8); font-size: 8px; line-height: 12px; text-transform: uppercase; color: #c59a45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ae-preview__remove { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; background: rgba(0,0,0,0.7); font-size: 10px; line-height: 15px; color: #fff; }
.ae-preview__remove:hover { background: #000; }
.ae-progress__row { display: flex; justify-content: space-between; font-size: 10px; line-height: 15px; color: #8f94a6; }
.ae-progress__row span:last-child { color: #c59a45; }
.ae-progress__bar { margin-top: 6px; height: 2px; background: #262833; }
.ae-progress__bar i { display: block; height: 100%; width: 0; background: #ecc02b; transition: width .3s; }
.ae-error { padding: 10px 14px; background: rgba(209,67,67,0.12); border: 1px solid rgba(209,67,67,0.4); font-size: 12px; line-height: 18px; color: #fca5a5; }
.ae-card__foot { margin: 24px 32px 32px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,0.1); display: flex; justify-content: flex-end; gap: 12px; }
.ae-btn { height: 38px; padding: 0 22px; font-weight: 600; font-size: 12px; line-height: 16px; letter-spacing: 1.2px; transition: filter .2s, background-color .2s; }
.ae-btn--ghost { border: 1px solid #262833; color: #9ca3af; }
.ae-btn--ghost:hover { color: #fff; border-color: #3a3d4a; }
.ae-btn--gold { background: #c59a45; color: #0e1014; font-weight: 700; }
.ae-btn--gold:hover { filter: brightness(1.08); }
.ae-btn[disabled] { opacity: .6; cursor: progress; }
body.ae-open { overflow: hidden; }
@media (max-width: 640px) {
  .ae-row { grid-template-columns: minmax(0, 1fr); }
  .ae-card__head, .ae-card__body { padding-left: 20px; padding-right: 20px; }
  .ae-card__foot { margin: 20px; }
  .ae-previews { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
