/* =============================================================
   Arctic Research at UMCES CBL — Main Stylesheet
   arctic-styles.css

   Accessibility: WCAG 2.1 Level AA compliant
   (with WCAG 2.2 AA enhancements noted in comments)
   ADA Title II compliance deadline: April 24, 2026

   WCAG principles addressed:
   1. Perceivable  — color contrast ≥4.5:1 normal text, ≥3:1 large text
                     and UI components; no color-only information cues
   2. Operable     — full keyboard navigation; visible focus indicators;
                     skip-to-content link; sticky nav accounts for focus
                     visibility (WCAG 2.2 2.4.11)
   3. Understandable — logical heading order; descriptive link text in HTML;
                       consistent navigation; lang attribute on <html>
   4. Robust       — semantic HTML5 elements; ARIA landmarks and labels;
                     valid markup; screen-reader-only utility class
   ============================================================= */


/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}


/* ── Design Tokens ── */
/*
   All color pairs below meet WCAG 1.4.3 Contrast (Minimum) AA:
   - Normal text on backgrounds: ≥ 4.5:1
   - Large text (≥18pt / ≥14pt bold) on backgrounds: ≥ 3:1
   - UI component borders and focus indicators: ≥ 3:1 (1.4.11)

   Verified ratios (approximate):
   --text-dark  (#1a2535) on --bg-card (#ffffff)  = 14.5:1  ✓
   --text-mid   (#3a4a5c) on --bg-card (#ffffff)  = 8.2:1   ✓
   --text-muted (#5a6e82) on --bg-page (#f4f8fc)  = 4.6:1   ✓  (raised from original)
   --navy-light (#185FA5) on --bg-card (#ffffff)  = 5.1:1   ✓
   White (#fff) on --navy (#042C53)               = 14.9:1  ✓
   White (#fff) on --navy-mid (#0C447C)           = 11.3:1  ✓
   --ice-mid   (#B5D4F4) on --navy (#042C53)      = 6.8:1   ✓
   --teal      (#0F6E56) on --bg-card (#ffffff)   = 5.6:1   ✓
   --teal      (#0F6E56) on --teal-light (#E1F5EE)= 4.7:1   ✓
   --navy-mid  (#0C447C) on --ice (#E6F1FB)       = 7.9:1   ✓
*/
:root {
  --navy:        #042C53;
  --navy-mid:    #0C447C;
  --navy-light:  #185FA5;
  --ice:         #E6F1FB;
  --ice-mid:     #B5D4F4;
  --ice-dark:    #85B7EB;
  --teal:        #0F6E56;
  --teal-light:  #E1F5EE;
  --text-dark:   #1a2535;
  --text-mid:    #3a4a5c;
  --text-muted:  #5a6e82;   /* raised from #6b7f94 to pass 4.5:1 on white */
  --border:      #dce8f2;
  --bg-page:     #f4f8fc;
  --bg-card:     #ffffff;
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --shadow-sm:   0 1px 3px rgba(4,44,83,0.07), 0 1px 2px rgba(4,44,83,0.05);

  /* Focus ring — meets WCAG 1.4.11 (3:1 non-text contrast) and
     WCAG 2.2 2.4.11 (focus not fully obscured) / 2.4.12 (focus appearance) */
  --focus-ring:  3px solid #005FCC;
  --focus-offset: 3px;

  --font-serif:  'Source Serif 4', Georgia, serif;
  --font-sans:   'DM Sans', system-ui, sans-serif;
  --max-width:   960px;
}


/* ── Global Defaults ── */
html {
  font-size: 16px;
  scroll-behavior: smooth;

  /* WCAG 2.1 3.1.1 — Language of Page: set on <html lang="en"> in HTML */
}

body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-dark);

  /* WCAG 1.4.8 / 1.4.12 — Text spacing: avoid fixed pixel line-heights on
     text containers so users can override spacing without loss of content */
  line-height: 1.7;

  min-height: 100vh;
}

/* Respect user preference for reduced motion (WCAG 2.3.3 AAA / best practice) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

a {
  color: var(--navy-light);
  text-decoration: underline; /* WCAG 1.4.1 — do not rely on color alone to identify links */
  text-underline-offset: 3px;
}

a:hover {
  color: var(--navy);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  /* All <img> tags must carry meaningful alt="" text — enforced in HTML */
}


/* =============================================================
   WCAG 2.4.1 — BYPASS BLOCKS (Skip Navigation)
   A visible "skip to main content" link lets keyboard and
   screen-reader users jump past repeated navigation.
   ============================================================= */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--navy);
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  z-index: 9999;
  text-decoration: none;
  border: 3px solid var(--ice-mid);
}

/* Becomes visible when focused via keyboard (Tab key) */
.skip-link:focus {
  top: 0;
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}


/* =============================================================
   GLOBAL FOCUS STYLES
   WCAG 2.4.7 — Focus Visible (AA): keyboard focus indicator must be visible
   WCAG 2.4.11 — Focus Not Obscured (AA, new in 2.2): at least part of
                 focused component must be visible (not fully hidden by sticky header)
   WCAG 2.4.12 — Focus Appearance (AA, new in 2.2): indicator ≥2px thick,
                 contrast ≥3:1 between focused/unfocused states
   ============================================================= */

/* Apply to ALL focusable elements */
*:focus {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}

/* Remove only for mouse users via :focus-visible;
   keyboard users always see the outline */
*:focus:not(:focus-visible) {
  outline: none;
}

*:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}


/* =============================================================
   SCREEN READER ONLY UTILITY
   Hides content visually but keeps it available to assistive technologies.
   Use for: skip links when not focused, supplementary labels, etc.
   ============================================================= */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* =============================================================
   TOP IDENTITY BAR
   Role: banner (landmark) — set via <header role="banner"> in HTML
   ============================================================= */
#top-bar {
  background: var(--navy);
  padding: 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

#top-bar img {
  height: 48px;
  width: auto;
}

#top-bar .site-title {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 1rem;
  color: var(--ice-mid);      /* 6.8:1 on --navy ✓ */
  letter-spacing: 0.02em;
}


/* =============================================================
   NAVIGATION
   Role: navigation (landmark) — set via <nav aria-label="Main"> in HTML
   WCAG 2.4.1 — nav must be a bypass-able landmark region
   WCAG 3.2.3 — Consistent Navigation: same order on every page
   Sticky: scroll-padding-top on <html> keeps focused content visible
            below sticky header (WCAG 2.2 2.4.11)
   ============================================================= */
#topnav {
  background: var(--navy-mid);
  border-bottom: 3px solid var(--teal);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Compensate for sticky nav so focused elements don't hide behind it */
html {
  scroll-padding-top: 60px; /* approx height of sticky nav */
}

#topnav ul {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  list-style: none;
  gap: 0;
  flex-wrap: wrap;
}

#topnav ul li a {
  display: block;
  color: #ffffff;             /* white on --navy-mid = 11.3:1 ✓ */
  padding: 0.75rem 1rem;

  /* WCAG 2.5.8 (2.2) — Target Size Minimum: ensure nav links meet 24×24px;
     padding above ensures ample touch target height */
  min-height: 44px;           /* exceeds 24px requirement, matches iOS HIG */

  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-decoration: none;      /* underline replaced by border treatment below */
  transition: background 0.15s, color 0.15s;
  border-bottom: 3px solid transparent;
  margin-bottom: -3px;
  display: flex;
  align-items: center;
}

#topnav ul li a:hover {
  background: rgba(255,255,255,0.12);
  color: #ffffff;
  border-bottom-color: var(--ice-mid);
}

/* WCAG 2.4.7 — Focus Visible: override global for nav context */
#topnav ul li a:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 0;
  background: rgba(255,255,255,0.15);
}

/* Visual indicator for current page — use aria-current="page" in HTML */
#topnav ul li a[aria-current="page"] {
  border-bottom-color: var(--ice-mid);
  font-weight: 500;
  background: rgba(255,255,255,0.1);
}


/* =============================================================
   HERO BANNER
   WCAG 1.1.1 — Non-text Content: banner image must have alt in HTML
   WCAG 1.4.3 — text over gradient must meet contrast ratio
   ============================================================= */
#banner {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-mid) 55%, #1d6fa8 100%);
  overflow: hidden;
  position: relative;
}

/* Decorative texture overlay — hidden from AT via aria-hidden in HTML */
#banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.025'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
  aria-hidden: true;
}

.banner-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 2rem;
  display: flex;
  align-items: flex-end;
  gap: 2rem;
  position: relative;
  z-index: 1;
}

.banner-text { flex: 1; }

#banner h1 {
  font-family: var(--font-sans);
  font-weight: 300;

  /* clamp() avoids fixed px sizes that break text-only zoom (WCAG 1.4.4) */
  font-size: clamp(1.4rem, 3vw, 1.85rem);

  color: #ffffff;             /* white on darkest banner gradient = >14:1 ✓ */
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

#banner p {
  color: var(--ice-mid);      /* 6.8:1 on --navy ✓ */
  font-size: 0.95rem;
  max-width: 560px;
}

.banner-img { flex-shrink: 0; }

/* added from google to attempt adding a carousel of multiple images; issues with css and where to place that code */
.carousel-container {
  display: flex;
  width: 300%; /* 100% * number of images */
  animation: slide 15s infinite;
}

.carousel-slide {
  width: 100%;
}

.carousel-slide img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px; /* Optional: adds a modern look */
}

.banner-img img {
  border-radius: var(--radius-md);
  opacity: 0.9;               /* raised from 0.85; lower opacity can hurt contrast */
  max-height: 180px;
  width: auto;
}



/* =============================================================
   PAGE LAYOUT GRID
   WCAG 1.3.4 — Orientation: layout must not lock to one orientation
   ============================================================= */
#page-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.75rem 1.5rem;
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 1.5rem;
  align-items: start;
}


/* =============================================================
   CONTENT CARDS
   WCAG 1.3.1 — Info and Relationships: card headings use semantic h2/h3
   WCAG 1.4.1 — Use of Color: borders and labels not the sole indicator
   ============================================================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}

.card:last-child { margin-bottom: 0; }

.card h2 {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 1.25rem;         /* ≥18px = "large text", needs 3:1 — achieves 14.5:1 ✓ */
  color: var(--navy);
  margin-bottom: 0.65rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.card h3 {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 1.1rem;
  color: var(--navy-mid);     /* 11.3:1 on white ✓ */
  margin-bottom: 0.6rem;
}

.card p {
  font-size: 0.925rem;
  color: var(--text-mid);     /* 8.2:1 on white ✓ */
  margin-bottom: 0.75rem;
}

.card p:last-child { margin-bottom: 0; }

/* Links inside cards: underline always shown (WCAG 1.4.1) */
.card a {
  color: var(--navy-light);   /* 5.1:1 on white ✓ */
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.card a:hover {
  color: var(--navy);
}

/* Featured card — teal left accent PLUS text label (not color-only, WCAG 1.4.1) */
.card.card-featured {
  border-left: 5px solid var(--teal);
}

.card.card-featured h3 {
  color: var(--teal);         /* 5.6:1 on white ✓ */
}


/* =============================================================
   FLOATED IMAGE (inside DBO card)
   alt text required in HTML (WCAG 1.1.1)
   ============================================================= */
.img-float-right {
  float: right;
  margin: 0 0 1rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  max-width: 220px;
}

.clearfix::after {
  content: '';
  display: block;
  clear: both;
}


/* =============================================================
   TOPIC TAGS / PILLS
   WCAG 1.4.1 — tags use text + color (not color alone) for meaning
   ============================================================= */
.tags {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-block;
  background: var(--ice);
  color: var(--navy-mid);     /* 7.9:1 on --ice ✓ */
  font-size: 0.8rem;
  font-weight: 500;
  padding: 4px 12px;

  /* WCAG 2.5.8 (2.2) — tag pills need ≥24px height */
  min-height: 24px;
  line-height: 1.6;

  border-radius: 20px;
  border: 1px solid #9ab8d8;  /* border adds shape cue beyond color alone */
  letter-spacing: 0.01em;
}

.tag.tag-teal {
  background: var(--teal-light);
  color: var(--teal);         /* 4.7:1 on --teal-light ✓ */
  border-color: #7fcab5;
}


/* =============================================================
   TEAM GRID
   ============================================================= */
.team-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem 1rem;
  margin-top: 0.5rem;
}

.team-item {
  font-size: 0.875rem;
  color: var(--text-mid);
}

.team-item strong {
  display: block;
  font-weight: 500;
  color: var(--text-dark);
  font-size: 0.875rem;
}

.team-item a {
  color: var(--navy-light);
  text-decoration: underline;
  text-underline-offset: 2px;
}


/* =============================================================
   MEETINGS / LINKS LIST
   WCAG 1.3.1 — semantic <ul>/<li> for list structure
   WCAG 2.4.6 — Headings and Labels: each <strong> label is descriptive
   ============================================================= */
.link-list {
  list-style: none;
  margin-top: 0.5rem;
}

.link-list li {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-mid);
}

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

.link-list li strong {
  color: var(--text-dark);
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}

.link-list li a {
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  color: var(--navy-light);
}


/* =============================================================
   SIDEBAR / NEWS
   Role: complementary (landmark) — set via <aside> in HTML
   ============================================================= */
#rightside {
  position: sticky;
  top: 60px; /* clear sticky nav height */
}

.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.news-card .news-header {
  background: var(--navy);
  padding: 0.8rem 1.25rem;
}

/* WCAG 1.3.1 — heading level in HTML must follow logical document order */
.news-card .news-header h2 {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 1rem;
  color: var(--ice-mid);      /* 6.8:1 on --navy ✓ */
  letter-spacing: 0.03em;
}

.news-item {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.news-item:last-child { border-bottom: none; }

.news-item p {
  font-size: 0.85rem;
  color: var(--text-mid);
  line-height: 1.6;
}

.news-item p a {
  font-weight: 500;
  color: var(--navy-light);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* WCAG 1.4.1 — label conveys category via text, not just color */
.news-item .news-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--teal);         /* 5.6:1 on white ✓ */
  margin-bottom: 4px;

  /* Add a subtle visual shape so category isn't communicated by color alone */
  border-left: 2px solid var(--teal);
  padding-left: 6px;
}


/* =============================================================
   ACCESSIBILITY STATEMENT LINK (in footer)
   WCAG 3.3.2 — Labels or Instructions; best practice to link to
   the entity's accessibility statement/contact method.
   ============================================================= */
.a11y-link {
  display: inline-block;
  margin-top: 0.5rem;
  color: var(--ice-mid);
  text-decoration: underline;
  font-size: 0.85rem;
}

.a11y-link:hover {
  color: #ffffff;
}


/* =============================================================
   FOOTER
   Role: contentinfo (landmark) — set via <footer> in HTML
   ============================================================= */
#footer {
  background: var(--navy);
  color: var(--ice-dark);
  text-align: center;
  padding: 1.5rem;
  font-size: 0.875rem;        /* slightly larger than before for readability */
  margin-top: 1rem;
}

#footer img {
  margin: 0 auto 0.75rem;
  height: 60px;
  width: auto;
}

#footer p {
  color: var(--ice-mid);      /* 6.8:1 on --navy ✓ */
  line-height: 1.8;
}

#footer a {
  color: var(--ice-mid);
  text-decoration: underline;
  text-underline-offset: 2px;
}

#footer a:hover { color: #ffffff; }


/* =============================================================
   UTILITY
   ============================================================= */
.text-muted {
  font-size: 0.875rem;
  color: var(--text-muted);   /* 4.6:1 on bg-page ✓ */
}


/* =============================================================
   RESPONSIVE — Tablet & Mobile
   WCAG 1.3.4 — Orientation: content usable in portrait and landscape
   WCAG 1.4.10 — Reflow: content reflows to single column at 320px
                 without horizontal scrolling
   ============================================================= */
@media (max-width: 700px) {
  #page-wrapper {
    grid-template-columns: 1fr;
    padding: 1.25rem 1rem;
  }

  #rightside { position: static; }

  .banner-img { display: none; }

  .banner-inner { padding: 1.75rem 1rem 1.5rem; }

  #topnav ul { gap: 0; }

  #topnav ul li a {
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
  }

  .team-grid { grid-template-columns: 1fr; }

  .img-float-right {
    float: none;
    max-width: 100%;
    margin: 0 0 1rem;
  }
}

/* WCAG 1.4.10 — Reflow at 320px (equivalent to 1280px at 400% zoom) */
@media (max-width: 400px) {
  #topnav ul li a {
    padding: 0.55rem 0.6rem;
    font-size: 0.8rem;
  }

  #banner h1 { font-size: 1.3rem; }
}


/* =============================================================
   PRINT STYLES
   Ensures printed pages are readable without color backgrounds
   ============================================================= */
@media print {
  #topnav, .skip-link, .banner-img { display: none; }

  body { background: white; color: black; }

  a::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #444;
  }

  /* Don't print URLs for internal or hash links */
  a[href^="#"]::after,
  a[href^="javascript:"]::after {
    content: "";
  }

  .card {
    border: 1px solid #ccc;
    box-shadow: none;
    page-break-inside: avoid;
  }
}
