/* ============================================================
   oSTEM @ UMich - style.css
   Palette: U-M blue (#00274C) + maize (#FFCB05) on warm paper.
   Signature: a thin 6-stripe "pride rule" under the header and
   above the footer, echoed as heading underlines.

   ACCESSIBILITY NOTES (please keep these rules intact):
   • Maize text is NEVER placed on white - it fails contrast.
     Maize is used only as a background (with blue text) or on blue.
   • All interactive elements have a visible :focus-visible style.
   • Animations are wrapped in prefers-reduced-motion checks.
   ============================================================ */

:root {
  --blue: #00274C;
  --blue-deep: #001A33;
  --maize: #FFCB05;
  --ink: #1C2733;          /* body text - 13.9:1 on paper */
  --muted: #4A5866;        /* secondary text - 7:1 on paper */
  --paper: #FBF8F1;        /* warm off-white page background */
  --card: #FFFFFF;
  --link: #00508F;         /* 6.7:1 on white - AA for normal text */
  --focus: #B3005E;        /* focus ring on light backgrounds */
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0, 39, 76, 0.10);

  /* Classic 6-stripe pride gradient, used only in thin rules */
  --pride: linear-gradient(90deg,
    #E40303 0 16.6%, #FF8C00 16.6% 33.3%, #FFED00 33.3% 50%,
    #008026 50% 66.6%, #24408E 66.6% 83.3%, #732982 83.3% 100%);
  /* Same stripes running top-to-bottom (for vertical edges) */
  --pride-v: linear-gradient(180deg,
    #E40303 0 16.6%, #FF8C00 16.6% 33.3%, #FFED00 33.3% 50%,
    #008026 50% 66.6%, #24408E 66.6% 83.3%, #732982 83.3% 100%);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

body {
  margin: 0;
  font-family: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}

h1, h2, h3 {
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  color: var(--blue);
  line-height: 1.15;
}

img { max-width: 100%; }

a { color: var(--link); }

/* Visible keyboard focus everywhere */
a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Screen-reader-only text (e.g. "opens in new tab") */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* External-link marker */
.ext {
  font-size: 0.75em;
  margin-left: 0.3em;
  display: inline-block;
}

/* Skip link - hidden until focused */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3.5rem;
  z-index: 100;
  background: var(--maize);
  color: var(--blue);
  font-weight: 700;
  padding: 0.6rem 1rem;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0; }

@media (prefers-reduced-motion: reduce) {
  .skip-link { transition: none; }
}

/* The signature pride rule */
.pride-rule {
  height: 6px;
  background: var(--pride);
}

/* ============ HEADER ============ */
.site-header {
  background: var(--blue);
  color: #fff;
}

/* Sticky header on larger screens; anchors get an offset so section
   headings aren't hidden underneath it. (Not sticky on small screens,
   where the wrapped header would eat too much space.) */
@media (min-width: 900px) {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 80;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  }
  main section[id] { scroll-margin-top: 96px; }
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  border-radius: 50%;
  border: 3px solid #fff;   /* ring so the round rainbow logo pops on blue */
  background: #fff;
}

.brand-name {
  font-family: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.01em;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.brand-at { color: var(--maize); }

/* Unified pill container: the three links read as one navigation
   unit instead of floating text. */
.site-nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-wrap: wrap;
  margin-inline: auto;   /* centers the nav between the brand and the search box */
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 0.3rem;
  min-height: 48px;      /* matches the search box exactly */
}

.site-nav a {
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  padding: 0.5rem 1.05rem;
  border-radius: 999px;
  white-space: nowrap;
}

.site-nav a:hover {
  background: rgba(255, 255, 255, 0.16);
  color: var(--maize);
}

/* Scroll-spy: highlights the section currently on screen */
.site-nav a.active {
  background: var(--maize);
  color: var(--blue);
}

.site-nav a.active:hover { background: #EDBB00; }

/* Search */
.search { display: flex; flex-direction: column; gap: 0.25rem; }

.search-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  position: relative;
  min-height: 48px;      /* matches the nav pill exactly */
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;  /* clicks pass through to the input */
}

.clear-search {
  border: 2px solid rgba(255, 255, 255, 0.7);
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  border-radius: 8px;
  padding: 0 0.8rem;
  cursor: pointer;
}

.clear-search:hover { background: rgba(255, 255, 255, 0.12); }

.search label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #fff;
}

.search input {
  width: 15.5rem;            /* fits the placeholder; still utility weight */
  max-width: 100%;
  height: 48px;
  padding: 0 1rem 0 2.5rem;  /* left padding clears the magnifier icon */
  border: 1px solid rgba(255, 255, 255, 0.14);  /* same border as the nav pill */
  border-radius: 999px;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--ink);
  background: #fff;
}

/* Widen while in use, so typing isn't cramped */
.search input:focus,
.search input:not(:placeholder-shown) {
  width: 18rem;
}

@media (prefers-reduced-motion: no-preference) {
  .search input { transition: width 0.18s ease; }
}

.search input:focus-visible {
  outline: 3px solid var(--maize);
  outline-offset: 1px;
}

/* ============ MAIN LAYOUT ============ */
main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.25rem 3.5rem;
}

section { margin-top: 3rem; }

/* Section headings get a short pride underline */
main h2 {
  font-size: 1.75rem;
  margin: 0 0 0.35rem;
  padding-bottom: 0.6rem;
  position: relative;
}

main h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 4.5rem;
  height: 4px;
  border-radius: 2px;
  background: var(--pride);
}

/* ============ CRISIS STRIP ============ */
.crisis {
  margin-top: 1.75rem;
  background: var(--maize);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}

.crisis h2 {
  font-size: 1.05rem;
  color: var(--blue);
  margin: 0 0 6px;
  padding-bottom: 0;
}

.crisis h2::after { display: none; }

.crisis-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.75rem;
}

.crisis-list a,
.crisis-phone {
  color: var(--blue);
  font-weight: 700;
}

.crisis-phone a { color: var(--blue); }

/* ============ INTRO ============ */
.intro {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 2.5rem;
  align-items: center;
}

.eyebrow {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.intro h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  margin: 0 0 1rem;
}

.intro-lede {
  font-size: 1.15rem;
  max-width: 58ch;
  margin: 0 0 1.5rem;
}

.intro-actions {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  font-weight: 700;
  text-decoration: none;
  padding: 0.8rem 1.3rem;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue-deep); }

.btn-maize { background: var(--maize); color: var(--blue); }
.btn-maize:hover { background: #EDBB00; }

/* Decorative CSS artwork (no image files needed) */
.intro-art {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0.75rem;
  min-height: 260px;
}

.art-block { border-radius: 14px; }

.art-a {
  /* Thin vertical pride stripe on the left edge, blue everywhere else */
  background: var(--pride-v) left / 6px 100% no-repeat, var(--blue);
  grid-row: 1 / 3;
}

.art-b { background: var(--maize); }

.art-c {
  background:
    radial-gradient(rgba(0, 39, 76, 0.22) 2.5px, transparent 2.5px) 0 0 / 22px 22px,
    #EAE3D4;
}

/* ============ SEARCH STATUS ============ */
.search-status {
  margin: 1rem 0 0;
  min-height: 1.4em;
  font-weight: 600;
  color: var(--muted);
}

.search-status:empty { margin: 0; min-height: 0; }

/* ============ EVENTS ============ */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.event-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.event-date-badge {
  background: var(--blue);
  color: #fff;
  padding: 0.7rem 1.1rem;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.event-date-badge .edb-day {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--maize);
}

.event-date-badge .edb-rest { font-weight: 600; }

.event-body {
  padding: 1rem 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
}

.event-body h3 {
  margin: 0;
  font-size: 1.2rem;
}

.event-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 600;
}

.event-desc { margin: 0; }

.event-link {
  margin-top: auto;
  font-weight: 700;
}

.events-empty,
.events-fallback {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.4rem;
  margin-top: 1.25rem;
}

.events-calendar-link { margin-top: 1.4rem; font-weight: 600; }

.past-events {
  margin-top: 1.5rem;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.9rem 1.2rem;
}

.past-events summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--blue);
}

.past-events ul {
  margin: 0.75rem 0 0.25rem;
  padding-left: 1.25rem;
  color: var(--muted);
}

/* ============ RESOURCES ============ */
.resources-hint { color: var(--muted); margin: 0.25rem 0 0; }

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.chip {
  border: 2px solid var(--blue);
  background: #fff;
  color: var(--blue);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  cursor: pointer;
}

.chip:hover { background: #EAF1F8; }

.chip.is-active {
  background: var(--blue);
  color: #fff;
}

/* Multi-column masonry layout: cards of different heights pack
   tightly instead of leaving a tall empty gap in the grid. */
.card-grid {
  columns: 320px;
  column-gap: 1.25rem;
  margin-top: 1.25rem;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.3rem 1.4rem 1.4rem;
  border-top: 4px solid var(--maize);
  break-inside: avoid;        /* keep each card whole within a column */
  margin-bottom: 1.25rem;
}

.card h3 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
}

.resource-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.resource-list li {
  padding: 0.7rem 0;
  border-bottom: 1px solid #EDE7DA;
}

.resource-list li:last-child { border-bottom: 0; padding-bottom: 0; }

.resource-list a { font-weight: 700; }

.resource-list p {
  margin: 0.2rem 0 0;
  font-size: 0.9375rem;
  color: var(--muted);
}

.no-results {
  margin-top: 1.5rem;
  background: var(--card);
  border-left: 5px solid var(--maize);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.3rem;
  font-weight: 600;
}

/* Gentle hover lift on cards (only when motion is OK) */
@media (prefers-reduced-motion: no-preference) {
  .card, .event-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }
  .card:hover, .event-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(0, 39, 76, 0.16);
  }
}

/* ============ BACK TO TOP ============ */
.to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 90;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--blue);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}

.to-top:hover { background: var(--blue-deep); }

/* ============ CONNECT ============ */
.connect {
  background: var(--maize);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.connect-inner {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
  padding: 1.9rem 1.5rem 2.1rem;
}

.connect h2 {
  color: var(--blue);
  padding-bottom: 0;
  margin-bottom: 0.6rem;
}

.connect h2::after {
  left: 50%;
  transform: translateX(-50%);
  bottom: -0.55rem;
}

.connect p {
  color: var(--blue);
  font-weight: 600;
  margin: 1.1rem 0 1.5rem;
}

/* ============ FOOTER ============ */
.site-footer {
  background: var(--blue);
  color: #fff;
  margin-top: 3.5rem;
}

.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2.75rem 1.25rem 3rem;
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 2.5rem;
  align-items: start;
}

.footer-brand { text-align: center; }

.footer-logo {
  border-radius: 50%;
  border: 3px solid #fff;
  background: #fff;
}

.footer-name {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 1.25rem;
  margin: 0.6rem 0 0;
}

.site-footer h2 {
  font-size: 1.05rem;
  color: var(--maize);
  margin: 0 0 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: "Public Sans", Arial, sans-serif;
}

.site-footer address { font-style: normal; line-height: 1.55; }

.site-footer a { color: var(--maize); font-weight: 600; }

.footer-note p { margin: 0 0 0.5rem; }

.footer-fine {
  color: #B9C4CF;
  font-size: 0.875rem;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .intro { grid-template-columns: 1fr; }
  .intro-art { min-height: 180px; }
  .footer-inner { grid-template-columns: 1fr; text-align: left; }
  .footer-brand { text-align: left; }
}

/* Menu button: hidden on desktop; JS reveals it on small screens */
.menu-button {
  display: none;
  align-items: center;
  gap: 0.5rem;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  min-height: 48px;
  cursor: pointer;
}

@media (max-width: 800px) {
  .header-inner { gap: 0.9rem; }
  .brand-name { font-size: 1.3rem; }

  .menu-button:not([hidden]) { display: inline-flex; }

  /* When JS runs (body.js), the nav collapses behind the menu button.
     Without JS it simply stays visible and wraps, so nothing breaks. */
  body.js .site-nav { display: none; }

  body.js .site-nav.open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    order: 3;               /* drops below the brand + menu row */
    border-radius: 14px;
    padding: 0.4rem;
  }

  body.js .site-nav.open a { text-align: center; }

  .search { width: 100%; }
  .search input,
  .search input:focus,
  .search input:not(:placeholder-shown) { width: 100%; }
}
