/*
Theme Name: ML Theme
Theme URI: https://millionleaves.com
Author: Millionleaves
Author URI: https://millionleaves.com
Description: Minimal WordPress theme for Millionleaves client builds. Handles header, footer, fonts, colours. Everything else lives in ACF blocks.
Version: 0.4.4
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: Proprietary
Text Domain: ml-theme

BUILD NOTES:
- Theme handles: header, footer, skip link, nav, fonts, CSS custom properties
- All page content is ACF blocks — theme provides the frame, not layout
- Customizer fields: colours, logo, sticky header, phone, CTA
- Footer pulls business info from ACF options page when available
- No bloat. If a project doesn't need it, it's not here.
*/

/* ============================================================
   CSS CUSTOM PROPERTIES
   Defaults set here, overridden by Customizer values via
   inline style on <body> in header.php
   ============================================================ */
:root {
    --color-primary: #3BB8B2;
    --color-primary-dark: #2A9A94;
    --color-primary-light: #E5F5F4;
    --color-secondary: #8B71AA;
    --color-secondary-dark: #6F5A8A;
    --color-secondary-light: #F0ECF5;
    --color-dark: #1B3A4B;
    --color-text: #2D3748;
    --color-muted: #6B7C8A;
    --color-border: #E0E3E8;
    --color-bg: #F7F8FA;
    --color-card: #FFFFFF;

    --font-heading: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
    --font-body: 'Source Sans 3', 'Segoe UI', sans-serif;

    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2.5rem;
    --space-xl: 4rem;
    --space-2xl: 6rem;

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;

    --shadow-sm: 0 1px 3px rgba(27, 58, 75, 0.06);
    --shadow-md: 0 4px 12px rgba(27, 58, 75, 0.08);
    --shadow-lg: 0 8px 30px rgba(27, 58, 75, 0.12);

    --max-width: 1200px;
    --max-width-narrow: 800px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}

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

a {
    color: var(--color-primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color 0.2s ease;
}
a:hover {
    color: var(--color-primary-dark);
}
a:focus-visible {
    outline: 3px solid var(--color-secondary);
    outline-offset: 2px;
    border-radius: 2px;
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    color: var(--color-dark);
    line-height: 1.25;
    font-weight: 700;
}

/* ============================================================
   SKIP LINK
   ============================================================ */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    background: var(--color-dark);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    z-index: 9999;
    text-decoration: none;
    transition: top 0.2s ease;
}
.skip-link:focus {
    top: 1rem;
    outline: 3px solid var(--color-secondary);
    outline-offset: 2px;
}

/* ============================================================
   SITE HEADER
   Width, padding, transparency controlled via CSS custom properties
   set by Customizer in wp_head inline style.
   ============================================================ */
.site-header {
    background: var(--header-bg, var(--color-card));
    border-bottom: 1px solid var(--color-border);
    z-index: 100;
    position: relative; /* default: normal flow, but relative for mobile menu positioning */
}
.site-header--sticky {
    position: sticky;
    top: 0;
}

/* Admin bar offset: WP admin bar is 32px desktop, 46px mobile */
body.admin-bar .site-header--sticky {
    top: 32px;
}
@media (max-width: 782px) {
    body.admin-bar .site-header--sticky {
        top: 46px;
    }
}

/* Transparent header: overlays page content */
.site-header.site-header--transparent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
body.admin-bar .site-header.site-header--transparent {
    top: 32px;
}
@media (max-width: 782px) {
    body.admin-bar .site-header.site-header--transparent {
        top: 46px;
    }
}

.site-header.site-header--transparent.site-header--sticky {
    position: fixed;
}

/*
 * Transparent header: hero block extends behind the header.
 * The hero block's own CSS should add:
 *   body.has-transparent-header .hero { padding-top: calc(var(--header-height, 72px) + normal); }
 * so text content clears the header bar while the background extends to page top.
 */

.site-header__container {
    max-width: var(--header-max-width, var(--max-width));
    margin: 0 auto;
    padding: 0 var(--header-padding-x, var(--space-md));
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--header-height, 72px);
}

/* Full-width mode: container stretches to 100% */
.site-header--full-width .site-header__container {
    max-width: 100%;
}

.site-header__logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: var(--color-dark);
    flex-shrink: 0;
}

.site-header__logo-img {
    height: 44px;
    width: auto;
}

.site-header__logo-text {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    display: none;
}

/* Phone link in header */
.site-header__phone {
    display: none;
    align-items: center;
    gap: 0.375rem;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.9375rem;
    margin-right: var(--space-sm);
    flex-shrink: 0;
}
.site-header__phone svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Navigation */
.site-header__nav {
    display: none;
}

.site-header__nav-list {
    list-style: none;
    display: flex;
    gap: var(--space-xs);
    align-items: center;
}

.site-header__nav-link {
    display: inline-block;
    padding: 0.5rem 0.875rem;
    text-decoration: none;
    color: var(--color-text);
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s ease, color 0.2s ease;
}
.site-header__nav-link:hover {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
}

/* Header CTA button */
.site-header__cta {
    display: inline-block;
    padding: 0.5rem 0.875rem;
    text-decoration: none;
    background: var(--color-secondary);
    color: #fff;
    font-weight: 700;
    font-size: 0.9375rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s ease;
}
.site-header__cta:hover {
    background: var(--color-secondary-dark);
    color: #fff;
}

/* Mobile menu toggle */
.site-header__menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--color-dark);
}
.site-header__menu-toggle svg {
    width: 24px;
    height: 24px;
}

/* Mobile menu panel */
.site-header__mobile-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-card);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    padding: var(--space-sm) var(--space-md);
    z-index: 99;
}
.site-header__mobile-menu.is-open {
    display: block;
}
.site-header__mobile-menu .site-header__nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
}
.site-header__mobile-menu .site-header__nav-link {
    display: block;
    padding: 0.75rem var(--space-sm);
    border-bottom: 1px solid var(--color-border);
}
.site-header__mobile-menu .site-header__cta {
    display: block;
    text-align: center;
    margin-top: var(--space-sm);
}

@media (min-width: 900px) {
    .site-header__menu-toggle {
        display: none;
    }
    .site-header__nav {
        display: block;
    }
    .site-header__logo-text {
        display: block;
    }
    .site-header__phone {
        display: flex;
    }
    .site-header {
        position: relative; /* mobile menu positioned relative to header */
    }
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
#main-content {
    min-height: 50vh;
}

/* WordPress block editor alignment */
.alignfull {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
}
.alignwide {
    max-width: var(--max-width);
    margin-left: auto;
    margin-right: auto;
}

/* ============================================================
   SITE FOOTER
   Grid layout controlled by --footer-columns CSS variable,
   set via Customizer layout preset.
   ============================================================ */
.site-footer {
    background: var(--footer-bg, var(--color-dark));
    color: var(--footer-text, rgba(255, 255, 255, 0.7));
    padding: var(--space-xl) var(--space-md) var(--space-lg);
    border-top: 3px solid var(--color-primary);
}

/* Footer links inherit footer text colour */
.site-footer a {
    color: var(--footer-text, rgba(255, 255, 255, 0.75));
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
}
.site-footer a:hover {
    opacity: 1;
    color: #fff;
}

.site-footer__container {
    max-width: var(--max-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
}

/* Layout presets (desktop) */
@media (min-width: 700px) {
    .site-footer--layout-4-equal .site-footer__container     { grid-template-columns: 1fr 1fr 1fr 1fr; }
    .site-footer--layout-brand-3 .site-footer__container     { grid-template-columns: 2fr 1fr 1fr 1fr; }
    .site-footer--layout-3-equal .site-footer__container      { grid-template-columns: 1fr 1fr 1fr; }
    .site-footer--layout-2-equal .site-footer__container      { grid-template-columns: 1fr 1fr; }
    .site-footer--layout-wide-left .site-footer__container    { grid-template-columns: 2fr 1fr 1fr; }
    .site-footer--layout-wide-right .site-footer__container   { grid-template-columns: 1fr 1fr 2fr; }
    .site-footer--layout-wide-center .site-footer__container  { grid-template-columns: 1fr 2fr 1fr; }
}

/* Column alignment */
.site-footer__column { }
.site-footer__column--align-left   { text-align: left; }
.site-footer__column--align-center { text-align: center; }
.site-footer__column--align-right  { text-align: right; }

/* Widget area block spacing — tighten WP block defaults for footer context */
.site-footer__column .widget-area > * + * {
    margin-top: var(--space-sm);
}

/* Typography defaults for content inside footer widget areas */
.site-footer__column h3,
.site-footer__column h4 {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: var(--space-sm);
}

.site-footer__column p {
    font-size: 0.9375rem;
    line-height: 1.6;
}

.site-footer__column ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.site-footer__column li {
    font-size: 0.9375rem;
}

/* Bottom bar — always 50/50 flex */
.site-footer__bottom {
    max-width: var(--max-width);
    margin: var(--space-lg) auto 0;
    padding: var(--space-md) var(--space-md) 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-sm);
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.4);
}

.site-footer__bottom-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.site-footer__bottom-right {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-align: right;
}

.site-footer__bottom a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
}
.site-footer__bottom a:hover {
    color: #fff;
}

/* ============================================================
   UTILITY
   ============================================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
