/* site/static/css/main.css — DCA 2.0 Design System */
/* WCAG AA compliant, mobile-first responsive */

:root {
  /* Color system - all pass WCAG AA 4.5:1 on white */
  --color-primary: #1a56db;       /* Blue - 5.2:1 contrast */
  --color-primary-dark: #1e3a8a;  /* Dark blue - 8.6:1 */
  --color-primary-light: #eff6ff; /* Light blue bg */
  --color-text: #1f2937;          /* Near-black - 14.7:1 */
  --color-text-muted: #4b5563;    /* Gray - 7.0:1 */
  --color-bg: #ffffff;
  --color-bg-alt: #f9fafb;
  --color-border: #d1d5db;
  --color-border-light: #e5e7eb;
  --color-success: #047857;       /* Green - 5.9:1 */
  --color-star: #d97706;          /* Amber - 3.8:1 on white (large text only) */
  --color-gold: #b45309;          /* Darker amber for small text - 5.1:1 */

  /* Typography */
  --font-sans: system-ui, -apple-system, sans-serif;
  --font-size-base: 1rem;
  --line-height: 1.5;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Layout */
  --max-width: 72rem;
  --content-width: 48rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

/* ========================================
   RESET
   ======================================== */

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

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main { flex: 1; }

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

/* ========================================
   TYPOGRAPHY — Mobile-first scale
   ======================================== */

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-lg);
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: var(--space-md);
}

h3 {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: var(--space-sm);
}

@media (min-width: 640px) {
  h1 { font-size: 2.25rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.25rem; }
}

/* Text spacing meets WCAG 1.4.12 */
p {
  margin-bottom: var(--space-md);
  line-height: var(--line-height);
}

/* ========================================
   FOCUS INDICATORS — WCAG 2.2 compliant
   ======================================== */

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

/* ========================================
   SKIP LINK — Accessibility
   ======================================== */

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-primary-dark);
  color: #fff;
  z-index: 100;
  border-radius: 0 0 4px 4px;
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus {
  top: 0;
}

/* ========================================
   LAYOUT
   ======================================== */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.section {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-2xl);
}

/* Mobile-first grid */
.grid {
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 640px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--4 { grid-template-columns: repeat(4, 1fr); }
}

/* ========================================
   LINKS
   ======================================== */

a {
  color: var(--color-primary);
}
a:hover {
  color: var(--color-primary-dark);
}

/* ========================================
   SITE HEADER — Mobile-first navigation
   ======================================== */

.site-header {
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.site-title {
  font-size: 1.125rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--color-text);
  white-space: nowrap;
}

.site-header nav ul {
  display: flex;
  list-style: none;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.site-header nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: var(--space-sm) var(--space-sm);
  text-decoration: none;
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background-color 0.15s;
}
.site-header nav a:hover {
  color: var(--color-primary);
  background: var(--color-bg-alt);
}
.site-header nav a[aria-current="true"] {
  color: var(--color-primary);
  font-weight: 600;
  background: var(--color-primary-light);
}

/* Mobile hamburger menu */
.menu-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  min-height: 44px;
  min-width: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}
.menu-toggle:hover { background: var(--color-bg-alt); }
.menu-toggle__bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}
.menu-toggle.is-active .menu-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.menu-toggle.is-active .menu-toggle__bar:nth-child(2) {
  opacity: 0;
}
.menu-toggle.is-active .menu-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile: hide nav by default, show hamburger */
@media (max-width: 639px) {
  .site-header nav {
    display: none;
    width: 100%;
    order: 3;
  }
  .site-header nav.is-open {
    display: block;
  }
  .site-header nav ul {
    flex-direction: column;
    gap: 0;
    padding-top: var(--space-sm);
  }
  .site-header nav a {
    width: 100%;
    justify-content: flex-start;
    padding: var(--space-sm) var(--space-md);
    border-radius: 0;
  }
  .site-header nav a:hover {
    background: var(--color-primary-light);
  }
}

/* Desktop: show nav, hide hamburger */
@media (min-width: 640px) {
  .menu-toggle { display: none; }
  .site-title { font-size: 1.25rem; }
  .site-header nav ul { gap: var(--space-xs); }
  .site-header nav a {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.9375rem;
  }
}

/* Truncation indicator */
.listing-page__showing {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-bottom: var(--space-md);
}

/* ========================================
   SITE FOOTER
   ======================================== */

.site-footer {
  padding: var(--space-xl) 0;
  margin-top: auto;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.875rem;
  background: var(--color-bg-alt);
}
.site-footer .container {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.site-footer nav ul {
  display: flex;
  list-style: none;
  gap: var(--space-lg);
  flex-wrap: wrap;
}
.site-footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--color-text-muted);
  text-decoration: none;
}
.site-footer nav a:hover { color: var(--color-primary); }

@media (min-width: 640px) {
  .site-footer .container {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

/* ========================================
   CARD COMPONENT
   ======================================== */

.card {
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  background: var(--color-bg);
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-border);
  transform: translateY(-1px);
}

/* Card as link — full clickable area */
.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}
.card-link:hover {
  color: inherit;
}

.card__title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--color-text);
}
.card__meta {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-bottom: 0;
}

/* ========================================
   BUTTONS — Touch-target compliant (44px min)
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-secondary {
  background: var(--color-bg);
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-secondary:hover {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

/* ========================================
   HERO SECTION
   ======================================== */

.hero {
  padding: var(--space-2xl) 0;
  text-align: center;
  background: linear-gradient(180deg, var(--color-primary-light) 0%, var(--color-bg) 100%);
}
.hero h1 {
  margin-bottom: var(--space-md);
  color: var(--color-text);
}
.hero p {
  max-width: var(--content-width);
  margin: 0 auto var(--space-xl);
  color: var(--color-text-muted);
  font-size: 1.125rem;
}
.hero-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

@media (min-width: 640px) {
  .hero {
    padding: var(--space-3xl) 0 var(--space-2xl);
  }
  .hero p {
    font-size: 1.25rem;
  }
}

/* ========================================
   HOW IT WORKS
   ======================================== */

.how-it-works__step {
  text-align: center;
  padding: var(--space-lg);
}
.how-it-works__number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--color-primary);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  border-radius: 50%;
  margin-bottom: var(--space-md);
}
.how-it-works__step h3 {
  margin-bottom: var(--space-sm);
  font-size: 1.125rem;
}
.how-it-works__step p {
  color: var(--color-text-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* ========================================
   CLAIM CTA SECTION
   ======================================== */

.claim-section {
  padding-bottom: var(--space-3xl);
}
.claim-section__inner {
  text-align: center;
  padding: var(--space-2xl) var(--space-xl);
  background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
  border: 1px solid #dbeafe;
  border-radius: var(--radius-lg);
}
.claim-section__inner h2 {
  margin-bottom: var(--space-sm);
}
.claim-section__inner p {
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}

/* ========================================
   DOCTOR CARD COMPONENT — BEM style
   ======================================== */

.doctor-list {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .doctor-list { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .doctor-list { grid-template-columns: repeat(3, 1fr); }
}

.doctor-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  position: relative;
}

/* Clickable card link — entire card is tappable */
.doctor-card__link {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  text-decoration: none;
  color: inherit;
  padding: var(--space-lg);
  margin: calc(-1 * var(--space-lg));
  border-radius: var(--radius-md);
  transition: background-color 0.2s, box-shadow 0.2s;
  position: relative;
}
.doctor-card__link:hover {
  color: inherit;
  background: var(--color-bg-alt);
  box-shadow: var(--shadow-sm);
}
.doctor-card__link:hover .doctor-card__name {
  color: var(--color-primary);
}
.doctor-card__link:hover .doctor-card__arrow {
  opacity: 1;
  transform: translateX(0) translateY(-50%);
}

.doctor-card__arrow {
  position: absolute;
  right: var(--space-lg);
  top: 50%;
  transform: translateX(-4px) translateY(-50%);
  opacity: 0;
  color: var(--color-primary);
  font-size: 1.25rem;
  font-weight: 700;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.doctor-card__info {
  flex: 1;
  padding-right: var(--space-xl);
}

.doctor-card__name {
  font-size: 1.0625rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  line-height: 1.3;
  transition: color 0.15s;
}
.doctor-card__name a {
  color: inherit;
  text-decoration: none;
}
.doctor-card__name a:hover {
  color: var(--color-primary);
}

.doctor-card__credentials {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.doctor-card__location {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-bottom: 0;
}

.doctor-card__stats {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.doctor-card__rating {
  font-weight: 600;
  color: var(--color-gold);
  font-size: 0.9375rem;
}

.doctor-card__reviews {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.doctor-card__badge {
  display: inline-block;
  padding: 2px var(--space-sm);
  background: var(--color-success);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.doctor-card__rank {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-primary);
  margin-bottom: var(--space-xs);
}

/* ========================================
   SEARCH PAGE
   ======================================== */

.search-page {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-2xl);
}
.search-page h1 {
  margin-bottom: var(--space-sm);
}
.search-page > p {
  color: var(--color-text-muted);
  margin-bottom: var(--space-xl);
}

/* Pagefind UI overrides — match site design system */
.pagefind-ui__search-input {
  font-family: var(--font-sans) !important;
  font-size: 1rem !important;
  border-color: var(--color-border) !important;
  border-radius: var(--radius-sm) !important;
  min-height: 44px !important;
  color: var(--color-text) !important;
}
.pagefind-ui__search-input:focus {
  outline: 3px solid var(--color-primary) !important;
  outline-offset: 2px !important;
  border-color: var(--color-primary) !important;
}
.pagefind-ui__result-link {
  color: var(--color-primary) !important;
  font-weight: 600 !important;
}
.pagefind-ui__result-link:hover {
  color: var(--color-primary-dark) !important;
}
.pagefind-ui__button {
  min-height: 44px !important;
  background: var(--color-primary) !important;
  border-radius: var(--radius-sm) !important;
}

/* ========================================
   INDEX GRIDS (specialties, locations)
   ======================================== */

.index-page {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-2xl);
}
.index-page h1 {
  margin-bottom: var(--space-sm);
}
.index-page > p,
.index-page > .container > p:first-of-type {
  color: var(--color-text-muted);
  margin-bottom: var(--space-xl);
}

/* ========================================
   LISTING PAGE (specialty/location detail)
   ======================================== */

.listing-page {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-2xl);
}
.listing-page h1 {
  margin-bottom: var(--space-sm);
}
.listing-page__count {
  color: var(--color-text-muted);
  margin-bottom: var(--space-xl);
}
.listing-page__cta {
  margin-top: var(--space-xl);
  text-align: center;
}
.listing-page__disclaimer {
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  font-style: italic;
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border-light);
}

/* ========================================
   UTILITIES
   ======================================== */

.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.mb-0 { margin-bottom: 0; }
.mt-xl { margin-top: var(--space-xl); }
.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;
}

/* ========================================
   RESPONSIVE — Ensure no horizontal scroll
   ======================================== */

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
}
body {
  overflow-x: hidden;
}

/* ========================================
   BREADCRUMBS
   ======================================== */

.breadcrumb {
  padding-top: var(--space-md);
  padding-bottom: var(--space-sm);
}

.breadcrumb__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.breadcrumb__item::after {
  content: "/";
  margin-left: var(--space-xs);
  color: var(--color-border);
}

.breadcrumb__item:last-child::after {
  content: "";
}

.breadcrumb__item a {
  color: var(--color-primary);
  text-decoration: none;
}

.breadcrumb__item a:hover {
  text-decoration: underline;
}

.breadcrumb__current {
  color: var(--color-text);
  font-weight: 500;
}

/* ========================================
   AWARD CROSS-LINKS
   ======================================== */

.award-crosslinks {
  margin-top: var(--space-2xl);
  border-top: 1px solid var(--color-border-light);
  padding-top: var(--space-xl);
}

.crosslink-group {
  margin-bottom: var(--space-xl);
}

.crosslink-group h3 {
  font-size: 1.125rem;
  margin-bottom: var(--space-md);
  color: var(--color-text);
}

.crosslink-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.crosslink-pill {
  display: inline-block;
  padding: var(--space-xs) var(--space-md);
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: 9999px;
  font-size: 0.875rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}

.crosslink-pill:hover {
  background: var(--color-bg);
  border-color: var(--color-primary);
}

/* ========================================
   AWARD SECTIONS (list page)
   ======================================== */

.award-section {
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--color-border-light);
}

.award-section:last-child {
  border-bottom: none;
}

.award-section__desc {
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
}

.award-category {
  margin-bottom: var(--space-xl);
}

.doctor-card__specialty {
  color: var(--color-primary);
  font-weight: 500;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
  .site-header,
  .site-footer,
  .hero-actions,
  .listing-page__cta,
  .skip-link { display: none; }
  body { color: #000; background: #fff; }
  a { color: #000; text-decoration: underline; }
}
