/* EquitableDocs v3 stylesheet
   Layout pattern inspired by WebAIM (hero + service cards + alternating sections).
   Palette is our own: charcoal + royal blue. Not WebAIM's navy/yellow.
   Typography: system sans, generous sizing for COGA (cognitive accessibility).
*/

:root {
  --text: #0b0c0c;
  --text-muted: #4b5563;
  --text-inverse: #ffffff;

  --bg: #ffffff;
  --bg-alt: #f3f4f6;
  --bg-hero: #1f2937;
  --bg-footer: #111827;
  --bg-card: #ffffff;

  --link: #1e40af;
  --link-visited: #6b21a8;
  --link-hover: #172554;
  --link-on-dark: #93c5fd;
  --link-on-dark-hover: #dbeafe;

  --border: #d1d5db;
  --card-border: #9ca3af;
  --accent: #1e40af;

  --focus-bg: #fde68a;
  --focus-outline: #78350f;
  --focus-text: #0b0c0c;
}

* { box-sizing: border-box; }

html { font-size: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

.wrap {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ===== SKIP LINK ===== */
.skip-link {
  position: absolute;
  left: -1000px;
  top: 0;
  background: var(--focus-bg);
  color: var(--focus-text);
  padding: 0.75rem 1.25rem;
  text-decoration: underline;
  font-weight: 700;
  z-index: 100;
}
.skip-link:focus { left: 0; outline: 3px solid var(--focus-outline); }

/* ===== HEADER / NAV ===== */
header {
  background: var(--bg);
  border-bottom: 2px solid var(--border);
  padding: 1.25rem 0;
}
header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.site-name {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.005em;
}
.site-name a {
  color: var(--text);
  text-decoration: none;
}
.site-name a:hover { text-decoration: underline; }

nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}
nav li { margin: 0.25rem 0; }
nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  padding: 0.375rem 0;
  border-bottom: 3px solid transparent;
}
nav a:hover { border-bottom-color: var(--accent); color: var(--accent); }
nav a[aria-current="page"] {
  border-bottom-color: var(--accent);
  font-weight: 700;
}

/* ===== TOOLS DROPDOWN MENU =====
   Disclosure pattern: a button toggles a hidden submenu. Keyboard-accessible:
   Esc closes and returns focus to the button; ArrowDown opens and focuses
   the first item; click outside closes; aria-expanded reflects state. */
.nav-tools { position: relative; }
.nav-tools__btn {
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
  font-weight: 500;
  padding: 0.375rem 0;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.nav-tools__btn:hover {
  border-bottom-color: var(--accent);
  color: var(--accent);
}
.nav-tools__btn:focus {
  background: var(--focus-bg);
  color: var(--focus-text);
  outline: 3px solid var(--focus-outline);
  outline-offset: 2px;
}
.nav-tools__btn[aria-expanded="true"] {
  border-bottom-color: var(--accent);
  color: var(--accent);
}
.nav-tools__btn::after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  margin-left: 0.25rem;
  transition: transform 150ms;
}
.nav-tools__btn[aria-expanded="true"]::after { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) {
  .nav-tools__btn::after { transition: none; }
}
.nav-tools__submenu {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  background-color: #ffffff;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  min-width: 18rem;
  padding: 0.4rem 0;
  margin: 0;
  list-style: none;
  z-index: 100;
}
.nav-tools__submenu[hidden] { display: none; }
.nav-tools__submenu li { margin: 0; }
.nav-tools__submenu a {
  display: block;
  padding: 0.55rem 1rem;
  border-bottom: none;
  font-weight: 500;
  white-space: nowrap;
}
.nav-tools__submenu a:hover {
  background-color: #f3f4f6;
  color: var(--accent);
  border-bottom: none;
}
.nav-tools__submenu a:focus {
  background: var(--focus-bg);
  color: var(--focus-text);
  outline: 2px solid var(--focus-outline);
  outline-offset: -2px;
}
.nav-tools__submenu a[aria-current="page"] {
  background-color: #eef2ff;
  font-weight: 700;
  color: var(--accent);
}
@media (max-width: 720px) {
  .nav-tools__submenu {
    position: static;
    box-shadow: none;
    margin-top: 0.25rem;
    margin-left: 1rem;
    min-width: 0;
  }
}

/* ===== HEADINGS ===== */
h1, h2, h3 {
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 1rem;
}
h1 { font-size: 2.5rem; }
h2 { font-size: 1.875rem; margin-top: 0; }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1rem; max-width: 44rem; }

/* ===== LINKS ===== */
a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 0.08em;
}
a:visited { color: var(--link-visited); }
a:hover { color: var(--link-hover); text-decoration-thickness: 0.15em; }
a:focus {
  outline: 3px solid var(--focus-outline);
  outline-offset: 2px;
  background: var(--focus-bg);
  color: var(--focus-text);
  text-decoration: none;
}

/* ===== HERO SECTION ===== */
.hero {
  background: var(--bg-hero);
  color: var(--text-inverse);
  padding: 5rem 0 4.5rem;
  border-bottom: 4px solid var(--accent);
}
.hero h1 {
  color: var(--text-inverse);
  margin: 0 auto 2.75rem;
  max-width: 50ch;
  line-height: 1.35;
  font-size: 2.125rem;
}
.hero .lede {
  color: var(--text-inverse);
  font-size: 1.3125rem;
  line-height: 1.7;
  max-width: 55ch;
  margin: 0 auto 2.25rem;
  opacity: 0.95;
}
.hero a {
  color: var(--link-on-dark);
}
.hero a:hover { color: var(--link-on-dark-hover); }

.hero-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  max-width: 60rem;
  margin: 0 auto 2.25rem;
  text-align: left;
}
.hero-col-label {
  color: var(--text-inverse);
  font-size: 0.9375rem;
  font-weight: 700;
  margin: 0 0 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.85;
}
.hero-col p {
  color: var(--text-inverse);
  font-size: 1.0625rem;
  line-height: 1.65;
  margin: 0;
  opacity: 0.95;
}
@media (max-width: 720px) {
  .hero-two-col {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0 auto;
  max-width: 55ch;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-block;
  padding: 0.875rem 1.5rem;
  font-size: 1.0625rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: 0.25rem;
  border: 2px solid transparent;
  line-height: 1.2;
}
.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--link-hover);
  border-color: var(--link-hover);
  color: var(--text-inverse);
  text-decoration: underline;
}
/* On dark hero background, the royal-blue primary button does not meet
   the 3:1 non-text contrast against #1f2937 charcoal. Add a white
   outline so the button surface is visually distinguishable from the
   hero background per WCAG 2.1 SC 1.4.11. */
.hero .btn-primary {
  border-color: var(--text-inverse);
}
.hero .btn-primary:hover {
  border-color: var(--text-inverse);
}
.btn-secondary {
  background: transparent;
  color: var(--text-inverse);
  border-color: var(--text-inverse);
}
.btn-secondary:hover {
  background: var(--text-inverse);
  color: var(--bg-hero);
  text-decoration: underline;
}
.btn:focus {
  outline: 3px solid var(--focus-bg);
  outline-offset: 2px;
  background: var(--focus-bg);
  color: var(--focus-text);
  border-color: var(--focus-outline);
}

/* ===== SECTIONS ===== */
main section {
  padding: 3rem 0;
}
.section-alt {
  background: var(--bg-alt);
}
section + section:not(.hero):not(.section-alt) {
  border-top: 1px solid var(--border);
}

/* ===== SERVICES CARD GRID ===== */
.services-intro {
  margin-bottom: 2rem;
}
ul.services {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1.25rem;
}
ul.services > li {
  background: var(--bg-card);
  border: 2px solid var(--card-border);
  border-left: 6px solid var(--accent);
  padding: 1.5rem 1.5rem 1.25rem;
  border-radius: 0.25rem;
  display: flex;
  flex-direction: column;
}
ul.services h3 {
  font-size: 1.1875rem;
  margin: 0 0 0.5rem;
  line-height: 1.3;
}
ul.services h3 a {
  text-decoration: none;
  color: var(--text);
}
ul.services h3 a:hover {
  color: var(--link);
  text-decoration: underline;
}
ul.services p {
  margin: 0;
  color: var(--text-muted);
  font-size: 1rem;
}

/* Tools stripe card extensions */
ul.services.tools-grid > li { border-left-color: #b07a00; }
.tools-status {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  padding: 0.1875rem 0.625rem;
  margin: 0 0 0.625rem;
  background: #fef3c7;
  color: #78350f;
  border-radius: 0.1875rem;
  text-transform: uppercase;
}
.tools-status.status-dev { background: #e5e7eb; color: #374151; }
.tools-cta {
  margin-top: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
}

/* Prose cards: paragraph-as-card pattern, lead phrase bold */
.prose-cards { margin-top: 1rem; }
.prose-cards p {
  background: var(--bg-card);
  border: 2px solid var(--card-border);
  border-left: 6px solid var(--accent);
  padding: 1rem 1.25rem;
  border-radius: 0.25rem;
  margin: 0 0 0.875rem;
  max-width: none;
}
.section-alt .prose-cards p { background: var(--bg); }

.student-note {
  margin: 1.5rem 0 0;
  padding: 1rem 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  color: var(--text);
  font-size: 1rem;
  max-width: none;
}
.section-alt .student-note { background: var(--bg-alt); }

/* ===== TOC (services page) ===== */
nav.toc {
  background: var(--bg);
  padding: 1.25rem 1.5rem;
  margin: 0 0 2.5rem;
  border: 2px solid var(--border);
  border-left: 6px solid var(--accent);
  border-radius: 0.25rem;
}
nav.toc h2 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
}
nav.toc ol {
  margin: 0;
  padding-left: 1.5rem;
}
nav.toc li { margin: 0.375rem 0; }

/* ===== SERVICE DETAIL PANELS (services page) ===== */
.service-panel {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-left: 6px solid var(--accent);
  padding: 1.75rem 1.75rem 1.25rem;
  margin: 0 0 1.5rem;
  border-radius: 0.25rem;
}
.service-panel h2 { margin-top: 0; }
.service-panel p:last-child { margin-bottom: 0; }

/* ===== LISTS IN MAIN ===== */
main ul:not(.services):not(.cta-list) {
  padding-left: 1.5rem;
}
main ul:not(.services) li { margin: 0.375rem 0; }

/* ===== FOOTER ===== */
footer {
  background: var(--bg-footer);
  color: var(--text-inverse);
  padding: 3rem 0 2rem;
  margin-top: 4rem;
}
footer h2 {
  font-size: 1.125rem;
  margin: 0 0 0.75rem;
  color: var(--text-inverse);
}
footer a {
  color: var(--link-on-dark);
  text-decoration: underline;
}
footer a:hover { color: var(--link-on-dark-hover); }
footer a:focus {
  background: var(--focus-bg);
  color: var(--focus-text);
  outline: 3px solid var(--focus-outline);
}
footer ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}
footer li { margin: 0.375rem 0; }
footer .wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 2rem 3rem;
}
.colophon {
  grid-column: 1 / -1;
  border-top: 1px solid rgba(255,255,255,0.2);
  padding-top: 1.25rem;
  margin-top: 0.5rem;
  font-size: 0.9375rem;
  color: rgba(255,255,255,0.85);
}
.colophon a { color: var(--link-on-dark); }

/* ===== RESPONSIVE ===== */
@media (max-width: 40rem) {
  h1 { font-size: 1.875rem; }
  h2 { font-size: 1.5rem; }
  .hero { padding: 2.5rem 0 2rem; }
  main section { padding: 2rem 0; }
  .hero .lede { font-size: 1.125rem; }
  ul.services { grid-template-columns: 1fr; }
  .btn { width: 100%; text-align: center; }
}

/* ===== MOTION / FORCED COLOURS ===== */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
@media (forced-colors: active) {
  .btn, ul.services > li, .service-panel, nav.toc {
    border: 2px solid ButtonText;
  }
  a:focus { outline: 3px solid LinkText; background: transparent; color: LinkText; }
}
