/*
 * ═══════════════════════════════════════════════════════
 * Base — Reset, Typography, Utilities
 * ═══════════════════════════════════════════════════════
 */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--ff-body);
    font-size: var(--fs-base);
    font-weight: var(--fw-regular);
    line-height: var(--lh-normal);
    color: var(--c-charcoal);
    background-color: var(--c-ivory);
    overflow-x: hidden;
}

/* Smooth scroll — Lenis takes over, this is fallback */
html.lenis,
html.lenis body {
    height: auto;
}
.lenis.lenis-smooth {
    scroll-behavior: auto !important;
}
.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

/* ─── Typography ─────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--ff-display);
    font-weight: var(--fw-bold);
    line-height: var(--lh-tight);
    letter-spacing: var(--ls-tight);
    color: var(--c-night);
}

h1 { font-size: var(--fs-5xl); }
h2 { font-size: var(--fs-4xl); }
h3 { font-size: var(--fs-3xl); }
h4 { font-size: var(--fs-2xl); }
h5 { font-size: var(--fs-xl); }
h6 { font-size: var(--fs-lg); }

p {
    margin-bottom: var(--sp-4);
    line-height: var(--lh-normal);
}

p:last-child {
    margin-bottom: 0;
}

a {
    color: var(--c-forest);
    text-decoration: none;
    transition: color var(--t-fast) var(--ease-out);
}

a:hover {
    color: var(--c-gold);
}

strong, b {
    font-weight: var(--fw-semibold);
}

small {
    font-size: var(--fs-sm);
}

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

ul, ol {
    list-style: none;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    border: var(--border);
    border-radius: var(--radius-md);
    padding: var(--sp-3) var(--sp-4);
    background: #fff;
    transition: border-color var(--t-fast) var(--ease-out),
                box-shadow var(--t-fast) var(--ease-out);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--c-gold);
    box-shadow: 0 0 0 3px rgba(200, 169, 110, 0.15);
}

/* ─── Section Eyebrow ────────────────────────────── */
.eyebrow {
    font-family: var(--ff-body);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    letter-spacing: var(--ls-wider);
    text-transform: uppercase;
    color: var(--c-gold);
    margin-bottom: var(--sp-3);
    display: inline-block;
}

/* ─── Section Title ──────────────────────────────── */
.section-title {
    font-size: var(--fs-4xl);
    margin-bottom: var(--sp-4);
}

.section-subtitle {
    font-size: var(--fs-md);
    color: var(--c-slate);
    max-width: 600px;
    line-height: var(--lh-relaxed);
}

.section-header {
    text-align: center;
    margin-bottom: var(--sp-12);
}

.section-header .section-subtitle {
    margin-left: auto;
    margin-right: auto;
}

/* ─── Container ──────────────────────────────────── */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding-left: var(--container-px);
    padding-right: var(--container-px);
}

.container--narrow {
    max-width: var(--container-narrow);
}

.container--wide {
    max-width: var(--container-wide);
}

/* ─── Section ────────────────────────────────────── */
.section {
    padding-top: var(--section-py);
    padding-bottom: var(--section-py);
}

.section--cream {
    background-color: var(--c-cream);
}

.section--dark {
    background-color: var(--c-forest-dark);
    color: var(--c-cream);
}

.section--dark h2,
.section--dark h3,
.section--dark h4 {
    color: #fff;
}

.section--dark .section-subtitle {
    color: var(--c-sage-light);
}

/* ─── Divider ────────────────────────────────────── */
.divider {
    width: 60px;
    height: 2px;
    background: var(--c-gold);
    margin: var(--sp-6) 0;
}

.divider--center {
    margin-left: auto;
    margin-right: auto;
}

/* ─── Selection ──────────────────────────────────── */
::selection {
    background-color: var(--c-gold);
    color: #fff;
}

/* ─── Scrollbar ──────────────────────────────────── */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--c-cream);
}

::-webkit-scrollbar-thumb {
    background: var(--c-stone);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--c-slate);
}

/* ─── Utility Classes ────────────────────────────── */
.text-center  { text-align: center; }
.text-left    { text-align: left; }
.text-right   { text-align: right; }
.text-gold    { color: var(--c-gold); }
.text-forest  { color: var(--c-forest); }
.text-muted   { color: var(--c-slate); }
.text-white   { color: #fff; }

.ff-display   { font-family: var(--ff-display); }
.ff-body      { font-family: var(--ff-body); }

.fw-light     { font-weight: var(--fw-light); }
.fw-regular   { font-weight: var(--fw-regular); }
.fw-medium    { font-weight: var(--fw-medium); }
.fw-semibold  { font-weight: var(--fw-semibold); }
.fw-bold      { font-weight: var(--fw-bold); }

.mt-0  { margin-top: 0; }
.mb-0  { margin-bottom: 0; }
.mt-4  { margin-top: var(--sp-4); }
.mt-8  { margin-top: var(--sp-8); }
.mb-4  { margin-bottom: var(--sp-4); }
.mb-8  { margin-bottom: var(--sp-8); }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* ─── Lazy-load placeholder ──────────────────────── */
img[data-src],
img.lazy {
    opacity: 0;
    transition: opacity var(--t-slow) var(--ease-out);
    background: linear-gradient(135deg, var(--c-forest) 0%, var(--c-forest-dark) 100%);
}

img.loaded,
img.lazy.loaded {
    opacity: 1;
}

/* Fallback: if JS disabled/failed, reveal images after 3s so they never stay hidden */
@media screen {
    img[data-src] {
        animation: lazyFallback 0.01s linear 3s forwards;
    }
}
@keyframes lazyFallback {
    to { opacity: 1; }
}

/* No-JS: force all lazy images visible */
.no-js img[data-src],
.no-js img.lazy {
    opacity: 1 !important;
}

/* ─── Page loader ────────────────────────────────── */
.page-loader {
    position: fixed;
    inset: 0;
    background: var(--c-ivory);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-loader);
    transition: opacity 0.6s var(--ease-out);
}

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

.page-loader__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--c-sand);
    border-top-color: var(--c-gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ─── Reduced Motion ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}
