/*
  Design System Variables
  Theme: Stillwater - Heritage Wellness (About-inspired)
*/
:root {
  --color-bg-primary: #f4f1ea;
  --color-bg-secondary: #ece6da;
  --color-surface: rgba(255, 255, 255, 0.92);
  --color-text-primary: #1c2a2a;
  --color-text-secondary: rgba(28, 42, 42, 0.7);
  --color-accent: #c08457;
  --color-accent-soft: #5f7d72;
  --color-border-soft: rgba(47, 72, 66, 0.14);
  --btn-hover-fill: #2f4842;
  --btn-hover-text: #f4f1ea;

  --color-moss: #2f4842;
  --color-sage: #8aa399;
  --color-clay: #c08457;

  --font-heading: "Fraunces", Georgia, serif;
  --font-body: "Outfit", -apple-system, sans-serif;

  --spacing-sm: 1rem;
  --spacing-md: 2rem;
  --spacing-lg: 4rem;
  --spacing-xl: 8rem;

  --transition-smooth: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* COMMENTED OUT: Light theme temporarily disabled - dark mode is default
:root[data-theme="light"] {
  --color-bg-primary: #f5f2ee;
  --color-bg-secondary: #ece5db;
  --color-surface: rgba(255, 255, 255, 0.92);
  --color-text-primary: #1a2e2c;
  --color-text-secondary: rgba(26, 46, 44, 0.84);
  --color-accent: #6a4d1f;
  --color-accent-soft: #3a8a8a;
  --color-border-soft: rgba(26, 46, 44, 0.18);
  --btn-hover-fill: rgba(26, 46, 44, 0.16);
  --btn-hover-text: #1a2e2c;
}
*/

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

body {
  font-family: var(--font-body);
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
  line-height: 1.6;
  max-width: 100vw;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition:
    background-color 0.35s ease,
    color 0.35s ease;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: 1.2;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition-smooth);
}

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

picture,
svg,
video {
  max-width: 100%;
  height: auto;
}

a,
button,
.btn,
[role="button"] {
  touch-action: manipulation;
}

/* Typography Utilities */
.text-center {
  text-align: center;
}
.text-display {
  font-size: clamp(3rem, 8vw, 6rem);
  letter-spacing: 0.01em;
  font-weight: 300;
}
.text-h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
}
.text-h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}
.text-caption {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--color-accent);
}

/* Layout Utilities */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 5%;
}

.section {
  padding: var(--spacing-xl) 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-lg);
}

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

/* Navigation (Sticky Header) — matches the home page nav */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 1.1rem clamp(20px, 5vw, 64px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  z-index: 100;
  transition: var(--transition-smooth);
  background: rgba(244, 241, 234, 0.82);
  border-bottom: 1px solid var(--color-border-soft);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

/* Push page content below the fixed header so it doesn't hide. */
body {
  padding-top: 4.5rem;
}

/* COMMENTED OUT: Light theme - dark mode is default
:root[data-theme="light"] .header {
  background: linear-gradient(
    to bottom,
    rgba(7, 18, 18, 0.93) 0%,
    rgba(7, 18, 18, 0.56) 68%,
    rgba(7, 18, 18, 0.16) 100%
  );
}
*/

.header.scrolled {
  background-color: var(--color-surface);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  padding: 1rem 5%;
  border-bottom: 1px solid var(--color-border-soft);
}

/* COMMENTED OUT: Light theme - dark mode is default
:root[data-theme="light"] .header.scrolled {
  background-color: rgba(255, 255, 255, 0.94) !important;
}
*/

:root[data-theme="dark"] .header.scrolled {
  background-color: rgba(7, 35, 41, 0.88) !important;
}

.header.scrolled .header-logo,
.header.scrolled .menu-btn,
.header.scrolled #authMenuButton,
.header.scrolled #authActions > a:not(.btn-solid) {
  color: #112629 !important;
}

:root[data-theme="dark"] .header.scrolled .header-logo,
:root[data-theme="dark"] .header.scrolled .menu-btn,
:root[data-theme="dark"] .header.scrolled #authMenuButton,
:root[data-theme="dark"] .header.scrolled #authActions > a:not(.btn-solid) {
  color: #e0f2f1 !important;
}

.header.scrolled .theme-toggle {
  color: #112629 !important;
  border-color: rgba(17, 38, 41, 0.35) !important;
  background: transparent;
}

:root[data-theme="dark"] .header.scrolled .theme-toggle {
  color: #e0f2f1 !important;
  border-color: var(--color-border-soft) !important;
  background: transparent;
}

.header-logo {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  letter-spacing: 0.5px;
  font-weight: 500;
  text-transform: none;
  position: static;
  top: auto;
  left: auto;
  transform: none;
  color: var(--btn-hover-fill);
  text-decoration: none;
  flex: 0 0 auto;
}

.header-logo > span,
.header-logo .header-logo-tail {
  color: var(--color-accent);
}

/* Legacy logo image — kept hidden in case any page still has it. */
.stillwater-logo-mark { display: none !important; }

.stillwater-brand {
  display: inline-flex;
  align-items: center;
}
.stillwater-brand-text { display: none !important; }

.menu-btn {
  display: none !important;
}

/* Site-wide language dropdown — injected by js/i18n.js */
.sw-lang-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--color-border-soft, rgba(47, 72, 66, 0.18));
  border-radius: 999px;
  padding: 4px 6px 4px 10px;
  margin-right: 0.5rem;
  color: var(--btn-hover-fill, #2f4842);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s ease;
}
.sw-lang-wrap:hover { background: rgba(255, 255, 255, 0.95); }
.sw-lang-globe { display: inline-flex; align-items: center; color: inherit; }
.sw-lang-select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 4px 18px 4px 4px;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%232f4842' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 4px center;
  background-size: 10px 10px;
}
.sw-lang-select:focus { outline: none; }
.sw-lang-wrap-floating {
  position: fixed;
  top: 0.8rem;
  right: 0.8rem;
  z-index: 10000;
}
@media (max-width: 1039px) {
  .sw-lang-wrap { padding: 4px 4px 4px 8px; font-size: 0.74rem; }
  .sw-lang-select { padding-right: 14px; background-size: 8px 8px; }
}

#authActions {
  position: absolute;
  right: 5%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  flex-wrap: wrap;
}

#authMenuWrap {
  min-width: 0;
}

#authMenuButton {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.auth-actions-compact #authActions {
  max-width: min(60vw, 260px);
  gap: 0.4rem;
  flex-wrap: nowrap;
  overflow: hidden;
}

body.auth-actions-compact #authMenuWrap {
  max-width: 140px;
  flex: 0 1 auto;
}

body.auth-actions-compact #authMenuButton {
  max-width: 100%;
  font-size: 0.72rem;
}

body.auth-actions-compact #btnIntake,
body.auth-actions-compact #btnAdmin {
  display: none !important;
}

/* ── Mobile header: force-hide inline buttons so logo never collides ── */
/* These selectors must beat the JS inline-style 'display:inline-flex'   */
@media (max-width: 1039px) {
  /* #btnIntake is shown by JS via inline style; !important overrides it */
  #btnIntake {
    display: none !important;
  }
  /* Admin button only shows on desktop */
  #btnAdmin {
    display: none !important;
  }
  /* Compact mode: shrink auth zone to guarantee logo clearance */
  #authActions {
    max-width: min(42vw, 200px);
    gap: 0.35rem;
    flex-wrap: nowrap;
    overflow: hidden;
  }
  #authMenuWrap {
    max-width: 120px;
    flex: 0 1 auto;
    min-width: 0;
  }
  #authMenuButton {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.72rem;
  }
}

.header > .btn {
  position: absolute;
  right: 5%;
  top: 50%;
  transform: translateY(-50%);
}

.theme-toggle {
  border: 1px solid var(--color-border-soft);
  background: rgba(13, 30, 30, 0.7);
  color: var(--color-text-primary);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  width: 58px;
  height: 32px;
  cursor: pointer;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  line-height: 1;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

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

.theme-toggle::before {
  content: "";
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(245, 242, 238, 0.95);
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.theme-toggle::after {
  content: "☾";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(245, 242, 238, 0.85);
  font-size: 0.82rem;
  pointer-events: none;
}

/* COMMENTED OUT: Light theme - dark mode is default
:root[data-theme="light"] .theme-toggle {
  background: rgba(236, 229, 219, 0.88);
}

:root[data-theme="light"] .theme-toggle::before {
  transform: translateX(26px);
  background: rgba(255, 255, 255, 0.96);
}

:root[data-theme="light"] .theme-toggle::after {
  content: "☀";
  left: 8px;
  right: auto;
  color: #8f7040;
}
*/

.theme-toggle:hover {
  border-color: var(--color-text-primary);
}

.header-theme-toggle {
  position: absolute;
  right: calc(5% + 210px);
}

.header-theme-toggle-inline {
  position: static;
  flex: 0 0 auto;
  align-self: center;
}

.settings-panel {
  border: 1px solid var(--color-border-soft);
  background: var(--color-surface);
  padding: 1.5rem;
  text-align: left;
  margin-top: 2rem;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

/* Full Screen Drawer Menu */
.menu-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background:
    radial-gradient(
      circle at 15% 15%,
      rgba(95, 179, 179, 0.08),
      transparent 42%
    ),
    var(--color-bg-primary);
  z-index: 200;
  display: flex;
  transform: translateY(-100%);
  transition: transform 0.8s cubic-bezier(0.77, 0, 0.175, 1);
}

.menu-drawer.active {
  transform: translateY(0);
}

.menu-drawer-left {
  flex: 1;
  padding: 5% 10%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.menu-drawer-close {
  position: absolute;
  top: 2rem;
  right: 5%;
  background: none;
  border: none;
  color: var(--color-text-primary);
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.menu-list {
  list-style: none;
}

.menu-list li {
  margin-bottom: 2rem;
  overflow: hidden;
}

.menu-list a {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 300;
  display: inline-block;
  transform: translateY(100%);
  opacity: 0;
  transition:
    transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.6s ease;
}

.menu-drawer.active .menu-list a {
  transform: translateY(0);
  opacity: 1;
}

.menu-list li:nth-child(1) a {
  transition-delay: 0.2s;
}
.menu-list li:nth-child(2) a {
  transition-delay: 0.3s;
}
.menu-list li:nth-child(3) a {
  transition-delay: 0.4s;
}
.menu-list li:nth-child(4) a {
  transition-delay: 0.5s;
}
.menu-list li:nth-child(5) a {
  transition-delay: 0.6s;
}
.menu-list li:nth-child(6) a {
  transition-delay: 0.7s;
}

.menu-list a:hover {
  color: var(--color-accent);
  transform: translateX(20px);
}

.menu-drawer-right {
  flex: 1;
  background-image: url("assets/menu-bg.jpg");
  background-size: cover;
  background-position: center;
  display: none;
}

@media (min-width: 992px) {
  .menu-drawer-right {
    display: block;
  }
}

/* UI Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.95rem 2.4rem;
  border: 1px solid rgba(47, 72, 66, 0.38);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.7rem;
  font-weight: 400;
  cursor: pointer;
  background: transparent;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  line-height: 1.1;
  border-radius: 100px;
}

.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--btn-hover-fill);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.btn:hover {
  color: var(--btn-hover-text);
  border-color: var(--color-moss);
}

.btn:hover::before {
  transform: scaleX(1);
}

.btn-solid {
  border-color: var(--color-moss);
  background-color: var(--color-moss);
  color: #f4f1ea;
}

.btn-solid::before {
  background-color: rgba(255, 255, 255, 0.14);
}

.btn-solid:hover {
  color: #f4f1ea;
  border-color: var(--color-moss);
}

/* COMMENTED OUT: Light theme - dark mode is default
:root[data-theme="light"] .btn {
  text-shadow: none;
  border-color: rgba(26, 46, 44, 0.35);
}

:root[data-theme="light"] .btn:hover,
:root[data-theme="light"] .btn-solid:hover {
  border-color: rgba(26, 46, 44, 0.55);
}

/* Preserve readability on image/video-heavy sections in light mode. */
:root[data-theme="light"] .header:not(.scrolled) .header-logo,
:root[data-theme="light"] .header:not(.scrolled) .menu-btn,
:root[data-theme="light"] .header:not(.scrolled) #authMenuButton,
:root[data-theme="light"] .header:not(.scrolled) #authActions > a,
:root[data-theme="light"] .header:not(.scrolled) .theme-toggle {
  color: #f5f2ee !important;
}

:root[data-theme="light"] .header:not(.scrolled) #authActions .btn,
:root[data-theme="light"] .header:not(.scrolled) #authMenuButton {
  border-color: rgba(245, 242, 238, 0.58) !important;
}

:root[data-theme="light"] .hero :is(h1, h2, h3, h4, h5, h6, p, span, a, button),
:root[data-theme="light"]
  .hero-content
  :is(h1, h2, h3, h4, h5, h6, p, span, a, button) {
  color: #f5f2ee;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.32);
}

:root[data-theme="light"] .hero .text-caption,
:root[data-theme="light"] .page-hero .text-caption,
:root[data-theme="light"] .hero-content .text-caption {
  color: #e4c489;
}
*/

/* Forms */
.form-group {
  margin-bottom: 2rem;
  position: relative;
}

.form-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(245, 242, 238, 0.22);
  color: var(--color-text-primary);
  padding: 1rem 0;
  font-family: var(--font-body);
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-input:focus {
  outline: none;
  border-bottom-color: var(--color-accent);
}

.form-label {
  position: absolute;
  top: 1rem;
  left: 0;
  color: var(--color-text-secondary);
  pointer-events: none;
  transition: var(--transition-smooth);
}

.form-input:focus ~ .form-label,
.form-input:not(:placeholder-shown) ~ .form-label {
  top: -0.5rem;
  font-size: 0.75rem;
  color: var(--color-accent);
}

/* Footer — single full-width band that blends with the page background */
.footer {
  max-width: none;
  width: 100%;
  background: var(--color-moss);
  color: rgba(244, 241, 234, 0.82);
  border: none;
  border-radius: 0;
  padding: 2.5rem 5% 1.75rem;
  margin: var(--spacing-lg) 0 0;
  box-shadow: none;

  /* One row: brand | socials | legal. Copyright sits below, full width. */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas:
    "brand socials legal"
    "copy  copy    copy";
  align-items: center;
  column-gap: 2rem;
  row-gap: 1.5rem;
}

/* Promote the grid-2 children up into the footer's grid. */
.footer .grid-2 {
  display: contents;
}

.footer .grid-2 > div:first-child {
  grid-area: brand;
}

.footer .grid-2 > div:last-child {
  grid-area: legal;
  justify-self: end;
}

.footer > .social-links {
  grid-area: socials;
}

.footer > .footer-bottom {
  grid-area: copy;
}

/* Override the header-only absolute positioning when .header-logo is
   reused as the footer brand mark. Higher specificity to beat
   .home-landing .header-logo at every breakpoint. */
footer.footer .header-logo,
.home-landing footer.footer .header-logo {
  position: static;
  transform: none;
  top: auto;
  left: auto;
  right: auto;
  margin: 0 0 1rem;
  font-size: 1.4rem;
  display: inline-flex;
}

.footer p {
  color: rgba(244, 241, 234, 0.7);
  line-height: 1.6;
  margin: 0;
}

/* Footer sits on dark moss — force light text/links throughout. */
.footer-bottom,
.compliance-links {
  color: rgba(244, 241, 234, 0.7);
}
.footer .text-caption,
footer.footer .stillwater-brand-text,
footer.footer .header-logo {
  color: #f4f1ea;
}
.footer a {
  color: rgba(244, 241, 234, 0.82);
}
.footer a:hover {
  color: #f4f1ea;
}
.footer .social-icon {
  color: rgba(244, 241, 234, 0.78);
}
.footer .social-icon:hover {
  color: #f4f1ea;
}
.compliance-links li + li::before {
  color: rgba(244, 241, 234, 0.4);
}

.footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer .text-caption {
  margin-bottom: 1rem;
}

.footer-bottom {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 0.5rem;
  padding-top: 0;
  border-top: none;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  text-align: center;
}

.compliance-links {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  color: var(--color-text-secondary);
  list-style: none;
  align-items: center;
}

.compliance-links li {
  position: relative;
}

.compliance-links li + li::before {
  content: "·";
  position: absolute;
  left: -0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-border-soft);
  pointer-events: none;
}

.provider-row {
  padding: 3rem 5% 1rem;
  background: linear-gradient(
    180deg,
    var(--color-bg-primary) 0%,
    var(--color-bg-secondary) 100%
  );
  border-top: 1px solid var(--color-border-soft);
  border-bottom: 1px solid var(--color-border-soft);
}

.provider-row-grid {
  max-width: 1400px;
  margin: 2rem auto 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .provider-row-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1200px) {
  .provider-row-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.provider-card {
  border: 1px solid var(--color-border-soft);
  background: var(--color-surface);
  padding: 1.25rem;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.provider-card h3 {
  font-size: 1.5rem;
  color: var(--color-text-primary);
  letter-spacing: 0.05em;
}

.provider-card p {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
}

.provider-tag {
  align-self: flex-start;
  border: 1px solid var(--color-border-soft);
  color: var(--color-accent);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
}

/* Animations */
.fade-up {
  opacity: 0;
  transform: translateY(40px);
  transition:
    opacity 1s ease,
    transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Cookie Consent Banner */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: var(--color-surface);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--color-border-soft);
  padding: 1.5rem 5%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 9999;
  transform: translateY(100%);
  transition:
    transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
    background-color 0.35s ease,
    border-top-color 0.35s ease;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}

@media (min-width: 768px) {
  .cookie-banner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.cookie-banner.show {
  transform: translateY(0);
}

.cookie-text {
  flex: 1;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
}

.cookie-buttons {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.btn-cookie {
  padding: 0.5rem 1.5rem;
  font-size: 0.75rem;
}

/* Trust Banner */
.trust-banner {
  background-color: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border-soft);
  border-bottom: 1px solid var(--color-border-soft);
  padding: 2rem 5%;
}

.trust-banner .stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  max-width: 760px;
  margin: 0 auto;
}

@media (min-width: 992px) {
  .trust-banner .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 4rem;
  }
}

.trust-item {
  text-align: center;
}

.trust-value {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--color-text-primary);
  margin-bottom: 0.5rem;
  display: block;
}

.trust-label {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* =====================
   Mobile Responsive
   ===================== */

/* Reduce section vertical padding on mobile */
@media (max-width: 767px) {
  :root {
    --color-border-soft: rgba(245, 242, 238, 0.24);
  }

  /* COMMENTED OUT: Light theme - dark mode is default
  :root[data-theme="light"] {
    --color-border-soft: rgba(26, 46, 44, 0.28);
  }
  */

  .container {
    padding: 0 4.5%;
  }

  .header,
  .header.scrolled {
    padding-left: 4.5%;
    padding-right: 4.5%;
  }

  .header-logo {
    font-size: 1.2rem;
    letter-spacing: 0.14em;
  }

  .menu-drawer {
    height: 100dvh;
  }

  .menu-list a {
    font-size: clamp(1.5rem, 8vw, 2.5rem);
  }

  #authActions {
    gap: 0.35rem;
    /* 42vw keeps auth zone fully right of any centered ~110px-wide logo */
    max-width: min(42vw, 196px);
    flex-wrap: nowrap;
    overflow: hidden;
  }

  body.auth-actions-compact #authActions {
    max-width: min(40vw, 180px);
  }

  body.auth-actions-compact #authMenuWrap {
    max-width: 100px;
  }

  body.auth-actions-compact #authMenuButton {
    font-size: 0.64rem;
  }

  .header-theme-toggle {
    right: 4.5%;
    top: 50%;
    transform: translateY(-50%);
  }

  .theme-toggle {
    width: 52px;
    height: 30px;
  }

  .theme-toggle::before {
    width: 22px;
    height: 22px;
    top: 3px;
    left: 3px;
  }

  /* COMMENTED OUT: Light theme - dark mode is default
  :root[data-theme="light"] .theme-toggle::before {
    transform: translateX(22px);
  }
  */

  .btn {
    padding: 0.78rem 1.5rem;
    font-size: 0.64rem;
    letter-spacing: 0.18em;
  }

  .btn-cookie {
    width: 100%;
  }

  .section {
    padding: 4rem 0;
  }

  /* Footer collapses to comfortable mobile padding and stacks vertically */
  .footer {
    padding: 1.75rem 5% 1.25rem;
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "legal"
      "socials"
      "copy";
    row-gap: 1.5rem;
  }

  .footer .grid-2 > div:last-child {
    justify-self: start;
    flex-direction: column;
    gap: 2rem;
    justify-content: flex-start;
  }

  /* Footer bottom wraps on very small screens */
  .footer-bottom {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }

  /* Hero counter font size */
  .hero-content p[style] {
    font-size: 1.1rem !important;
  }

  /* Reduce vision image height */
  .vision-image-wrapper {
    height: 320px;
  }

  /* Prevent quote section overflow */
  .text-h2 {
    word-break: break-word;
  }

  /* Team card bio max-height bump for mobile hover */
  .team-card:hover .team-bio {
    max-height: 560px;
    overflow-y: auto;
  }

  /* Trust banner grid: 2 cols on mobile, already set, ensure spacing */
  .trust-banner .stats-grid {
    gap: 1.5rem;
  }

  /* Partner cards padding reduction */
  .partner-card {
    padding: 2rem;
  }

  .provider-card {
    min-height: 0;
  }

  /* Reduce menu-drawer left padding for small screens */
  .menu-drawer-left {
    padding: 5% 8%;
  }

  /* Remove left borders on single-column mobile layouts */
  .info-card {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--color-accent);
    padding-top: 1.5rem;
  }

  /* Remove Vision column divider border on mobile (single column) */
  .grid-2 > div[style*="border-left"] {
    border-left: none !important;
    padding-left: 0 !important;
  }

  .cookie-banner {
    padding: 1rem 4.5%;
    gap: 0.75rem;
  }

  .cookie-text {
    font-size: 0.82rem;
  }

  .cookie-buttons {
    width: 100%;
  }

  .social-links {
    gap: 0.8rem;
    flex-wrap: wrap;
  }

  .admin-table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }

  .admin-table th,
  .admin-table td {
    padding: 0.65rem;
  }
}

/* Social Links */
.social-links {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  justify-content: center;
}

/* When the social row sits inside the footer grid (between brand and
   legal), drop the divider/margin it uses when standing alone. */
.footer > .social-links {
  padding: 0;
  border-top: none;
  margin: 0;
}

.social-icon {
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--color-border-soft);
  border-radius: 50%;
  transition:
    color 0.3s ease,
    border-color 0.3s ease,
    transform 0.3s ease;
}

.social-icon:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  transform: translateY(-3px);
}

/* Extra small screens */
@media (max-width: 480px) {
  .container {
    padding: 0 4%;
  }

  .menu-btn {
    left: 4%;
    font-size: 0;
    letter-spacing: 0;
    gap: 0;
    min-width: 22px;
    padding: 0;
  }

  .menu-btn svg {
    width: 20px;
    height: 20px;
  }

  .header-logo {
    font-size: 1.05rem;
  }

  .menu-drawer-left {
    padding: 12% 7% 8%;
  }

  .trust-banner .grid-4 {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .hero-content p[style] {
    font-size: 1rem !important;
  }

  .section {
    padding: 3rem 0;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  #authActions {
    gap: 0.3rem;
    max-width: min(40vw, 172px);
  }

  body.auth-actions-compact #authActions {
    max-width: min(38vw, 158px);
    gap: 0.25rem;
  }

  body.auth-actions-compact #authMenuWrap {
    max-width: 86px;
  }

  body.auth-actions-compact #authMenuButton {
    font-size: 0.6rem;
  }

  .theme-toggle {
    width: 48px;
    height: 28px;
    font-size: 0.62rem;
  }

  .theme-toggle::before {
    width: 20px;
    height: 20px;
  }

  /* COMMENTED OUT: Light theme - dark mode is default
  :root[data-theme="light"] .theme-toggle::before {
    transform: translateX(18px);
  }
  */

  .header-theme-toggle {
    right: calc(4% + 72px);
  }

  .header > .btn {
    right: 4%;
    padding: 0.42rem 0.72rem;
    font-size: 0.56rem;
    letter-spacing: 0.12em;
    max-width: 68px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .menu-list li {
    margin-bottom: 1.4rem;
  }
}

@media (max-width: 380px) {
  .container {
    padding: 0 3.5%;
  }

  #authActions {
    max-width: min(38vw, 152px);
  }

  body.auth-actions-compact #authActions {
    max-width: min(36vw, 140px);
  }

  .header > .btn {
    padding: 0.38rem 0.6rem;
    font-size: 0.52rem;
    letter-spacing: 0.08em;
    right: 3.5%;
    max-width: 62px;
  }

  .header-theme-toggle {
    display: none;
  }

  .stillwater-brand-text {
    display: none;
  }

  .header-logo {
    letter-spacing: 0;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .hero,
  .page-hero {
    height: auto;
    min-height: 72vh;
  }

  .header,
  .header.scrolled {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }
}

@supports (padding: max(0px)) {
  .header,
  .cookie-banner,
  .menu-drawer-left {
    padding-left: max(5%, env(safe-area-inset-left));
    padding-right: max(5%, env(safe-area-inset-right));
  }

  @media (max-width: 767px) {
    .header,
    .cookie-banner,
    .menu-drawer-left {
      padding-left: max(4.5%, env(safe-area-inset-left));
      padding-right: max(4.5%, env(safe-area-inset-right));
    }
  }

  @media (max-width: 480px) {
    .header,
    .cookie-banner,
    .menu-drawer-left {
      padding-left: max(4%, env(safe-area-inset-left));
      padding-right: max(4%, env(safe-area-inset-right));
    }
  }
}

/* Desktop baseline for Text-to-Icon login button:
   icon is hidden, text label is shown (default/desktop state). */
.header-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.header-login-btn .btn-icon {
  display: none; /* Hidden on desktop; shown on mobile via media query */
}

.header-login-btn .btn-label {
  display: inline; /* Shown on desktop; hidden on mobile via media query */
}

/* User profile button desktop baseline */
#authMenuButton .auth-btn-icon {
  display: none;
}

#authMenuButton .auth-btn-label {
  display: inline;
}

/* ==========================================================
   MOBILE FIXES — strictly scoped to narrow viewports.
   Desktop (≥ 1040px) is completely unaffected.
   ========================================================== */

/* ── 1. Hide "Menu" text label — icon-only below 768 px ─── */
@media (max-width: 767px) {
  .menu-btn .menu-btn-label {
    display: none;
  }

  /* In case the text is a direct text node, zero out font-size
     and gap on the button itself (already handled at ≤480px via
     existing rules, but extend the range here for 481-767 px) */
  .menu-btn {
    font-size: 0 !important;
    letter-spacing: 0 !important;
    gap: 0 !important;
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }

  .menu-btn svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
  }
}

/* ── 2. Header: enforce safe auth-zone + logo non-collision ─ */
/* Authenticated state on narrow phones (375-768 px):
   The theme toggle + "Hi, Name" button together can collide
   with the absolutely-centred logo.                          */
@media (max-width: 767px) {
  /* Shrink the theme toggle slightly so auth zone has room    */
  .theme-toggle {
    width: 48px !important;
    height: 28px !important;
  }

  /* Give the auth zone a hard right-side cap that leaves at
     least 40 % of the viewport for the centered logo.        */
  #authActions {
    max-width: min(44vw, 192px) !important;
  }

  /* Hide header theme toggle on mobile as requested */
  .header-theme-toggle-inline {
    display: none !important;
  }

  /* Text-to-Icon: On mobile, hide the "Hi, Name" text label and
     show a profile icon instead. Restrict to a 44x44 circular button. */
  #authMenuButton .auth-btn-label {
    display: none !important;
  }
  
  #authMenuButton .auth-btn-icon {
    display: block !important;
    flex-shrink: 0;
  }

  #authMenuButton {
    min-width: 44px;
    min-height: 44px;
    padding: 0 !important;
    justify-content: center;
    border-radius: 50%;
  }

  /* Since text + theme toggle are gone, we can safely reduce the container sizes */
  #authActions, #authMenuWrap {
    max-width: 50px !important;
  }

  /* The dropdown menu is absolutely positioned inside #authActions, which
     has overflow:hidden on mobile — that clips the menu. Promote it to
     position: fixed so it escapes the clip and stays anchored to the
     top-right of the viewport, just below the header. */
  #authMenu {
    position: fixed !important;
    top: 4rem !important;
    right: 0.75rem !important;
    bottom: auto !important;
    left: auto !important;
    min-width: 160px;
    z-index: 200;
  }

  /* Fix: For non-home pages the header uses .header > .btn
     (Login / Join) — prevent it from pushing the logo.      */
  .header > .btn {
    max-width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Text-to-Icon: hide "Login" text label on mobile;
     show only the person icon (SVG).                        */
  .header-login-btn .btn-label {
    display: none;
  }

  .header-login-btn .btn-icon {
    display: block;
    flex-shrink: 0;
  }

  /* Also remove the extra padding the inline style adds     */
  .header-login-btn {
    padding: 0 !important;
    font-size: 0 !important;
    letter-spacing: 0 !important;
    gap: 0 !important;
  }
}


/* ── 3. Footer: fix right-aligned link columns on mobile ─── */
@media (max-width: 767px) {
  /* The footer grid-2 right column uses inline justify-content:
     flex-end which looks odd on a stacked single column.     */
  .footer .grid-2 > div:last-child {
    justify-content: flex-start !important;
  }

  /* Give the footer link groups proper spacing               */
  .footer .grid-2 > div:last-child > div {
    min-width: 0;
  }
}

/* ── 5. Partner cards: make details visible on mobile (tap) ─ */
/* On desktop they reveal on :hover; mobile has no hover,
   so we show a truncated preview and allow full reveal via
   the .open class applied in JS (below).                    */
@media (max-width: 767px) {
  /* Show a short preview by default */
  .partner-details {
    max-height: none !important;
    opacity: 1 !important;
    margin-top: 1rem !important;
    overflow: hidden;
    transition: none !important;
  }

  /* Keep partner-conditions and meta visible but truncate desc */
  .partner-desc {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* When user taps a partner card, show full description     */
  .partner-card.mobile-open .partner-desc {
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    overflow: visible;
  }

  /* Ensure partner-card hover transform doesn't apply on touch */
  .partner-card:hover {
    transform: none;
  }
}

/* ── 6. auth.html: allow body to scroll on mobile ──────────  */
/* auth.html originally sets overflow: hidden on body;
   on short-ish phones with a long form this clips content.  */
@media (max-width: 767px) {
  /* Only for the auth layout; scoped via its unique class    */
  body:has(.auth-layout) {
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  .auth-layout {
    height: auto !important;
    min-height: 100svh;
  }

  .auth-main {
    height: auto !important;
    min-height: 100svh;
  }

  .right {
    padding: 3rem 1.5rem 4rem !important;
    min-height: 100svh;
    overflow-y: visible !important;
  }

  /* Ensure the toggle buttons have ample touch targets       */
  .toggle-btn {
    padding: 1rem 0;
    font-size: 0.68rem !important;
  }
}

/* ── 7. intake.html: safe header on the no-menu page ───────  */
@media (max-width: 767px) {
  /* intake header only has logo + Home btn, so use simple
     space-between layout instead of absolute positioning     */
  .intake-shell {
    margin-top: 5.5rem;
  }

  .intake-card {
    padding: 1.4rem 1.1rem;
  }
}

/* ── 8. Blog page: featured card stacks cleanly on mobile ── */
@media (max-width: 767px) {
  .blog-card-featured {
    grid-column: 1 / -1;        /* already set, keep it */
    display: flex !important;   /* override the grid layout */
    flex-direction: column !important;
  }

  /* Blog placeholder cards: reduce min-height on very small screens */
  .blog-card-placeholder {
    min-height: 180px;
  }
}

/* ── 9. Careers: job card grid forces 1 col cleanly ────────  */
@media (max-width: 767px) {
  .jobs-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* ── 10. General overflow guard for all pages ───────────────  */
@media (max-width: 767px) {
  /* Prevent any element from causing horizontal scroll   */
  section,
  .container,
  main,
  footer {
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Trust banner: ensure 2-col grid doesn't overflow     */
  .trust-banner .stats-grid {
    width: 100%;
    max-width: 100%;
  }

  /* Provider row: tighten padding */
  .provider-row {
    padding-left: 4.5%;
    padding-right: 4.5%;
  }

  /* Quote section on index: ensure it wraps and doesn't push width */
  .text-h2 {
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* Admin table: already has overflow-x: auto at ≤767px,
     but ensure the wrapping element clips as well         */
  .admin-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ── 11. Cookie banner: safe-area bottom on modern iPhones ─  */
@media (max-width: 767px) {
  .cookie-banner {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
}

/* ── 12. Hero descriptor: keep text readable at 375 px ─────  */
@media (max-width: 480px) {
  .hero-descriptor {
    max-width: 100%;
    padding: 0;
  }

  /* Ensure hero CTA button has full touch target             */
  .hero-cta .btn {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* ── 13. Vision section: reduce oversized image height ─────  */
@media (max-width: 767px) {
  .vision-image-wrapper {
    height: 260px;
  }
}

@media (max-width: 480px) {
  .vision-image-wrapper {
    height: 220px;
  }
}

/* ── 14. Section spacing: avoid excessive whitespace ────────  */
@media (max-width: 480px) {
  .partners-section {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }

  .application-section {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
  }
}

/* ── 15. Page hero: consistent padding across pages  ────────  */
@media (max-width: 767px) {
  .page-hero {
    padding-top: 7rem !important;
    padding-bottom: 2.5rem !important;
  }

  .page-hero h1.text-display {
    font-size: clamp(2rem, 9vw, 3rem);
  }
}

@media (max-width: 480px) {
  .page-hero {
    padding-top: 6.4rem !important;
    padding-bottom: 2rem !important;
  }
}

/* Header brand: image-based logo (replaces the two-tone "Stilwater"
   text wordmark). Scoped to <img> direct children, so the footer
   .brand which still contains text + <span> is unaffected. */
.header-logo img,
.brand > img {
  display: block;
  height: 2.4rem;
  width: auto;
}
@media (max-width: 720px) {
  .header-logo img,
  .brand > img {
    height: 2rem;
  }
}

