/*
 * Savvy Child — Base Element Styles
 *
 * Element-level defaults that use tokens. Page-specific or component-specific
 * styles live in their own files (e.g. components/hero.css). Anything you
 * style here should consume token variables, never raw values.
 *
 * Rule: if you want to write a hex code here, stop. Either it's a new token
 * (add to tokens.css) or it should reference an existing token.
 */

/* ─── Body & Type ──────────────────────────────────────────────── */

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text-default);
  background-color: var(--surface-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-default);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  font-weight: var(--fw-bold);
  margin-top: 0;
}

h1, h2 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

h3, h4, h5, h6 { font-family: var(--font-sans); }

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
h5 { font-size: var(--fs-md); }
h6 {
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-uppercase);
  color: var(--text-muted);
}

input,
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="month"],
input[type="week"],
input[type="time"],
input[type="datetime"],
input[type="datetime-local"],
select,
textarea {
  --ast-form-input-text: var(--text-default);
  --ast-form-input-focus-text: var(--text-default);
  --ast-form-input-bg: var(--surface-base);
  --ast-form-input-border: var(--border-default);
  --ast-form-input-focus-border: var(--brand-primary);
  --ast-form-input-placeholder-color: var(--text-muted);
  color: var(--text-default);
  border-color: var(--border-default);
}

input:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-primary);
}

::placeholder { color: var(--text-muted); opacity: 1; }

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

/* ─── Links ────────────────────────────────────────────────────── */

a {
  color: var(--text-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--text-link-hover);
}

/* ─── Buttons (used in CTAs everywhere) ────────────────────────── */

.btn,
button.savvy-btn,
.wp-block-button__link.savvy-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  line-height: 1;
  text-decoration: none;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn--primary {
  background-color: var(--brand-accent);
  color: var(--text-on-dark);
}
.btn--primary:hover {
  background-color: var(--brand-accent-hover);
  color: var(--text-on-dark);
}

.btn--secondary {
  background-color: transparent;
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}
.btn--secondary:hover {
  background-color: var(--brand-primary);
  color: var(--text-on-dark);
}

.btn--secondary.btn--on-dark {
  color: var(--text-on-dark);
  border-color: var(--text-on-dark);
}
.btn--secondary.btn--on-dark:hover {
  background-color: var(--text-on-dark);
  color: var(--brand-primary);
}

/* ─── Dark sections (footer, hero overlay) ─────────────────────── */

.surface-inverse {
  background-color: var(--surface-inverse);
  color: var(--text-on-dark);
}
.surface-inverse h1,
.surface-inverse h2,
.surface-inverse h3,
.surface-inverse h4,
.surface-inverse h5,
.surface-inverse h6 {
  color: var(--text-on-dark);
}
.surface-inverse a {
  color: var(--text-on-dark);
}

/* ─── Alt surface ──────────────────────────────────────────────── */

.surface-alt {
  background-color: var(--surface-alt);
}

/* ─── Trust strip (badges below hero) ──────────────────────────── */

.savvy-trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  justify-content: center;
  align-items: center;
  padding: var(--space-5) var(--container-padding);
  background-color: var(--surface-alt);
  border-top: 1px solid var(--border-default);
  border-bottom: 1px solid var(--border-default);
}
.savvy-trust-strip img {
  height: 48px;
  width: auto;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}
.savvy-trust-strip img:hover {
  opacity: 1;
}

/* ─── Section spacing ──────────────────────────────────────────── */

.savvy-section {
  padding-top: var(--space-9);
  padding-bottom: var(--space-9);
}
@media (max-width: 768px) {
  .savvy-section {
    padding-top: var(--space-7);
    padding-bottom: var(--space-7);
  }
}

/* ─── Container ────────────────────────────────────────────────── */

.savvy-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

/* ─── Header site-identity overrides ────────────────────────────── */

/* When a custom logo is set, hide the redundant site-title and tagline.
   The wordmark logo already contains the brand name. Visually-hidden via
   clip so it stays available to screen readers + structured data.
   Sibling selector — only hides when the logo image is actually present. */
.site-logo-img ~ .ast-site-title-wrap,
.site-logo-img ~ .site-description {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: -1px;
}


/* ─── Astra container override (full-bleed sections) ────────────────
   PROBLEM: Astra + this child theme have a three-layer wrapper cascade
   between <body> and each .savvy-X section. ANY one of them enforcing a
   max-width clamps every section below it, producing visible side gutters
   even when section CSS sets full-width backgrounds.

   THE CASCADE:
     <html> → <body>
       └─ #page                              (Astra outer)
          └─ #content.site-content           (Astra content wrapper)
             └─ div.ast-container            (Astra max-width 1200px + padding)
                └─ <main class="savvy-page"> (still 1200px, intermediate)
                   └─ <section class="savvy-X"> (the actual section we author)
                      └─ .savvy-X__inner       (the intentional 1200px cap)

   THE PRINCIPLE: .savvy-X__inner is the ONLY layer that should cap width
   (for readable content centerline). Everything above it must be 100%
   so section backgrounds extend edge-to-edge.

   THE TRAP: opening .ast-container alone leaves <main class="savvy-page">
   clamped — every section still renders 1200px wide with a ~161px right
   gutter at 1361px viewports. Cowork DOM-walk audit 2026-05-20 caught
   this; the override below opens all three upstream layers + main itself.

   DEBUG RECIPE if a gutter reappears: in DevTools, walk up from a
   .savvy-X section and check computed max-width on every ancestor.
   First ancestor under 100% is the culprit; add it to the selector list.

   SCOPE: main content only. Header + footer ast-containers stay
   constrained (they're built to be 1200px-aligned with the content). */
.ast-plain-container.ast-no-sidebar #primary,
.ast-plain-container.ast-no-sidebar #content,
#content,
#content > .ast-container,
.ast-plain-container #content > .ast-container,
.ast-plain-container.ast-no-sidebar #content > .ast-container,
main.savvy-page,
.ast-container > main,
.ast-container > main.savvy-page {
  max-width: 100% !important;
  width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Prevent any rogue child element from creating horizontal scroll */
html, body {
  overflow-x: hidden;
}
