:root {
    --sunshine: #ffc926;
    --cream: #f3e8cc;
    --carrot: #f96015;
    --tomato: #d52518;
    --forest: #18542a;
    --kiwi: #9ABC05;
    --hero-nav-clearance: clamp(118px, 13vh, 158px);
    --hero-text-width: min(86vw, 1056px);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--cream);
    overflow-x: hidden;
    min-width: 320px;
}

/* Loader Styles */
.loader {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--forest);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: var(--cream);
    transition: opacity 0.5s ease;
    font-family: sans-serif;
}

.loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(243, 232, 204, 0.3);
    border-top-color: var(--sunshine);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin { 100% { transform: rotate(360deg); } }

.loading-text {
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 2px;
}

/* Scroll Container */
.scroll-container {
    position: relative;
    width: 100%;
    height: 240svh;
    min-height: 1120px;
}

.canvas-container {
    position: sticky;
    top: 0;
    width: 100%;
    height: 100svh;
    min-height: 640px;
    z-index: 1;
    overflow: hidden;
    background: #f4f5ec;
    isolation: isolate;
}

.canvas-container::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: clamp(120px, 14vw, 260px);
    z-index: 3;
    background: linear-gradient(90deg, rgba(244, 245, 236, 0), rgba(244, 245, 236, 0.92) 78%, #f4f5ec);
    pointer-events: none;
}

video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#hero-video {
    object-position: center calc(50% + 28px);
    opacity: 1;
    transition: opacity 420ms ease-in-out;
    will-change: opacity;
}

#hero-video.hero-video-transitioning {
    opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
    #hero-video {
        display: none;
    }
}

/* ==========================================================================
   Hero-Specific Developer Alignment Grid
   ========================================================================== */

:root {
    /* Toggle: Set to 'block' to show grid, 'none' to hide grid in production */
    --hero-dev-grid-display: none;

    /* Custom Colors for Alignment Guides */
    --hero-dev-grid-color-boundary: rgba(0, 229, 255, 0.45);   /* Cyan for outer boundaries */
    --hero-dev-grid-color-safe: rgba(255, 235, 59, 0.45);       /* Yellow for content-safe margins */
    --hero-dev-grid-color-axis: rgba(0, 230, 118, 0.3);         /* Green for center crosshairs */
    --hero-dev-grid-color-col-bg: rgba(213, 0, 249, 0.02);      /* Magenta tint for column fill */
    --hero-dev-grid-color-col-border: rgba(213, 0, 249, 0.15);  /* Magenta lines for column guides */

    /* Grid Geometry Config */
    --hero-dev-grid-safe-width: 1200px;
    --hero-dev-grid-gutter: 20px;
}

/* 
   Overlay layer.
   Resides inside .canvas-container's local stacking context (z-index: 1).
   Uses minimum z-index (2) to overlay the video without overlapping global elements (like .loader).
   pointer-events: none ensures zero impact on scroll, drag, click, or video scrubbing.
*/
.hero-dev-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    display: var(--hero-dev-grid-display, none);
    box-sizing: border-box;

    /* Outer Section Boundaries */
    border: 1px dashed var(--hero-dev-grid-color-boundary);

    /* Center Axes Guides (Horizontal and Vertical centerlines) */
    background-image: 
        /* Vertical center line */
        linear-gradient(to right, transparent calc(50% - 0.5px), var(--hero-dev-grid-color-axis) calc(50% - 0.5px), var(--hero-dev-grid-color-axis) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
        /* Horizontal center line */
        linear-gradient(to bottom, transparent calc(50% - 0.5px), var(--hero-dev-grid-color-axis) calc(50% - 0.5px), var(--hero-dev-grid-color-axis) calc(50% + 0.5px), transparent calc(50% + 0.5px));
    background-size: 100% 100%;
    background-repeat: no-repeat;
}

/* 
   Safe Area Container & 12-Column Grid (Pure CSS Gradient Implementation).
   Avoids rendering unnecessary DOM nodes for each column.
*/
.hero-dev-grid::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--hero-dev-grid-safe-width, 1200px);
    height: 100%;
    box-sizing: border-box;
    pointer-events: none;

    /* Safe Content Area Boundaries (Left/Right margins) */
    border-left: 1px dashed var(--hero-dev-grid-color-safe);
    border-right: 1px dashed var(--hero-dev-grid-color-safe);

    /* 
       12-Column Grid Background Paint:
       Within a single background-size cell of (100% + gutter) / 12:
       - 0px to 1px: Left border of the column
       - 1px to (100% - gutter - 1px): Column fill
       - (100% - gutter - 1px) to (100% - gutter): Right border of the column
       - (100% - gutter) to 100%: Gutter space (transparent)
    */
    background-image: linear-gradient(
        to right,
        var(--hero-dev-grid-color-col-border) 0px,
        var(--hero-dev-grid-color-col-border) 1px,
        var(--hero-dev-grid-color-col-bg) 1px,
        var(--hero-dev-grid-color-col-bg) calc(100% - var(--hero-dev-grid-gutter) - 1px),
        var(--hero-dev-grid-color-col-border) calc(100% - var(--hero-dev-grid-gutter) - 1px),
        var(--hero-dev-grid-color-col-border) calc(100% - var(--hero-dev-grid-gutter)),
        transparent calc(100% - var(--hero-dev-grid-gutter)),
        transparent 100%
    );
    background-size: calc((100% + var(--hero-dev-grid-gutter)) / 12) 100%;
    background-repeat: repeat-x;
}

/* Class-based toggles for dynamic integration / run-time overrides */
.hero-dev-grid-active .hero-dev-grid {
    display: block !important;
}
.hero-dev-grid-inactive .hero-dev-grid {
    display: none !important;
}

/* ==========================================================================
   Hero Text Overlay (Static)
   ========================================================================== */

.hero-text-overlay {
    position: absolute;
    top: var(--hero-nav-clearance);
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    pointer-events: none; /* Allows clicks to pass through if necessary */
    display: flex;
    flex-direction: column;
    align-items: center;
    width: var(--hero-text-width);
    isolation: isolate;
}

.hero-text-overlay::before {
    content: "";
    position: absolute;
    inset: -1rem -2rem -0.7rem;
    z-index: -1;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(244, 245, 236, 0.86) 10%,
        rgba(244, 245, 236, 0.96) 50%,
        rgba(244, 245, 236, 0.86) 90%,
        transparent 100%
    );
    filter: blur(10px);
}

.hero-text-greeting {
    font-family: 'Handsome', 'Caveat', 'Dancing Script', cursive;
    font-size: clamp(12px, 1.55vw, 30px);
    font-style: italic; /* Emphasize handwritten italic appearance */
    color: #000;
    align-self: flex-start;
    margin-left: -0.15em; /* Scalable spacing */
    margin-bottom: -0.52em; /* Scalable spacing */
    text-shadow: 0 0 10px #f4f5ec, 1px 1px 2px rgba(0, 0, 0, 0.15); /* Subtle, soft shadow treatment */
}

.hero-text-heading-1 {
    font-family: 'Tan Tangkiwood', 'Sunburn', 'Georgia', serif;
    font-size: clamp(22px, 2.95vw, 60px);
    font-weight: 900;
    color: #000;
    margin: 0;
    width: 100%;
    min-width: 0;
    line-height: 1.1;
    text-align: center;
    white-space: nowrap; /* Force one line */
    overflow-wrap: normal;
    letter-spacing: -0.015em; /* Scalable tracking */
    text-shadow: 0 0 12px #f4f5ec, 1px 1px 2px rgba(0, 0, 0, 0.15);
}

.hero-text-heading-2 {
    font-family: 'Tan Tangkiwood', 'Sunburn', 'Georgia', serif;
    font-size: clamp(18px, 2.45vw, 48px);
    font-weight: 900;
    color: #000;
    margin: 0;
    margin-top: 0.08em; /* Scalable spacing */
    width: 100%;
    min-width: 0;
    line-height: 1.1;
    text-align: center;
    white-space: nowrap; /* Force one line */
    overflow-wrap: normal;
    letter-spacing: -0.008em; /* Scalable tracking */
    text-shadow: 0 0 12px #f4f5ec, 1px 1px 2px rgba(0, 0, 0, 0.15);
}

.hero-text-tagline {
    font-family: 'Handsome', 'Caveat', 'Dancing Script', cursive;
    font-size: clamp(11px, 1.28vw, 25px);
    font-style: italic;
    color: #000;
    align-self: flex-end;
    max-width: 100%;
    margin-right: 2em; /* Scalable inset */
    margin-top: -0.08em; /* Scalable spacing */
    text-shadow: 0 0 10px #f4f5ec, 1px 1px 2px rgba(0, 0, 0, 0.15);
}

@media (max-width: 900px) {
    :root {
        --hero-nav-clearance: clamp(124px, 17vh, 164px);
        --hero-text-width: min(92vw, 440px);
    }

    .scroll-container {
        height: 205svh;
        min-height: 980px;
    }

    .canvas-container {
        min-height: 620px;
    }

    #hero-video {
        object-fit: cover;
        object-position: center bottom;
    }

    .hero-text-overlay {
        top: var(--hero-nav-clearance);
        width: var(--hero-text-width);
    }

    .hero-text-heading-1,
    .hero-text-heading-2 {
        white-space: normal;
        overflow-wrap: break-word;
        word-break: normal;
        margin-left: auto;
        margin-right: auto;
    }

    .hero-text-heading-1 {
        font-size: clamp(19px, 4.7vw, 26px);
        max-width: min(88vw, 360px);
    }

    .hero-text-heading-2 {
        font-size: clamp(17px, 4.2vw, 23px);
        max-width: min(88vw, 370px);
    }

    .hero-text-greeting,
    .hero-text-tagline {
        font-size: clamp(11px, 3.2vw, 18px);
    }

    .hero-text-tagline {
        align-self: center;
        width: 100%;
        max-width: min(86vw, 340px);
        margin-right: 0;
        text-align: center;
        line-height: 1.2;
    }
}

@media (max-width: 600px) {
    :root {
        --hero-nav-clearance: clamp(112px, 16vh, 138px);
        --hero-text-width: min(90vw, 360px);
    }

    .scroll-container {
        height: 190svh;
        min-height: 880px;
    }

    .canvas-container {
        min-height: 560px;
    }

    #hero-video {
        object-position: center bottom;
    }

    .hero-text-overlay::before {
        inset: -0.8rem -1rem -0.6rem;
    }
}

@media (max-width: 380px) {
    .hero-text-heading-1 {
        font-size: clamp(18px, 5.4vw, 20px);
        max-width: 84vw;
    }

    .hero-text-heading-2 {
        font-size: clamp(16px, 4.9vw, 18px);
        max-width: 84vw;
    }

    .hero-text-greeting,
    .hero-text-tagline {
        font-size: 13px;
    }
}
