/**
 * Dogology Theme — Header + Footer + global utilities
 *
 * Replaces Tailwind utility classes in partials/header.php and
 * partials/footer.php with semantic plain CSS so the theme can drop
 * its Tailwind build pipeline. Mirrors the design tokens defined in
 * dogology-tokens.css.
 *
 * Existing JS at assets/js/dogology-custom.js relies on a few utility
 * classes (.hidden, .hamburger-icon, .close-icon) — those are preserved
 * here for compatibility.
 */

/* ============================================================
 * Generic utilities (preserved for JS compatibility)
 * ============================================================ */

.dgl-hidden,
.hidden {
    display: none !important;
}

/* ============================================================
 * Header — solid white sticky bar
 *
 * Pivoted 2026-05-14 from fixed/translucent to sticky/solid-white.
 * Sticky keeps the header in normal flow so it takes its own space
 * above the hero — eliminates the white-spacer-or-body-padding hack
 * that previously created a visible gap between header and hero.
 * Soft two-layer shadow (crisp hairline + diffuse halo) bleeds into
 * the hero below for the "header floats slightly above" cue.
 * ============================================================ */

#dogology-header.main-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #ffffff;
    box-shadow:
        0 1px 0 rgba(15, 23, 42, 0.06),
        0 4px 16px rgba(15, 23, 42, 0.08);
    transition: box-shadow 0.3s ease;
}

/* When the mobile menu is open, the panel sits flush below the header
 * (also white). Suppress the shadow so the two surfaces read as one
 * continuous panel — no visible seam at the header bottom. */
body.mobile-menu-open #dogology-header.main-header {
    box-shadow: none;
}

.dgl-header__container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.dgl-header__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    /* Force header to exactly --dgl-header-h regardless of logo image
     * natural height — guarantees the mobile menu panel (positioned at
     * top: var(--dgl-header-h)) sits flush against the header bottom
     * with no gap showing hero behind. */
    min-height: var(--dgl-header-h);
    box-sizing: border-box;
}

.dgl-header__logo {
    flex-shrink: 0;
}

.dgl-header__logo-link {
    display: block;
    width: 7rem;
}

.dgl-header__logo-link img {
    display: block;
    width: 100%;
    height: auto;
}

/* Desktop nav + actions — hidden below 1024px */
.dgl-header__desktop {
    display: none;
    align-items: center;
    gap: 1rem;
}

@media (min-width: 1024px) {
    .dgl-header__desktop {
        display: flex;
    }
}

.dgl-header__nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.dgl-header__nav-link {
    color: var(--dgl-text-secondary);
    transition: color var(--dgl-transition-base);
    text-decoration: none;
}

.dgl-header__nav-link:hover {
    color: var(--dgl-primary);
}

.dgl-header__nav-link--active {
    color: var(--dgl-primary);
    font-weight: 500;
}

.dgl-header__actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dgl-icon-btn {
    background: transparent;
    border: 0;
    padding: 0.5rem;
    color: var(--dgl-text-secondary);
    cursor: pointer;
    transition: color var(--dgl-transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dgl-icon-btn:hover {
    color: var(--dgl-primary);
}

.dgl-icon-btn svg {
    width: 1.5rem;
    height: 1.5rem;
}

/* CTA buttons in header */
.dgl-header__cta {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--dgl-radius-pill);
    text-decoration: none;
    transition: all var(--dgl-transition-base);
    line-height: 1.4;
}

.dgl-header__cta--outline {
    color: var(--dgl-primary);
    border: 2px solid var(--dgl-primary);
    background: transparent;
}

.dgl-header__cta--outline:hover {
    background: var(--dgl-primary);
    color: var(--dgl-text-inverse);
}

.dgl-header__cta--filled {
    color: var(--dgl-text-inverse);
    background: var(--dgl-gradient);
    border: 2px solid transparent;
}

.dgl-header__cta--filled:hover {
    box-shadow: var(--dgl-shadow-lg);
    color: var(--dgl-text-inverse);
}

/* Mobile menu toggle button */
.dgl-header__mobile-toggle {
    background: transparent;
    border: 0;
    padding: 0.5rem;
    color: var(--dgl-text-secondary);
    cursor: pointer;
    transition: color var(--dgl-transition-base);
}

.dgl-header__mobile-toggle:hover {
    color: var(--dgl-primary);
}

@media (min-width: 1024px) {
    .dgl-header__mobile-toggle {
        display: none;
    }
}

.dgl-header__mobile-toggle svg {
    width: 1.5rem;
    height: 1.5rem;
}

/* Desktop search form (toggled via .hidden) */
#desktop-search-form {
    padding: 1rem 0;
    border-top: 1px solid var(--dgl-border);
}

.dgl-search-row {
    display: flex;
    align-items: center;
    max-width: 42rem;
    margin: 0 auto;
    position: relative; /* anchors .dgl-hs-dropdown */
}

.dgl-search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--dgl-border-strong);
    border-right: 0;
    border-top-left-radius: 0.5rem;
    border-bottom-left-radius: 0.5rem;
    outline: 0;
    transition: border-color var(--dgl-transition-base), box-shadow var(--dgl-transition-base);
    font-family: var(--dgl-font-body);
}

.dgl-search-input:focus {
    border-color: var(--dgl-primary);
    box-shadow: 0 0 0 2px rgba(0, 118, 186, 0.15);
}

.dgl-search-submit {
    padding: 0.75rem 1.5rem;
    background: var(--dgl-gradient);
    color: var(--dgl-text-inverse);
    border: 0;
    border-top-right-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
    cursor: pointer;
    transition: opacity var(--dgl-transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dgl-search-submit:hover {
    opacity: 0.9;
}

.dgl-search-submit svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Mobile menu panel */
#mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

@media (min-width: 1024px) {
    #mobile-menu {
        display: none;
    }
}

#mobile-menu.active {
    opacity: 1;
    pointer-events: auto;
}

#mobile-menu-overlay {
    position: absolute;
    top: var(--dgl-header-h);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.dgl-mobile-menu__panel {
    position: absolute;
    top: var(--dgl-header-h);
    left: 0;
    right: 0;
    background: var(--dgl-bg-white);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    max-height: calc(100vh - var(--dgl-header-h));
    overflow-y: auto;
}

.dgl-mobile-menu__inner {
    padding: 1.5rem;
}

.dgl-mobile-menu__nav {
    margin-bottom: 1.5rem;
}

.dgl-mobile-menu__nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dgl-mobile-menu__nav li + li {
    margin-top: 0.25rem;
}

.dgl-mobile-menu__nav a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--dgl-text-primary);
    border-radius: 0.5rem;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--dgl-transition-base);
}

.dgl-mobile-menu__nav a:hover {
    background: var(--dgl-bg-light);
}

.dgl-mobile-menu__actions {
    padding-top: 1rem;
    border-top: 1px solid var(--dgl-border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dgl-mobile-menu__pill {
    display: flex;
    width: 100%;
    height: 3.5rem;
    align-items: center;
    justify-content: center;
    border-radius: var(--dgl-radius-pill);
    font-weight: 600;
    text-decoration: none;
    transition: all var(--dgl-transition-base);
    font-family: var(--dgl-font-display);
}

.dgl-mobile-menu__pill--outline {
    color: var(--dgl-primary);
    border: 2px solid var(--dgl-primary);
}

.dgl-mobile-menu__pill--outline:hover {
    background: var(--dgl-primary);
    color: var(--dgl-text-inverse);
}

.dgl-mobile-menu__pill--filled {
    color: var(--dgl-text-inverse);
    background: var(--dgl-gradient);
}

.dgl-mobile-menu__pill--filled:hover {
    opacity: 0.92;
    color: var(--dgl-text-inverse);
}

.dgl-mobile-search {
    position: relative;
    width: 100%;
    /* min-height (not height) lets the form grow when the autocomplete
     * dropdown opens below the input. The mobile menu panel already
     * scrolls, so a tall result list is handled naturally. */
    min-height: 3.5rem;
}

.dgl-mobile-search input {
    width: 100%;
    height: 3.5rem;
    padding: 0 3rem 0 1.5rem;
    border: 1px solid var(--dgl-border-strong);
    border-radius: var(--dgl-radius-pill);
    outline: 0;
    font-family: var(--dgl-font-body);
}

.dgl-mobile-search input:focus {
    border-color: var(--dgl-primary);
    box-shadow: 0 0 0 2px rgba(0, 118, 186, 0.15);
}

.dgl-mobile-search button {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    color: var(--dgl-text-muted);
    cursor: pointer;
    transition: color var(--dgl-transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dgl-mobile-search button:hover {
    color: var(--dgl-primary);
}

.dgl-mobile-search button svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Header spacer retired 2026-05-14 — sticky header now takes its own
 * flow space, no offset needed. Rule kept as a no-op safety net in
 * case any cached template still emits the empty <div>. */
.dgl-header-spacer { display: none; }

/* ============================================================
 * Footer Final CTA section
 * ============================================================ */

#dogology-footer-cta {
    background: var(--dgl-gradient);
    padding: 4rem 0;
}

@media (min-width: 768px) {
    #dogology-footer-cta {
        padding: 6rem 0;
    }
}

.dgl-footer-cta__inner {
    max-width: 56rem;
    margin: 0 auto;
    padding: 0 1rem;
    text-align: center;
}

.dgl-footer-cta__heading {
    font-family: var(--dgl-font-display);
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--dgl-text-inverse);
    margin-bottom: 1.5rem;
    line-height: 1.25;
}

@media (min-width: 768px) {
    .dgl-footer-cta__heading {
        font-size: 2.25rem;
    }
}

@media (min-width: 1024px) {
    .dgl-footer-cta__heading {
        font-size: 3rem;
    }
}

.dgl-footer-cta__text {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0 auto 2rem;
    max-width: 36rem;
    line-height: 1.6;
}

@media (min-width: 768px) {
    .dgl-footer-cta__text {
        font-size: 1.25rem;
    }
}

.dgl-footer-cta__buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: center;
}

@media (min-width: 640px) {
    .dgl-footer-cta__buttons {
        flex-direction: row;
    }
}

.dgl-footer-cta__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    font-family: var(--dgl-font-display);
    font-weight: 600;
    border-radius: var(--dgl-radius-pill);
    text-decoration: none;
    transition: all var(--dgl-transition-base);
}

.dgl-footer-cta__btn--solid {
    background: var(--dgl-bg-white);
    color: var(--dgl-primary);
    box-shadow: var(--dgl-shadow-md);
}

.dgl-footer-cta__btn--solid:hover {
    background: #f3f4f6;
    color: var(--dgl-primary);
}

.dgl-footer-cta__btn--ghost {
    background: transparent;
    border: 2px solid var(--dgl-text-inverse);
    color: var(--dgl-text-inverse);
}

.dgl-footer-cta__btn--ghost:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--dgl-text-inverse);
}

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

#dogology-footer {
    background: #111827;
    color: var(--dgl-text-inverse);
}

.dgl-footer__inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 3rem 1rem;
}

@media (min-width: 768px) {
    .dgl-footer__inner {
        padding: 4rem 1rem;
    }
}

.dgl-footer__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

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

@media (min-width: 1024px) {
    .dgl-footer__grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 3rem;
    }
}

.dgl-footer__col-about {
    /* spans 1 col on lg */
}

.dgl-footer__logo-wrap {
    margin-bottom: 1.5rem;
}

.dgl-footer__logo {
    height: 2.5rem;
    width: auto;
    filter: brightness(0) invert(1);
}

.dgl-footer__about {
    color: #9ca3af;
    font-size: 0.875rem;
    line-height: 1.625;
    margin-bottom: 1.5rem;
}

.dgl-footer__heading {
    font-family: var(--dgl-font-display);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dgl-text-inverse);
    margin-bottom: 1rem;
}

.dgl-footer__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dgl-footer__list a {
    color: #9ca3af;
    font-size: 0.875rem;
    text-decoration: none;
    transition: color var(--dgl-transition-base);
}

.dgl-footer__list a:hover {
    color: var(--dgl-text-inverse);
}

.dgl-footer__contact {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dgl-footer__contact-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.dgl-footer__contact-item svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.dgl-footer__contact-item .icon-teal { color: var(--dgl-secondary); }
.dgl-footer__contact-item .icon-line { color: #00B900; }

.dgl-footer__contact-item a,
.dgl-footer__contact-item span {
    color: #9ca3af;
    font-size: 0.875rem;
    text-decoration: none;
    transition: color var(--dgl-transition-base);
}

.dgl-footer__contact-item a:hover {
    color: var(--dgl-text-inverse);
}

.dgl-footer__contact-line a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Social icons */
.dgl-footer__social {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dgl-footer__social-icon {
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #1f2937;
    border-radius: 50%;
    color: var(--dgl-text-inverse);
    transition: background var(--dgl-transition-base);
}

.dgl-footer__social-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.dgl-footer__social-icon--facebook:hover { background: #1877F2; }
.dgl-footer__social-icon--instagram:hover {
    background: linear-gradient(45deg, #facc15, #ef4444 50%, #a855f7);
}
.dgl-footer__social-icon--youtube:hover { background: #FF0000; }
.dgl-footer__social-icon--line:hover { background: #00B900; }

/* =====================================================================
 * Mobile (<768px): center every footer column's content. The grid
 * collapses to one column at this width, so individual columns reading
 * left-aligned creates an awkward narrow text rail. Centering balances
 * the layout. Reverts to default (left-aligned) at ≥768px where columns
 * sit side-by-side.
 * ===================================================================== */
@media (max-width: 767px) {
    .dgl-footer__grid {
        text-align: center;
    }
    .dgl-footer__logo-wrap,
    .dgl-footer__social {
        justify-content: center;
        display: flex;
    }
    .dgl-footer__list {
        align-items: center;
    }
    .dgl-footer__contact {
        align-items: center;
    }
    .dgl-footer__contact-item {
        justify-content: center;
    }
}

/* Copyright bar */
.dgl-footer__copyright {
    border-top: 1px solid #1f2937;
    margin-top: 3rem;
    padding-top: 2rem;
}

.dgl-footer__copyright-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    color: #6b7280;
    font-size: 0.875rem;
    gap: 1rem;
}

@media (min-width: 768px) {
    .dgl-footer__copyright-inner {
        flex-direction: row;
        gap: 0;
    }
}

.dgl-footer__copyright p {
    margin: 0;
}

.dgl-footer__legal {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.dgl-footer__legal a {
    color: #6b7280;
    text-decoration: none;
    transition: color var(--dgl-transition-base);
}

.dgl-footer__legal a:hover {
    color: var(--dgl-text-inverse);
}

/* Back to top */
#back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3rem;
    height: 3rem;
    background: var(--dgl-gradient);
    color: var(--dgl-text-inverse);
    border: 0;
    border-radius: 50%;
    box-shadow: var(--dgl-shadow-lg);
    opacity: 0;
    visibility: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 40;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#back-to-top:hover {
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

#back-to-top svg {
    width: 1.5rem;
    height: 1.5rem;
}

#back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
}

/* ============================================================
 * Header Search Autocomplete dropdown
 * Anchored absolutely below [data-search-form] (which is
 * position: relative). Compact result rows with thumb + title.
 * Used by both desktop revealed-form and mobile in-menu form.
 * ============================================================ */

.dgl-hs-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 60;
    background: #ffffff;
    border: 1px solid var(--dgl-border);
    border-radius: 12px;
    box-shadow:
        0 1px 0 rgba(15, 23, 42, 0.04),
        0 12px 32px rgba(15, 23, 42, 0.12);
    overflow: hidden;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}

.dgl-hs-dropdown[hidden] {
    display: none;
}

.dgl-hs-results {
    list-style: none;
    margin: 0;
    padding: 4px;
    overflow-y: auto;
    flex: 1;
}

.dgl-hs-result {
    margin: 0;
}

.dgl-hs-result > a {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--dgl-ink);
    transition: background 0.15s ease;
}

.dgl-hs-result > a:hover,
.dgl-hs-result.is-active > a {
    background: rgba(0, 171, 142, 0.06);
}

.dgl-hs-result__thumb {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--dgl-bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dgl-hs-result__thumb img,
.dgl-hs-result__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.dgl-hs-result__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dgl-hs-result__cat {
    font-family: var(--dgl-font-display);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--dgl-secondary);
    line-height: 1;
}

.dgl-hs-result__title {
    font-family: var(--dgl-font-body);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--dgl-ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dgl-hs-loading,
.dgl-hs-empty {
    list-style: none;
    padding: 16px 12px;
    text-align: center;
    color: var(--dgl-text-muted);
    font-family: var(--dgl-font-body);
    font-size: 0.9rem;
}

.dgl-hs-seeall {
    display: block;
    padding: 12px 14px;
    background: var(--dgl-bg-light);
    border-top: 1px solid var(--dgl-border);
    font-family: var(--dgl-font-display);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dgl-primary);
    text-decoration: none;
    text-align: center;
    transition: background 0.15s ease;
}

.dgl-hs-seeall:hover {
    background: rgba(0, 118, 186, 0.06);
}

/* Mobile: render the dropdown in normal document flow below the input
 * (not absolutely positioned). The form's parent (the mobile menu panel)
 * is already a scrollable column, so the results extend naturally and
 * the panel scroll handles overflow — no artificial max-height cap, no
 * "trapped inside the search row" feeling. */
.dgl-hs-dropdown--mobile {
    position: static;
    margin-top: 10px;
    max-height: none;
    box-shadow: none;
    border-color: var(--dgl-border);
}

/* Inner results list can scroll independently if it gets very long, but
 * we let it grow up to a generous cap before that kicks in. */
.dgl-hs-dropdown--mobile .dgl-hs-results {
    max-height: none;
}
