/* =====================================================================
   New England Anime Society — proof of concept
   No frameworks. Design tokens first, then layout, then components.
   ===================================================================== */

/* ---------------------------------------------------------------------
   Fonts. WOFF2 first (~30% smaller), then WOFF/TTF for older browsers.
   font-display:swap renders text immediately in the fallback face instead
   of holding a blank frame while the webfont downloads.
   --------------------------------------------------------------------- */
@font-face {
  font-family: "MuseoSans";
  src:
    url("fonts/2333BA_0_0.woff2") format("woff2"),
    url("fonts/2333BA_0_0.woff") format("woff"),
    url("fonts/2333BA_0_0.ttf") format("truetype");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "MuseoSans";
  src:
    url("fonts/2333BA_1_0.woff2") format("woff2"),
    url("fonts/2333BA_1_0.woff") format("woff"),
    url("fonts/2333BA_1_0.ttf") format("truetype");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}

/* ---------------------------------------------------------------------
   Tokens
   --------------------------------------------------------------------- */
:root {
  /* brand */
  --red: #c8102e;
  --red-dark: #a00d25;
  --red-wash: rgba(200, 16, 46, 0.06);

  /* ink & surfaces */
  --ink: #1a1a1a;
  --ink-muted: #5c5c5c; /* 6.5:1 on white, 6.1:1 on --surface-2 */
  --surface: #ffffff;
  --surface-2: #f6f6f7;
  --line: #e5e5e8;

  /* spacing */
  --gutter: clamp(1.25rem, 4vw, 2rem);
  --section-y: clamp(3rem, 6vw, 5rem);
  --stack: clamp(1.5rem, 3vw, 2.25rem);
  --grid-gap: clamp(1rem, 2vw, 1.5rem);

  /* type scale */
  --t-xs: 0.8125rem;
  --t-sm: 0.9375rem;
  --t-body: 1.0625rem;
  --t-lead: clamp(1.075rem, 1rem + 0.35vw, 1.2rem);
  --t-h4: 1rem;
  --t-h3: clamp(1.25rem, 1.1rem + 0.7vw, 1.6rem);
  --t-h2: clamp(1.65rem, 1.35rem + 1.3vw, 2.25rem);
  --t-h1: clamp(2rem, 1.6rem + 2vw, 2.75rem);

  /* shape & depth */
  --r-sm: 10px;
  --r-md: 14px;
  --shadow-1: 0 1px 2px rgba(18, 18, 20, 0.05), 0 2px 10px rgba(18, 18, 20, 0.05);
  --shadow-2: 0 10px 28px rgba(200, 16, 46, 0.14);

  /* layout */
  /* Wide enough that the five value cards and five board cards each hold a
     two-line label, and that the navbar logo lines up with section content. */
  --container: 1080px;
  --measure: 68ch;
  /* Logo height; the sticky bar is taller because the menu sits under it. */
  --nav-h: 76px;
}

/* ---------------------------------------------------------------------
   Reset & base
   --------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  /* Logo row + menu row under it; keep anchors clear of the sticky bar. */
  scroll-padding-top: calc(var(--nav-h) + 3.5rem);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "MuseoSans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: var(--t-body);
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3,
h4 {
  line-height: 1.2;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

/* Consistent, always-visible keyboard focus. */
:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 1100;
  padding: 0.75rem 1.25rem;
  background: var(--ink);
  color: var(--surface);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
}

/* ---------------------------------------------------------------------
   Layout primitives
   --------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: var(--section-y);
}

/* Alternating surfaces give each section a readable edge without rules. */
.section--tint {
  background-color: var(--surface-2);
  border-block: 1px solid var(--line);
}

.stack > * + * {
  margin-top: var(--stack);
}

/* ---------------------------------------------------------------------
   Navigation
   --------------------------------------------------------------------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  transition: box-shadow 0.25s ease;
}

/* Toggled by a sentinel IntersectionObserver — no scroll listener. */
.navbar.is-stuck {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.09);
}

.nav-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding-block: 0.35rem 0.2rem;
}

.nav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.nav-logo picture {
  display: block;
  max-width: 100%;
}

.logo-img {
  display: block;
  /* Full logo height whenever the container allows; shrinks by width only. */
  width: min(100%, calc(var(--nav-h) * 1200 / 150));
  height: auto;
  max-height: var(--nav-h);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: clamp(0.15rem, 1vw, 0.75rem);
  list-style: none;
  flex-wrap: wrap;
  justify-content: center;
}

.nav-menu a {
  display: inline-flex;
  align-items: center;
  /* 44px min height keeps every link a comfortable tap target. */
  min-height: 44px;
  padding: 0.5rem 0.7rem;
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: var(--t-sm);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-menu a:hover {
  color: var(--red);
  background-color: var(--red-wash);
}

/* ---------------------------------------------------------------------
   Hero
   --------------------------------------------------------------------- */
.hero {
  padding-block: clamp(2.5rem, 5vw, 4rem);
  background: linear-gradient(170deg, var(--surface) 0%, var(--surface-2) 100%);
  border-bottom: 1px solid var(--line);
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(2rem, 4vw, 3rem);
}

.hero-about {
  max-width: var(--measure);
  text-align: center;
}

.hero-about p {
  font-size: var(--t-lead);
  line-height: 1.75;
  color: var(--ink-muted);
}

/* Inline links pick up the brand rather than the browser default blue. */
.hero-about a,
.content-block a {
  color: var(--red-dark);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.08em;
  transition: color 0.2s ease;
}

.hero-about a:hover,
.content-block a:hover {
  color: var(--red);
}

.hero-values {
  width: 100%;
  text-align: center;
}

.hero-values h2 {
  margin-bottom: clamp(1.25rem, 2.5vw, 1.75rem);
  font-size: var(--t-h2);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--red);
}

/* Five values: 5-up on desktop, a deliberate 3+2 on tablet, 2-up on phones.
   Flex + justify-content centers the incomplete last row instead of left-aligning it. */
.values-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--grid-gap);
}

.values-grid > .value-card {
  flex: 0 1 calc((100% - 4 * var(--grid-gap)) / 5);
  max-width: calc((100% - 4 * var(--grid-gap)) / 5);
}

.value-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  padding: 1.5rem 1rem;
  font-family: inherit;
  font-size: var(--t-h4);
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.value-card:hover {
  transform: translateY(-6px);
  border-color: var(--red);
  box-shadow: var(--shadow-2);
}

/* Sentinel for the navbar shadow; never occupies layout space. */
#nav-sentinel {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
}

/* ---------------------------------------------------------------------
   Section headings & prose
   --------------------------------------------------------------------- */
.section-title {
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
  font-size: var(--t-h2);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--red);
  text-align: center;
}

.subsection-title {
  margin-bottom: 1.25rem;
  font-size: var(--t-h3);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--red);
}

#officers .subsection-title {
  text-align: center;
}

.content-block h2 {
  margin-bottom: 0.6rem;
  font-size: var(--t-h3);
  font-weight: 700;
  color: var(--ink);
}

.content-block p {
  max-width: var(--measure);
  color: var(--ink-muted);
}

.content-block p + p {
  margin-top: 1rem;
}

/* ---------------------------------------------------------------------
   Officers & board
   --------------------------------------------------------------------- */
.officers-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--grid-gap);
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.officer-card {
  padding: 1.75rem 1.25rem;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.officer-card:hover {
  transform: translateY(-4px);
  border-color: var(--red);
  box-shadow: var(--shadow-2);
}

.officer-card h4 {
  margin-bottom: 0.4rem;
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--red);
}

.officer-card p {
  font-size: var(--t-body);
  font-weight: 600;
}

.board-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--grid-gap);
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.board-grid > .board-member {
  flex: 0 1 calc((100% - 4 * var(--grid-gap)) / 5);
  max-width: calc((100% - 4 * var(--grid-gap)) / 5);
}

.board-member {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1rem;
  text-align: center;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.board-member:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-2);
}

.ombudsman {
  display: flex;
  justify-content: center;
}

.ombudsman .board-member {
  min-width: min(100%, 260px);
}

/* ---------------------------------------------------------------------
   Events / Anime Boston
   --------------------------------------------------------------------- */
.event-subsection + .event-subsection {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  padding-top: clamp(2.5rem, 5vw, 4rem);
  border-top: 1px solid var(--line);
}

/* Shares the left edge with its heading and the body copy below it, so the
   whole subsection reads as one column instead of a centred island. */
.anime-boston-intro {
  max-width: var(--measure);
  margin-bottom: clamp(1.5rem, 3vw, 2rem);
  font-size: var(--t-lead);
  line-height: 1.75;
  color: var(--ink-muted);
}

.anime-boston-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: var(--grid-gap);
  margin-block: clamp(1.5rem, 3vw, 2rem);
}

.anime-boston-images picture {
  display: block;
}

.anime-boston-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--r-md);
  background-color: var(--surface-2);
}

.anime-boston-cta {
  margin-top: clamp(1.75rem, 3vw, 2.5rem);
  text-align: center;
}

.anime-boston-link {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0.85rem 1.75rem;
  background-color: var(--red);
  color: var(--surface);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--r-sm);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.anime-boston-link:hover {
  background-color: var(--red-dark);
  transform: translateY(-2px);
}

.past-events-list {
  list-style: none;
}

.past-events-list li {
  position: relative;
  padding: 0.4rem 0 0.4rem 1.6rem;
  color: var(--ink-muted);
}

.past-events-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--red);
  font-weight: 700;
}

/* ---------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------- */
.footer {
  padding-block: clamp(2rem, 4vw, 3rem);
  background-color: var(--ink);
  color: rgba(255, 255, 255, 0.88);
  text-align: center;
}

.footer p + p {
  margin-top: 0.4rem;
}

.footer-note {
  font-size: var(--t-sm);
  color: rgba(255, 255, 255, 0.72);
}

/* ---------------------------------------------------------------------
   Values dialog — native <dialog> gives focus trapping, Escape handling
   and focus restoration without any of our own JavaScript.
   --------------------------------------------------------------------- */
.value-modal {
  /* The universal margin reset above cancels the UA stylesheet's
     `margin: auto`, which is what centres a native dialog. Put it back. */
  margin: auto;
  width: min(92vw, 560px);
  padding: clamp(1.5rem, 4vw, 2.25rem);
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

.value-modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.value-modal[open] {
  animation: modal-in 0.25s ease;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
}

.value-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--ink-muted);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.value-modal-close:hover {
  color: var(--red);
  background-color: var(--red-wash);
}

#modal-title {
  margin-bottom: 0.75rem;
  padding-right: 2.5rem;
  font-size: var(--t-h3);
  font-weight: 700;
  color: var(--red);
}

#modal-text {
  color: var(--ink-muted);
}

/* ---------------------------------------------------------------------
   Scroll reveal.
   Gated behind html.js so the page is fully visible without JavaScript,
   and never applied to the hero, which holds the largest paint.
   --------------------------------------------------------------------- */
html.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

html.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------- */
@media (max-width: 860px) {
  .values-grid > .value-card,
  .board-grid > .board-member {
    /* 3 + 2; the trailing pair centers under the row above. */
    flex-basis: calc((100% - 2 * var(--grid-gap)) / 3);
    max-width: calc((100% - 2 * var(--grid-gap)) / 3);
  }

  .officers-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .values-grid > .value-card,
  .board-grid > .board-member {
    flex-basis: calc((100% - var(--grid-gap)) / 2);
    max-width: calc((100% - var(--grid-gap)) / 2);
  }
}

@media (max-width: 400px) {
  .values-grid > .value-card,
  .board-grid > .board-member {
    flex-basis: 100%;
    max-width: 100%;
  }

  .officers-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------------------------------------------------------------------
   Motion preferences
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html.js .reveal {
    opacity: 1;
    transform: none;
  }
}
