@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* MGC Bridge gallery: navy + gold, mobile-first */
.mg {
  --navy: #0a2150;
  --navy-deep: #06142f;
  --blue: #1b4bb8;
  --blue-soft: #e8eefb;
  --gold: #f5b301;
  --gold-soft: #ffd96a;
  --ink: #14213d;
  --muted: #5b6b8c;
  --line: #d6dff2;
  --bg: #f4f7fd;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
}
.mg *, .mg *::before, .mg *::after { box-sizing: border-box; }
.mg h1, .mg h2, .mg h3 { font-family: var(--serif); }

/* ---------- Hero (text colours forced so site-wide heading styles cannot hide them) ---------- */
.mg .mg-hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(800px 320px at 90% -10%, rgba(245,179,1,.30), transparent 60%),
    radial-gradient(600px 300px at 0% 120%, rgba(27,75,184,.55), transparent 60%),
    linear-gradient(135deg, var(--navy-deep) 0%, var(--navy) 55%, #123a8f 100%);
  padding: clamp(2.5rem, 7vw, 5rem) 1rem clamp(3.5rem, 8vw, 5.5rem);
  border-bottom: 4px solid var(--gold);
}
.mg .mg-hero::before {
  content: "\2660  \2665  \2666  \2663";
  position: absolute; right: -1rem; bottom: -2.2rem;
  font-size: clamp(5rem, 16vw, 11rem); letter-spacing: .4rem; line-height: 1;
  color: rgba(255,255,255,.06); pointer-events: none; white-space: nowrap;
}
.mg-wrap { position: relative; width: min(1180px, 100%); margin-inline: auto; padding-inline: 1rem; }
.mg .mg-hero .mg-wrap { padding-inline: 1rem; }
.mg .mg-eyebrow {
  display: inline-block; margin-bottom: .9rem; color: var(--gold) !important;
  font-size: .78rem; font-weight: 800; letter-spacing: .22em; text-transform: uppercase;
}
.mg .mg-hero h1 {
  margin: 0 0 .8rem; color: #fff !important;
  font-size: clamp(2rem, 6vw, 3.6rem); line-height: 1.08; font-weight: 800; letter-spacing: -.01em;
  text-shadow: 0 2px 18px rgba(0,0,0,.25);
}
.mg .mg-hero h1::after {
  content: ""; display: block; width: 72px; height: 4px; margin-top: .9rem;
  border-radius: 4px; background: linear-gradient(90deg, var(--gold), var(--gold-soft));
}
.mg .mg-hero p {
  margin: 0; max-width: 58ch; color: rgba(255,255,255,.9) !important;
  font-size: clamp(1rem, 2.3vw, 1.2rem); line-height: 1.65; font-weight: 400;
}
.mg .mg-crumbs { margin-bottom: 1rem; font-size: .85rem; color: rgba(255,255,255,.75) !important; }
.mg .mg-crumbs a { color: var(--gold) !important; text-decoration: none; font-weight: 700; }
.mg .mg-crumbs a:hover { text-decoration: underline; }

/* ---------- Filter bar ---------- */
.mg-filter {
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: end;
  margin-top: -2.1rem; position: relative; z-index: 2;
  background: #fff; border: 1px solid var(--line); border-radius: 18px;
  padding: 1.1rem 1.3rem; box-shadow: 0 14px 36px rgba(10,33,80,.14);
}
.mg-filter label { display: block; font-weight: 700; font-size: .8rem; color: var(--navy); margin-bottom: .35rem; letter-spacing: .04em; text-transform: uppercase; }
.mg-filter select {
  min-width: 170px; padding: .7rem .9rem; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; font: inherit; color: var(--ink);
}
.mg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .72rem 1.3rem; border-radius: 10px; border: 0; cursor: pointer;
  font: inherit; font-weight: 700; text-decoration: none; line-height: 1.2;
  background: var(--navy); color: #fff; transition: background .2s, transform .1s, box-shadow .2s;
}
.mg-btn:hover { background: var(--blue); box-shadow: 0 6px 16px rgba(27,75,184,.3); }
.mg-btn:active { transform: translateY(1px); }
.mg-btn--gold { background: var(--gold); color: var(--navy); }
.mg-btn--gold:hover { background: var(--gold-soft); box-shadow: 0 6px 16px rgba(245,179,1,.4); }
.mg-btn--ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.mg-btn--ghost:hover { background: var(--blue-soft); box-shadow: none; }

/* ---------- Album grid ---------- */
.mg-section { padding: 2.5rem 0 4.5rem; }
.mg-grid { display: grid; gap: 1.4rem; grid-template-columns: 1fr; }
@media (min-width: 560px)  { .mg-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px)  { .mg-grid { grid-template-columns: repeat(3, 1fr); gap: 1.9rem; } }

.mg-card {
  position: relative; display: flex; flex-direction: column; background: #fff; text-decoration: none; color: inherit;
  border: 1px solid var(--line); border-radius: 20px; overflow: hidden;
  box-shadow: 0 6px 18px rgba(10,33,80,.07);
  transition: box-shadow .3s, border-color .3s, transform .3s;
}
.mg-card::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: linear-gradient(90deg, var(--gold), var(--gold-soft));
  transform: scaleX(0); transform-origin: left; transition: transform .35s;
}
.mg-card:hover, .mg-card:focus-visible { border-color: var(--gold); box-shadow: 0 18px 40px rgba(10,33,80,.18); transform: translateY(-4px); }
.mg-card:hover::after, .mg-card:focus-visible::after { transform: scaleX(1); }
.mg-card:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.mg-cover { position: relative; aspect-ratio: 4 / 3; background: linear-gradient(135deg, var(--navy), var(--blue)); overflow: hidden; }
.mg-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s; }
.mg-card:hover .mg-cover img { transform: scale(1.06); }
.mg-cover-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(245,179,1,.9); font-size: 4rem; letter-spacing: .5rem; }
.mg-cover::after { content: ""; position: absolute; inset: auto 0 0 0; height: 45%; background: linear-gradient(to top, rgba(6,20,47,.7), transparent); pointer-events: none; }
.mg-count {
  position: absolute; z-index: 1; right: .8rem; bottom: .8rem;
  background: var(--gold); color: var(--navy); font-size: .76rem; font-weight: 800;
  padding: .3rem .7rem; border-radius: 999px; box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.mg-body { padding: 1.15rem 1.3rem 1.4rem; display: flex; flex-direction: column; gap: .4rem; }
.mg-year { align-self: flex-start; background: #fff4cc; color: #7a5600; font-weight: 800; font-size: .78rem; letter-spacing: .06em; padding: .22rem .75rem; border-radius: 999px; }
.mg .mg-title { margin: .25rem 0 0; font-size: 1.3rem; font-weight: 700; color: var(--navy); line-height: 1.25; }
.mg-date { color: var(--blue); font-size: .92rem; font-weight: 600; }

/* ---------- Empty state ---------- */
.mg-empty { text-align: center; background: #fff; border: 2px dashed var(--line); border-radius: 20px; padding: 3.5rem 1.5rem; color: var(--muted); }
.mg-empty strong { display: block; color: var(--navy); font-family: var(--serif); font-size: 1.3rem; margin-bottom: .4rem; }

/* ---------- Photo masonry (album page) ---------- */
.mg-masonry { column-count: 1; column-gap: 1.1rem; }
@media (min-width: 520px)  { .mg-masonry { column-count: 2; } }
@media (min-width: 960px)  { .mg-masonry { column-count: 3; } }
@media (min-width: 1280px) { .mg-masonry { column-count: 4; } }
.mg-photo { break-inside: avoid; margin: 0 0 1.1rem; }
.mg-photo a {
  display: block; position: relative; overflow: hidden; border-radius: 16px;
  border: 1px solid var(--line); background: var(--blue-soft);
  box-shadow: 0 4px 14px rgba(10,33,80,.08); transition: box-shadow .3s, border-color .3s;
}
.mg-photo a::after {
  content: "\2315"; position: absolute; right: .6rem; top: .6rem; width: 36px; height: 36px;
  display: grid; place-items: center; border-radius: 50%; background: var(--gold); color: var(--navy);
  font-weight: 800; opacity: 0; transform: scale(.8); transition: opacity .25s, transform .25s;
}
.mg-photo a:hover, .mg-photo a:focus-visible { border-color: var(--gold); box-shadow: 0 14px 30px rgba(10,33,80,.2); }
.mg-photo a:hover::after, .mg-photo a:focus-visible::after { opacity: 1; transform: scale(1); }
.mg-photo img { display: block; width: 100%; height: auto; transition: transform .5s; }
.mg-photo a:hover img { transform: scale(1.04); }
.mg-photo a:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.mg-photo figcaption { margin-top: .45rem; font-size: .88rem; color: var(--muted); }

/* ---------- Lightbox (works without JS; zoom controls appear when JS loads) ---------- */
body:has(.mg-lightbox:target) { overflow: hidden; }
.mg-lightbox {
  position: fixed; inset: 0; z-index: 9999; display: none;
  align-items: center; justify-content: center; padding: 4.2rem .75rem 1rem;
  background: rgba(4,12,32,.96);
}
.mg-lightbox:target { display: flex; }
.mg-lightbox-bg { position: absolute; inset: 0; }
.mg-lb-top {
  position: absolute; z-index: 3; top: 0; left: 0; right: 0; display: flex; align-items: center;
  justify-content: space-between; gap: .75rem; padding: .75rem;
}
.mg-lb-count { color: rgba(255,255,255,.85); font-size: .9rem; font-weight: 600; min-width: 4.5rem; }
.mg-zoombar { display: none; align-items: center; gap: .35rem; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); border-radius: 999px; padding: .25rem; }
.mg-js .mg-zoombar { display: flex; }
.mg-zoombar button {
  min-width: 38px; height: 38px; padding: 0 .7rem; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--gold); color: var(--navy); font: 800 1.15rem/1 var(--sans);
}
.mg-zoombar button:hover { background: var(--gold-soft); }
.mg-zoombar button[data-zoom="reset"] { background: transparent; color: #fff; font-size: .8rem; font-weight: 700; }
.mg-zoom-level { min-width: 3.4rem; text-align: center; color: #fff; font-size: .85rem; font-weight: 700; }
.mg-close { background: #fff; color: var(--navy); border-radius: 999px; padding: .55rem 1rem; font-weight: 800; font-size: .9rem; text-decoration: none; }
.mg-close:hover { background: var(--gold); }

.mg-lightbox figure { position: relative; z-index: 1; margin: 0; width: min(94vw, 1200px); text-align: center; }
.mg-stage {
  position: relative; width: 100%; height: calc(100vh - 11.5rem); min-height: 220px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  border-radius: 14px; border: 3px solid var(--gold); background: #000; touch-action: none;
}
.mg-stage img {
  max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain;
  user-select: none; -webkit-user-drag: none; transform-origin: center center; will-change: transform;
}
.mg-js .mg-stage { cursor: zoom-in; }
.mg-js .mg-stage.is-zoomed { cursor: grab; }
.mg-js .mg-stage.is-dragging { cursor: grabbing; }
.mg-lightbox figcaption { color: #fff; margin-top: .75rem; font-size: .98rem; }
.mg-lb-hint { display: none; margin-top: .3rem; color: rgba(255,255,255,.55); font-size: .78rem; }
.mg-js .mg-lb-hint { display: block; }

.mg-nav {
  position: absolute; z-index: 4; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold); color: var(--navy); font-size: 1.7rem; font-weight: 800; text-decoration: none;
  box-shadow: 0 6px 18px rgba(0,0,0,.4);
}
.mg-nav:hover { background: var(--gold-soft); }
.mg-prev { left: .75rem; } .mg-next { right: .75rem; }
@media (max-width: 640px) {
  .mg-nav { top: auto; bottom: 1rem; transform: none; }
  .mg-prev { left: calc(50% - 60px); } .mg-next { right: calc(50% - 60px); }
  .mg-lb-hint { display: none !important; }
  .mg-stage { height: calc(100vh - 13rem); }
  .mg-zoom-level { min-width: 2.8rem; }
  .mg-zoombar button[data-zoom="reset"] { display: none; }
}

.mg-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2.5rem; }

@media (prefers-reduced-motion: reduce) {
  .mg *, .mg *::before, .mg *::after { transition: none !important; }
}

/* ---------- Pagination ---------- */
.mg-pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 2rem; color: var(--muted); flex-wrap: wrap; }
.mg-pager .is-disabled { opacity: .45; pointer-events: none; }

/* ---------- Admin ---------- */
.mg-admin-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.mg-admin-head h1 { margin: 0; color: var(--navy); font-size: clamp(1.4rem, 4vw, 2rem); }
.mg-flash { background: #fff4cc; border: 1px solid var(--gold); color: #5c4200; padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
.mg-flash--error { background: #fde8e8; border-color: #e07070; color: #7a1d1d; }
.mg-panel { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.25rem; margin-bottom: 1.25rem; display: grid; gap: 1rem; }
.mg-field label { display: block; font-weight: 700; font-size: .85rem; color: var(--navy); margin-bottom: .35rem; }
.mg-field input, .mg-field select, .mg-field textarea { width: 100%; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; }
.mg-field input:focus, .mg-field select:focus, .mg-field textarea:focus { outline: 3px solid rgba(245,179,1,.5); border-color: var(--gold); }
.mg-row { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .mg-row { grid-template-columns: repeat(4, 1fr); } }
.mg-check { display: flex; gap: .5rem; align-items: center; font-weight: 600; }
.mg-table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.mg-table { width: 100%; border-collapse: collapse; }
.mg-table th, .mg-table td { padding: .85rem 1rem; text-align: left; border-bottom: 1px solid var(--line); }
.mg-table th { background: var(--blue-soft); color: var(--navy); font-size: .85rem; }
.mg-row-actions { display: flex; gap: .5rem; justify-content: flex-end; }
@media (max-width: 640px) {
  .mg-table thead { display: none; }
  .mg-table tr { display: block; border-bottom: 1px solid var(--line); padding: .5rem 0; }
  .mg-table td { display: flex; justify-content: space-between; border: 0; padding: .35rem 1rem; }
  .mg-table td[data-label]::before { content: attr(data-label); color: var(--muted); font-weight: 600; }
}
.mg-admin-photos { display: grid; gap: 1rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .mg-admin-photos { grid-template-columns: repeat(4, 1fr); } }
.mg-admin-photo { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.mg-admin-photo img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.mg-admin-photo-actions { display: flex; gap: .4rem; padding: .5rem; flex-wrap: wrap; }
.mg-admin-photo-actions .mg-btn { padding: .4rem .7rem; font-size: .8rem; }
