/* ==========================================================================
   The Cozy Nest — Loader 3-en-1 (C7)
   Modes : .tcn-loader--splash · .tcn-loader--iframe · page-transition fallback
   Tokens : var(--tcn-*) depuis tokens.css — aucune couleur hardcodée.
   ========================================================================== */

/* --- 1. Splash screen ---------------------------------------------------- */

.tcn-loader--splash {
    position: fixed;
    inset: 0;
    z-index: var(--tcn-z-splash, 9999);
    background: var(--tcn-cream, #f8f7f2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(0.75rem, 2vw, 1.25rem);
    opacity: 1;
    transition: opacity 600ms var(--tcn-ease, cubic-bezier(.4, 0, .2, 1));
}

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

.tcn-loader--splash.is-gone {
    display: none;
}

/* Logo SVG inline inside splash */
.tcn-loader__logo {
    width: min(320px, 65vw);
    height: auto;
    display: block;
    color: var(--tcn-primary, #415d4b); /* currentColor hérité par fill du SVG */
}

.tcn-loader__name {
    font-family: var(--font-serif, 'Cormorant Garamond', Georgia, serif);
    font-size: clamp(0.9rem, 3vw, 1.35rem);
    font-weight: 400;
    color: var(--tcn-primary, #415d4b);
    text-align: center;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    max-width: 22ch;
    text-wrap: balance;
    margin: 0;
    line-height: 1.4;
}

/* --- 2. Iframe overlay loader -------------------------------------------- */

.tcn-loader--iframe {
    position: absolute;
    inset: 0;
    z-index: var(--tcn-z-modal, 9000);
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 200ms var(--tcn-ease, cubic-bezier(.4, 0, .2, 1));
}

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

.tcn-loader__spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--tcn-border, #e5e7eb);
    border-top-color: var(--tcn-primary, #415d4b);
    border-radius: 50%;
    animation: tcn-spin 1s linear infinite;
}

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

/* --- 3. Page transitions — fallback CSS (View Transitions non dispo) ----- */

body.is-leaving {
    opacity: 0;
    transition: opacity 200ms var(--tcn-ease, cubic-bezier(.4, 0, .2, 1));
}

/* --- 4. prefers-reduced-motion ------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
    .tcn-loader--splash {
        display: none !important;
    }
    body.is-leaving {
        transition: none;
    }
    .tcn-loader__spinner {
        animation: none;
    }
}
