/*
Theme Name: PSIA-NRM
Theme URI: https://psia-nrm.org
Description: Custom theme for PSIA-AASI Northern Rocky Mountain Division
Version: 1.0
Author: NRM
Requires at least: 6.0
Requires PHP: 8.0
License: Private
*/

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap');

:root {
  --psia-teal: #035368;
  --psia-teal-light: #E8F4F7;
  --psia-teal-mid: #5B9AAE;
  --shield-blue: #045996;
  --shield-red: #E31636;
  --slate-text: #2D3748;
  --text-secondary: #4A5568;
  --text-muted: #5D6B80; /* darkened from #718096 to pass WCAG AA (4.5:1) on white */
  --border-light: #E2E8F0;
  --ice: #F0F3F7;
  --snow: #FAFBFC;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  color: var(--slate-text);
  background: var(--snow);
  line-height: 1.6;
}

a { color: var(--shield-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.container-narrow { max-width: 800px; margin: 0 auto; padding: 0 1rem; }

/* Header */
.site-header {
  background: var(--psia-teal);
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}
.header-top {
  background: rgba(3,83,104,0.9);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 0.75rem;
  padding: 0.25rem 0;
  color: rgba(255,255,255,0.7);
}
.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.header-logo { display: inline-flex; align-items: center; }
.header-logo img { height: 52px; width: auto; border-radius: 6px; display: block; }
.header-nav { display: flex; gap: 0.25rem; align-items: center; }
.header-nav a {
  color: rgba(255,255,255,0.9);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  text-decoration: none;
}
.header-nav a:hover, .header-nav a.current {
  color: white;
  background: rgba(255,255,255,0.1);
  text-decoration: none;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--psia-teal) 0%, var(--shield-blue) 50%, var(--psia-teal) 100%);
  color: white;
  padding: 5rem 0;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}
.hero p { font-size: 1.25rem; color: rgba(255,255,255,0.8); max-width: 640px; }
.hero .stats { display: grid; grid-template-columns: repeat(3, auto); gap: 1.5rem; margin-top: 3rem; max-width: 400px; }
.hero .stat-number { font-size: clamp(1.5rem, 3vw, 2.5rem); font-weight: 700; }
.hero .stat-label { font-size: 0.875rem; color: rgba(255,255,255,0.6); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: white; color: var(--psia-teal); }
.btn-primary:hover { background: rgba(255,255,255,0.9); }
.btn-secondary { background: rgba(255,255,255,0.1); color: white; border: 1px solid rgba(255,255,255,0.2); }
.btn-secondary:hover { background: rgba(255,255,255,0.2); }
.btn-teal { background: var(--psia-teal); color: white; }
.btn-teal:hover { opacity: 0.9; }

/* Cards */
.card {
  background: white;
  border-radius: 0.75rem;
  border: 1px solid var(--border-light);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  padding: 1.5rem;
  transition: all 0.2s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(3,83,104,0.12); }
.card-grid { display: grid; gap: 1.5rem; }
.card-grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card-grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card-grid-4 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-alpine { background: #DBEAFE; color: #1E40AF; }
.badge-snowboard { background: #EDE9FE; color: #5B21B6; }
.badge-telemark { background: #FEF3C7; color: #92400E; }
.badge-xc { background: #D1FAE5; color: #065F46; }
.badge-adaptive { background: #FFE4E6; color: #9F1239; }
.badge-teal { background: var(--psia-teal-light); color: var(--psia-teal); }

/* Section */
.section { padding: 4rem 0; }
.section-ice { background: var(--ice); }
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--psia-teal);
  margin-bottom: 1.5rem;
}

/* Event cards */
.event-card { display: flex; overflow: hidden; }
.event-date {
  background: var(--psia-teal);
  color: white;
  padding: 1.5rem;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.event-date .month { font-size: 0.875rem; opacity: 0.7; }
.event-date .day { font-size: 2rem; font-weight: 700; }
.event-content { padding: 1.5rem; flex: 1; }
.event-content h3 { color: var(--psia-teal); font-weight: 700; font-size: 1.125rem; margin-bottom: 0.25rem; }

/* Member cards */
.member-card { display: flex; align-items: center; gap: 1rem; }
.member-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--psia-teal);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}
.member-avatar-lg { width: 96px; height: 96px; font-size: 1.5rem; }

/* Campaign banner */
.campaign-banner {
  background: linear-gradient(135deg, var(--psia-teal), var(--shield-blue));
  border-radius: 1rem;
  padding: 3rem;
  color: white;
}
.campaign-pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.campaign-pillar { background: rgba(255,255,255,0.1); border-radius: 0.5rem; padding: 1rem; }

/* Footer */
.site-footer {
  background: var(--psia-teal);
  color: white;
  padding: 3rem 0;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; }
.footer-col h3 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.8);
  margin-bottom: 0.75rem;
}
.footer-col a { color: rgba(255,255,255,0.6); font-size: 0.875rem; display: block; padding: 0.25rem 0; text-decoration: none; }
.footer-col a:hover { color: white; text-decoration: none; }
.footer-col p { color: rgba(255,255,255,0.6); font-size: 0.875rem; line-height: 1.6; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: 2rem;
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
}

/* Quick actions offset */
.quick-actions { margin-top: -2rem; position: relative; z-index: 10; }

/* Utility */
.text-teal { color: var(--psia-teal); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* Sponsor bar */
.sponsor-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2rem; opacity: 0.6; }
.sponsor-item { color: var(--text-muted); font-weight: 600; font-size: 0.875rem; padding: 0.5rem 1rem; border: 1px solid var(--border-light); border-radius: 0.5rem; }

/* ── Icons (inline SVG, replaces emoji) ── */
.nrm-icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.quick-action-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--psia-teal-light); color: var(--psia-teal);
  margin-bottom: 0.75rem;
}
.nrm-doc-ico { color: var(--psia-teal); display: inline-flex; flex-shrink: 0; }
.profile-quick-link {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.625rem; background: var(--ice); border-radius: 0.5rem;
  font-size: 0.8125rem; text-decoration: none; color: var(--psia-teal); font-weight: 600;
  min-height: 44px;
}

/* ── Requirement / module bullet lists (discipline pages) ── */
.nrm-req { font-size: 0.875rem; color: var(--text-secondary); }
.nrm-req .nrm-req-list { list-style: none; padding: 0; margin: 0; }
.nrm-req .nrm-req-list li {
  position: relative; padding-left: 1.1rem; line-height: 1.55; margin-bottom: 0.4rem;
}
.nrm-req .nrm-req-list li::before {
  content: ""; position: absolute; left: 0; top: 0.55em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--psia-teal-mid);
}
.nrm-req p { margin: 0.5rem 0; line-height: 1.6; }

/* ── Skip link ── */
.skip-link {
  position: absolute; left: 0.5rem; top: -3rem; z-index: 1000;
  background: var(--shield-blue); color: #fff; padding: 0.6rem 1rem;
  border-radius: 0 0 0.5rem 0.5rem; font-weight: 600; transition: top 0.15s;
}
.skip-link:focus { top: 0; text-decoration: none; outline: 3px solid #fff; outline-offset: 2px; }

/* ── Visible focus ── */
:focus-visible { outline: 3px solid var(--shield-blue); outline-offset: 2px; border-radius: 2px; }
.site-header :focus-visible, .hero :focus-visible, .campaign-banner :focus-visible { outline-color: #fff; }

/* ── Mobile nav toggle (hidden on desktop) ── */
.nav-toggle {
  display: none; background: transparent; border: 0; color: #fff;
  width: 44px; height: 44px; align-items: center; justify-content: center;
  cursor: pointer; border-radius: 0.5rem;
}
.nav-toggle:hover { background: rgba(255,255,255,0.1); }
.nav-toggle .nrm-icon-x { display: none; }
.nav-toggle[aria-expanded="true"] .nrm-icon-menu { display: none; }
.nav-toggle[aria-expanded="true"] .nrm-icon-x { display: inline-block; }

/* Long-form readability cap (desktop parity, §6.5) */
.entry-content { max-width: 68ch; }
.entry-content.full-width, .card .entry-content { max-width: none; }

/* Footer links a touch brighter for contrast */
.site-footer a { color: rgba(255,255,255,0.88); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav-toggle { display: inline-flex; }
  .header-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; gap: 0; background: var(--psia-teal);
    padding: 0.5rem; box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    border-top: 1px solid rgba(255,255,255,0.1);
  }
  .header-nav.is-open { display: flex; }
  .header-nav a { padding: 0.85rem 1rem; border-radius: 0.5rem; font-size: 1rem; min-height: 44px; display: flex; align-items: center; }
  .header-main { position: relative; }
  .hero { padding: 3rem 0; }
  .hero .stats { grid-template-columns: repeat(3, 1fr); gap: 1rem; }
  .event-card { flex-direction: column; }
  .event-date { flex-direction: row; gap: 0.5rem; min-width: auto; padding: 1rem; }
  .campaign-banner { padding: 2rem 1.5rem; }
  .footer-bottom { flex-direction: column; text-align: center; }
  /* Dues / rate tables: let wide tables scroll rather than overflow the viewport */
  .entry-content table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* ── Form inputs: ≥16px prevents iOS auto-zoom; ≥44px touch height ── */
.nrm-form input, .nrm-form textarea, .nrm-form select {
  font-size: 16px; min-height: 44px;
}
.nrm-form textarea { min-height: 120px; }

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important; scroll-behavior: auto !important;
  }
  .card:hover { transform: none !important; }
}

/* WordPress specific overrides */
.wp-block-group { margin-bottom: 0; }
.entry-content > * { margin-bottom: 1.5rem; }
.entry-content > *:last-child { margin-bottom: 0; }

/* ── Editor content (Gutenberg blocks inside .entry-content) ──
   Styles core blocks so office staff can edit tables, accordions, and
   document links in the normal editor and they render on-design. */
.entry-content h2 { color: var(--psia-teal); font-weight: 700; font-size: 1.25rem; margin-bottom: 1rem; }
.entry-content h3 { color: var(--psia-teal); font-weight: 700; font-size: 1.05rem; margin-bottom: 0.5rem; }
.entry-content p { font-size: 0.9375rem; color: var(--text-secondary); line-height: 1.7; }
.entry-content ul, .entry-content ol { font-size: 0.9375rem; color: var(--text-secondary); line-height: 1.9; padding-left: 1.25rem; }
.entry-content a { color: var(--shield-blue); }

.entry-content table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.entry-content table thead th,
.entry-content table thead td { text-align: left; padding: 0.625rem 0.75rem; color: var(--psia-teal); border-bottom: 2px solid var(--border-light); font-weight: 700; }
.entry-content table tbody td { padding: 0.625rem 0.75rem; border-bottom: 1px solid var(--border-light); }
.entry-content table tbody tr:last-child td { border-bottom: none; }
.entry-content .wp-block-table figcaption { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.5rem; }

.entry-content details { border-bottom: 1px solid var(--border-light); padding: 0.75rem 0; margin-bottom: 0 !important; }
.entry-content details:last-of-type { border-bottom: none; }
.entry-content details > summary { cursor: pointer; font-size: 0.875rem; font-weight: 600; color: var(--slate-text); }
.entry-content details > *:not(summary) { padding-top: 0.75rem; font-size: 0.875rem; }

/* Document link pill — used via the "Document link" block pattern */
.entry-content .nrm-doc-link,
.nrm-doc-link { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; background: var(--ice); border-radius: 0.5rem; text-decoration: none; color: inherit; margin-bottom: 0.5rem; }
.nrm-doc-link .nrm-doc-title { font-size: 0.875rem; font-weight: 600; color: var(--psia-teal); }
.nrm-doc-link .nrm-doc-note { font-size: 0.75rem; color: var(--text-muted); }

/* Deadline badge — used via the "Deadline badge" block pattern */
.nrm-deadline { display: inline-block; background: rgba(227,22,54,0.1); color: var(--shield-red); font-weight: 600; font-size: 0.8125rem; padding: 0.25rem 0.75rem; border-radius: 0.5rem; margin-bottom: 0.5rem; }

/* Info panel (tinted box) */
.entry-content .nrm-panel { padding: 1.25rem; background: var(--ice); border-radius: 0.75rem; }
.entry-content .nrm-panel-teal { padding: 1.25rem; background: var(--psia-teal-light); border-radius: 0.75rem; }
.entry-content .wp-block-columns { gap: 1rem; }
