/*
 * Autumn theme — "Golden Fall"
 * ------------------------------------------------------------------
 * A pared-back, ambient autumn treatment. Every rule is namespaced under
 * `.autumn-fx`, the fixed overlay that AutumnTheme.tsx mounts on the public
 * marketing pages (not the app). This keeps the whole effect scoped even
 * though `data-theme="autumn"` is applied to <body> site-wide.
 *
 * What's here: tumbling maple/oak/birch leaves, occasional wind gusts (bursts
 * of leaves streaking across), and a soft drifting mist low on the page.
 * (A sun, corner branches, geese and a leaf-litter horizon were tried and then
 * removed at the owner's request.) No PNG assets — inline SVG + CSS.
 */

.autumn-fx {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;

    /* Palette (harmonises with the brand green #04B76D via the golds) */
    --autumn-orange: #e8720c;
    --autumn-rust: #b5451f;
    --autumn-burnt: #c1440e;
    --autumn-gold: #e8a020;
    --autumn-amber: #f4a62a;
    --autumn-brown: #6b4423;
    --autumn-maroon: #8a3413;
}

/* ── Warm sun (top-right) with a soft cloud beside it ────────────── */
/* Warm glow halo */
.autumn-sun {
    position: absolute;
    top: -150px;
    right: -120px;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    background: radial-gradient(
        circle at center,
        rgba(255, 207, 138, 0.72) 0%,
        rgba(255, 176, 102, 0.4) 42%,
        rgba(255, 176, 102, 0) 72%
    );
    filter: blur(6px);
    animation: autumn-breathe 10s ease-in-out infinite;
}

/* Defined sun disc so the sun is clearly visible (not just a wash) */
.autumn-sun-core {
    position: absolute;
    top: -70px;
    right: -40px;
    width: 172px;
    height: 172px;
    border-radius: 50%;
    background: radial-gradient(
        circle at 42% 42%,
        rgba(255, 241, 200, 0.98) 0%,
        rgba(255, 207, 122, 0.94) 52%,
        rgba(244, 166, 58, 0) 80%
    );
    filter: blur(1px);
    animation: autumn-breathe 10s ease-in-out infinite;
}

/* Soft, semi-transparent cloud sitting BESIDE the sun (to its lower-left) */
.autumn-cloud {
    position: absolute;
    top: 16px;
    right: 118px;
    width: 250px;
    z-index: 1;
    opacity: 0.6;
    animation: autumn-cloud-bob 22s ease-in-out infinite;
}

.autumn-cloud svg {
    width: 100%;
    height: auto;
    display: block;
}

@media (max-width: 640px) {
    .autumn-sun { width: 320px; height: 320px; top: -110px; right: -90px; }
    .autumn-sun-core { width: 120px; height: 120px; top: -50px; right: -30px; }
    .autumn-cloud { width: 150px; right: 76px; top: 10px; }
}

/* ── Tumbling falling leaves ─────────────────────────────────────── */
.autumn-leaf {
    position: absolute;
    top: -8vh;
    left: var(--left, 50%);
    width: var(--size, 22px);
    height: var(--size, 22px);
    opacity: 0;
    will-change: transform, opacity;
    animation: autumn-fall var(--dur, 15s) linear infinite;
    animation-delay: var(--delay, 0s);
}

/* inner element tumbles while the outer element falls + sways sideways */
.autumn-leaf__inner {
    width: 100%;
    height: 100%;
    animation: autumn-tumble var(--dur, 15s) linear infinite;
    animation-delay: var(--delay, 0s);
}

.autumn-leaf svg,
.autumn-gust svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ── Wind gusts: bursts of leaves streaking fast across ──────────── */
.autumn-gust {
    position: absolute;
    top: var(--gtop, 20%);
    left: 0;
    width: var(--size, 22px);
    height: var(--size, 22px);
    opacity: 0;
    z-index: 3;
    will-change: transform, opacity;
    animation: autumn-gust-fly var(--dur, 22s) linear infinite;
    animation-delay: var(--delay, 0s);
}

/* inner tumbles fast while the outer streaks across on the wind */
.autumn-gust__inner {
    width: 100%;
    height: 100%;
    animation: autumn-gust-spin 1.1s linear infinite;
}

/* ── Soft drifting mist (low on the page) ────────────────────────── */
.autumn-mist {
    position: absolute;
    left: -10%;
    right: -10%;
    bottom: 2%;
    height: 170px;
    pointer-events: none;
}

.autumn-mist__band {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    filter: blur(26px);
    will-change: transform;
}

.autumn-mist__band--a {
    background: radial-gradient(60% 90% at 30% 100%, rgba(255, 248, 238, 0.55) 0%, rgba(255, 248, 238, 0) 70%),
                radial-gradient(55% 80% at 75% 100%, rgba(250, 238, 224, 0.45) 0%, rgba(250, 238, 224, 0) 70%);
    opacity: 0.6;
    animation: autumn-mist-drift-a 26s ease-in-out infinite;
}

.autumn-mist__band--b {
    background: radial-gradient(55% 85% at 55% 100%, rgba(255, 245, 232, 0.4) 0%, rgba(255, 245, 232, 0) 72%);
    opacity: 0.5;
    animation: autumn-mist-drift-b 34s ease-in-out infinite;
}

/* ── Keyframes ──────────────────────────────────────────────────── */

/* Falls the full height, drifting side to side on the breeze. The sideways
   amount is per-leaf via --sway (a unitless number scaled to vw). */
@keyframes autumn-fall {
    0%   { transform: translate(0, 0); opacity: 0; }
    6%   { opacity: var(--op, 0.8); }
    25%  { transform: translate(calc(var(--sway, 4) * 1vw), 28vh); }
    50%  { transform: translate(calc(var(--sway, 4) * -0.8vw), 56vh); }
    75%  { transform: translate(calc(var(--sway, 4) * 1vw), 84vh); }
    94%  { opacity: var(--op, 0.8); }
    100% { transform: translate(0, 116vh); opacity: 0; }
}

@keyframes autumn-tumble {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Streak fast across left→right with a downward slant, then rest off-screen for
   the remainder of the long cycle → gusts feel occasional. */
@keyframes autumn-gust-fly {
    0%   { transform: translate(-12vw, 0); opacity: 0; }
    2%   { opacity: var(--op, 0.7); }
    14%  { transform: translate(58vw, 9vh); }
    26%  { transform: translate(118vw, 15vh); opacity: 0; }
    100% { transform: translate(118vw, 15vh); opacity: 0; }
}

@keyframes autumn-gust-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes autumn-mist-drift-a {
    0%, 100% { transform: translateX(-6%); }
    50%      { transform: translateX(6%); }
}

@keyframes autumn-mist-drift-b {
    0%, 100% { transform: translateX(7%); }
    50%      { transform: translateX(-7%); }
}

/* the cloud gently drifts (subtle, so it reads as slow weather) */
@keyframes autumn-cloud-bob {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(-14px, 2px); }
}

/* sun glow gently breathes */
@keyframes autumn-breathe {
    0%, 100% { transform: scale(1); opacity: 0.85; }
    50%      { transform: scale(1.06); opacity: 1; }
}

@keyframes autumn-sway {
    0%, 100% { transform: rotate(-2deg); }
    50%      { transform: rotate(2deg); }
}

/* ── Page accents (rendered inline by pages, gated on the active theme) ──
   These sit INSIDE page content (hero cat), not the .autumn-fx overlay. */

/* Cosy beanie on the cat's head. Percentages map to the cat illustration box;
   22.5% down seats it on the head with the ears poking out. */
.autumn-cat-beanie {
    position: absolute;
    top: 22.5%;
    left: 16%;
    width: 36%;
    z-index: 21;
    pointer-events: none;
    transform: rotate(-5deg);
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.16));
    animation: autumn-beanie-in 0.6s ease-out both;
}

@keyframes autumn-beanie-in {
    0%   { opacity: 0; transform: translateY(-8px) rotate(-9deg); }
    100% { opacity: 1; transform: translateY(0) rotate(-5deg); }
}

/* Big realistic pumpkin on the ground next to the cat (lower-left, ~half the
   cat's height, with a clear gap from the cat). */
.autumn-cat-pumpkin-big {
    position: absolute;
    top: 63%;
    left: -2%;
    width: 28%;
    z-index: 14;
    pointer-events: none;
    filter: drop-shadow(0 5px 7px rgba(0, 0, 0, 0.16));
    animation: autumn-pumpkin-in 0.6s ease-out both;
}

@keyframes autumn-pumpkin-in {
    0%   { opacity: 0; transform: translateY(10px) scale(0.94); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Maple sprig tucked onto a card's top-right corner (kept for reuse) */
.autumn-card-leaf {
    position: absolute;
    top: -15px;
    right: -9px;
    width: 46px;
    height: 46px;
    z-index: 5;
    pointer-events: none;
    transform: rotate(6deg);
    transform-origin: bottom left;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.10));
    animation: autumn-sway 7.5s ease-in-out infinite;
}

@media (max-width: 640px) {
    .autumn-card-leaf { width: 38px; height: 38px; top: -12px; right: -7px; }
}

/* ── Visitor toggle: turn the effects off (low-end machines) ─────── */
.autumn-toggle {
    position: fixed;
    left: 14px;
    bottom: 14px;
    z-index: 60;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: #6b4423;
    cursor: pointer;
    opacity: 0.72;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.autumn-toggle:hover {
    opacity: 1;
    transform: translateY(-1px);
}

.autumn-toggle__icon {
    font-size: 14px;
    line-height: 1;
}

@media (max-width: 640px) {
    .autumn-toggle { left: 10px; bottom: 10px; padding: 7px; }
    .autumn-toggle__label { display: none; }
}

/* ── Respect reduced-motion: keep the look, drop the movement ───── */
@media (prefers-reduced-motion: reduce) {
    .autumn-fx *,
    .autumn-sun,
    .autumn-sun-core,
    .autumn-cloud,
    .autumn-card-leaf,
    .autumn-cat-beanie,
    .autumn-cat-pumpkin-big {
        animation: none !important;
    }

    /* A few leaves still visible, just static and faint; hide the fast gusts */
    .autumn-leaf {
        opacity: var(--op, 0.5);
        top: auto;
        bottom: 40vh;
    }
    .autumn-gust { display: none; }
}
