/* =========================================================================
   Dr. Brent Young — site.css
   Shared stylesheet for all pages.

   Palette: Wilkes University brand colors (Wilkes Blue / Wilkes Gold), per
   the university style guide. Built mobile-first with accessibility as a
   first-class requirement: WCAG AA+ contrast, visible focus states, a skip
   link, respect for prefers-reduced-motion, and a light/dark toggle that
   also honors prefers-color-scheme by default.
   ========================================================================= */

/* ---------- Design tokens ---------- */
/*
 * Two independent color systems on purpose:
 *  - "chrome" tokens (--chrome-*) style the header/nav/footer bar and solid
 *    brand buttons. They stay fixed to Wilkes Navy/Gold in BOTH light and
 *    dark mode, the way most university chrome does — so white text on the
 *    bar is always safe and never has to be recomputed per theme.
 *  - "content" tokens (--color-*) style the page body and DO invert for
 *    dark mode. Keeping these separate avoids the classic bug where a
 *    background meant to flip for dark mode is reused somewhere that
 *    assumed it would always stay dark (or vice versa), silently breaking
 *    contrast for exactly the visitors most likely to need it to work.
 */
:root {
  --chrome-bg: #002855;          /* Wilkes Blue */
  --chrome-bg-strong: #001c3d;
  --chrome-text: #ffffff;
  --chrome-text-muted: #c7d6e8;
  --chrome-accent: #ffcd00;      /* Wilkes Gold */
  --chrome-accent-ink: #3d2f00;

  --color-bg: #ffffff;
  --color-bg-alt: #f3f6fa;
  --color-surface: #ffffff;
  --color-text: #16202b;
  --color-text-muted: #45525f;
  --color-border: #d7dee6;

  --color-primary: #00458a;      /* used for in-content emphasis/tags, not chrome */
  --color-primary-100: #e6ecf3;
  --color-accent: #ffcd00;
  --color-accent-ink: #3d2f00;
  --color-link: #00458a;
  --color-link-visited: #4a3b8f;
  --color-focus: #946200;        /* dark goldenrod, ~4:1+ against both light and dark content backgrounds */

  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;

  --max-width: 68rem;
  --measure: 70ch;
  --radius: 12px;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;

  color-scheme: light;
}

/* Dark mode driven by OS preference, unless overridden by data-theme */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #0d1520;
    --color-bg-alt: #121d2b;
    --color-surface: #16212f;
    --color-text: #eaf0f6;
    --color-text-muted: #b6c2cf;
    --color-border: #2a3a4c;

    --color-primary: #8ec2ff;
    --color-primary-100: #16283f;
    --color-accent: #ffd633;
    --color-accent-ink: #1a1300;
    --color-link: #8ec2ff;
    --color-link-visited: #c6b6ff;
    --color-focus: #ffd633;

    color-scheme: dark;
  }
}

/* Manual toggle (js/site.js) overrides the OS preference either way */
:root[data-theme="dark"] {
  --color-bg: #0d1520;
  --color-bg-alt: #121d2b;
  --color-surface: #16212f;
  --color-text: #eaf0f6;
  --color-text-muted: #b6c2cf;
  --color-border: #2a3a4c;

  --color-primary: #8ec2ff;
  --color-primary-100: #16283f;
  --color-accent: #ffd633;
  --color-accent-ink: #1a1300;
  --color-link: #8ec2ff;
  --color-link-visited: #c6b6ff;
  --color-focus: #ffd633;

  color-scheme: dark;
}

/* ---------- Reset-ish base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  color: var(--color-text);
  line-height: 1.25;
  margin-top: 0;
}
h1 { font-size: clamp(1.9rem, 1.5rem + 1.6vw, 2.75rem); }
h2 { font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.85rem); margin-bottom: 0.75em; }
h3 { font-size: 1.25rem; }

p, ul, ol, dl, table { max-width: var(--measure); }
main :is(p, ul, ol) { color: var(--color-text); }

a {
  color: var(--color-link);
  text-underline-offset: 0.15em;
}
a:visited { color: var(--color-link-visited); }
a:hover { text-decoration-thickness: 2px; }

/* Strong, visible focus ring everywhere, not just links */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3.5rem;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 8px 8px;
  font-weight: 700;
  z-index: 100;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 0;
}

/* ---------- Layout shell ---------- */
/* Header/nav/footer intentionally use the fixed --chrome-* tokens, not the
   theme-adaptive --color-* ones, so this bar stays Wilkes Navy with white
   text in both light and dark mode instead of inheriting a dark-mode swap
   that was tuned for body text on a body background. */
.site-header {
  background: var(--chrome-bg);
  color: var(--chrome-text);
  border-bottom: 4px solid var(--chrome-accent);
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-3) var(--space-2) var(--space-2);
}
.site-title {
  color: var(--chrome-text);
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.25rem);
  margin: 0 0 0.15em;
}
.site-subtitle {
  margin: 0;
  color: var(--chrome-text-muted);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
}
.site-subtitle + .site-subtitle { color: var(--chrome-text-muted); }

/* ---------- Nav ---------- */
.site-nav {
  background: var(--chrome-bg-strong);
}
.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-toggle {
  display: none;
}
.nav-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0;
  padding: 0;
}
.nav-list a {
  display: block;
  padding: 0.9rem 1rem;
  color: var(--chrome-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 3px solid transparent;
}
.nav-list a:visited { color: var(--chrome-text); }
.nav-list a:hover,
.nav-list a:focus-visible {
  border-bottom-color: var(--chrome-accent);
  background: rgba(255, 255, 255, 0.06);
}
.nav-list [aria-current="page"] {
  border-bottom-color: var(--chrome-accent);
  color: var(--chrome-text);
}
.theme-toggle {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: var(--chrome-text);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.theme-toggle:hover { background: rgba(255,255,255,0.1); }

@media (max-width: 46rem) {
  .nav-inner { flex-wrap: wrap; }
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.6rem 0;
    background: transparent;
    color: var(--chrome-text);
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 8px;
    padding: 0.5rem 0.8rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
  }
  .nav-list {
    flex-direction: column;
    width: 100%;
    display: none;
  }
  .nav-list.is-open { display: flex; }
  .nav-list a { padding: 0.8rem 0.25rem; border-bottom: 1px solid rgba(255,255,255,0.12); }
}

/* ---------- Main content ---------- */
.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-4) var(--space-2) var(--space-5);
}
.breadcrumb-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-muted);
  margin: 0 0 0.5rem;
}

.layout-with-aside {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
}
@media (min-width: 55rem) {
  .layout-with-aside {
    grid-template-columns: minmax(260px, 320px) 1fr;
    align-items: start;
  }
}

.profile-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-3);
}
.profile-photo {
  width: 100%;
  max-width: 220px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  margin: 0 auto var(--space-2);
}
.profile-card h2 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}
.profile-card address {
  font-style: normal;
  color: var(--color-text-muted);
  line-height: 1.7;
}
.profile-card address a { font-weight: 600; }

/* ---------- Cards / sections ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}
.card + .card { margin-top: var(--space-3); }

.callout {
  border: 1px solid var(--color-border);
  border-left: 6px solid var(--color-accent);
  background: var(--color-bg-alt);
  border-radius: 8px;
  padding: var(--space-3);
  margin: var(--space-3) 0;
}
.callout h2, .callout h3 { margin-bottom: 0.4em; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--chrome-bg);
  color: var(--chrome-text) !important;
  text-decoration: none;
  font-weight: 700;
  padding: 0.75rem 1.4rem;
  border-radius: 999px;
  border: 2px solid var(--chrome-bg);
  min-height: 44px;
}
.button:hover { background: var(--chrome-bg-strong); border-color: var(--chrome-bg-strong); }
.button:visited { color: var(--chrome-text) !important; }
.button--gold {
  background: var(--color-accent);
  color: var(--color-accent-ink) !important;
  border-color: var(--color-accent);
}
.button--gold:hover { filter: brightness(0.95); }
.button--gold:visited { color: var(--color-accent-ink) !important; }

/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-2) 0 var(--space-3);
}
caption {
  text-align: left;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--color-text-muted);
}
th, td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}
thead th {
  background: var(--color-primary-100);
  border-bottom: 2px solid var(--color-primary);
}

.courses-table th:nth-child(1),
.courses-table td:nth-child(1) {
  white-space: nowrap;
}
.courses-table th:nth-child(3),
.courses-table td:nth-child(3) {
  width: 28%;
}

/* ---------- Lists of resources/links ---------- */
.resource-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.resource-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-border);
}
.resource-list li:last-child { border-bottom: none; }
.resource-list .meta {
  display: block;
  color: var(--color-text-muted);
  font-size: 0.92rem;
  margin-top: 0.15rem;
}

.tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--color-primary-100);
  color: var(--color-primary);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  margin-left: 0.5rem;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--chrome-bg);
  color: var(--chrome-text-muted);
  margin-top: var(--space-5);
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-3) var(--space-2);
}
.footer-inner nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  padding: 0;
  margin: 0 0 0.75rem;
}
.footer-inner a { color: var(--chrome-text); }
.footer-inner p { margin: 0; font-size: 0.9rem; color: var(--chrome-text-muted); }

/* Visually-hidden utility for extra screen-reader context */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Print styles */
@media print {
  .site-nav, .skip-link, .theme-toggle, .nav-toggle { display: none; }
  .site-header { background: none; color: #000; border-bottom: 2px solid #000; }
  a { color: #000; text-decoration: underline; }
}
