/* =========================================
   1. VARIABLES & RESET (Global)
   ========================================= */
:root {
    --color-bg: #FDFBF7;
    --color-bg-alt: #E8DCC8;
    --color-primary: #2D5016;
    --color-secondary: #4A7C2E;
    --color-accent: #2c5f6f;
    --color-text-main: #2D3748;
    --color-text-light: #F7FAFC;
    --color-white: #ffffff;

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

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

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

    --radius-md: 8px;
    --radius-lg: 16px;

    --transition-fast: 0.2s ease;
    --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    height: 100%;
}

body {
    font-family: var(--font-body);
    color: var(--color-text-main);
    background-color: var(--color-bg);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    /* Changed from height: 100% for better scroll behavior */
    display: flex;
    flex-direction: column;
}

ul {
    list-style: none;
}

/* Updated to ensure images behave well in flex containers */
img {
    max-width: 100%;
    display: block;
    height: auto;
    width: auto;
    /* Explicit auto width helpful for Safari */
}

/* Main takes up remaining space */
main {
    flex: 1 0 auto;
    width: 100%;
}

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

/* Accessibility */
a:focus,
button:focus,
.btn:focus {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

.skip-to-main {
    position: absolute;
    left: -9999px;
    z-index: 999;
    padding: 1em;
    background: var(--color-accent);
    color: white;
}

.skip-to-main:focus {
    left: 50%;
    transform: translateX(-50%);
    top: 10px;
}

/* =========================================
   2. TYPOGRAPHY & UTILITIES (Global Base)
   ========================================= */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--color-primary);
    line-height: 1.2;
    margin-bottom: var(--spacing-sm);
}

h1 {
    font-size: 3rem;
    font-weight: 700;
}

h2 {
    font-size: 2.25rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

p {
    margin-bottom: var(--spacing-sm);
    font-size: 1.05rem;
    color: #4A5568;
}

.container {
    width: 90%;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

.section {
    padding: 5rem 0;
}

/* Buttons Global */
.btn {
    display: inline-block;
    padding: 12px 28px;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 50px;
    transition: var(--transition-smooth);
    cursor: pointer;
    text-align: center;
}

.btn-primary {
    background: var(--color-accent);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: #1e4450;
}

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

.btn-outline:hover {
    background: var(--color-primary);
    color: white;
}

/* Phone Reveal Global */
.phone-reveal {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 4px;
    transition: var(--transition-smooth);
}

.phone-reveal .number-text {
    display: none;
}

.phone-reveal:hover {
    text-decoration: none;
}

.phone-reveal:hover .click-text {
    display: none;
}

.phone-reveal:hover .number-text {
    display: inline;
    color: var(--color-primary);
    font-weight: 700;
    padding: 0 4px;
    background: rgba(220, 237, 200, 0.4);
    border-radius: 4px;
}

/* =========================================
   3. COMPONENT BASICS (Shared)
   ========================================= */
/* Header */
header {
    background: rgba(253, 251, 247, 0.95);
    backdrop-filter: blur(10px);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-sm) 0;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--color-primary);
}

.logo img {
    height: 50px;
    width: auto;
}

/* Mobile Menu Toggle (Base Hidden) */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

.hamburger-line {
    width: 28px;
    height: 3px;
    background: var(--color-primary);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Footer */
footer {
    background: linear-gradient(135deg, #2d1810 0%, #3a1f18 50%, #2d1810 100%);
    color: white;
    padding: var(--spacing-lg) 0 var(--spacing-md);
    margin-top: auto;
}

.footer-logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.copyright {
    margin-top: var(--spacing-lg);
    font-size: 0.9rem;
    opacity: 0.7;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: var(--spacing-md);
    width: 100%;
    text-align: center;
}

/* Cards & Sections */
.location-cards-stacked {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.location-wide-card,
.service-card,
.policy-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
}

.promo-badge {
    background: rgba(255, 255, 255, 0.9);
    border: 3px solid var(--color-accent);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    text-align: center;
    box-shadow: var(--shadow-md);
}

.service-image img {
    transition: transform 0.6s ease;
}

.service-card:hover .service-image img {
    transform: scale(1.05);
}

/* =========================================
   4. DESKTOP LAYOUT (Strict Separation)
   ========================================= */
@media (min-width: 481px) {

    /* Nav */
    .nav-links {
        display: flex;
        align-items: center;
        gap: var(--spacing-md);
    }

    .nav-links a.nav-item {
        font-weight: 500;
        color: var(--color-primary);
        font-size: 1rem;
    }

    .nav-links a.nav-item:hover {
        color: #ff3333;
    }

    /* Hero */
    .hero {
        margin-top: 80px;
        padding: var(--spacing-md) 0 var(--spacing-xl);
    }

    .hero-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-lg);
        max-width: 960px;
    }

    .hero-image {
        width: 100%;
        max-width: 960px;
        display: block;
        /* Changed from flex for Safari stability */
        margin: 0 auto;
    }

    .hero-image img {
        width: 100%;
        height: auto;
    }

    .hero-text {
        text-align: center;
        max-width: 800px;
        padding: 0 var(--spacing-md);
    }

    .hero-buttons {
        display: flex;
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Spacers */
    .section-spacer {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 6.75rem 0;
    }

    .section-spacer img {
        width: 180px;
        max-width: 180px;
        opacity: 0.7;
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    }

    /* Service Card (Row Layout) */
    .services-grid {
        display: flex;
        flex-direction: column;
        gap: var(--spacing-lg);
        max-width: 900px;
        margin: 0 auto;
    }

    .service-card {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        gap: var(--spacing-md);
        padding: var(--spacing-md);
        min-height: 300px;
    }

    .service-image {
        flex-shrink: 0;
        width: 300px;
        height: 300px;
        border-radius: var(--radius-md);
        overflow: hidden;
        aspect-ratio: 1/1;
    }

    .service-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .service-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .service-links {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        margin-top: auto;
    }

    /* Promo Content (Row Layout) */
    .promo-content {
        display: flex;
        gap: var(--spacing-lg);
        align-items: center;
        max-width: 960px;
        margin: 0 auto;
        flex-direction: row;
    }

    .promo-image {
        flex: 1;
        min-width: 300px;
    }

    .promo-image img {
        width: 100%;
        height: auto;
    }

    .promo-text {
        flex: 1.2;
        min-width: 300px;
    }

    /* Location Cards */
    .location-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .map-links-centered {
        display: flex;
        gap: var(--spacing-sm);
        justify-content: center;
        flex-wrap: wrap;
    }

    .map-links-centered .btn {
        min-width: 180px;
    }

    .location-wide-card {
        padding: 1rem 1.25rem;
        text-align: left;
    }

    /* Grid layout for Finding Us / Contact */
    .location-wide-card div[style*="grid-template-columns: 1fr 1fr"] {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    /* Footer */
    .footer-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: var(--spacing-md);
    }

    .footer-nav {
        display: flex;
        gap: var(--spacing-md);
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Policy Grid */
    .policy-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 3rem;
        max-width: 900px;
        margin: 0 auto;
    }
}

/* =========================================
   5. MOBILE LAYOUT (Strict Separation)
   ========================================= */
@media (max-width: 480px) {

    /* Responsive Typography */
    h1 {
        font-size: 2.25rem;
    }

    h2 {
        font-size: 2rem;
    }

    h3 {
        font-size: 1.35rem;
    }

    p {
        font-size: 1rem;
    }

    /* Nav Mobile (Drawer) */
    .mobile-menu-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 76px;
        left: 0;
        right: 0;
        background-color: var(--color-bg);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: var(--spacing-md);
        box-shadow: var(--shadow-lg);
        transform: translateX(100%);
        transition: transform 0.3s ease;
        max-height: calc(100vh - 76px);
        overflow-y: auto;
    }

    .nav-links.active {
        transform: translateX(0);
    }

    .nav-links a.nav-item,
    .nav-links .spwidget-button {
        padding: var(--spacing-sm) 0;
        border-bottom: 1px solid rgba(45, 80, 22, 0.1);
        text-align: center;
        font-size: 1.1rem;
        display: block;
    }

    .nav-links .spwidget-button {
        margin-top: var(--spacing-sm);
        border-bottom: none;
    }

    body.menu-open {
        overflow: hidden;
    }

    /* Hero Mobile */
    .hero {
        margin-top: 80px;
        padding: var(--spacing-md) 0;
    }

    .hero-content {
        display: flex;
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .hero-text h1 {
        font-size: 2rem;
    }

    .hero-buttons {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .hero-buttons a {
        width: 100%;
        text-align: center;
    }

    /* Services Mobile (Column) */
    .services-grid {
        display: flex;
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .service-card {
        display: flex;
        flex-direction: column;
        padding: var(--spacing-md);
        gap: 1rem;
    }

    /* Square Image Enforcement */
    .service-image {
        width: 100%;
        aspect-ratio: 1/1;
        height: auto;
        border-radius: var(--radius-md);
        overflow: hidden;
    }

    .service-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .service-content {
        display: flex;
        flex-direction: column;
    }

    .service-links {
        margin-top: 1rem;
    }

    .service-links a {
        min-height: 44px;
        padding: var(--spacing-xs) 0;
    }

    /* Promo Mobile (Image Top) */
    .promo-content {
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }

    /* Strict column = Image First */
    .promo-image,
    .promo-text {
        min-width: 100%;
    }

    .promo-badge p:nth-child(2) {
        font-size: 2rem !important;
    }

    /* Reduced Spacer */
    .section-spacer {
        display: flex;
        justify-content: center;
        padding: 2rem 0;
    }

    .section-spacer img {
        width: 90px;
        max-width: 90px;
        height: auto;
        opacity: 0.7;
    }

    /* Location / Footer Mobile (Stacked) */
    .location-container {
        padding: 0 var(--spacing-sm);
    }

    .map-links-centered {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .map-links-centered .btn {
        width: 100%;
    }

    /* Explicit Stacking for Grids */
    .mobile-stack {
        grid-template-columns: 1fr !important;
    }

    /* Also target generic grids if needed */
    footer div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Footer Mobile */
    .footer-content {
        gap: 1.5rem;
    }

    .footer-nav {
        display: flex;
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    footer .btn,
    footer .spwidget-button {
        width: 100%;
        max-width: 300px;
        display: block;
        margin: 0 auto;
    }

    /* Policy Mobile */
    .policy-grid {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    .table-wrapper {
        overflow-x: auto;
        margin-bottom: 1rem;
    }

    .policy-card table {
        min-width: 600px;
    }
}

/* =========================================
   6. TABLET/PRO (481px - 960px)
   ========================================= */
@media (min-width: 481px) and (max-width: 960px) {
    .service-card {
        flex-direction: column;
    }

    .service-image {
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
        height: 0;
        /* Padding hack for aspect ratio */
        padding-bottom: 100%;
        position: relative;
    }

    .service-image img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .promo-content {
        flex-direction: column;
        gap: 2rem;
    }
}

/* =========================================
   7. LARGE SCREENS (1400px+)
   ========================================= */
@media (min-width: 1400px) {
    .container {
        max-width: 960px;
    }
}