:root {
  --paper: #ffffff;
  --paper-deep: #f2f2f2;
  --ink: #14202c;
  --slate: #5b6773;
  --primary: #1a1a1a;
  --accent: #CC0000;
  --accent-on-dark: #FF5A5A;
  --accent-deep: #990000;
  --accent-tint: #FBE9E9;
  --line: rgba(26, 26, 26, 0.14);
  --rail: 64px;
  --content-pad: 2rem;
  --hero-h: min(60vh, 560px);
  --crest-lg: 148px;
  --crest-sm: 40px;
  --ribbon-h: 16px;
}

@media (max-width: 899px) {
  :root {
    --rail: 44px;
    --content-pad: 1.5rem;
    --hero-h: min(48vh, 420px);
    --crest-lg: 112px;
    --ribbon-h: 12px;
  }
}

@media (max-width: 560px) {
  :root {
    --rail: 20px;
    --content-pad: 1.25rem;
    --hero-h: min(38vh, 300px);
    --crest-lg: 84px;
    --crest-sm: 34px;
    --ribbon-h: 9px;
  }
}

* { box-sizing: border-box; }

html { background: var(--primary); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  line-height: 1.55;
  padding-left: var(--rail);
  position: relative;
}

/* --- Signature: School-colors rail, full page height --- */
body::before {
  content: "";
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail);
  box-sizing: border-box;
  border-right: 2px solid var(--primary);
  background-color: #ffffff;
  background-image: url("/assets/rail.png");
  background-repeat: repeat-y;
  background-size: 100% auto;
  background-position: top center;
  z-index: 5;
}

.loading, .error {
  font-family: "Inter", system-ui, sans-serif;
  color: var(--slate);
  padding: 5rem 1.5rem;
  text-align: center;
}

/* --- Logo mark (used small in masthead, large as hero crest) --- */
.logo-circle {
  border-radius: 50%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-tint);
  color: var(--primary);
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  flex: none;
}
.logo-circle--sm {
  width: var(--crest-sm);
  height: var(--crest-sm);
  font-size: 0.95rem;
}
.logo-circle--lg {
  width: var(--crest-lg);
  height: var(--crest-lg);
  font-size: 2.4rem;
  box-shadow: 0 0 0 6px var(--paper), 0 20px 34px -16px rgba(26, 26, 26, 0.55);
}

/* --- Masthead (persistent, sticky on every page) --- */
.masthead-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.masthead {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.15rem var(--content-pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  position: relative;
}
.masthead-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--primary);
}
.masthead-name {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.site-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.site-nav a { color: var(--slate); text-decoration: none; padding-bottom: 0.3rem; border-bottom: 2px solid transparent; }
.site-nav a[aria-current="page"] { color: var(--primary); border-bottom-color: var(--accent); }
.site-nav a:hover { color: var(--primary); }

/* --- Mobile nav toggle (hamburger) --- */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}
.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle--open .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle--open .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle--open .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 899px) {
  .nav-toggle { display: flex; }
  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 0 var(--content-pad);
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    transition: max-height 0.25s ease;
  }
  .site-nav--open {
    max-height: 60vh;
    pointer-events: auto;
  }
  .site-nav a {
    width: 100%;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--line);
  }
  .site-nav a:last-child { border-bottom: none; }
  .site-nav a[aria-current="page"] { border-bottom-color: var(--accent); }
}

/* --- Hero: full-width photo with overlapping crest --- */
.hero { position: relative; }
.hero-photo-frame {
  position: relative;
  width: 100%;
  height: var(--hero-h);
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
}
.hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  animation: hero-reveal 0.9s ease-out both;
}
.hero--fallback .hero-photo-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.08) 0, rgba(255, 255, 255, 0.08) 1px, transparent 1px, transparent 26px),
    repeating-linear-gradient(-45deg, rgba(26, 26, 26, 0.12) 0, rgba(26, 26, 26, 0.12) 1px, transparent 1px, transparent 26px);
}

/* Seam ribbon: bridges the hero photo and the crest, echoing the argyle rail's
   contrast piping so the rail's texture isn't isolated to the left edge. */
.hero-ribbon {
  position: relative;
  height: var(--ribbon-h);
  background: var(--primary);
  border-top: 2px dashed var(--accent);
  border-bottom: 2px dashed var(--accent);
  z-index: 2;
}

.hero-crest {
  position: absolute;
  left: 50%;
  top: calc(var(--hero-h) + var(--ribbon-h));
  transform: translate(-50%, -50%);
  z-index: 3;
  animation: hero-reveal 0.9s 0.1s ease-out both;
}
.hero-crest::after {
  content: "";
  position: absolute;
  inset: -14px;
  border: 2px dashed var(--accent-deep);
  border-radius: 50%;
  opacity: 0.55;
  pointer-events: none;
}
@media (max-width: 899px) {
  .hero-crest::after { inset: -10px; }
}
@media (max-width: 560px) {
  .hero-crest::after { inset: -7px; }
}
.hero-header {
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
  padding: calc(var(--crest-lg) / 2 + 1.25rem) var(--content-pad) 1rem;
  animation: hero-reveal 0.9s 0.15s ease-out both;
}
@keyframes hero-reveal {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.hero-crest.hero-crest { animation-name: hero-crest-reveal; }
@keyframes hero-crest-reveal {
  from { opacity: 0; transform: translate(-50%, -40%); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

h1 {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 600;
  font-variation-settings: "WONK" 1;
  margin: 0 0 0.5rem;
  color: var(--primary);
}
.tagline { font-size: 1.2rem; color: var(--slate); margin: 0 0 1.1rem; }
.meeting-pill {
  display: inline-block;
  background: var(--accent-tint);
  color: var(--primary);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  margin: 0;
}

.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem var(--content-pad) 4rem;
}
.page-header { margin-bottom: 1rem; }
.eyebrow {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: 0.4rem;
}

.about-section {
  border-top: 1px solid var(--line);
  padding-top: 2.25rem;
  margin: 2rem 0 1rem;
}
.about {
  font-size: 1.08rem;
  max-width: 64ch;
  white-space: pre-wrap;
  margin: 0;
}
@media (min-width: 561px) {
  .about::first-letter {
    font-family: "Fraunces", Georgia, serif;
    font-weight: 600;
    font-size: 3.6em;
    line-height: 0.78;
    float: left;
    padding: 0.03em 0.09em 0 0;
    color: var(--primary);
  }
}

.gallery-section {
  border-top: 1px solid var(--line);
  padding-top: 2.25rem;
  margin: 2rem 0 1rem;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.6rem;
}
@media (min-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
  }
}
.gallery-grid--scroll {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.gallery-grid--scroll::-webkit-scrollbar {
  display: none;
}
.gallery-grid--scroll .gallery-item {
  flex: 0 0 180px;
  width: 180px;
  scroll-snap-align: start;
}
@media (min-width: 900px) {
  .gallery-grid--scroll .gallery-item {
    flex-basis: 340px;
    width: 340px;
  }
}
.gallery-scrollbar {
  position: relative;
  height: 4px;
  margin-top: 1rem;
  background-image: repeating-linear-gradient(90deg, var(--line) 0 5px, transparent 5px 10px);
  border-radius: 2px;
  cursor: pointer;
}
.gallery-scrollbar-thumb {
  position: absolute;
  top: -1px;
  height: 6px;
  background: var(--accent);
  border-radius: 999px;
  cursor: grab;
}
.gallery-scrollbar-thumb:active {
  background: var(--accent-deep);
  cursor: grabbing;
}
.gallery-item {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 6px;
  box-shadow: 0 0 0 4px var(--paper);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.gallery-item:hover {
  box-shadow: 0 0 0 4px var(--paper), 0 14px 24px -14px rgba(26, 26, 26, 0.4);
}
.gallery-item:nth-child(odd):hover { transform: translateY(-3px) rotate(-1deg); }
.gallery-item:nth-child(even):hover { transform: translateY(-3px) rotate(1deg); }
.gallery-item img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 26, 26, 0.92);
  animation: hero-reveal 0.2s ease-out both;
}
.lightbox[hidden] { display: none; }
body.lightbox-open { overflow: hidden; }
.lightbox-image {
  max-width: min(88vw, 1100px);
  max-height: 82vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.6);
}
.lightbox-close,
.lightbox-nav {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  color: var(--paper);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}
.lightbox-close:hover,
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.22); }
.lightbox-close {
  top: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  font-size: 1.6rem;
  line-height: 1;
}
.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  font-size: 2rem;
  line-height: 1;
}
.lightbox-prev { left: 1.5rem; }
.lightbox-next { right: 1.5rem; }
.lightbox-counter {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--paper);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  margin: 0;
}
@media (max-width: 560px) {
  .lightbox-nav { width: 42px; height: 42px; font-size: 1.6rem; }
  .lightbox-prev { left: 0.5rem; }
  .lightbox-next { right: 0.5rem; }
  .lightbox-close { top: 0.75rem; right: 0.75rem; }
}

.event-card {
  display: flex;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--line);
}
.event-card:first-of-type { border-top: none; }
.event-date {
  flex: none;
  width: 68px;
  text-align: center;
  border-top: 3px solid var(--accent);
  padding-top: 0.4rem;
}
.event-date .day {
  display: block;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.85rem;
  font-weight: 600;
  line-height: 1;
  color: var(--primary);
}
.event-date .month {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--slate);
  margin-top: 0.2rem;
}
.event-body h3 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  color: var(--primary);
}
.event-description { color: var(--slate); margin: 0.25rem 0 0; }
.event-link { display: inline-block; margin-top: 0.4rem; font-weight: 600; color: var(--accent-deep); text-decoration: none; }
.event-link:hover { text-decoration: underline; }

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 2.25rem 1.75rem;
}
.team-card { text-align: left; }
.team-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.team-photo, .team-initials {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  transition: transform 0.2s ease;
}
.team-card:hover .team-photo,
.team-card:hover .team-initials { transform: translateY(-3px); }
.team-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-tint);
  color: var(--primary);
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 600;
}
.team-name { font-weight: 600; margin: 0; color: var(--primary); }
.team-role { color: var(--slate); font-size: 0.9rem; margin: 0.15rem 0 0; }
.team-bio { color: var(--slate); font-size: 0.92rem; margin: 0; line-height: 1.5; }

.support-card {
  background: var(--accent-tint);
  border-left: 3px solid var(--primary);
  border-radius: 4px;
  padding: 2rem;
  margin: 0.5rem 0 1.25rem;
}
.support-card:last-of-type { margin-bottom: 0.5rem; }
.support-card p { font-size: 1.05rem; margin: 0 0 0.5rem; }
.donate-button {
  display: inline-block;
  background: var(--primary);
  color: var(--paper);
  text-decoration: none;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.8rem 1.6rem;
  border-radius: 999px;
  margin-top: 0.75rem;
  transition: background 0.2s ease;
}
.donate-button:hover { background: var(--accent-deep); }

.empty-state {
  color: var(--slate);
  padding: 3rem 0;
  text-align: center;
  font-style: italic;
}

.site-footer {
  margin-top: 3rem;
  background: var(--primary);
  color: var(--paper);
}
.site-footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem var(--content-pad) 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.contact { margin: 0; font-family: "IBM Plex Mono", monospace; font-size: 0.82rem; letter-spacing: 0.02em; }
.contact a { color: var(--accent-on-dark); text-decoration: none; font-weight: 500; }
.contact a:hover { text-decoration: underline; }
.social-links { display: flex; gap: 0.9rem; }
.social-links a { color: var(--paper); opacity: 0.75; display: inline-flex; transition: opacity 0.2s ease; }
.social-links a:hover { opacity: 1; }

.watermark {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
  padding: 0.75rem var(--content-pad) 0.95rem;
}
.watermark a {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
}
.watermark a:hover { color: rgba(255, 255, 255, 0.9); }

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent-deep);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Member sign-in */
.member-card {
  max-width: 640px;
  background: var(--accent-tint);
  border-left: 3px solid var(--primary);
  border-radius: 4px;
  padding: 1.75rem;
}
.member-lead { margin: 0 0 1rem; color: var(--slate); }
.member-form { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 1rem; }
.member-form label { font-size: 0.85rem; font-weight: 600; color: var(--primary); margin-top: 0.5rem; }
.member-form input[type="email"],
.member-form input[type="password"],
.member-form textarea {
  font: inherit;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
}
.member-form .donate-button { align-self: flex-start; border: 0; cursor: pointer; margin-top: 1rem; }
.member-form .donate-button:disabled { opacity: 0.6; cursor: default; }
.member-card .team-card-header { margin-bottom: 0.5rem; }
.member-switch { font-size: 0.9rem; margin: 1.25rem 0 0; color: var(--slate); }
.member-switch a { color: var(--primary); font-weight: 600; }
.member-hint { font-size: 0.82rem; color: var(--slate); font-weight: 400; }
.member-status { min-height: 1.2em; font-size: 0.9rem; margin: 0.75rem 0 0; }
.member-status--ok { color: #1d6b3a; }
.member-status--error { color: #a02020; }
.footer-member-link { font-family: "IBM Plex Mono", monospace; font-size: 0.78rem; color: var(--paper); opacity: 0.75; text-decoration: none; }
.footer-member-link:hover { opacity: 1; text-decoration: underline; }
.member-divider { border: 0; border-top: 1px solid var(--line); margin: 1.75rem 0 1.25rem; }
.member-h2 { font-size: 1.15rem; margin: 0 0 0.75rem; color: var(--primary); }
.member-event { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.9rem; margin-bottom: 0.75rem; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; }
.member-event input, .member-event textarea { font: inherit; padding: 0.55rem 0.7rem; border: 1px solid var(--line); border-radius: 4px; }
.member-link-button { align-self: flex-start; background: none; border: 0; padding: 0.25rem 0; margin: 0 0 0.5rem; color: var(--primary); font-weight: 600; cursor: pointer; text-decoration: underline; }
#manage .donate-button { border: 0; cursor: pointer; display: block; margin-top: 0.75rem; }
#manage > label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--primary); margin: 0.75rem 0 0.35rem; }
.member-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.6rem; }
.member-gallery-item { position: relative; aspect-ratio: 1; }
.member-gallery-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; }
.member-gallery-item button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: rgba(26, 26, 26, 0.85); color: #fff; cursor: pointer; line-height: 1; }

/* Larger exec photos on desktop (Team page only) */
@media (min-width: 900px) {
  .team-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 3rem 2.25rem;
  }
  .team-card .team-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.1rem;
    margin-bottom: 1rem;
  }
  .team-card .team-photo,
  .team-card .team-initials {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    border-radius: 8px;
  }
  .team-card .team-initials { font-size: 4rem; }
  .team-card .team-name { font-size: 1.25rem; }
  .team-card .team-role { font-size: 1rem; }
  .team-card .team-bio { font-size: 1rem; }
}
