/**
 * GDH Starter – Theme Layout CSS
 *
 * Header variants:  A (classic), B (centred), C (dark), D (split)
 * Footer variants:  A (multi-col), B (minimal), C (three-zone), D (compact bar)
 *
 * Default: Header A + Footer A
 * Switch by changing the class on <header> and <footer> in the PHP templates.
 *
 * Uses design-system tokens wherever possible.
 */

/* ============================================
   MINIMAL RESET
   Kill browser defaults that fight token-driven spacing.

   Layered into @layer reset (v3 master defines the layer order) so these
   defaults lose to master's component rules, as a reset should. Unlayered,
   they beat EVERY @layer rule — e.g. `svg { display: block }` overrode
   .site-nav__caret's `inline-block` (nav chevron wrapped below its label)
   and `h1-h6 { margin-top: 0 }` overrode master's prose heading spacing.
   Kept (rather than deleted) for consumers pairing theme-layout with a
   pre-v3 master that ships no reset of its own.
   ============================================ */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body { margin: 0; }
  h1, h2, h3, h4, h5, h6 { margin-top: 0; }
  img, svg { display: block; max-width: 100%; }
}

/* ============================================
   SKIP TO CONTENT (accessibility)
   ============================================ */
.skip-to-content {
    position: absolute;
    top: -100%;
    left: var(--space-4);
    z-index: 9999;
    padding: var(--space-2) var(--space-4);
    background: var(--brand-accent-text);
    color: var(--text-heading-on-dark);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: top 0.2s ease;
}

.skip-to-content:focus {
    top: var(--space-2);
    outline: 2px solid var(--brand-accent-text);
    outline-offset: 2px;
}

/* ============================================
   CONTAINER (modernized v3.7.2)
   ============================================
   Pre-v3.7.2 this rule used `width: 85%` + a max-width with a mobile
   @media bumping to 90%. That was the legacy WordPress / Divi pattern
   — proportional gutters that varied with viewport width. It made
   .container diverge from master's own .site-nav__inner (which uses
   `max-inline-size + padding-inline + margin-inline: auto`), so
   nav-and-section content edges never aligned except by accident
   at ≥1400px viewports.

   v3.7.2 switches .container to match master's canonical pattern:
   max-inline-size + fixed padding-inline. Result: .container and
   .site-nav__inner content edges align at every viewport. Fixed
   gutter behaviour is the modern norm (Stripe, Linear, Vercel,
   Tailwind defaults). Drops the mobile-bump @media — `padding-inline`
   at a constant 1.5rem already gives sensible mobile gutters.

   Token fix: --layout-max-width was a non-existent token (fallback
   1400px was what actually resolved). Master's canonical name is
   --layout-max. Fixed while we're here.

   Breaking-change note: any consumer that relied on the previous
   85%-proportional-gutter behaviour will see narrower content +
   wider gutters at non-1400px viewports after this change. Project-
   layer override to recover the legacy behaviour:
     @layer overrides {
       .container { width: 85%; padding-inline: 0; }
       @media (max-width: 768px) {
         .container { width: 90%; }
       }
     }

   v3.16.0: master now ships the canonical .container (section 40.0,
   same metrics, gutter tokenized as --space-md). This copy stays for
   consumers pairing theme-layout with an older master; keep the two
   in sync if either changes.
   ============================================ */
.container {
    max-inline-size: var(--layout-max);
    padding-inline: var(--space-md);
    margin-inline: auto;
}

/* ============================================
   SITE LOGO (shared)
   ============================================ */
.site-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.site-logo img,
.site-logo .custom-logo {
    max-height: 40px;
    width: auto;
}

.site-title {
    font-size: var(--text-lg);
    font-weight: var(--font-weight-bold);
    color: var(--text-heading);
    line-height: 1;
}

/* ============================================
   NAVIGATION (shared)
   ============================================ */
.site-nav .nav-list {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-nav .nav-list li {
    position: relative;
}

.site-nav .nav-list li a {
    display: block;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-body);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
}

.site-nav .nav-list li a:hover,
.site-nav .nav-list li.current-menu-item > a {
    background: var(--surface-light);
    color: var(--brand-accent-text);
}

/* Dropdown / sub-menu */
.site-nav .nav-list .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--surface-white);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-base);
    box-shadow: var(--shadow-md);
    padding: var(--space-2);
    min-width: 200px;
    list-style: none;
    z-index: var(--z-dropdown);
}

.site-nav .nav-list li:hover > .sub-menu {
    display: block;
}

.site-nav .nav-list .sub-menu a {
    font-size: var(--text-sm);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
}

/* Nav CTA button */
.nav-cta {
    display: inline-block;
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-heading-on-dark);
    background: var(--brand-accent-text);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: opacity 0.15s;
    margin-left: var(--space-2);
}

.nav-cta:hover { opacity: 0.9; }

.nav-cta--white {
    background: var(--surface-white);
    color: var(--text-heading);
}

.nav-cta--white:hover {
    opacity: 0.9;
}

/* ============================================
   NAV TOGGLE (MOBILE – shared)
   ============================================ */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-2);
    flex-direction: column;
    gap: 5px;
    z-index: calc(var(--z-sticky) + 1);
}

.nav-toggle__bar {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-heading);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hamburger → X animation */
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ============================================
   HEADER VARIANTS — mobile fallbacks
   ============================================ */
@media (max-width: 768px) {
    /* Header variants B and D fall back to a simple flex row on mobile. */
    .site-header--b .site-header__inner,
    .site-header--d .site-header__inner {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
    }

    .site-header--d .nav-left,
    .site-header--d .nav-right {
        display: none;
    }
}


/* ============================================
   HEADER – SHARED BASE
   ============================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    transition: box-shadow 0.2s ease;
}

.admin-bar .site-header {
    top: 32px;
}

@media screen and (max-width: 782px) {
    .admin-bar .site-header {
        top: 46px;
    }
}

.site-header.is-scrolled {
    box-shadow: var(--shadow-sm);
}


/* ============================================
   HEADER A – Classic (logo left, nav right)
   ============================================ */
.site-header--a {
    background: var(--surface-white);
    border-bottom: 1px solid var(--border-subtle);
}

.site-header--a .site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    gap: var(--space-6);
}

.site-header--a .nav-right {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}


/* ============================================
   HEADER B – Centred (logo above, nav below)
   ============================================ */
.site-header--b {
    background: var(--surface-white);
    border-bottom: 1px solid var(--border-subtle);
    text-align: center;
}

.site-header--b .site-header__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: var(--space-5);
    padding-bottom: var(--space-4);
    gap: var(--space-3);
}

.site-header--b .site-nav .nav-list {
    justify-content: center;
}

.site-header--b .site-logo img,
.site-header--b .site-logo .custom-logo {
    max-height: 48px;
}


/* ============================================
   HEADER C – Dark bar (logo left, nav right)
   ============================================ */
.site-header--c {
    background: var(--surface-dark);
    border-bottom: none;
}

.site-header--c .site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    gap: var(--space-6);
}

.site-header--c .site-title {
    color: var(--text-heading-on-dark);
}

.site-header--c .site-nav .nav-list li a {
    color: hsla(0, 0%, 100%, 0.7);
}

.site-header--c .site-nav .nav-list li a:hover,
.site-header--c .site-nav .nav-list li.current-menu-item > a {
    background: hsla(0, 0%, 100%, 0.1);
    color: var(--text-heading-on-dark);
}

.site-header--c .nav-toggle__bar {
    background: var(--text-heading-on-dark);
}

.site-header--c .nav-cta {
    background: var(--surface-white);
    color: var(--text-heading);
}


/* ============================================
   HEADER D – Split (nav left, logo centre, nav right)
   ============================================ */
.site-header--d {
    background: var(--surface-white);
    border-bottom: 1px solid var(--border-subtle);
}

.site-header--d .site-header__inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    min-height: 72px;
    gap: var(--space-4);
}

.site-header--d .nav-left .nav-list {
    justify-content: flex-end;
}

.site-header--d .nav-right .nav-list {
    justify-content: flex-start;
}

.site-header--d .site-logo {
    justify-self: center;
}


/* ============================================
   FOOTER – SHARED BASE
   ============================================ */
.site-footer {
    margin-top: auto;
}

/* "Built by GDH" credit logo */
.credit-logo {
    height: 14px;
    width: auto;
    vertical-align: middle;
    opacity: 0.55;
    transition: opacity 0.15s;
}

.credit-logo:hover {
    opacity: 0.85;
}

.credit-logo--dark {
    height: 14px;
    width: auto;
    vertical-align: middle;
    opacity: 0.45;
    transition: opacity 0.15s;
}

.credit-logo--dark:hover {
    opacity: 0.7;
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-4);
    padding-top: var(--space-6);
    font-size: var(--text-xs);
}


/* ============================================
   FOOTER A – Multi-column dark
   ============================================ */
.site-footer--a {
    background: var(--surface-dark);
    color: var(--text-on-dark);
    padding: var(--space-12) 0 var(--space-8);
}

.site-footer--a .footer-cols {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--space-8);
}

.site-footer--a .footer-cols h4 {
    color: var(--text-heading-on-dark);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-3);
}

.site-footer--a .footer-cols ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-footer--a .footer-cols li {
    margin-bottom: var(--space-2);
}

.site-footer--a .footer-cols a {
    color: hsla(0, 0%, 100%, 0.6);
    font-size: var(--text-sm);
    text-decoration: none;
    transition: color 0.15s;
}

.site-footer--a .footer-cols a:hover {
    color: var(--text-heading-on-dark);
}

.site-footer--a .brand-col p {
    color: hsla(0, 0%, 100%, 0.5);
    font-size: var(--text-sm);
    line-height: 1.6;
    margin-top: var(--space-3);
}

.site-footer--a .footer-bottom {
    border-top: 1px solid hsla(0, 0%, 100%, 0.1);
    margin-top: var(--space-8);
    color: hsla(0, 0%, 100%, 0.4);
}

@media (max-width: 768px) {
    .site-footer--a .footer-cols {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .site-footer--a .footer-cols {
        grid-template-columns: 1fr;
    }
}


/* ============================================
   FOOTER B – Minimal centred
   ============================================ */
.site-footer--b {
    background: var(--surface-white);
    border-top: 1px solid var(--border-subtle);
    padding: var(--space-8) 0;
    text-align: center;
}

.site-footer--b .footer-nav-list {
    display: flex;
    justify-content: center;
    gap: var(--space-6);
    list-style: none;
    margin: 0 0 var(--space-4) 0;
    padding: 0;
}

.site-footer--b .footer-nav-list a {
    font-size: var(--text-sm);
    color: var(--text-body);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
    transition: color 0.15s;
}

.site-footer--b .footer-nav-list a:hover {
    color: var(--brand-accent-text);
}

.site-footer--b .footer-copy {
    font-size: var(--text-xs);
    color: var(--text-body-muted);
    margin: 0;
}


/* ============================================
   FOOTER C – Three-zone dark (brand + links + newsletter)
   ============================================ */
.site-footer--c {
    background: var(--surface-dark);
    color: var(--text-on-dark);
    padding: var(--space-12) 0 var(--space-8);
}

.site-footer--c .footer-top {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: var(--space-10);
    margin-bottom: var(--space-10);
    align-items: start;
}

.site-footer--c .footer-top h4 {
    color: var(--text-heading-on-dark);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-4);
}

.site-footer--c .brand-intro p {
    color: hsla(0, 0%, 100%, 0.45);
    font-size: var(--text-sm);
    line-height: 1.7;
    margin-top: var(--space-4);
    max-width: 280px;
}

.site-footer--c .footer-link-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-footer--c .footer-link-col li {
    margin-bottom: var(--space-3);
}

.site-footer--c .footer-link-col a {
    color: hsla(0, 0%, 100%, 0.6);
    font-size: var(--text-sm);
    text-decoration: none;
    transition: color 0.15s;
}

.site-footer--c .footer-link-col a:hover {
    color: var(--text-heading-on-dark);
}

.site-footer--c .newsletter-text {
    color: hsla(0, 0%, 100%, 0.45);
    font-size: var(--text-sm);
    line-height: 1.6;
    margin-bottom: var(--space-4);
}

.site-footer--c .newsletter-form {
    display: flex;
    gap: var(--space-2);
}

.site-footer--c .newsletter-form input {
    flex: 1;
    padding: 10px var(--space-3);
    border: 1px solid hsla(0, 0%, 100%, 0.15);
    border-radius: var(--radius-sm);
    background: hsla(0, 0%, 100%, 0.06);
    color: var(--text-heading-on-dark);
    font-size: var(--text-sm);
    outline: none;
    transition: border-color 0.15s;
}

.site-footer--c .newsletter-form input:focus {
    border-color: hsla(0, 0%, 100%, 0.35);
}

.site-footer--c .newsletter-form input::placeholder {
    color: hsla(0, 0%, 100%, 0.25);
}

.site-footer--c .newsletter-form button {
    padding: 10px var(--space-5);
    background: var(--brand-accent-text);
    color: var(--text-heading-on-dark);
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.15s;
}

.site-footer--c .newsletter-form button:hover {
    opacity: 0.9;
}

.site-footer--c .footer-bottom {
    border-top: 1px solid hsla(0, 0%, 100%, 0.08);
    color: hsla(0, 0%, 100%, 0.35);
}

@media (max-width: 768px) {
    .site-footer--c .footer-top {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .site-footer--c .footer-top {
        grid-template-columns: 1fr;
    }
}


/* ============================================
   FOOTER D – Compact brand bar
   ============================================ */
.site-footer--d {
    background: var(--brand-secondary);
    color: var(--text-heading-on-dark);
    padding: var(--space-6) 0;
}

.site-footer--d .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.site-footer--d .footer-nav-list {
    display: flex;
    gap: var(--space-5);
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-footer--d .footer-nav-list a {
    color: hsla(0, 0%, 100%, 0.7);
    font-size: var(--text-sm);
    text-decoration: none;
    transition: color 0.15s;
}

.site-footer--d .footer-nav-list a:hover {
    color: var(--text-heading-on-dark);
}

.site-footer--d .footer-copy {
    font-size: var(--text-xs);
    color: hsla(0, 0%, 100%, 0.5);
    margin: 0;
}

.site-footer--d .site-logo .site-title {
    color: var(--text-heading-on-dark);
    font-size: var(--text-sm);
}

@media (max-width: 768px) {
    .site-footer--d .container {
        flex-direction: column;
        text-align: center;
    }

    .site-footer--d .footer-nav-list {
        justify-content: center;
    }
}


/* ============================================
   PAGE FLOW
   ============================================ */
.site-content {
    min-height: calc(100vh - 72px - 200px);
}

body.page .site-content {
    /* No max-width constraint — your pasted HTML controls its own layout */
}

/* Entry content defaults for blog posts */
.entry-content {
    line-height: var(--leading-relaxed);
}

.entry-content > * + * {
    margin-top: var(--space-4);
}

.entry-content h2 {
    margin-top: var(--space-10);
    font-size: var(--text-2xl);
}

.entry-content h3 {
    margin-top: var(--space-8);
    font-size: var(--text-xl);
}

.entry-content img {
    border-radius: var(--radius-base);
    max-width: 100%;
    height: auto;
}

.entry-content blockquote {
    border-left: 4px solid var(--brand-accent);
    padding-left: var(--space-4);
    color: var(--text-body-muted);
    font-style: italic;
}
