/* ============================================================
   Modern Base CSS - 2026 Refactor
   ------------------------------------------------------------
   KEY CHANGES FROM PREVIOUS VERSION:
   1. @layer structure for cascade control
   2. Expanded design tokens (spacing scale, fluid type scale)
   3. Single variable font replaces 4 @font-face declarations
   4. Logical properties (inline/block) instead of directional
   5. color-scheme + dark mode groundwork
   6. :is() / :where() to reduce repetition
   7. SVG bullet replaced with CSS mask
   8. Container query example replacing some media query logic
   ============================================================ */


/* ============================================================
   @layer DECLARATION
   ------------------------------------------------------------
   Layers let you control specificity without !important wars.
   Think of it as a priority stack — later layers win, but ONLY
   when specificity is otherwise equal. The order you declare
   them here is what matters.

   reset    → zero out browser defaults
   base     → your foundational element styles
   components → cards, buttons, forms, blockquotes etc.
   utilities  → helper classes (.text-center, .bg-white etc.)

   Why it matters: a utility class in the 'utilities' layer will
   always beat a component style in 'components', even if the
   component selector is more specific. No more specificity hacks.
   ============================================================ */
@layer reset, base, components, utilities;


/* ============================================================
   LAYER: RESET
   ============================================================ */
@layer reset {

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

    /* Prevent iOS font size inflation on orientation change */
    html {
        -webkit-text-size-adjust: none;
        text-size-adjust: none;

        /*
        color-scheme tells the browser which modes you support.
        Even if you never build dark mode, this prevents the
        browser from rendering a white flash in dark OS mode.
        'light dark' = support both; 'light' = light only.
        */
        color-scheme: light;
    }

    /* Remove list styles only where needed — use :where() so
       specificity is zero and easier to override downstream */
    :where(ul, ol) {
        list-style: none;
    }

    img, embed, iframe, object, video {
        max-width: 100%;
        display: block;
    }

    embed, iframe, object, video {
        width: 100%;
    }

    /* Allow long words to break rather than overflow */
    html {
        word-wrap: break-word;
    }
}


/* ============================================================
   DESIGN TOKENS — Custom Properties
   ------------------------------------------------------------
   Expanded from the original. The spacing scale and fluid type
   scale mean you stop writing magic numbers like 'padding: 1rem'
   everywhere and instead use --space-md, --space-lg etc.

   Fluid type uses clamp() — the font scales between two sizes
   based on viewport width. No media queries needed for type.
   ============================================================ */
@layer base {

    :root {
        /* --- Base Colour scheme setting ---*/
        color-scheme: light dark;

        /* --- Colours --- */
        --transparent: transparent;
        --color-main-bg: #262629;
        --color-black: #000;
        --color-white: #fff;
        --color-yellow-main-bg: #fffbea;
        --color-yellow-border: #fee685;
        --color-dark-yellow-border: #c1ab41;
        --color-yellow-card-bg: #fff9df;
        --color-light-pink: rgb(252 188 253 / 0.25);
        --color-pink: #d10285;
        --color-pink-border: #d10285;
        --color-dark-grey: #1F1F1F;

        --color-light-grey: rgb(253 252 252 / 0.96);
        --color-medium-grey: #ebebeb;
        --color-light-purple: #913bf1;
        --color-medium-purple: #6c3edf;
        --color-dark-purple: #2d0057;

        /* --- Semantic colour aliases --- */
        /* --- These also include light/dark mode and their fallbacks -- */
        --color-text: var(--color-black);
        --color-text: light-dark(var(--color-black), var(--color-white));
        --color-text-muted: #555;
        --color-link: #444;
        --color-link: light-dark(#444, var(--color-white));
        --color-link-hover: #5e5e5e;
        --color-link-hover: light-dark(#5e5e5e, var(--color-medium-grey));
        --color-bg: var(--color-yellow-main-bg);
        --color-bg: light-dark(var(--color-yellow-main-bg), var(--color-main-bg));
        --color-card-bg: var(--color-yellow-card-bg);
        --color-card-bg: light-dark(var(--color-yellow-card-bg), var(--color-dark-grey));

        --color-border: var(--color-yellow-border);
        --color-border: light-dark(var(--color-yellow-border), var(--color-light-pink));

        --color-menu-border: var(--color-dark-yellow-border);
        --color-menu-border: light-dark(var(--color-dark-yellow-border), var(--color-light-pink));

        --color-accent: var(--color-light-purple);
        --color-accent-dark: var(--color-medium-purple);

        --color-animated-bg: --color-yellow-card-bg;
        --color-animated-bg: light-dark(var(--color-yellow-card-bg), var(--color-main-bg));
        --color-animated-lines: --color-dark-yellow-border;
        --color-animated-lines: light-dark(var(--color-dark-yellow-border), var(--color-pink));

        ---color-button-hover: var(--color-dark-yellow-border);
        ---color-button-hover: light-dark(var(--color-dark-yellow-border), var(--color-white));

        /* --- specific colour aliases --- */
        --cta-button: #444;
        --cta-button: light-dark(#444, var(--color-black));

        --cta-bg: var(--color-yellow-border);
        --cta-bg: light-dark(var(--color-yellow-border), var(--color-pink));

        --testimonial-inactive-dot: var(--color-medium-grey);
        --testimonial-inactive-dot: light-dark(var(--color-medium-grey), var(--color-text-muted));

        --blog-category-separator: var(--color-dark-yellow-border);
        --blog-category-separator: light-dark(var(--color-dark-yellow-border), var(--color-pink));

        /* --- Spacing scale ---
           8-point grid. Use these instead of arbitrary rem values.
           --space-xs  = 4px  (tight gaps, icon padding)
           --space-sm  = 8px  (small component gaps)
           --space-md  = 16px (standard padding/gap)
           --space-lg  = 24px (section inner padding)
           --space-xl  = 32px (section gaps)
           --space-2xl = 48px (large section breaks)
           --space-3xl = 64px (hero-level spacing) */
        --space-xs:  0.25rem;
        --space-sm:  0.5rem;
        --space-md:  1rem;
        --space-lg:  1.5rem;
        --space-xl:  2rem;
        --space-2xl: 3rem;
        --space-3xl: 4rem;

        /* --- Fluid type scale ---
           clamp(min, preferred, max) — scales with viewport.
           No breakpoints needed for font sizes. The middle value
           uses vw units to make it fluid between min and max. */
        --text-xs:   clamp(0.75rem,  1.5vw, 0.875rem);
        --text-sm:   clamp(0.875rem, 1.8vw, 1rem);
        --text-base: clamp(1rem,     2vw,   1.125rem);
        --text-lg:   clamp(1.125rem, 2.5vw, 1.5rem);
        --text-xl:   clamp(1.5rem,   3vw,   2rem);
        --text-2xl:  clamp(1.75rem,  4vw,   2.625rem);
        --text-3xl:  clamp(2rem,     5vw,   3.25rem);

        /* --- Border radius --- */
        --radius-sm:  0.625rem;
        --radius-md:  1rem;
        --radius-lg:  1.5rem;
        --radius-xl:  25px;
        --radius-full: 9999px;

        /* --- Transitions --- */
        --transition-speed: 0.4s;
        --transition-fast: 0.2s;
        --transition-base: 0.25s ease;
        --transition-color: color var(--transition-fast), background-color var(--transition-fast);

        /* --- Shadows ---
           Named by use case, not by visual description.
           Easier to remember which one to reach for. */
        --shadow-card:  1px 0 25px -6px rgb(0 0 0 / 0.1);
        --shadow-soft:  1px 0 25px -6px rgb(0 0 0 / 0.05);
        --shadow-icon:  1px 0 8px 1px rgb(0 0 0 / 0.1);
    }


    /* ============================================================
       SELECTION
       ============================================================ */
    ::selection {
        background-color: var(--color-light-pink);
    }


    /* ============================================================
       BODY
       ============================================================ */
    body {
        font-family: "OpenSans", Arial, sans-serif;
        font-weight: 300;
        font-size: var(--text-base);
        line-height: 1.6;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        color: var(--color-text);
        background-color: var(--color-bg);
        overflow-x: hidden;

        scroll-behavior: smooth;
        text-rendering: optimizeSpeed;
    }

    p {
        padding-block-end: var(--space-xs);
        /*
        padding-block-end = padding-bottom in LTR (left-to-right) languages.
        Logical properties like this work correctly in RTL layouts too.
        block  = the block axis (vertical in normal writing modes)
        inline = the inline axis (horizontal in normal writing modes)
        -start = beginning of that axis (top or left in LTR)
        -end   = end of that axis (bottom or right in LTR)
        */
    }


    /* ============================================================
       FONTS
       ------------------------------------------------------------
       Variable fonts, one file handles all weights via font-weight: 100 900.
       ============================================================ */
    @font-face {
        font-family: "OpenSans";
        src: url('../fonts/opensans/opensans-variable.woff2') format('woff2-variations');
        font-weight: 100 900;
        font-style: normal;
        font-display: swap;
    }


    /* ============================================================
       HEADINGS
       ------------------------------------------------------------
       Using :is() to target multiple elements in one rule.
       :is() keeps the specificity of its highest-specificity argument,
       so section :is(h1, h2) has the same specificity as section h1.

       Use :where() instead if you want zero added specificity
       (easier to override later).
       ============================================================ */

    /* Zero out margin/padding on heading & list elements inside sections */
    section :is(h1, h2, h3, h4, h5, h6, ol, ul, li, blockquote) {
        margin: 0;
        padding: 0;
    }

    /* Stop user agent styles adding bold to headers */
    :is(h1, h2, h3, h4, h5, h6) {
        font-weight: normal;
    }

    section :is(h1, h2, h3, h4, h5, h6) {
        display: block;
        width: 100%;
        line-height: 1.25;
    }

    section {
        h1.main-heading {
            margin-block-end: var(--space-sm);
            font-size: var(--text-3xl);
            font-weight: 100;

            &::after {
                position: relative;
                top: 0;
                display: inline-block;
                width: 10px;
                height: 10px;
                border-radius: 50%;
                background-color: var(--color-animated-lines);
                content: "";
            }
        }

        h2 {
            font-size: var(--text-2xl);
            text-wrap: balance;
            text-box-trim: trim-both;
        }

        :is(h2, h3) {
            padding-block-end: var(--space-xs);
        }

        h3 {
            font-size: var(--text-lg);
        }
        h4 {
            padding: 0 0 var(--space-xs) 0;
            font-size: var(--text-base);
        }
        h5 {
            font-size: var(--text-sm);
            font-weight: 600;
        }
        h6 {
            font-size: var(--text-xs);
            font-weight: 100;
        }

        .section-header p {
            font-size: var(--text-lg);
        }
    }


    /* ============================================================
       LINKS
       ============================================================ */
    a {
        color: var(--color-text);
        text-decoration-thickness: 1px;
        text-underline-offset: 0.1em;
        transition: var(--transition-color);

        &:is(:hover, :focus) {
            /*
            :is(:hover, :focus) replaces the old &:hover, &:focus pattern.
            Cleaner, and slightly more readable at a glance.
            */
            color: var(--color-link-hover);
            text-decoration: underline;
        }
    }


    /* ============================================================
       IMAGES / MEDIA
       ============================================================ */
    img {
        height: auto; /* Already in reset but explicit here for clarity */
    }

    .cover-img {
        display: block;
        object-fit: cover;
    }

    .bg-img {
        width: 100%;
        height: 100%;
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
    }


    /* ============================================================
       LISTS
       ============================================================ */
    ol {
        list-style-position: outside;
    }

    :is(ul, ol) li {
        margin-block-end: var(--space-xs);
        font-size: var(--text-xs);
    }

    /* Custom bullet list inside #main ---
       CSS mask approach replaces the URL-encoded SVG in ::before. */
    #main ul li {
        position: relative;
        padding-inline-start: 1.5rem;

        &::before {
            position: absolute;
            top: 0.5em;
            inset-inline-start: 0; /* = left in LTR, right in RTL */
            display: inline-block;
            width: 14px;
            height: 10px;
            background-color: var(--color-animated-lines);
            mask-image: url('../images/icon-dot.svg');
            mask-repeat: no-repeat;
            mask-size: contain;
            content: "";
        }

        p { padding-block-end: 0; }
    }


    /* ============================================================
       MAIN CONTENT AREA
       ============================================================ */
    #main {
        /* Social list reset inside #main */
        ul.social {
            padding: 0;
            list-style: none;

            li a svg {
                fill: var(--color-accent);
            }
        }
    }
}
/* END @layer base */


/* ============================================================
   LAYER: COMPONENTS
   ============================================================ */
@layer components {

    /* ============================================================
       BUTTONS
       ============================================================ */
    :is(.button, button, button[type=submit], input[type=button], input[type=submit]) {
        text-transform: uppercase;
        color: var(--color-white);
        border: none;
        background-color: var(--color-accent);
        cursor: pointer;
        transition: background-color var(--transition-speed);
        -webkit-appearance: none;

        &:hover {
            background-color: var(--color-accent-dark);
        }
    }

    @media only screen and (min-width: 30em) {
        :is(.button, button, input[type=button], input[type=submit]) {
            display: inline-block;
        }
    }

    @media only screen and (min-width: 37.5em) {
        :is(.button, button, input[type=button], input[type=submit]) {
            padding: 0.6rem 2.5rem 0.4rem;
        }
    }

    @media screen and (min-width: 64em) {
        .contact .wpcf7-form .wpcf7-submit {
            padding: 1rem 7rem;
        }
    }

    /* Link-style button */
    a {
        &.link-button {
            padding: 0.25rem 1.25rem;
            font-weight: 400;
            text-decoration: none;
            border: 1px solid var(--color-animated-lines);
            border-radius: 10px;
            transition: var(--transition-speed);

            .icon {
                use {
                    fill: var(--color-animated-lines);
                }
            }

            &:hover {
                background-color: var(--cta-bg);

                .icon {
                    use {
                        fill: var(---color-button-hover);
                    }
                }
            }
        }
        &.text-button {
            font-weight: 500;
            color: var(--color-animated-lines);
        }
    }


    /* ============================================================
       CARDS
       ============================================================ */
    .card {
        .card-item {
            height: 100%;
            border-radius: var(--radius-sm);
        }
    }


    /* ============================================================
       GLOBAL SVG ICONS
       ============================================================ */
    .icon--background {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 50px;
        height: 50px;
        background-color: var(--color-bg);
        border-radius: var(--radius-sm);
        box-shadow: var(--shadow-icon);
        .icon--service {
            width: 30px;
            height: 30px;
        }
    }
    svg {
        &.icon {
            position: relative;
            top: -1px;
            left: 10px;
            height: 18px;
            width: 36px;
            vertical-align: middle;
            transition: transform var(--transition-base);
        }
        &.icon--large {
            height: 30px;
            width: 48px;
        }
        &.icon--right {
            left: unset;
        }
        &.rotate-90 {
            transform: rotate(-45deg);
        }
        &.google-reviews {
            /*width: 40px;*/
            /*height: 40px;*/
            /*.google-red { background-color: var(--google-red); }*/
            /*.google-yellow { background-color: var(--google-yellow); }*/
            /*.google-green { background-color: var(--google-green); }*/
            /*.google-blue { background-color: var(--google-blue); }*/
        }
    }


    /* ============================================================
       SOCIAL SVG ICONS
       ============================================================ */
    .social {
        display: flex;
        padding: 0;
        gap: var(--space-xs);
        list-style: none;
        justify-content: flex-start;

        li a {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            height: 30px;
            width: 30px;

            svg {
                width: 18px;
                height: 18px;
                fill: var(--color-accent);
            }
        }
    }

    .icon {
        li { position: relative; }

        :is(li svg, svg) {
            display: inline-block;
            vertical-align: top;
            height: 18px;
            width: 18px;
            margin: 4px 5px 0 0;
            fill: var(--color-accent);
        }
    }

    /* ============================================================
       BLOG / ARCHIVE / SINGULAR POST STYLES
       ============================================================ */
    :is(.wp-singular, .blog, .archive) {

        .post-list {
            align-items: stretch;

            .post-inner {
                height: 100%;
            }
        }

        .post-loop {
            .post-inner {
                .post-thumbnail a {
                    display: flex;
                    vertical-align: middle;
                    align-items: center;
                    overflow: hidden;
                    img {
                        margin: 0 auto;
                        padding: 5px;
                        border-radius: 15px;
                    }
                }

                .post-content {
                    :is(h2, h3) {
                        margin-block-end: var(--space-xs);
                        padding-block-end: 0;
                        font-size: 1.25rem;
                        line-height: 1.2;
                        display: -webkit-box;
                        -webkit-line-clamp: 2;
                        -webkit-box-orient: vertical;
                        overflow: hidden;
                    }

                    :is(.post-excerpt, .entry-content) {
                        position: relative;

                        p {
                            font-size: var(--text-base);
                            margin-block-end: 0;
                            padding-block-end: 0.5rem;
                            display: -webkit-box;
                            -webkit-line-clamp: 3;
                            -webkit-box-orient: vertical;
                            overflow: hidden;
                        }
                    }
                }
            }
        }
    }
}
/* END @layer components */


/* ============================================================
   LAYER: UTILITIES
   ------------------------------------------------------------
   These are your helper/modifier classes. Because they're in
   the 'utilities' layer (declared last), they always win over
   component styles without needing !important.
   ============================================================ */
@layer utilities {

    .light-dark-bg {
        background-color: var(--color-card-bg);
    }

    .overflow-hidden {
        overflow: hidden;
    }

    /* --- Borders & Radius --- */
    .border-radius {
        border-radius: var(--radius-md);
        overflow: hidden;
    }

    .border-radius--md {
        border-radius: var(--radius-md);
        overflow: hidden;
    }

    .border-light-dark {
        border: 1px solid var(--color-animated-lines);
    }

    .border-bottom-ld {
        border-bottom: 1px solid var(--color-border);
    }

    /* --- Shadows --- */
    .box-shadow {
        box-shadow: var(--shadow-card);
    }

    /* --- Text --- */
    .text-white  { color: var(--color-white); }
    .text-light-pink  { color: var(--color-light-pink); }
    .text-bright-pink { color: var(--color-pink); }
    .text-bold   { font-weight: 600; }
    .text-center { text-align: center; }

    /* --- Layout --- */
    .align-center { place-items: center; }

    /* --- Responsive show/hide ---
       Using @media with display: none still works fine here.
       An alternative is using 'hidden' attribute in HTML for
       simpler cases, but these classes give you layout-level control. */
    @media only screen and (max-width: 64em) {
        .mobile-hidden { display: none; }
    }

    @media only screen and (min-width: 48em) {
        .desktop-hidden { display: none; }

        .align-left  { align-items: flex-start !important; }
        .align-right { align-items: flex-end !important; }
        /*
        The !important here is intentional and correct inside utilities.
        Utility classes are meant to be overrides — this is exactly
        the use case !important was designed for.
        */
    }

    /* --- Row reverse layout (desktop only) --- */
    @media only screen and (min-width: 64em) {
        .row-reverse > :first-child { order: 2; }
        .row-reverse > :last-child  { order: 1; }
    }

    /* --- Accessibility --- */
    .screen-reader-text {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

}
/* END @layer utilities */
