@import url('https://fonts.googleapis.com/css2?family=Newsreader:wght@400;600;700&family=Source+Sans+3:wght@400;600&display=swap');

/* =========================================================
   Silver Surfers — styles.css
   Plain CSS. No build step. All design tokens live in :root
   so they're easy to tweak in one place.
   ========================================================= */

:root {
  /* Colors — warm, calm, accessible */
  --color-cream:        #FAF6EE;
  --color-cream-soft:   #F2EBD9;
  --color-surface:      #FFFFFF;
  --color-ink:          #1F2A37; /* primary text on cream — ~13:1 contrast */
  --color-ink-soft:     #43505F; /* secondary text on cream  — ~7.5:1     */
  --color-green-soft:   #C5DCBE;
  --color-green-deep:   #345E40; /* meets 4.5:1 on cream */
  --color-blue-soft:    #C9DEE6;
  --color-blue-deep:    #2A5167; /* meets 4.5:1 on cream */
  --color-rule:         #E5DFD2;
  --color-focus:        #2A5167;

  /* Spacing scale (rem-based) */
  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 2.5rem;
  --space-7: 3.5rem;
  --space-8: 5rem;

  /* Layout */
  --container-max: 72rem;       /* 1152px */
  --container-narrow: 52rem;    /* 832px  */
  --radius-sm: 0.5rem;
  --radius-md: 1rem;
  --radius-lg: 1.5rem;
  --radius-pill: 999px;

  /* Type — base size is large and readable */
  --font-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
}

/* =========================================================
   Base / reset
   ========================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--color-cream);
  color: var(--color-ink);
  font-family: var(--font-base);
  font-size: 1.125rem;              /* 18px */
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

@media (min-width: 768px) {
  body { font-size: 1.25rem; }      /* 20px on tablet+ */
}

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

h1, h2, h3 {
  color: var(--color-ink);
  line-height: 1.2;
  margin: 0 0 var(--space-3);
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; }
h2 { font-size: clamp(1.625rem, 3.5vw, 2.25rem); font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 600; }

/* Larger, more editorial hero headline. */
.hero-content h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  line-height: 1.1;
  margin-bottom: 24px;
}

/* Scale up main section h2s only. Footer headings are <h4> and card
   titles are <h3>, so neither is affected. */
section h2 {
  font-size: clamp(1.875rem, 4vw, 2.75rem);
  line-height: 1.2;
}

/* Typography — Newsreader serif for headings, Source Sans 3 for body.
   These rules are placed after the body and h1-h3 rules above so the
   later font-family declarations win the cascade. */
h1, h2, h3, h4 {
  font-family: 'Newsreader', Georgia, serif;
}

body, p, a, button, .btn {
  font-family: 'Source Sans 3', system-ui, sans-serif;
}

p { margin: 0 0 var(--space-4); }

/* Constrain paragraph widths in hero, who-we-work-with, and our-approach.
   Hero and approach paragraphs are also centered; who-we-work-with keeps
   its existing left alignment. */
.hero-content p,
#who-we-work-with p,
.approach-content p {
  max-width: 720px;
}

/* Comfortable, senior-friendly readability across the main content
   sections. Hero p has its own clamp() rule and is intentionally
   excluded; nav, buttons, footer, and card text are scoped separately. */
#who-we-work-with p,
#how-we-help p,
#for-seniors p,
#get-involved p,
#contact p,
.approach-content p {
  font-size: 1.125rem;
  line-height: 1.65;
}
.hero-content p {
  font-size: clamp(1.05rem, 1.5vw, 1.2rem);
  max-width: 760px;
}
.hero-content p,
.approach-content p {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}
/* Hero paragraph aligns left on desktop to match the rest of the split layout. */
@media (min-width: 860px) {
  .hero-content p {
    margin-left: 0;
    margin-right: 0;
    text-align: left;
  }
}

ul { margin: 0 0 var(--space-4); padding-left: 1.25rem; }

a {
  color: var(--color-blue-deep);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* Visible focus on every interactive element */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Reduced-motion users: defensive guard to kill any animations/transitions. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* =========================================================
   Utilities
   ========================================================= */

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

.container.narrow { max-width: var(--container-narrow); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.lede {
  font-size: 1.1875rem;
  color: var(--color-ink-soft);
}
@media (min-width: 768px) {
  .lede { font-size: 1.3125rem; }
}

/* =========================================================
   Skip link
   ========================================================= */

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip-link:focus {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
}

/* =========================================================
   Header / navigation
   ========================================================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 76px;
  background: var(--color-cream);
  border-bottom: 1px solid var(--color-rule);
  display: flex;
  align-items: center;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-block: var(--space-3);
  width: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--color-ink);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.01em;
}

.brand__mark {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-soft-blue, var(--color-blue-soft)) 0%, var(--color-green-soft) 100%);
  box-shadow: inset 0 0 0 2px var(--color-cream);
}

.brand__name { letter-spacing: 0.01em; }

/* Hamburger button — mobile only */
.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 48px;
  height: 48px;
  padding: 0;
  background: transparent;
  border: 2px solid var(--color-rule);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.nav-toggle__bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-ink);
  margin-inline: auto;
}

.primary-nav { display: none; }

.primary-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.primary-nav__list a {
  position: relative;                 /* anchors the ::after underline */
  display: block;
  /* 12px padding x at least 1rem font + line-height 1.6 keeps tap height >44px. */
  padding: 12px 12px;
  min-height: 44px;
  color: var(--color-ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.02em;
  border-radius: var(--radius-sm);
}
.primary-nav__list a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 3px;                        /* a touch bolder than before */
  background-color: var(--color-green-deep);
  transform: scaleX(0);
  transform-origin: right;
}
.primary-nav__list a:hover {
  color: var(--color-green-deep);
}
.primary-nav__list a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Active nav link — set by the scroll-spy observer in main.js.
   Selector is scoped to .primary-nav__list a so it beats the default
   ::after rule on specificity, otherwise the transform would not switch. */
.primary-nav__list a.nav-active {
  color: var(--color-green-deep);
  font-weight: 700;                   /* heavier weight for stronger active cue */
}
.primary-nav__list a.nav-active::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Mobile menu open state */
.primary-nav.is-open {
  display: block;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-cream);
  border-bottom: 1px solid var(--color-rule);
  padding: var(--space-2) var(--space-3) var(--space-4);
}

@media (min-width: 860px) {
  .nav-toggle { display: none; }
  .primary-nav,
  .primary-nav.is-open {
    display: block;
    position: static;
    background: transparent;
    border: 0;
    padding: 0;
  }
  .primary-nav__list {
    display: flex;
    gap: var(--space-4);              /* 24px between nav items on desktop */
  }
}

/* =========================================================
   Buttons
   ========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 14px 24px;
  /* 2px border reserved at base so primary and secondary share dimensions. */
  border: 2px solid transparent;
  border-radius: 50px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
}
.btn + .btn { margin-left: var(--space-2); }

.btn--primary {
  background: var(--color-ink);
  color: var(--color-cream);
}
.btn--primary:hover {
  /* Slightly darker than --color-ink (#1F2A37) for a gentle press feel. */
  background: #131C26;
  color: var(--color-cream);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.btn--secondary {
  background: transparent;
  color: var(--color-ink);
  border-color: var(--color-ink);
  /* Wrapper for the ::before slide-fill. isolation: isolate ensures the
     pseudo's negative z-index stays inside the button's stacking context. */
  position: relative;
  overflow: hidden;
  isolation: isolate;
  z-index: 1;
}
.btn--secondary::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--color-ink);
  transform: scaleX(0);
  transform-origin: left;
  z-index: -1;
}
.btn--secondary:hover {
  color: #FFFFFF;
  border-color: var(--color-ink);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Reduced-motion fallback: pseudo cannot animate, so flat-fill on hover. */
@media (prefers-reduced-motion: reduce) {
  .btn--secondary:hover {
    background-color: var(--color-ink);
  }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.actions .btn + .btn { margin-left: 0; }

/* =========================================================
   Sections (general)
   ========================================================= */

.section {
  padding-block: 80px;            /* minimum 80px top/bottom on every section */
}

.section--alt { background: var(--color-cream-soft); }

/* Pure white sections — overrides .section--alt where applied. */
#who-we-work-with,
#how-we-help {
  background: #FFFFFF;
}

/* Warm beige section. */
#for-seniors {
  background: var(--color-cream);
}

/* Inverted dark section. Cards inside keep their own background +
   text colors, so they pop against the dark surround. */
#get-involved {
  background-color: var(--color-ink);
}
#get-involved > .container > h2,
#get-involved > .container > p {
  color: #FFFFFF;
}

/* Soft radial spotlight: bright at top center, fading to warm cream
   at the edges. Hero (#top) and #our-approach still own their own bg. */
#what-we-offer,
#contact {
  background: radial-gradient(circle at top center, #FFFFFF 0%, var(--color-cream) 100%);
}

/* Increased padding on the main content sections. Hero (#top) and
   #our-approach are intentionally not in this list — they keep their
   own padding/min-height. */
#who-we-work-with,
#what-we-offer,
#how-we-help,
#for-seniors,
#get-involved,
#contact {
  padding-top: 100px;
  padding-bottom: 100px;
}

@media (max-width: 767px) {
  #who-we-work-with,
  #what-we-offer,
  #how-we-help,
  #for-seniors,
  #get-involved,
  #contact {
    padding-top: 64px;
    padding-bottom: 64px;
  }
}

/* Clean spacing under the section heading. */
#what-we-offer h2 {
  margin-bottom: 48px;
}

/* =========================================================
   Hero (Opening) — premium split layout: text left, framed video right.
   No dark overlay, no full-bleed video, light cream background.
   ========================================================= */

#top {
  background: var(--color-cream);
}

.hero-grid {
  display: grid;
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
}

.hero-content {
  text-align: center;                   /* mobile default */
  max-width: 800px;
  margin: 0 auto;
}

/* Framed video panel — square aspect for visual balance with the
   tall serif headline column. Overflow:hidden clips video to corners. */
.hero-media {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;                       /* centers the panel in its column */
  aspect-ratio: 1 / 1;
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.10);
  overflow: hidden;
  background-color: var(--color-cream-soft);
}

.hero-bg-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (min-width: 860px) {
  .hero-grid {
    grid-template-columns: 1.05fr 1fr;
  }
  .hero-content {
    text-align: left;
    margin: 0;
  }
  .hero-content .actions {
    justify-content: flex-start;
  }
}

/* Reduced-motion: hide the autoplaying video; the <video> poster image
   (images/hero.jpg) still shows because the .hero-media frame has its
   own background fallback below. The poster also covers the case where
   hero-video.mp4 is not yet present in the project. */
@media (prefers-reduced-motion: reduce) {
  .hero-bg-video {
    display: none;
  }
  .hero-media {
    background: var(--color-cream-soft) url('../images/hero.jpg') center / cover no-repeat;
  }
}

/* =========================================================
   Split layout (image + text rows used in several sections)
   ========================================================= */

.split {
  display: grid;
  gap: var(--space-5);
  align-items: center;
}

.split__media img {
  border-radius: 16px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  width: 100%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

@media (min-width: 860px) {
  .split {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-7);
  }
  .split--reverse .split__media { order: 2; }
}

/* =========================================================
   Our Approach — full-width image banner with green overlay
   ========================================================= */

#our-approach {
  position: relative;
  background-image: url('../images/approach.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

.approach-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(20, 50, 40, 0.85);
  z-index: 0;
}

.approach-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  padding: 5rem 2rem;
}

.approach-content,
.approach-content h1,
.approach-content h2,
.approach-content h3,
.approach-content p,
.approach-content .lede {
  color: #FFFFFF;
}

/* =========================================================
   Cards (What We Offer / Get Involved)
   ========================================================= */

.cards {
  list-style: none;
  padding: 0;
  margin: var(--space-4) 0 0;
  display: grid;
  gap: var(--space-3);
}

@media (min-width: 600px) {
  .cards { grid-template-columns: 1fr 1fr; }
}

/* Get Involved — natural 2x2 on desktop (with the .container.narrow
   max-width of 832px), single column on narrow viewports. No media
   queries needed — auto-fit with a 320px minimum handles both. */
.cards--four {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-4);
}
.cards--four .card {
  padding: var(--space-6);            /* 40px — wider cards feel spacious */
}

.card {
  background: #FFFFFF;
  /* Refined 1px border on right/bottom/left, plus a subtle 4px green accent on top. */
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-top: 4px solid var(--color-green-deep);
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}
.card:hover {
  border-left-color: var(--color-green-deep);
  background-color: var(--color-cream);
}
.card h3 {
  /* Aligns paragraph text across cards in a row even when titles wrap. */
  min-height: 3rem;
  margin-bottom: 12px;
  color: var(--color-blue-deep);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1.25;
}
.card p {
  margin: 0;
  color: var(--color-ink-soft);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Feature cards (What We Offer): clean 2x2 grid, generous padding,
   larger title and description. Stacks to one column on mobile. */
.cards--feature {
  grid-template-columns: 1fr;       /* mobile: single column */
  gap: var(--space-4);
  margin-top: var(--space-5);
}
.cards--feature .card {
  padding: var(--space-5);
}
@media (min-width: 700px) {
  .cards--feature {
    grid-template-columns: 1fr 1fr; /* 2x2 from tablet up */
    gap: var(--space-5);
  }
  .cards--feature .card { padding: var(--space-6); }
}

/* =========================================================
   Outcomes list (How We Help Communities)
   ========================================================= */

.outcomes__intro {
  font-weight: 600;
  margin-bottom: var(--space-2);
}
.outcomes {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-2);
}
.outcomes li {
  display: flex;
  align-items: center;
  gap: 16px;                                /* breathing room between icon and text */
  padding: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-rule);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  font-size: 1.075rem;
  line-height: 1.55;
}
.outcomes li::before {
  content: "";
  flex: 0 0 1.25rem;                        /* fixed-size icon — never shrinks */
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--color-green-soft);
  box-shadow: inset 0 0 0 4px var(--color-green-deep);
}
.outcomes li:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: var(--color-green-deep);
}

/* =========================================================
   Contact card
   ========================================================= */

.contact-card {
  background: var(--color-surface);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-lg);
  padding: 40px;
  margin-top: 40px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

/* Email and phone links inside the contact card.
   Clean readable — no default browser blue, underline only on hover/focus. */
.contact-card .contact-link {
  color: var(--color-ink);
  font-weight: 600;
  text-decoration: none;
}
.contact-card .contact-link:hover,
.contact-card .contact-link:focus-visible {
  color: var(--color-green-deep);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.contact-card__list {
  margin: 0;
  display: grid;
  gap: var(--space-3);
}
.contact-card__row {
  display: grid;
  gap: 0.25rem;
}
@media (min-width: 600px) {
  .contact-card__row {
    grid-template-columns: 8rem 1fr;
    align-items: baseline;
  }
}
.contact-card dt {
  font-weight: 700;
  color: var(--color-ink);
}
.contact-card dd {
  margin: 0;
  color: var(--color-ink-soft);
}
.contact-card__note {
  margin: var(--space-4) 0 0;
  font-size: 0.95rem;
  color: var(--color-ink-soft);
  border-top: 1px dashed var(--color-rule);
  padding-top: var(--space-3);
}

/* =========================================================
   Footer
   ========================================================= */

.site-footer {
  background-color: var(--color-ink);
  padding: 80px 5% 40px;
}

.footer-main {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 64px;
}

.footer-logo {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #FFFFFF;
  margin-bottom: 16px;
}

.footer-col h4 {
  color: #FFFFFF;
  font-weight: 700;
  font-size: 1.125rem;
  margin-bottom: 24px;
}

.footer-col p,
.footer-col a,
.footer-col li {
  color: rgba(255, 255, 255, 0.78);
  font-size: 1.0625rem;               /* 17px — readable in dark footer */
  line-height: 1.6;
  list-style: none;
  margin-bottom: 12px;
  text-decoration: none;
}

.footer-col ul {
  padding: 0;
  margin: 0;
}

.footer-col a:hover,
.footer-col a:focus-visible {
  color: #FFFFFF;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.footer-sub {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 32px;
  margin-top: 64px;
  text-align: center;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
}

/* Floor every footer paragraph and link at 1.0625rem (17px) so the
   sub-row copyright matches column readability — the spec's 1rem
   minimum is met everywhere. */
.site-footer p,
.site-footer a {
  font-size: 1.0625rem;
  line-height: 1.6;
}

/* =========================================================
   Hover transitions — only when the user is OK with motion.
   Hover state changes themselves still apply for everyone;
   only the smooth fade between states is gated here.
   ========================================================= */

@media (prefers-reduced-motion: no-preference) {
  .btn {
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
  }

  /* Primary button — gentle lift with a green-deep wash on hover. */
  .btn--primary {
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  }
  .btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    color: #FFFFFF;
    background-color: var(--color-green-deep);
  }

  /* Secondary button — slide-fill via ::before pseudo. */
  .btn--secondary {
    transition: color 0.3s ease, border-color 0.3s ease;
  }
  .btn--secondary::before {
    transition: transform 0.3s ease;
  }
  .btn--secondary:hover::before {
    transform: scaleX(1);
  }
  .btn--secondary:hover {
    color: #FFFFFF;
    border-color: var(--color-ink);
  }

  .primary-nav__list a {
    transition: color 0.2s ease;
  }
  .primary-nav__list a::after {
    transition: transform 0.3s ease;
  }
  .card {
    transition: border 0.2s ease, background-color 0.2s ease;
  }
  .outcomes li {
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
  }
}
