/* Thanksgiving sign-in theme. Everything is scoped under html.thanksgiving,
   which login-theme.js sets only in season (or with ?theme=thanksgiving), so
   the everyday login page is untouched. login-thanksgiving.js walks the
   turkey. Delete this file, login-thanksgiving.js and the tg-* markup in
   login.html to retire it. */

/* Caveat, SIL Open Font License 1.1 (fonts/Caveat-OFL.txt). Self-hosted:
   the login page's CSP only allows same-origin styles. */
@font-face {
    font-family: "Caveat";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/static/fonts/caveat-700-latin.woff2") format("woff2");
}

.tg-scene,
.tg-turkey,
.tg-card-leaf {
    display: none;
}

/* Shared shapes/gradients. Must stay rendered (not display:none) or Chrome
   drops the gradient fills on every <use>. */
.tg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

html.thanksgiving body {
    background:
        radial-gradient(ellipse 70% 45% at 22% 78%, rgba(255, 214, 130, 0.55), transparent 65%),
        linear-gradient(180deg, #3d2a55 0%, #7d3b55 24%, #c4583a 50%, #ec9444 72%, #f7c879 100%);
    overflow-x: hidden;
}

/* ---------- Backdrop ---------- */

html.thanksgiving .tg-scene {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

html.thanksgiving .login-container {
    position: relative;
    z-index: 1;
}

.tg-sun {
    position: absolute;
    left: 14vw;
    bottom: 18vh;
    width: 170px;
    height: 170px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, #fff6d2 0%, #ffd77a 52%, #f6a440 100%);
    box-shadow:
        0 0 60px 20px rgba(255, 210, 120, 0.45),
        0 0 200px 90px rgba(255, 170, 80, 0.25);
    animation: tg-sun-glow 8s ease-in-out infinite;
}

@keyframes tg-sun-glow {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.03); opacity: 0.94; }
}

.tg-cloud {
    position: absolute;
    width: 360px;
    height: 70px;
    border-radius: 50%;
    background:
        radial-gradient(ellipse 30% 60% at 30% 55%, rgba(255, 222, 205, 0.55), transparent 70%),
        radial-gradient(ellipse 35% 70% at 55% 45%, rgba(255, 210, 190, 0.5), transparent 70%),
        radial-gradient(ellipse 30% 55% at 78% 60%, rgba(255, 222, 205, 0.45), transparent 70%);
    filter: blur(4px);
    animation: tg-drift 70s linear infinite alternate;
}

.tg-cloud-a { top: 12vh; left: 8vw; }
.tg-cloud-b { top: 26vh; right: 6vw; width: 280px; animation-duration: 90s; animation-direction: alternate-reverse; opacity: 0.8; }

@keyframes tg-drift {
    from { transform: translateX(-6vw); }
    to   { transform: translateX(6vw); }
}

/* A small V of geese crosses the sky now and then. */
.tg-geese {
    position: absolute;
    top: 14vh;
    left: -160px;
    width: 120px;
    height: 70px;
    animation: tg-migrate 38s linear infinite;
    animation-delay: -6s;
}

.tg-goose {
    position: absolute;
    width: 22px;
    height: 10px;
    overflow: visible;
    animation: tg-flap 0.6s ease-in-out infinite alternate;
}

.tg-goose-1 { left: 96px; top: 30px; }
.tg-goose-2 { left: 72px; top: 18px; animation-delay: -0.2s; }
.tg-goose-3 { left: 72px; top: 42px; animation-delay: -0.4s; }
.tg-goose-4 { left: 48px; top: 6px; animation-delay: -0.1s; }
.tg-goose-5 { left: 48px; top: 54px; animation-delay: -0.3s; }

@keyframes tg-migrate {
    0%   { transform: translate(0, 0); }
    60%  { transform: translate(calc(100vw + 320px), -6vh); }
    100% { transform: translate(calc(100vw + 320px), -6vh); }
}

@keyframes tg-flap {
    from { transform: scaleY(1); }
    to   { transform: scaleY(0.45); }
}

.tg-hills {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 36vh;
    min-height: 220px;
    overflow: visible;
}

.tg-hill-far { fill: #8e3f2e; }
.tg-hill-mid { fill: #c98a34; }
.tg-ground { fill: #6a4522; }

.tg-tree-a { fill: #d9622b; }
.tg-tree-b { fill: #e8a83c; }
.tg-tree-c { fill: #b2302a; }
.tg-tree-d { fill: #c47a33; }

.tg-barn-wall { fill: #9a2a1f; }
.tg-barn-roof { fill: #57201a; }
.tg-barn-door { fill: #7a1f17; stroke: #f1e3cc; stroke-width: 2; }
.tg-barn-trim { stroke: #f1e3cc; stroke-width: 2; fill: none; }
.tg-barn-loft { fill: #f1e3cc; }
.tg-silo { fill: #b7aa98; }
.tg-silo-cap { fill: #8a7d6c; }

.tg-rows {
    fill: none;
    stroke: #a86f26;
    stroke-width: 2;
    stroke-opacity: 0.55;
}

.tg-bale rect { fill: #e1b457; stroke: #a87a2c; stroke-width: 2; }
.tg-bale path { stroke: #a87a2c; stroke-width: 1.5; fill: none; stroke-dasharray: 5 4; }

.tg-fence rect { fill: #7a5432; }
.tg-rail { stroke: #8a6038; stroke-width: 5; stroke-linecap: round; fill: none; }

.tg-grass {
    stroke: #8b6a2c;
    stroke-width: 2;
    stroke-linecap: round;
    fill: none;
}

.tg-gl-a { fill: #d9622b; }
.tg-gl-b { fill: #e8a83c; }
.tg-gl-c { fill: #b2302a; }

/* ---------- Falling leaves: the outer svg falls, the leaf inside tumbles ---------- */

.tg-leaf {
    position: absolute;
    top: -8vh;
    width: 26px;
    height: 26px;
    overflow: visible;
    animation: tg-fall 14s linear infinite, tg-tumble 3.2s ease-in-out infinite alternate;
}

@keyframes tg-fall {
    0%   { translate: 0 0; }
    25%  { translate: 4vw 28vh; }
    50%  { translate: -2vw 56vh; }
    75%  { translate: 5vw 84vh; }
    100% { translate: 1vw 116vh; }
}

@keyframes tg-tumble {
    from { transform: rotate(-35deg) rotateY(0deg); }
    to   { transform: rotate(40deg) rotateY(160deg); }
}

.tg-leaf-1  { left: 6vw;  fill: #d9622b; animation-duration: 15s, 3.1s; animation-delay: -2s, 0s; }
.tg-leaf-2  { left: 17vw; fill: #e8a83c; animation-duration: 18s, 2.6s; animation-delay: -11s, -1s; width: 20px; height: 20px; }
.tg-leaf-3  { left: 28vw; fill: #b2302a; animation-duration: 13s, 3.6s; animation-delay: -6s, -2s; }
.tg-leaf-4  { left: 39vw; fill: #c47a33; animation-duration: 17s, 2.9s; animation-delay: -14s, 0s; width: 22px; height: 22px; }
.tg-leaf-5  { left: 50vw; fill: #e8a83c; animation-duration: 16s, 3.3s; animation-delay: -4s, -1.5s; width: 18px; height: 18px; }
.tg-leaf-6  { left: 61vw; fill: #d9622b; animation-duration: 19s, 2.7s; animation-delay: -9s, -0.5s; }
.tg-leaf-7  { left: 71vw; fill: #b2302a; animation-duration: 14s, 3.4s; animation-delay: -1s, -2.5s; width: 22px; height: 22px; }
.tg-leaf-8  { left: 80vw; fill: #c47a33; animation-duration: 17s, 3s; animation-delay: -12s, -1s; }
.tg-leaf-9  { left: 89vw; fill: #e8a83c; animation-duration: 15s, 2.8s; animation-delay: -7s, 0s; width: 20px; height: 20px; }
.tg-leaf-10 { left: 95vw; fill: #b2302a; animation-duration: 20s, 3.5s; animation-delay: -16s, -2s; width: 18px; height: 18px; }
.tg-leaf-11 { left: 11vw; fill: #c47a33; animation-duration: 21s, 3.2s; animation-delay: -17s, -1s; width: 16px; height: 16px; }
.tg-leaf-12 { left: 56vw; fill: #d9622b; animation-duration: 22s, 2.9s; animation-delay: -19s, -0.5s; width: 18px; height: 18px; }

/* ---------- Turkey ---------- */

/* Outside .tg-scene and above the card, so its speech bubble is never
   hidden behind the sign-in form. */
html.thanksgiving .tg-turkey {
    display: block;
    position: fixed;
    z-index: 2;
    left: 0;
    bottom: 1.5vh;
    width: 190px;
    height: 190px;
    pointer-events: none;
    will-change: transform;
}

/* The bird is drawn as three views of one 3D-styled character: side, three-
   quarter and front. One shows at a time; login-thanksgiving.js steps through
   them when it turns, swapping poses instantly like a sprite turnaround (a
   crossfade would ghost two poses on top of each other). The art carries neutral, matte material shading only.
   The key light (upper left, to match the sun) and the rim come from a
   filter on this unmirrored wrapper, so they stay put when the art flips. */
.tg-figure {
    position: absolute;
    inset: 0;
    filter: url(#tg-keylight) drop-shadow(0 5px 5px rgba(27, 13, 18, 0.28));
}

.tg-ground-shadow {
    position: absolute;
    left: 34%;
    bottom: 0;
    width: 44%;
    height: 7%;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(27, 13, 18, 0.45), rgba(27, 13, 18, 0));
}

.tg-view {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
    opacity: 0;
    pointer-events: none;
}

.tg-turkey-art {
    opacity: 1;
    transform-origin: 55% 50%;
}

.tg-q-art {
    transform-origin: 52% 50%;
}

.tg-turkey.tg-view-q .tg-turkey-art,
.tg-turkey.tg-view-front .tg-turkey-art {
    opacity: 0;
}

.tg-turkey.tg-view-q .tg-q-art,
.tg-turkey.tg-view-front .tg-front-art {
    opacity: 1;
}

.tg-turkey.tg-facing-left .tg-turkey-art,
.tg-turkey.tg-facing-left .tg-q-art {
    transform: scaleX(-1);
}

/* Only the bird itself is clickable, never its transparent box, so it can't
   swallow clicks meant for the form. */
.tg-bob {
    pointer-events: visiblePainted;
    cursor: pointer;
}

/* Materials: matte feathers with broad soft highlights, soft contact
   shadows between feather layers, skin and beak a touch smoother. */
.tg-ao { fill: #1a0608; opacity: 0.42; filter: url(#tg-blur-s); }
.tg-ao-soft { fill: #1a0608; opacity: 0.5; filter: url(#tg-blur-l); }
.tg-ao-band { fill: #1a0608; opacity: 0.42; filter: url(#tg-blur-m); }

.tg-body { fill: url(#tg-m-body); }
.tg-chest { fill: url(#tg-m-chest); }
.tg-tex-body { fill: url(#tg-tex-body); }
.tg-tex-chest { fill: url(#tg-tex-chest); }
.tg-chest-sheen { fill: #3f8f78; opacity: 0.22; filter: url(#tg-blur-m); }
.tg-broad-hi { fill: #ffd6a0; opacity: 0.2; filter: url(#tg-blur-l); }

.tg-primary { fill: url(#tg-m-primary); }
.tg-secondary { fill: url(#tg-m-wing); }
.tg-secondary.tg-far { filter: brightness(0.6); }
.tg-covert { fill: url(#tg-m-covert); }
.tg-m-sheen-fill { fill: url(#tg-m-sheen); }
.tg-bars { stroke: #eedbb0; stroke-width: 2.6; stroke-linecap: round; fill: none; }
.tg-sec-edge { fill: none; stroke: #e9cf9a; stroke-width: 1.6; stroke-linecap: round; opacity: 0.55; }
.tg-wing-sheen { fill: #ffd9a8; opacity: 0.18; filter: url(#tg-blur-s); }
.tg-beard { fill: #1c0c0c; }
.tg-beard-hi { fill: none; stroke: #5a3a30; stroke-width: 1; opacity: 0.7; }

.tg-neck { fill: url(#tg-m-neck); }
.tg-caruncle { fill: url(#tg-m-bump); }

.tg-face { fill: url(#tg-m-head); }
.tg-face-rim { fill: none; stroke: #1f3c84; stroke-width: 1.3; stroke-linecap: round; opacity: 0.7; }
.tg-socket { fill: #1b3270; opacity: 0.55; filter: url(#tg-blur-xs); }
.tg-eye-white { fill: url(#tg-m-eye); }
.tg-iris { fill: url(#tg-m-iris); }
.tg-pupil { fill: #110a0c; }
.tg-glint { fill: #ffffff; }
.tg-lid { fill: #6c9fe0; }
.tg-lid-line { fill: none; stroke: #1d2f66; stroke-width: 0.9; stroke-linecap: round; }
.tg-brow { fill: url(#tg-m-brow); }
.tg-brow-shadow { fill: none; stroke: #14275e; stroke-width: 2.6; stroke-linecap: round; opacity: 0.55; filter: url(#tg-blur-xs); }
.tg-beak { fill: url(#tg-m-beak); }
.tg-beak-lo { fill: url(#tg-m-beak-lo); }
.tg-beak-ridge { fill: none; stroke: #fff3c8; stroke-width: 1; stroke-linecap: round; opacity: 0.8; }
.tg-gape { fill: none; stroke: #5a2a0a; stroke-width: 0.9; stroke-linecap: round; }
.tg-nostril { fill: #6a3410; }
.tg-skin { fill: url(#tg-m-skin); }
.tg-skin-hi { fill: none; stroke: #ffc2bb; stroke-width: 1.2; stroke-linecap: round; opacity: 0.6; }
.tg-skin-bumps { fill: #f25a64; opacity: 0.5; }

.tg-thigh,
.tg-shank,
.tg-toes { stroke-linecap: round; stroke-linejoin: round; fill: none; }
.tg-thigh { stroke: #6a2c17; stroke-width: 10; }
.tg-shank { stroke: #ff8a3d; stroke-width: 4.8; }
.tg-toes { stroke: #ff8a3d; stroke-width: 3.2; }
.tg-thigh.tg-line { stroke: #2a0d12; stroke-width: 12; }
.tg-shank.tg-line { stroke: #a8441a; stroke-width: 6.6; }
.tg-toes.tg-line { stroke: #7a2a10; stroke-width: 4.8; }
.tg-shank.tg-hi,
.tg-toes.tg-hi { stroke: #ffc79a; stroke-width: 1.3; opacity: 0.85; }
.tg-leg-far { filter: brightness(0.72); }

/* Pivot points, in the turkey's 200x200 viewBox. */
.tg-tail,
.tg-neck-head,
.tg-bob,
.tg-head-side,
.tg-head-front {
    transform-box: view-box;
}

.tg-tail { transform-origin: 82px 112px; }
.tg-neck-head { transform-origin: 132px 104px; }
/* login-thanksgiving.js sets .tg-bob's transform (step bob, peck lean). */
.tg-bob { transform-origin: 112px 188px; }

.tg-eye {
    transform-box: fill-box;
    transform-origin: center;
    animation: tg-blink 4.6s infinite;
}

@keyframes tg-blink {
    0%, 93%, 100% { transform: scaleY(1); }
    96%           { transform: scaleY(0.1); }
}

/* Side view: the tail trails back, closed, while walking. Fanned (looking,
   gobbling, turning) it is seen at an angle, extending behind the back. */
.tg-tail {
    transform: rotate(-64deg) scale(0.2, 0.8);
    transition: transform 0.6s cubic-bezier(0.3, 1.3, 0.5, 1);
}

.tg-looking .tg-tail,
.tg-gobble .tg-tail,
.tg-turning .tg-tail {
    transform: scale(0.62, 1);
}

.tg-head-front {
    opacity: 0;
    transition: opacity 0.18s ease;
}

.tg-head-side {
    transition: opacity 0.18s ease;
}

.tg-looking .tg-head-front { opacity: 1; }
.tg-looking .tg-head-side { opacity: 0; }

/* Peck: look, strike fast, nibble, come back up, pause. */
.tg-pecking .tg-neck-head { animation: tg-peck 1.1s infinite; }

@keyframes tg-peck {
    0%   { transform: rotate(0deg); animation-timing-function: ease-in; }
    22%  { transform: rotate(8deg); animation-timing-function: cubic-bezier(0.5, 0, 0.9, 0.6); }
    36%  { transform: rotate(76deg); animation-timing-function: ease-in-out; }
    44%  { transform: rotate(71deg); animation-timing-function: ease-in-out; }
    52%  { transform: rotate(76deg); animation-timing-function: ease-out; }
    78%  { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
}

.tg-gobble .tg-neck-head { animation: tg-gobble 0.16s ease-in-out 5 alternate; }
.tg-gobble .tg-bob { animation: tg-puff 0.9s ease-out; }

@keyframes tg-gobble {
    from { transform: rotate(-5deg); }
    to   { transform: rotate(6deg); }
}

@keyframes tg-puff {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.07); }
    100% { transform: scale(1); }
}

/* Speech bubble: a hand-drawn outline with handwritten text. It sits outside
   the flipped art so the text never mirrors; the tail points at the head. */
.tg-bubble {
    position: absolute;
    bottom: calc(100% - 38px);
    left: 80%;
    padding: 6px 24px 26px;
    color: #5c2a0c;
    font-family: "Caveat", "Segoe Print", "Bradley Hand", cursive;
    font-size: 31px;
    font-weight: 700;
    line-height: 1.05;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-41%) translateY(10px) rotate(-3deg) scale(0.5);
    transform-origin: 41% 100%;
    transition: opacity 0.18s ease, transform 0.42s cubic-bezier(0.3, 1.5, 0.5, 1);
    pointer-events: none;
}

.tg-bubble-outline {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    filter: drop-shadow(0 4px 6px rgba(60, 25, 5, 0.22));
}

.tg-bubble-outline path {
    fill: #fffaf0;
    stroke: #5c2a0c;
    stroke-width: 2.4;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.tg-bubble-text {
    position: relative;
}

.tg-turkey.tg-facing-left .tg-bubble {
    left: 20%;
    transform: translateX(-59%) translateY(10px) rotate(3deg) scale(0.5);
    transform-origin: 59% 100%;
}

.tg-turkey.tg-facing-left .tg-bubble-outline {
    transform: scaleX(-1);
}

.tg-turkey.tg-saying .tg-bubble {
    opacity: 1;
    transform: translateX(-41%) rotate(-3deg);
}

.tg-turkey.tg-facing-left.tg-saying .tg-bubble {
    transform: translateX(-59%) rotate(3deg);
}

/* ---------- Card ---------- */

html.thanksgiving .login-card {
    position: relative;
    border: none;
    border-radius: 16px;
    background:
        linear-gradient(90deg, #b2302a, #e8812c 40%, #f2b442 70%, #8a4a1f) top / 100% 5px no-repeat,
        #ffffff;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.08),
        0 24px 60px rgba(60, 20, 10, 0.4),
        0 0 90px rgba(255, 170, 70, 0.18);
    animation: tg-rise 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes tg-rise {
    from { opacity: 0; transform: translateY(18px) scale(0.985); }
    to   { opacity: 1; transform: none; }
}

/* A maple leaf has landed on the card's top-right corner. */
html.thanksgiving .tg-card-leaf {
    display: block;
    position: absolute;
    top: -14px;
    right: 26px;
    width: 34px;
    height: 34px;
    fill: #d9622b;
    filter: drop-shadow(0 3px 3px rgba(80, 30, 5, 0.3));
    transform-origin: 50% 100%;
    animation: tg-rock 4.5s ease-in-out infinite;
    z-index: 2;
}

@keyframes tg-rock {
    0%, 100% { transform: rotate(-24deg); }
    50%      { transform: rotate(-12deg); }
}

html.thanksgiving .form-group input:focus,
html.thanksgiving .reset-email-input:focus,
html.thanksgiving .mfa-code-input:focus {
    outline: none;
    border-color: #d9622b;
    box-shadow: 0 0 0 3px rgba(217, 98, 43, 0.16);
}

html.thanksgiving .login-btn:not(:disabled) {
    background: linear-gradient(135deg, #131d61 0%, #3a2350 100%);
    box-shadow: 0 6px 16px rgba(19, 29, 97, 0.28);
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

html.thanksgiving .login-btn:not(:disabled):hover {
    background: linear-gradient(135deg, #1a2678 0%, #4a2c62 100%);
    box-shadow:
        0 8px 20px rgba(19, 29, 97, 0.32),
        0 0 0 3px rgba(232, 129, 44, 0.3);
    transform: translateY(-1px);
}

html.thanksgiving .login-footer a,
html.thanksgiving .back-link {
    color: #7a3412;
}

/* ---------- Small screens & reduced motion ---------- */

/* Where the card reaches the ground, keep the turkey behind it. */
@media (max-width: 640px), (max-height: 760px) {
    html.thanksgiving .tg-turkey {
        z-index: 0;
    }
}

@media (max-width: 640px) {
    .tg-sun {
        width: 100px;
        height: 100px;
        left: 6vw;
    }

    .tg-turkey {
        width: 120px;
        height: 120px;
    }

    .tg-bubble {
        font-size: 24px;
    }

    .tg-leaf-9,
    .tg-leaf-10,
    .tg-leaf-11,
    .tg-leaf-12,
    .tg-cloud-b {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tg-scene *,
    html.thanksgiving .login-card,
    html.thanksgiving .tg-card-leaf {
        animation: none !important;
    }

    .tg-leaf,
    .tg-geese {
        display: none;
    }
}
