/* ==========================================================================
   UCT Ballroom: design system.
   All colours live in the tokens below. Swap them (and templates/_logo.html)
   when the real branding arrives. Dark is the default; light is opt-in via
   the header toggle (html[data-theme="light"]).
   ========================================================================== */

@font-face { font-family: "Bevan"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("../fonts/bevan-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Bevan"; font-weight: 400; font-style: italic; font-display: swap;
  src: url("../fonts/bevan-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-weight: 100 1000; font-style: normal; font-display: swap;
  src: url("../fonts/dm-sans-latin-wght-normal.woff2") format("woff2"); }

:root {
  color-scheme: dark;
  --bg: #0a1128;
  --bg-elev: #101a38;
  --surface: #152145;
  --surface-2: #1d2b57;
  --text: #e9edf9;
  --muted: #9fabcb;
  --line: rgb(255 255 255 / .1);
  --accent: #8ab4ff;
  --accent-ink: #0a1128;
  --accent-hover: #b3cdff;
  --shadow: 0 14px 36px rgb(0 0 0 / .4);
  --hero-end: var(--bg);  /* dark: hero fades seamlessly into the page */

  --font-display: "Bevan", Georgia, "Times New Roman", serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(1.1rem, 4vw, 3rem);
  --max: 1280px;
  --gap: 6px;
  --radius: 6px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fc;
  --bg-elev: #ffffff;
  --surface: #e9eefa;
  --surface-2: #dbe3f6;
  --text: #0d1630;
  --muted: #56628a;
  --line: rgb(13 22 48 / .12);
  --accent: #2556d6;
  --accent-ink: #ffffff;
  --accent-hover: #1a43b0;
  --shadow: 0 14px 36px rgb(13 22 48 / .14);
  --hero-end: rgb(6 10 26 / .72);  /* light: keep a clean dark hero with a hard edge */
}

/* ---- Base ---------------------------------------------------------------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--text);
  font: 400 1rem/1.65 var(--font-body); -webkit-font-smoothing: antialiased; }
main { flex: 1; }
img { max-width: 100%; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: .2em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.15; letter-spacing: 0; margin: 0 0 .5em; }
h1 { font-size: clamp(2.1rem, 5vw + .8rem, 4rem); margin-bottom: .3em; }
h2 { font-size: clamp(1.5rem, 2vw + 1rem, 2.1rem); }
h3 { font-size: 1.4rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.eyebrow { font-size: .75rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); margin-bottom: 1rem; }
.eyebrow a { text-decoration: none; }
.lead { font-size: clamp(1.05rem, .6vw + 1rem, 1.3rem); color: var(--muted); max-width: 52ch; }
.container { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.page { padding-block: clamp(1.5rem, 4vw, 3rem) clamp(3rem, 8vw, 6rem); }
.prose { max-width: 66ch; }
.prose h2 { margin-top: 2em; }
.skip-link { position: absolute; left: -999px; top: 0; z-index: 100; background: var(--accent); color: var(--accent-ink);
  padding: .6rem 1rem; border-radius: 0 0 var(--radius) 0; }
.skip-link:focus { left: 0; }

/* ---- Header / footer ------------------------------------------------------ */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--bg);
  box-shadow: 0 0 1.25rem .75rem var(--bg); }  /* soft fade into the page instead of a hard edge */
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); }
/* The logo is a single-colour alpha shape, drawn as a mask so it takes the theme's text colour. */
.logo-mark { display: none; flex: none; height: 3.4rem; aspect-ratio: 121 / 128; background-color: currentColor; }
@supports (mask-image: url("x.png")) or (-webkit-mask-image: url("x.png")) {
  .logo-mark { display: inline-block;
    -webkit-mask: url("../img/logo-mark.png") center / contain no-repeat;
    mask: url("../img/logo-mark.png") center / contain no-repeat; }
}
.logo-mark--sm { height: 2.4rem; vertical-align: middle; margin-right: .6rem; }
.brand .logo-mark { transition: transform .5s var(--ease); }
.brand:hover .logo-mark { transform: rotate(-6deg) scale(1.04); }
.logo-text { font-family: var(--font-display); font-size: 1rem; font-weight: 400; line-height: 1.15; max-width: 24ch; }
.nav { display: flex; align-items: center; gap: clamp(.9rem, 2.5vw, 1.8rem); font-size: .95rem; }
.nav a { text-decoration: none; color: var(--muted); padding-block: .3rem; border-bottom: 1px solid transparent; transition: color .2s, border-color .2s; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); }
.nav a[aria-current="page"] { border-bottom-color: var(--accent); }
.nav a.nav-cta { color: var(--accent-ink); background: var(--accent); padding: .4rem 1rem; border-radius: 999px; border: 0; font-weight: 600; }
.nav a.nav-cta:hover { background: var(--accent-hover); color: var(--accent-ink); }

.site-footer { border-top: 1px solid var(--line); background: var(--bg-elev); padding-block: 2.5rem; margin-top: auto; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1.5rem; }
.footer-brand { display: flex; align-items: center; font-family: var(--font-display); font-size: 1.4rem; margin: 0 0 .2rem; }
.footer-inner .muted { margin: 0; font-size: .875rem; }
.footer-nav { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: flex-start; font-size: .95rem; }
.footer-nav a { text-decoration: none; color: var(--muted); }
.footer-nav a:hover { color: var(--text); }

/* ---- Buttons -------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: .8rem 1.6rem; border-radius: 999px;
  font-weight: 600; font-size: .95rem; text-decoration: none; border: 1px solid transparent;
  transition: background .2s, transform .2s var(--ease), border-color .2s; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn-ghost { border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--text); }

/* ---- Home ----------------------------------------------------------------- */
/* Hero: the whole re-cropped photo, full width at every size, never cropped further, so nobody is cut off.
   The headline sits below it. The top gap keeps the header's soft shadow off the photo. */
.hero { padding-bottom: 2.5rem; }
.hero-media { aspect-ratio: 1148 / 623; width: 100%; margin-top: 1.5rem; }
.hero-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hero-inner { margin-top: 1rem; }
.hero h1 { max-width: none; margin: 0; text-align: center; }
.hero-cta { text-align: center; margin: 1.5rem 0 0; }
.actions { display: flex; gap: .8rem; flex-wrap: wrap; }
.section { padding-block: clamp(2rem, 5vw, 4rem); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 1.5rem; }
.section-head h2 { margin: 0; }
.cta { text-align: center; border: 1px solid var(--line); border-radius: 16px; background: var(--bg-elev);
  padding: clamp(2rem, 6vw, 4rem) var(--gutter); margin-top: 2rem; }
.cta .lead { margin-inline: auto; }

/* ---- Albums --------------------------------------------------------------- */
.album-list { align-items: start; display: grid; gap: 2rem 1.5rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.album-card { text-decoration: none; display: block; }
.album-card h3 { margin: .8rem 0 .1rem; transition: color .2s; }
.album-card:hover h3 { color: var(--accent); }
.album-card p { margin: 0; font-size: .875rem; }
.cover { position: relative; aspect-ratio: 3 / 2; overflow: hidden; border-radius: var(--radius); background: var(--surface) center / cover;
  box-shadow: var(--shadow); }
.cover--full { aspect-ratio: var(--ar); }  /* show the whole photo instead of cropping it */
/* The card's highlight photos are stacked; one is active. Fade mode cross-fades, slide mode slides them across. */
.cover img.slide { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; opacity: 0;
  transition: opacity var(--t, .8s) ease, transform .6s var(--ease); }
.cover img.slide.is-active { opacity: 1; }
.cover--full img.slide { object-fit: contain; }
.album-list[data-mode="slide"] .cover img.slide { opacity: 1; transform: translateX(100%); transition: transform var(--t, .8s) ease; }
.album-list[data-mode="slide"] .cover img.slide.is-active { transform: none; }
.album-list[data-mode="slide"] .cover img.slide.is-left { transform: translateX(-100%); }
.album-list:not([data-mode="slide"]) .album-card:hover .cover img.is-active { transform: scale(1.04); }

/* ---- Photo grid ----------------------------------------------------------- */
/* Justified rows: each tile's width follows its aspect ratio and rows stretch to fill. */
.grid { display: flex; flex-wrap: wrap; gap: var(--gap); margin-top: 1.5rem; }
.grid--bleed { margin: 0; gap: 3px; }  /* front page: edge to edge, no side margin */
.grid--bleed .tile { border-radius: 0; }
.grid--bleed::after { display: none; }  /* front page: the last row stretches to the full width too */
.grid::after { content: ""; flex-grow: 1000000; }  /* keeps the last row from stretching */
.tile { --row-h: 240px; display: block; position: relative; overflow: hidden; border-radius: 3px;
  flex: calc(var(--ar) * 100) 1 calc(var(--ar) * var(--row-h)); aspect-ratio: var(--ar);
  background: var(--surface) center / cover no-repeat; }
.tile img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease), filter .3s; }
.tile:hover img, .tile:focus-visible img { transform: scale(1.04); filter: brightness(1.08); }
.more { text-align: center; color: var(--muted); padding: 2rem 0; }

/* ---- Photo page ----------------------------------------------------------- */
.photo { margin: 0; text-align: center; }
.photo img { max-width: 100%; height: auto; max-height: 80vh; width: auto; object-fit: contain;
  background: var(--surface) center / cover; border-radius: var(--radius); box-shadow: var(--shadow); }
.photo figcaption { margin-top: 1rem; }
.photo-nav { display: flex; justify-content: space-between; margin-top: 1.25rem; }

/* ---- PhotoSwipe (stays dark in both themes: photos look best on dark) ----- */
.pswp { --pswp-bg: #04060f; }
.pswp__custom-caption { position: absolute; left: 0; right: 0; bottom: 0; z-index: 10; padding: 2.5rem 1.25rem 1rem;
  background: linear-gradient(transparent, rgb(0 0 0 / .7)); color: #fff; text-align: center; pointer-events: none; }
.pswp__custom-caption p { margin: 0; }
.pswp__custom-caption .caption-credit { color: #cfcfdc; font-size: .875rem; }
.pswp__button { color: #fff; }

/* ---- Motion --------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise .8s var(--ease) both; animation-delay: calc(var(--d, 0) * 90ms); }
  @keyframes rise { from { opacity: 0; transform: translateY(18px); } }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media (max-width: 560px) {
  .header-inner { justify-content: center; }
  .nav { width: 100%; justify-content: space-between; gap: .5rem; font-size: .9rem; }
  .hero h1 { font-size: 6.2vw; }  /* keeps each line of the headline on one line */
}


/* ---- Admin (only rendered when signed in) -------------------------------------- */
.admin-login { display: grid; gap: .8rem; max-width: 22rem; }
.admin-login input { font: inherit; padding: .7rem .9rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); }
.admin-error { color: #ff9a9a; margin: 0; }
.admin-bar { position: fixed; z-index: 60; left: 50%; bottom: 1rem; transform: translateX(-50%); display: flex; gap: .5rem;
  align-items: center; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 1.5rem); padding: .5rem .75rem;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); font-size: .85rem; }
.admin-bar form { margin: 0; }
.admin-bar button { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: .3rem .8rem; cursor: pointer; }
.admin-bar button:hover:not(:disabled) { border-color: var(--accent); }
.admin-bar button:disabled { opacity: .4; cursor: default; }
.admin-bar #sel-delete { border-color: #c25b5b; }
.grid.selecting .tile { cursor: copy; }
.tile.selected { outline: 3px solid var(--accent); outline-offset: -3px; }
.tile.selected::after { content: "✓"; position: absolute; top: .4rem; right: .4rem; width: 1.6rem; height: 1.6rem; display: grid;
  place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.album-card.dragging { opacity: .4; }
.cover-dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--bg-elev); color: var(--text); padding: 1.25rem;
  width: min(92vw, 28rem); }
.cover-dialog::backdrop { background: rgb(0 0 0 / .6); }
.cover-dialog .cover { cursor: grab; touch-action: none; user-select: none; }
.cover-dialog .cover:active { cursor: grabbing; }
.cover-dialog .cover--full { cursor: default; }
.cover-dialog img.slide { transition: none; }
.cover-dialog label { display: flex; gap: .5rem; align-items: center; margin: .9rem 0; }
.cover-dialog .row { display: flex; gap: .6rem; justify-content: flex-end; }
.admin-link { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: .3rem .8rem; text-decoration: none; }
.admin-link:hover { border-color: var(--accent); color: var(--text); }
body[data-admin] .tile[data-highlight]::before { content: "★"; position: absolute; z-index: 1; top: .4rem; left: .4rem;
  width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border-radius: 50%; background: rgb(0 0 0 / .6); color: #ffd666; }
.cover-dialog .nav { display: flex; align-items: center; justify-content: center; gap: .8rem; margin-top: .8rem; }
.cover-dialog .nav button { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: .2rem .8rem; cursor: pointer; }
.panel-form { display: grid; gap: 1.2rem; max-width: 28rem; margin-bottom: 2rem; }
.panel-form fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; display: grid; gap: 1rem; }
.panel-modes { display: flex; gap: 1.4rem; }
.panel-modes label, .panel-speed, .panel-shuffle { display: flex; gap: .5rem; align-items: center; }
.panel-speed input { flex: 1; }
.panel-actions { display: flex; align-items: center; gap: 1rem; }
.panel-preview { max-width: 24rem; pointer-events: none; }
.cover-dialog .row button:not(.btn) { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: .5rem 1.1rem; cursor: pointer; }

/* ---- Album index, groups, jump ---------------------------------------------------- */
.album-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 1rem .8rem; margin: 1.5rem 0 2rem; }
.index-card { text-decoration: none; display: block; }
.index-thumb { display: block; position: relative; aspect-ratio: 3 / 2; overflow: hidden; border-radius: var(--radius); background: var(--surface) center / cover; }
.index-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.index-card:hover .index-thumb img { transform: scale(1.05); }
.index-names { display: block; margin-top: .35rem; font-size: .85rem; line-height: 1.3; color: var(--muted); }
.index-card:hover .index-names { color: var(--accent); }
.start-bar { margin: 1rem 0; }
.back-fab { position: fixed; z-index: 55; left: 1rem; bottom: 1rem; box-shadow: var(--shadow); }
.grid-break { flex: 0 0 100%; height: 0; }
.grid-fill { flex: 1000000 1 0; height: 0; }  /* soaks up the free space so a group's last row is not stretched */
.group-head { flex: 0 0 100%; display: flex; align-items: baseline; gap: 1rem; padding: 1.6rem 0 .4rem; }
.group-names { font-size: clamp(1.2rem, 1vw + 1rem, 1.7rem); margin: 0; }
.group-edit { font: inherit; font-size: .8rem; color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: .15rem .7rem; cursor: pointer; }
.group-edit:hover { color: var(--text); border-color: var(--accent); }
.people-rows { display: grid; gap: .5rem; margin: .8rem 0; }
.people-rows input { font: inherit; padding: .55rem .8rem; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); }
.cover-dialog .danger { border-color: #c25b5b; margin-right: auto; }

/* ---- Front-page strip ------------------------------------------------------ */
/* One row of photos, all the same height with natural widths, edge to edge. */
.strip-wrap { --strip-h: clamp(150px, 28vw, 240px); margin-top: 1.5rem; }
.strip { display: flex; gap: 3px; height: var(--strip-h); overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip-tile { flex: none; height: 100%; aspect-ratio: var(--ar); background: var(--surface) center / cover no-repeat; overflow: hidden; }
.strip-tile img { display: block; height: 100%; width: 100%; object-fit: cover; transition: filter .3s; }
.strip-tile.is-selected img { filter: brightness(1.12); }
.strip-caption { margin: .6rem var(--gutter) 0; text-align: center; color: var(--muted); }
.strip-caption a { margin-left: .5rem; }
