/* ==========================================================
   Theme settings. Edit these values to retheme the whole site.
   ========================================================== */
:root {
  /* Colors */
  --bg: #000000;
  --surface: #0c0f0d;
  --surface-hover: #131a15;
  --border: #222b25;
  --text: #e8efe9;
  --muted: #9db0a2;
  --green: #015d15;          /* school green */
  --green-bright: #3aa65a;   /* readable green for text on dark */
  --purple: #663399;         /* school purple */
  --purple-bright: #a983dc;  /* readable purple for text and focus */

  /* Fonts */
  --font-main: "Montserrat", system-ui, sans-serif;
  --font-accent: "Crimson Pro", Georgia, serif;

  /* Layout */
  --max-width: 1100px;
  --page-pad: 1.25rem;
  --gap: 0.85rem;
  --radius: 8px;
  --tile-ratio: 4 / 3;       /* thumbnail shape */

  /* Tile columns per screen size */
  --cols: 2;                 /* phones: two side by side */
}
@media (min-width: 700px)  { :root { --cols: 3; --gap: 1.1rem; } }
@media (min-width: 1000px) { :root { --cols: 4; --gap: 1.25rem; } }

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  font-family: var(--font-main);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
main, .site-header, .site-footer {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding-left: var(--page-pad);
  padding-right: var(--page-pad);
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--purple-bright); outline-offset: 3px; }

/* ---------- Header and footer ---------- */
.site-header {
  padding-top: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.brand {
  font-family: var(--font-accent);
  font-size: 1.25rem;
  font-weight: 600;
  text-decoration: none;
}
.brand:hover { color: var(--purple-bright); }
.site-footer {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- Landing page ---------- */
.hero { padding: 3rem 0 2rem; }
.hero h1 {
  margin: 0 0 1rem;
  font-family: var(--font-accent);
  font-size: clamp(2.4rem, 7vw, 4rem);
  font-weight: 600;
  line-height: 1.05;
}
.hero p { max-width: 60ch; margin: 0; color: var(--muted); }

.events h2 {
  margin: 1rem 0 1.1rem;
  font-family: var(--font-accent);
  font-size: 1.6rem;
  font-weight: 600;
}
.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--gap);
}
.tile {
  display: block;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s;
}
.tile:hover { border-color: var(--purple); background: var(--surface-hover); }
.tile-thumb {
  aspect-ratio: var(--tile-ratio);
  background: linear-gradient(135deg, var(--green), var(--purple));
}
.tile-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-body { padding: 0.7rem 0.8rem 0.85rem; }
.tile-title { margin: 0; font-size: 0.95rem; font-weight: 600; line-height: 1.3; }
.tile-date { margin: 0.2rem 0 0; font-size: 0.8rem; color: var(--muted); }

.notice { color: var(--muted); }

/* ---------- Album page ---------- */
.album { padding-top: 1.5rem; }
.back { font-size: 0.9rem; color: var(--purple-bright); text-decoration: none; }
.back:hover { text-decoration: underline; }
.album h1 {
  margin: 1rem 0 0.25rem;
  font-family: var(--font-accent);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 600;
  line-height: 1.1;
}
.album-meta { margin: 0; color: var(--muted); font-size: 0.9rem; }
.album-desc { max-width: 60ch; margin: 0.75rem 0 0; color: var(--muted); }

.swiper {
  --swiper-theme-color: var(--purple-bright);
  --swiper-navigation-color: var(--text);
  --swiper-navigation-size: 20px;
  /* Breaks out of the page width so photos use the whole screen */
  width: 100vw;
  margin-top: 1.5rem;
  margin-left: calc(50% - 50vw);
  height: 88vh;
  height: 88dvh;             /* how tall the viewer is on the page; raise for bigger photos */
  background: var(--bg);
}
.swiper-slide {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
}
.swiper-zoom-container {
  position: relative;
  display: block;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  height: auto;
}
.swiper-zoom-container img {
  /* The photo is pinned to all four edges of its space, so it always grows to fill it,
     whatever the screen size or the photo's own pixel size. */
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;       /* never cropped, black bars fill the leftover space */
  cursor: zoom-in;           /* click a photo to open full screen */
}
.caption {
  margin: 0;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

/* Arrows float over the left and right sides of the photo */
.swiper .swiper-button-prev,
.swiper .swiper-button-next {
  top: 50%;
  bottom: auto;
  margin-top: 0;
  transform: translateY(-50%);
  width: 48px;               /* tap target size */
  height: 48px;
  z-index: 20;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--border);
  border-radius: 50%;
}
.swiper .swiper-button-prev { left: 0.75rem; right: auto; }
.swiper .swiper-button-next { right: 0.75rem; left: auto; }
.swiper .swiper-button-prev:hover,
.swiper .swiper-button-next:hover { border-color: var(--purple); }

/* Photo counter floats over the top left corner of the photo */
.swiper .swiper-pagination {
  top: 0.75rem;
  bottom: auto;
  left: 0.75rem;
  width: auto;
  padding: 0.2rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--border);
  border-radius: 999px;
  pointer-events: none;      /* never blocks clicks meant for the photo or arrows */
}

/* ---------- Full screen mode ---------- */
.swiper.is-full {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  z-index: 100;
  background: #000;
}
.swiper.is-full .swiper-slide {
  /* top space keeps the photo clear of the buttons; edit to taste */
  padding:
    max(4rem, calc(env(safe-area-inset-top, 0px) + 3.5rem))
    0
    env(safe-area-inset-bottom, 0px);
}
.swiper.is-full .swiper-pagination { top: max(0.75rem, env(safe-area-inset-top, 0px)); }
.swiper.is-full .swiper-zoom-container { touch-action: none; }
.swiper.is-full .swiper-zoom-container img { cursor: default; }
.swiper.is-full .swiper-slide-zoomed img { cursor: move; }

/* Toolbar: counter and Download always show, Zoom and Close only in full screen */
.viewer-tools {
  display: flex;
  position: absolute;
  top: max(0.75rem, env(safe-area-inset-top, 0px));
  right: 0.75rem;
  z-index: 30;
  gap: 0.5rem;
}
.viewer-zoom,
.viewer-close { display: none; }
.swiper.is-full .viewer-close { display: block; }
.viewer-btn {
  padding: 0.5rem 1rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.viewer-btn:hover { border-color: var(--purple); }
.viewer-count {
  display: none;             /* only used on desktop, see below */
  align-items: center;
  padding: 0 1rem;
  font-size: 0.9rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
@media (hover: hover) {
  /* Desktop: the counter sits in the toolbar at the top right instead of the left corner */
  .viewer-count { display: flex; }
  .swiper .swiper-pagination { display: none; }
  .swiper.is-full .viewer-zoom { display: block; }   /* touch screens pinch to zoom instead */
}
@media (hover: none) {
  .swiper .swiper-button-prev,
  .swiper .swiper-button-next { width: 40px; height: 40px; }
}

/* ---------- Phones turned sideways (short, wide screens) ----------
   Space is tight, so the photo takes the whole screen and the buttons float over it. */
@media (orientation: landscape) and (max-height: 500px) {
  .swiper {
    height: 100vh;
    height: 100dvh;          /* the page viewer fills the screen height when scrolled to */
    margin-top: 1rem;
  }
  .swiper.is-full .swiper-slide {
    padding: 0 env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
  }
  .caption {                 /* captions float over the bottom of the photo */
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.3rem 1rem;
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.55);
  }
  .viewer-btn { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
  .viewer-tools { top: 0.5rem; right: max(0.5rem, env(safe-area-inset-right, 0px)); }
  .swiper .swiper-pagination,
  .swiper.is-full .swiper-pagination {
    top: 0.5rem;
    left: max(0.5rem, env(safe-area-inset-left, 0px));
  }
  .swiper .swiper-button-prev { left: max(0.5rem, env(safe-area-inset-left, 0px)); }
  .swiper .swiper-button-next { right: max(0.5rem, env(safe-area-inset-right, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
