/**
 * aimac-shared.css - Shared AIMAC components used by PACE
 *
 * Source: the AIMAC website repository, site/assets/css/, at commit
 * 492870e4, with shared navigation and footer fixes refreshed from dcf187ea
 * on 2026-11-15 after verification on aimac.ai.
 * Rules are copied unchanged, in source order: 02-base, 03-layout,
 * 04-components, 05-pages. Load after aimac-tokens.css and before pace.css.
 *
 * Do not restyle these rules here. Change the parent first, then refresh
 * this copy. PACE-only rules belong in pace.css.
 *
 * One deliberate difference from the parent: html and body do not set
 * overflow-x: hidden. The parent needs it for sections that break out of a
 * container with negative margins. PACE sections are full width already, and
 * DESIGN.md forbids concealing overflow.
 */

/* ----- 02-base.css ----- */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--gaad-bg);
  color: var(--gaad-fg);
  font-family: "DM Sans",system-ui, -apple-system, sans-serif;
  line-height: 1.75rem;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Ensure [hidden] consistently removes content from layout + a11y tree. */
[hidden] {
  display: none !important;
}

/* ----- 03-layout.css ----- */

/* Header Styles - Matching GAAD Foundation */
.header {
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-height);
  max-height: var(--header-height);
  background-color: var(--gaad-bg);
  border-bottom: 0.0625rem solid var(--gaad-border);
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 90rem;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  padding: 0 1rem;
}

@media (min-width: 62em) {
  .header-container {
    padding: 0 1.875rem;
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  width: 200px;
  gap: 0.5rem;
  color: var(--gaad-brand);
  font-weight: 800;
  text-decoration: none;
}

.brand:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.brand-logo {
  width: 100%;
  height: 4.375rem;
  object-fit: contain;
}

.header-nav {
  display: flex;
  align-items: center;
}

/* Desktop nav list - horizontal, no bullets */
.nav-list {
  display: flex;
  align-items: center;
  gap: 2.125rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-link {
  display: block;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 0.25rem;
  text-decoration: none;
  color: var(--black);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.875rem;
  font-family: 'DM Sans', sans-serif;
  letter-spacing: 0.05em;
}

.nav-link:focus-visible {
  outline: var(--focus-ring-sm);
  outline-offset: var(--focus-offset);
}

.nav-link:hover {
  text-decoration: underline;
  color: var(--focus);
  text-decoration-thickness: 2px;
  text-underline-offset: 9.5px;
}

.nav-link:visited {
  color: var(--gaad-brand);
}

.nav-link:visited:focus-visible {
  color: var(--gaad-accent);
}

/* Donate button styling */
.nav-link-donate {
  background-color: var(--gaad-accent);
  color: var(--white) !important;
  border: 2px solid var(--gaad-accent);
  border-radius: 4px;
  padding: 10px 24px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.nav-link-donate:hover {
  background-color: var(--white);
  color: var(--gaad-accent) !important;
  border-color: var(--gaad-accent);
  text-decoration: none;
}

.nav-link-donate:visited {
  color: var(--white) !important;
}

.nav-link-donate:visited:hover {
  color: var(--gaad-accent) !important;
}

.nav-link-donate:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

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

/* =========================================
   Mobile Navigation / Hamburger Menu
   ========================================= */

/* Hamburger toggle button - hidden on desktop */
.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.75rem; /* 44x44px minimum touch target for WCAG 2.2 SC 2.5.8 */
  z-index: 1001;
}

.hamburger-bar {
  display: block;
  width: 1.5rem;
  height: 3px;
  background-color: var(--gaad-brand);
  margin: 4px 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .hamburger-bar {
    transition: none;
  }
}

/* Transform hamburger to X when open */
.menu-toggle[aria-expanded="true"] .hamburger-bar:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle[aria-expanded="true"] .hamburger-bar:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] .hamburger-bar:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.menu-toggle:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Mobile styles - show hamburger, hide nav by default */
@media (max-width: 48em) {
  .menu-toggle {
    display: block;
  }

  .header-container {
    flex-wrap: wrap;
  }

  .header-nav {
    position: static;
  }

  /* Mobile: nav-list is hidden by default, shown when toggle opens it */
  .nav-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    display: none;
    flex-direction: column;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    background: var(--gaad-bg);
    box-shadow: var(--shadow-md);
  }

  .nav-list:not([hidden]) {
    display: flex;
  }

  .nav-list li {
    margin: 0;
    padding: 0;
  }

  .nav-list .nav-link {
    padding: 0.875rem 1rem;  /* 14px + 14px + ~16px font = 44px min touch target */
    min-height: 44px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--gaad-border);
    width: 100%;
    box-sizing: border-box;
  }

  .nav-list li:last-child .nav-link {
    border-bottom: none;
  }

  .brand-logo {
    height: 3rem;
  }

  /* Until the script reveals the toggle, keep navigation in the page flow.
     This also covers a failed app.js request with JavaScript enabled. */
  .header:has(.menu-toggle[hidden]) {
    height: auto;
    max-height: none;
  }

  .header:has(.menu-toggle[hidden]) .header-container {
    height: auto;
  }

  .header:has(.menu-toggle[hidden]) .brand {
    min-height: var(--header-height);
  }

  .mobile-nav-region:has(.menu-toggle[hidden]) {
    flex: 0 0 100%;
  }

  .header-nav:has(.menu-toggle[hidden]) {
    display: block;
  }

  .menu-toggle[hidden] + .nav-list {
    position: static;
    box-shadow: none;
    border-top: 1px solid var(--gaad-border);
  }
}

.container {
  max-width: 48rem;  /* 768px - optimal for prose readability */
  margin: 0 auto;
  padding: 1rem;
}

/* Skip link target - prevent content from being hidden under fixed header */
#main {
  scroll-margin-top: calc(var(--header-height) + 1rem);
}

/* Programmatic focus destinations (skip link, TOC links, scroll-to-top targets).
   Uses :focus (not :focus-visible) because programmatic .focus() calls do not
   reliably trigger :focus-visible across browsers, especially Safari/WebKit. */
[tabindex="-1"]:focus {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}

/* Section spacing */
section {
  margin-bottom: 0;  /* Full-bleed sections handle their own spacing via padding */
  padding-top: 2rem;
}

/* Comparison columns for AIMAC vs WebAIM */
.comparison-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

@media (min-width: 48em) {
  .comparison-columns {
    grid-template-columns: 1fr 1fr;
  }
}

.comparison-col {
  background: var(--hero-bg);
  padding: 1.25rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-subtle);
}

.comparison-col ul {
  margin: 0;
  padding-left: 1.25rem;
}

.comparison-col li {
  margin-bottom: 0.35rem;
}

.comparison-note {
  font-size: 0.85rem;
  color: var(--gaad-muted);
  margin-top: 0.75rem;
  margin-bottom: 0;
  font-style: italic;
}

.section-container {
  max-width: 48rem;  /* 768px - optimal for prose readability */
  margin: 0 auto;
  padding: 0 1rem;
}

section:first-of-type {
  padding-top: 2.5rem;  /* Half-hero: more breathing room at top */
}

/* Half-hero: larger title with more breathing room */
.hero h1 {
  font-size: 2rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 48em) {
  .hero h1 {
    font-size: 2.25rem;
    margin-bottom: 1.75rem;
  }
}

/* Hero section - credible, editorial feel */
.hero {
  background: linear-gradient(180deg, var(--hero-bg) 0%, var(--hero-bg-end) 100%);
  padding: 2.5rem 1rem 2rem;
  margin: -2rem -1rem 2rem;
  border-bottom: 2px solid var(--gaad-brand);
  border-radius: 0 0 8px 8px;
}

/* Header hierarchy: tagline, lede, byline */
.tagline {
  font-size: 1.35rem;
  color: var(--hero-text-emphasis);
  font-weight: 500;
  margin-top: -0.25rem;
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
}

.lede {
  font-size: 1.05rem;
  color: var(--hero-text);
  line-height: 1.6;
  margin-top: 0;
  margin-bottom: 1rem;
  max-width: 52rem;
}

.byline {
  font-size: 0.875rem;
  color: var(--gaad-muted);
  margin-top: 0;
  margin-bottom: 0;
}

/* All details/summary elements: ensure marker renders correctly by avoiding system fonts */
details summary {
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

/* ----- 04-components.css ----- */

/* Keep each heading selector single-source; avoid grouped h1-h4 rules. */
h1 {
  color: var(--gaad-heading);  /* GAAD Foundation teal */
  line-height: 1.3;
  font-size: 2rem;
  font-weight: 700;
  margin: 0.5rem 0 1rem 0;
}

h2 {
  color: var(--gaad-heading);  /* GAAD Foundation teal */
  line-height: 1.3;
  font-size: 1.75rem;
  font-weight: 700;
  margin: 2.5rem 0 1rem 0;
}

/* First h2 in a section shouldn't have excessive top margin */
section > .section-container > h2:first-child,
section > h2:first-child {
  margin-top: 0;
}

h3 {
  color: var(--gaad-heading);  /* GAAD Foundation teal */
  line-height: 1.3;
  font-size: 1.375rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem 0;
}

/* ----------------------------------------
   COMPONENT: Skip Link
   ---------------------------------------- */
.skip-link {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  z-index: 10000;
  background: var(--gaad-brand);
  color: var(--gaad-bg);
  border: 3px solid var(--gaad-brand);
  border-radius: 0 0 6px 6px;
  padding: 1rem 2rem;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  box-shadow: var(--shadow-lg);
  transition: transform 0.15s ease-out;
}

.skip-link:focus {
  transform: translateX(-50%) translateY(0);
  top: 0;
  border-color: var(--gaad-bg);
  box-shadow: var(--shadow-lg-focus);
}

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

/* ----------------------------------------
   COMPONENT: Footer
   Matching GAAD Foundation design
   ---------------------------------------- */
.footer {
  background-color: var(--gray-100);  /* Continue alternating section pattern */
  border-top: 1px solid var(--gray-900);
  margin-top: 0;  /* Flush against last section; dark border provides separation */
  padding: 2rem 0 1rem 0;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  color: var(--gaad-muted);
  font-size: 0.875rem;
}

.footer-container {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  max-width: 1440px;
  margin-left: auto;
  margin-right: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: 2rem;
  margin-top: 0;
}

.footer-col {
  box-sizing: border-box;
  min-width: 0; /* Prevent grid items from overflowing */
}

/* Responsive grid adjustments */
@media (min-width: 48em) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem;
  }
}

@media (min-width: 62em) {
  .footer-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
  }
}

@media (min-width: 75em) {
  .footer-grid {
    gap: 2.5rem;
  }
}

.footer-logo {
  margin-top: 2.5rem;  /* Match h2 margin-top for alignment with headings */
  margin-bottom: 1rem;
}

.footer-logo-img {
  width: 180px;
  height: auto;
  object-fit: contain;
}

.footer-email {
  display: block;
  overflow-wrap: anywhere;
  color: var(--gaad-brand);
  text-decoration: none;
  margin-bottom: 0.75rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
}

.footer-email:hover {
  text-decoration: underline;
}

.footer-description {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8125rem;
  line-height: 1.4;
  margin-top: 0.75rem;
}

.footer-heading {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--gaad-fg);
  font-size: 0.875rem;
}

.footer-link {
  display: block;
  color: var(--gaad-brand);
  text-decoration: none;
  margin-bottom: 0.5rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
}

.footer-link:hover {
  text-decoration: underline;
}

.footer-social-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;  /* WCAG touch target */
  color: var(--gaad-fg);
  text-decoration: none;
  margin-bottom: 0.75rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
}

.footer-social-link:hover {
  text-decoration: underline;
}

/* Social icon circular wrapper - matches gaad.foundation */
.footer-social-icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.625rem;  /* ~26px per GF */
  height: 1.625rem;
  background-color: var(--gaad-brand);
  border-radius: 50%;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}

.footer-social-icon {
  width: 1rem;
  height: 1rem;
  color: var(--white);
  transition: color 0.15s ease;
}

/* Hover: invert colors (white bg, teal icon) */
.footer-social-link:hover .footer-social-icon-wrapper {
  background-color: var(--white);
}

.footer-social-link:hover .footer-social-icon {
  color: var(--gaad-brand);
}

@media (prefers-reduced-motion: reduce) {
  .footer-social-icon-wrapper,
  .footer-social-icon {
    transition: none;
  }
}

.footer-bottom {
  background-color: var(--gray-100);  /* Matches footer background for unified footer section */
  border-top: 1px solid var(--gray-900);
  margin-top: 1.5rem;
  padding-top: 1rem;
}

.footer-bottom-container {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  max-width: 1440px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 1rem;
}

@media (max-width: 47.9375em) {
  .footer-bottom-container {
    flex-direction: column;
    gap: 0.5rem;
  }
}

.footer-copyright {
  font-family: 'DM Sans', sans-serif;
  color: var(--gaad-muted);
  font-size: 0.8125rem;
}

/* ----- 05-pages.css ----- */

/* General hint/guidance text for sections */
.text-hint {
  font-size: 0.9rem;
  color: var(--gaad-muted);
  margin: 0.5rem 0 1rem 0;
  line-height: 1.5;
}

.btn-primary {
  flex: 1;
  display: inline-block;
  padding: 10px 16px;
  min-height: 44px;
  background: var(--gaad-brand);
  color: var(--white);
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  transition: background 0.2s;
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  background: var(--gaad-brand-2);
}

.btn-primary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.btn-secondary {
  display: inline-block;
  padding: 10px 16px;
  min-height: 44px;
  background: transparent;
  color: var(--gaad-brand);
  text-decoration: none;
  border: 1px solid var(--gaad-brand);
  border-radius: 4px;
  font-size: 0.85rem;
  text-align: center;
  transition: all 0.2s;
  white-space: nowrap;
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--gray-50);
}

.btn-secondary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .btn-primary,
  .btn-secondary {
    transition: none;
  }
}

.homepage-toc {
  margin: 1.5rem -1rem 2rem -1rem;
  padding: 1rem;
  background: var(--gray-50);
  border-radius: 4px;
}

.homepage-toc h2 {
  margin-top: 0;
}

.homepage-toc__list {
  margin: 1rem 0 0 1.5rem;
  padding: 0;
  list-style: decimal;
}

.homepage-toc__list li {
  margin: 0.5rem 0;
  line-height: 1.4;
}

.homepage-toc__list a {
  color: var(--gaad-brand);
  text-decoration: underline;
}

.homepage-toc__list a:hover {
  text-decoration: underline;
}

.homepage-toc__list a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
