/* ==========================================================================
   AI4Therapists: shared navbar and footer, used by every page of the main site.
   Source of truth for the markup: tools/site-chrome/ (header.html, header-slim.html,
   footer.html). Run tools/site-chrome/sync.py after changing them. This file styles that
   markup and nothing else, so every selector starts with .sc-
   Everything is set explicitly (padding, margin, font, colour), so a page's own
   header / footer / a / ul / p rules cannot change how the chrome looks.
   Light and dark follow the visitor's setting (prefers-color-scheme), as the pages do.
   ========================================================================== */

:root {
  --sc-bg: #F4F8F6;
  --sc-ink: #142A30;
  --sc-muted: #4A6064;
  --sc-line: #CFDDD8;
  --sc-hover: #8A5A0B;
  --sc-amber: #EAA53D;
  --sc-amber-hover: #F0B65E;
  --sc-on-amber: #142A30;
  --sc-focus: #19424D;
  --sc-sans: Figtree, system-ui, -apple-system, "Segoe UI", sans-serif;
  --sc-gutter: clamp(1rem, 4vw, 2.5rem);
  --sc-max: 68rem;
  /* Height of the navbar, for pages that fill the screen (survey, join) and need to leave room for it. */
  --sc-header-h: calc(4rem + 1px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sc-bg: #0F2227;
    --sc-ink: #E6EEEB;
    --sc-muted: #A6BBB8;
    --sc-line: #2A474E;
    --sc-hover: #F0C26F;
    --sc-focus: #EAA53D;
  }
}
:root[data-theme="dark"] {
  --sc-bg: #0F2227;
  --sc-ink: #E6EEEB;
  --sc-muted: #A6BBB8;
  --sc-line: #2A474E;
  --sc-hover: #F0C26F;
  --sc-focus: #EAA53D;
}

/* ---------- Shared basics ---------- */
.sc-header, .sc-footer { box-sizing: border-box; background: var(--sc-bg); font-family: var(--sc-sans); -webkit-font-smoothing: antialiased; }
.sc-header *, .sc-footer * { box-sizing: border-box; }
.sc-links, .sc-foot-links { list-style: none; margin: 0; padding: 0; }
.sc-links li, .sc-foot-links li { margin: 0; padding: 0; }
.sc-contact, .sc-legal { margin: 0; padding: 0; max-width: none; }
.sc-header img, .sc-footer img { display: block; max-width: 100%; height: auto; }
.sc-header a, .sc-footer a { text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
.sc-header a:focus-visible, .sc-header summary:focus-visible, .sc-footer a:focus-visible {
  outline: 3px solid var(--sc-focus);
  outline-offset: 3px;
}

/* ---------- Navbar ---------- */
.sc-header {
  position: relative;
  z-index: 30;
  margin: 0;
  padding: 0;
  color: var(--sc-ink);
  border: 0;
  border-bottom: 1px solid var(--sc-line);
  font-size: 1rem;
  line-height: 1.3;
  font-weight: 500;
}
.sc-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--sc-max);
  min-height: 4rem;
  margin: 0 auto;
  padding: 0.5rem var(--sc-gutter);
}
.sc-brand { display: block; flex: none; line-height: 0; border-radius: 4px; }
.sc-brand img { width: 150px; }
.sc-nav { margin: 0; padding: 0; }

/* Small screens: a "Menu" button (a <details>, so it works without JavaScript) that opens the links in a panel. */
.sc-menu summary {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  margin: 0;
  padding: 0 1rem;
  border: 1px solid var(--sc-line);
  border-radius: 999px;
  color: var(--sc-ink);
  font: 500 1rem/1.2 var(--sc-sans);
  list-style: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.sc-menu summary::-webkit-details-marker { display: none; }
.sc-menu summary::marker { content: ""; }
.sc-menu summary:hover { border-color: var(--sc-muted); }
.sc-menu-icon { position: relative; flex: none; width: 1.05rem; height: 0.8rem; }
.sc-menu-icon::before, .sc-menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
}
.sc-menu-icon::before { top: 0; box-shadow: 0 5.4px 0 currentColor; }
.sc-menu-icon::after { bottom: 0; }
.sc-menu[open] .sc-menu-icon::before { top: calc(50% - 1px); box-shadow: none; transform: rotate(45deg); }
.sc-menu[open] .sc-menu-icon::after { bottom: calc(50% - 1px); transform: rotate(-45deg); }
.sc-links {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1;
  padding: 0.25rem max(var(--sc-gutter), calc((100% - var(--sc-max)) / 2 + var(--sc-gutter))) 1.25rem;
  background: var(--sc-bg);
  border-bottom: 1px solid var(--sc-line);
  box-shadow: 0 22px 32px -22px rgba(20, 42, 48, 0.4);
}
.sc-links a {
  display: flex;
  align-items: center;
  min-height: 3rem;
  padding: 0.4rem 0;
  color: var(--sc-ink);
  text-decoration: none;
  border-bottom: 1px solid var(--sc-line);
}
.sc-links a:hover { color: var(--sc-hover); }
.sc-links a.sc-cta {
  justify-content: center;
  min-height: 3rem;
  margin-top: 1rem;
  padding: 0.6rem 1.25rem;
  border: 0;
  border-radius: 999px;
  background: var(--sc-amber);
  color: var(--sc-on-amber);
  font-weight: 600;
}
.sc-links a.sc-cta:hover { background: var(--sc-amber-hover); color: var(--sc-on-amber); }
.sc-links a[aria-current="page"] { font-weight: 600; }
.sc-links a.sc-cta[aria-current="page"] { box-shadow: inset 0 0 0 2px var(--sc-on-amber); }

/* Wider screens: the links sit in the bar. Browsers too old to know ::details-content keep the Menu button at every width. */
@media (min-width: 48rem) {
  .sc-brand img { width: 168px; }
  @supports selector(::details-content) {
    .sc-menu summary { display: none; }
    .sc-menu::details-content { content-visibility: visible; }
    .sc-links {
      position: static;
      display: flex;
      align-items: center;
      gap: 0.25rem clamp(1.25rem, 2.6vw, 2rem);
      padding: 0;
      background: none;
      border: 0;
      box-shadow: none;
    }
    .sc-links a {
      display: inline-flex;
      min-height: 2.75rem;
      padding: 0.4rem 0;
      border: 0;
    }
    .sc-links a[aria-current="page"] {
      text-decoration: underline;
      text-decoration-color: var(--sc-amber);
      text-decoration-thickness: 2px;
      text-underline-offset: 0.45em;
    }
    .sc-links a.sc-cta {
      min-height: 2.75rem;
      margin: 0 0 0 0.25rem;
      padding: 0.55rem 1.2rem;
    }
  }
}

/* ---------- Footer ---------- */
.sc-footer {
  margin: 0;
  padding: clamp(2.5rem, 6vw, 3.5rem) 0 3rem;
  border: 0;
  border-top: 1px solid var(--sc-line);
  color: var(--sc-muted);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.55;
}
.sc-foot { max-width: var(--sc-max); margin: 0 auto; padding: 0 var(--sc-gutter); }
.sc-foot-logo { display: block; width: 150px; margin: 0 0 1.25rem; }
.sc-foot-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; margin: 0 0 0.9rem; }
.sc-footer a { color: var(--sc-ink); font-weight: 500; }
.sc-footer a:hover { color: var(--sc-hover); }
.sc-footer a[aria-current="page"] { text-decoration-thickness: 2px; }
.sc-contact { margin: 0 0 0.9rem; }
.sc-legal { max-width: 44rem; }
