/* Magical Wonder Night: the season's look. The memorable thing is one idea: a plant you own lights up.
   It follows the site's own square corners (--r) and palette: in light, the head continues the navy
   bar, then white and grey as everywhere; in dark, the night is the page.
   When the season ends: remove this file, season.js and assets/game/season/ with their two lines in
   index.html; in trade.js, drawHead back to a plain title (the head, the garland) and `.night-empty`
   to a sentence; in app.js, SITE_LOAD back to 'wood_block'. The construction site's sky, shadows and
   dust stay: they're in logis.css. */
body {
    --s-title: #f7edcf;
    --s-head-ink: #dfe6f1;
    --s-head-from: var(--navy);
    --s-head-to: var(--navy2);
    --s-lantern: #f4b23f;
    --s-pumpkin: #e9772b;
    --s-panel: var(--surface);
    --s-line: var(--border);
    --s-off-bg: var(--surface-2);
    --s-off-line: #c6cfdb;
    --s-off-stars: #76849a;
    --s-off-img: grayscale(1) brightness(.72) contrast(.9);
    --s-tag-off: #e9edf2;
    --s-tag-off-ink: var(--text-muted);
    --s-tag-on: #fcefd2;
    --s-tag-on-ink: #80530a;
    --s-link: var(--accent);
    --s-glow: #f4b23f55;
}
body.dark {
    --s-head-from: #17102f;
    --s-head-to: #271c4a;
    --s-panel: #1c1439;
    --s-line: #35286a;
    --s-off-bg: #181030;
    --s-off-line: #4a3b7c;
    --s-off-stars: #a093cd;
    --s-off-img: grayscale(1) brightness(.42);
    --s-tag-off: #ffffff14;
    --s-tag-off-ink: #b9aedb;
    --s-tag-on: #f4b23f26;
    --s-tag-on-ink: #ffd98a;
    --s-link: #ffd98a;
}

.topbar .optimize-btn:disabled { filter: none; animation: flicker 1.4s infinite; }
@keyframes flicker { 0%, 100% { box-shadow: 0 0 6px #f4b23f55; } 40% { box-shadow: 0 0 20px #f4b23fbb; } 55% { box-shadow: 0 0 8px #f4b23f66; } }

/* --- Échanges: the head ------------------------------------------------------------------ */
#page-trade .trade-head { margin-bottom: 12px; }
.night-hero { position: relative; overflow: hidden; border-radius: var(--r); padding: 22px 26px 0; color: var(--s-head-ink);
    background: linear-gradient(180deg, var(--s-head-from), var(--s-head-to)); }
.night-moon { position: absolute; top: -46px; right: 24%; width: 132px; height: 132px; filter: drop-shadow(0 0 34px #f7edcf70); pointer-events: none; }
.night-top { position: relative; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 20px; }
#page-trade .night-copy h1 { margin: 0; font: 800 clamp(26px, 3.4vw, 40px)/1.05 var(--font-display, 'Bricolage'), sans-serif; color: var(--s-title); letter-spacing: -.01em; }
#page-trade .night-copy p { margin: 8px 0 0; color: var(--s-head-ink); font-size: 15px; max-width: 58ch; }
.night-ready { display: inline-block; margin-top: 10px; padding: 7px 14px; border: 0; cursor: pointer; border-radius: var(--r); font-weight: 700; font-size: 14px; color: var(--on-cta); background: var(--cta); text-decoration: none; }
.night-ready:hover { color: var(--on-cta); filter: brightness(1.07); box-shadow: 0 0 18px #f4b23f88; }
.night-help { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r); font-size: 13px; font-weight: 600; color: #fff !important; background: #ffffff14; border: 1px solid #ffffff2b; text-decoration: none; white-space: nowrap; }
.night-help:hover { background: #ffffff24; }

/* The garland: every plant of the season, on one string. */
.garland { position: relative; height: 92px; margin: 6px -26px 0; }
.garland svg { position: absolute; inset: 0 0 auto; width: 100%; height: 60px; overflow: visible; }
.garland svg path { stroke: #7f8ea8; }
.bead { position: absolute; width: 46px; height: 46px; margin: -6px 0 0 -23px; border-radius: 50%; display: grid; place-items: center; }
.bead img { width: 100%; height: 100%; object-fit: contain; }
.bead.missing img { filter: grayscale(1) brightness(.42) contrast(.9); }
.bead.owned { filter: drop-shadow(0 0 7px #f4b23f99); }
.bead.surplus { filter: drop-shadow(0 0 13px #ffd572) drop-shadow(0 0 3px #fff3c9); }
.garland.first .bead { animation: bead-on .5s calc(.25s + var(--i) * 55ms) both cubic-bezier(.3, 1.6, .5, 1); }
@keyframes bead-on { from { transform: scale(.55) translateY(-8px); opacity: 0; } }
.bead.just-lit { animation: bead-pop .55s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes bead-pop { 40% { transform: scale(1.35); } }
.firefly { position: absolute; left: var(--x); top: var(--y); width: 5px; height: 5px; border-radius: 50%; background: #ffe48e; box-shadow: 0 0 9px 3px #ffc94f99; opacity: 0; animation: firefly 12s var(--d) infinite ease-in-out; pointer-events: none; }
@keyframes firefly { 10% { opacity: .9; } 50% { opacity: .15; transform: translate(26px, -34px); } 90% { opacity: .8; transform: translate(-12px, -60px); } 100% { opacity: 0; transform: translate(-22px, -74px); } }

/* --- Échanges: the album. The picture says it all: off, lit, or lit and giving. ---------------- */
#page-trade .collection-group { background: var(--s-panel); border-color: var(--s-line); }
#page-trade .collection-group-head { background: transparent; border-bottom: 1px solid var(--s-line); }
#page-trade .mutation-grid { background: transparent; }
#page-trade .mutation-tile:hover .mutation-picture { transform: translateY(-3px); }
#page-trade .mutation-picture { transition: transform .18s; }
#page-trade .mutation-tile.missing .mutation-picture { background: var(--s-off-bg); border: 2px dashed var(--s-off-line); }
#page-trade .mutation-tile.missing img { filter: var(--s-off-img); opacity: 1; }
#page-trade .mutation-tile.owned .mutation-picture { border: 2px solid #c9913a; background: radial-gradient(circle at 50% 45%, #ffcf7a, #d98b36 70%); box-shadow: 0 0 18px var(--s-glow); }
#page-trade .mutation-tile.surplus .mutation-picture { border: 2px solid #ffe29a; background: radial-gradient(circle at 50% 45%, #fff0b8, #f4b23f 64%, #c56f2a); box-shadow: 0 0 28px #ffc95a99; }
/* The one thing that moves on its own: a plant you can give breathes. */
#page-trade .mutation-tile.surplus .mutation-picture::after { content: ''; position: absolute; inset: -9px; border-radius: 50%; border: 2px solid #f4b23f; opacity: 0; animation: breathe 3.2s infinite ease-out; pointer-events: none; }
@keyframes breathe { 0% { transform: scale(.94); opacity: .75; } 70%, 100% { transform: scale(1.12); opacity: 0; } }
#page-trade .mutation-tile.just-lit .mutation-picture { animation: tile-pop .5s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes tile-pop { 35% { transform: scale(1.14); } }
#page-trade .mutation-stars { color: #d98a14; }
#page-trade .missing .mutation-stars { color: var(--s-off-stars); }
#page-trade .mutation-status { background: var(--s-tag-off); color: var(--s-tag-off-ink); }
#page-trade .owned .mutation-status { background: var(--s-tag-on); color: var(--s-tag-on-ink); }
#page-trade .surplus .mutation-status { background: var(--s-lantern); color: #2a1405; }
#page-trade .mutation-gift { background: var(--s-pumpkin); color: #2a1405; border-radius: var(--r); }
#page-trade .mutation-edit { color: var(--s-link); }
#page-trade .legend-owned { background: var(--s-tag-on); color: var(--s-tag-on-ink); border-color: #c9913a; }
#page-trade .legend-surplus { background: var(--s-lantern); color: #2a1405; border-color: var(--s-lantern); }

/* The trades. */
#page-trade .collection-save .primary { background: var(--cta); color: var(--on-cta); border: 0; font-weight: 800; }
#page-trade .collection-save .primary:hover:not(:disabled) { filter: brightness(1.06); box-shadow: 0 0 16px #f4b23f77; }
#page-trade .collection-matches .trade-box { display: flex; flex-direction: column; gap: 8px; transition: transform .16s, box-shadow .16s, border-color .16s; }
#page-trade .collection-matches .trade-box:hover { transform: translateY(-2px); border-color: #c9913a; box-shadow: 0 0 22px var(--s-glow); }
#page-trade .collection-matches .trade-box > .trade-discord { margin-top: auto; }
#page-trade .collection-matches h3 { margin: 6px 0 0; font-size: 13px; color: var(--s-tag-on-ink); }
#page-trade .collection-matches .match-items { margin: 0; }
#page-trade .collection-matches .match-items img { filter: drop-shadow(0 0 7px #f4b23f88); }
.night-empty { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--r); background: var(--s-panel); border: 1px solid var(--s-line); }
.night-empty img { width: 60px; height: auto; filter: drop-shadow(0 0 10px #f4b23f88); flex: none; }
.night-empty p { margin: 0; }

/* The way in. */
#page-trade .collection-gate { margin: 0; max-width: none; }
#page-trade .collection-gate-art img { filter: drop-shadow(0 0 14px #ffc95a88); }

/* Sparks, when a plant lights up. */
.spark { position: fixed; z-index: 1000; width: 6px; height: 6px; border-radius: 50%; background: #ffe48e; box-shadow: 0 0 8px 2px #ffc94f; pointer-events: none; animation: spark .62s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }

/* --- The plan ------------------------------------------------------------------------------ */
.night-strip { position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px; min-height: 62px; margin: 0 0 12px; padding: 8px 18px; border-radius: var(--r); color: var(--s-head-ink); background: linear-gradient(90deg, var(--s-head-from), var(--s-head-to)); }
.night-strip img.jack { width: 46px; height: auto; filter: drop-shadow(0 0 12px #f4b23fa0); flex: none; }
.night-strip b { display: block; font: 700 17px/1.2 var(--font-display, 'Bricolage'), sans-serif; color: var(--s-title); }
.night-strip span { font-size: 13px; }
.night-strip .moonlet { position: absolute; right: 7%; top: -30px; width: 76px; opacity: .9; filter: drop-shadow(0 0 16px #f7edcf80); pointer-events: none; }

#page-plan .studio-empty { position: relative; overflow: hidden; border-radius: var(--r); padding-top: 28px; padding-bottom: 28px; color: var(--s-head-ink); background: linear-gradient(180deg, var(--s-head-from), var(--s-head-to)); --text-muted: #c3cedd; --text: #eef2f8; --border: #4a5d7e; --surface: #16233a; --surface-2: #233553; }
#page-plan .studio-empty a, #page-plan .studio-empty a:hover, #page-plan .studio-empty .link-btn, #page-plan .studio-empty .link-btn:hover { color: #ffd98a !important; }
#page-plan .studio-empty .start-title { color: var(--s-title); font-size: clamp(28px, 4vw, 44px); position: relative; }
.empty-art { position: absolute; right: 5%; top: 12px; display: flex; align-items: flex-end; gap: 6px; pointer-events: none; }
.empty-art .moonlet { width: 104px; margin-top: -40px; filter: drop-shadow(0 0 22px #f7edcf80); }
.empty-art .jack { width: 84px; margin-left: -28px; filter: drop-shadow(0 0 16px #f4b23fa8); }

/* The numbers arrive lit. */
#kpis .kpi b.counting { color: var(--s-pumpkin); }
#kpis .kpi b { transition: color .5s; }
#kpis .kpi { transition: box-shadow .8s; }
#kpis .kpi.just-done { box-shadow: 0 0 0 1px #f4b23f88 inset, 0 0 18px var(--s-glow); }

/* --- The construction site, for the season (its general animation is in logis.css) ------------- */
/* Dusk over the site: navy above, the last light low down; the same in light and dark. */
.site-sky { background: linear-gradient(180deg, #1b2a44 0%, #3c3a5e 52%, #a9685a 82%, #efa961 100%) !important; }
.site-sky::before { content: ''; position: absolute; left: 80%; top: 5%; width: 13cqw; height: 13cqw; background: url(assets/game/season/moon.webp) center / contain no-repeat; filter: drop-shadow(0 0 2cqw #f7edcf90); }
.site-sky::after { content: ''; position: absolute; inset: 0 0 40%; background-image: radial-gradient(1px 1px at 30% 20%, #fff, transparent), radial-gradient(1px 1px at 46% 44%, #fff, transparent), radial-gradient(1.5px 1.5px at 62% 14%, #fff, transparent), radial-gradient(1px 1px at 88% 30%, #fff, transparent), radial-gradient(1px 1px at 72% 52%, #fff, transparent), radial-gradient(1.5px 1.5px at 20% 60%, #fff, transparent); }
.site-cloud { background: #e3dcea33 !important; }
.site-ground { background: linear-gradient(#54402f, #3b2c22) !important; box-shadow: inset 0 .5cqw 0 #6e573b !important; -webkit-mask-image: none !important; mask-image: none !important; }
.site-dust, .site-puff { background: #d9c6a866 !important; }
/* Hard hats carved out of pumpkins. */
.site-hat::before { background: radial-gradient(circle at 34% 30%, #ffc77a, #ef8a2c 44%, #b9541a) !important; }
.site-hat::after { background: #7a3c12 !important; }
/* The cone is a lantern tonight. */
.site-cone { left: 90cqw; width: 9cqw; height: 8cqw; background: url(assets/game/season/jack.webp) center bottom / contain no-repeat !important; clip-path: none !important; filter: drop-shadow(0 0 1.6cqw #f4b23fc0); animation: lantern-flicker 2.4s infinite; }
@keyframes lantern-flicker { 0%, 100% { filter: drop-shadow(0 0 1.6cqw #f4b23fc0); } 42% { filter: drop-shadow(0 0 3cqw #ffc95a); } 58% { filter: drop-shadow(0 0 1.2cqw #f4b23f99); } }
/* Fruit lanterns strung along the jib, swinging a little as the crane works. */
.site-lanterns { display: block !important; position: absolute; left: 0; right: 0; top: 2.6cqw; height: 0; }
.site-lanterns i { position: absolute; top: 0; width: 5cqw; height: 6cqw; transform-origin: 50% 0; background: url(assets/game/mutant-plants/4030145.webp) center / contain no-repeat; filter: drop-shadow(0 0 1.2cqw #ffc95a); animation: lantern-swing 3.2s ease-in-out infinite; }
.site-lanterns i:nth-child(1) { left: 22%; }
.site-lanterns i:nth-child(2) { left: 56%; animation-delay: -1.1s; }
.site-lanterns i:nth-child(3) { left: 88%; animation-delay: -2.1s; }
@keyframes lantern-swing { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
.site-sparkle { background: #ffb347 !important; }

@media (max-width: 720px) {
    .night-hero { padding: 16px 14px 0; }
    .night-moon { width: 62px; height: 62px; top: -20px; left: 12%; right: auto; }
    .night-top { flex-direction: column; }
    .night-help { order: -1; align-self: flex-end; position: absolute; top: -4px; right: 0; padding: 4px 8px; font-size: 12px; }
    .night-copy { padding-top: 26px; }
    .garland { height: 62px; margin: 2px -10px 0; }
    .garland svg { height: 36px; }
    .bead { width: 24px; height: 24px; margin: -3px 0 0 -12px; }
    .night-strip { flex-wrap: wrap; }
    .night-strip .moonlet { display: none; }
    .empty-art { display: none; }
}

@media (max-width: 360px) { .bead { width: 19px; height: 19px; margin: -2px 0 0 -9.5px; } }

@media (prefers-reduced-motion: reduce) {
    .firefly, .spark { display: none; }
    .garland.first .bead, .bead.just-lit, #page-trade .mutation-tile.just-lit .mutation-picture, .topbar .optimize-btn:disabled, .site-cone, .site-lanterns i { animation: none; }
    #page-trade .mutation-tile.surplus .mutation-picture::after { animation: none; opacity: .5; }
    #page-trade .mutation-tile:hover .mutation-picture, #page-trade .collection-matches .trade-box:hover { transform: none; }
}
