/* =====================================================================
   Themes: seasons (spring/summer/autumn/winter) × day/night, scene
   animations, particles, "Nachtstall" dark mode, UI micro-animations.
   html[data-theme] and html[data-season] are set by theme.js.
   ===================================================================== */

/* ---------- Scene palettes: day ---------- */
html {
  --sky: linear-gradient(180deg, #2b1a2e 0%, #5b2c26 38%, #a8552a 72%, #d98c45 100%);
  --hill-far: #6e3420; --hill-mid: #5a2c18; --hill-near: #4a2617;
  --tree1: #b5652a; --tree2: #93501f; --tree3: #c9822f; --trunk: #3a2214; --pine: #24382f;
  --barn-wall: #2a170e; --barn-roof: #1f110a; --barn-trim: #c98a4b;
  --fence: #3a2214; --horse: #24140c;
  --sun: #ffd28a; --glow-op: .55; --cloud: #ffd9b0; --cloud-op: .35;
  --star-op: .45; --overlay-op: .25;
}
html[data-season="spring"] {
  --sky: linear-gradient(180deg, #34507a 0%, #5f8fbf 40%, #a9cde3 70%, #f7e0c4 100%);
  --hill-far: #8fb27c; --hill-mid: #6d9a5a; --hill-near: #4f7d44;
  --tree1: #5e8f45; --tree2: #4a7a3f; --tree3: #e8a9c0;
  --barn-wall: #8a3b2a; --barn-roof: #4a2a22; --barn-trim: #f3e6cf;
  --fence: #6b4a2e; --horse: #3b2a1e; --trunk: #5b3d26;
  --sun: #fff1c2; --glow-op: .5; --cloud: #ffffff; --cloud-op: .85;
  --star-op: 0; --overlay-op: .42;
}
html[data-season="summer"] {
  --sky: linear-gradient(180deg, #22436a 0%, #4d82b3 42%, #9cc3d9 66%, #f2c879 100%);
  --hill-far: #a7b55e; --hill-mid: #839d47; --hill-near: #627f37;
  --tree1: #4c6b2f; --tree2: #3f5c27; --tree3: #5d7d36;
  --barn-wall: #7e3324; --barn-roof: #3e1f18; --barn-trim: #f1e2c4;
  --fence: #6b4a2e; --horse: #352416; --trunk: #4a3220;
  --sun: #ffe08a; --glow-op: .6; --cloud: #ffffff; --cloud-op: .8;
  --star-op: 0; --overlay-op: .42;
}
html[data-season="winter"] {
  --sky: linear-gradient(180deg, #23324d 0%, #50709a 42%, #a6bdd6 72%, #e4ebf3 100%);
  --hill-far: #a9bbcf; --hill-mid: #cbd8e5; --hill-near: #e7eef6;
  --pine: #2d4a3e; --trunk: #3b2a20;
  --barn-wall: #6b2e24; --barn-roof: #3a1d17; --barn-trim: #efe6d6;
  --fence: #4a3426; --horse: #2a1c14;
  --sun: #fff6dc; --glow-op: .45; --cloud: #f4f7fb; --cloud-op: .8;
  --star-op: 0; --overlay-op: .45;
}

/* ---------- Scene palettes: night ---------- */
html[data-theme="dark"] {
  --sky: linear-gradient(180deg, #050814 0%, #0e1630 45%, #1f2b52 78%, #34406b 100%);
  --hill-far: #1e2a46; --hill-mid: #17223b; --hill-near: #111a2e;
  --tree1: #121d30; --tree2: #0f182a; --tree3: #16223a; --trunk: #0b1220; --pine: #0f1a28;
  --barn-wall: #0d1424; --barn-roof: #080d18; --barn-trim: #3b4a6e;
  --fence: #0b1220; --horse: #070b16;
  --glow-op: .35; --cloud: #8090b8; --cloud-op: .12; --star-op: .95; --overlay-op: .2;
}
html[data-theme="dark"][data-season="winter"] {
  --hill-far: #3c4c6a; --hill-mid: #4c5d80; --hill-near: #5d6f96; --pine: #142336;
}

/* ---------- Hero & visibility ---------- */
.hero { background: var(--sky); transition: background .6s ease; padding-bottom: 13rem; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(100deg, rgba(15, 10, 20, var(--overlay-op)) 0%, rgba(15, 10, 20, calc(var(--overlay-op) * .5)) 45%, transparent 70%);
}
.hero-scene { height: 360px; z-index: 0; }
.particles { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

.hill-far { fill: var(--hill-far); }
.hill-mid { fill: var(--hill-mid); }
.hill-near { fill: var(--hill-near); }
.ground { fill: var(--bg); }
.trunk { fill: var(--trunk); }
.crown.t1 { fill: var(--tree1); } .crown.t2 { fill: var(--tree2); } .crown.t3 { fill: var(--tree3); }
.pine { fill: var(--pine); }
.pine-snow, .snowcap { fill: #f7fbff; }
.barn-wall { fill: var(--barn-wall); } .barn-roof { fill: var(--barn-roof); }
.barn-trim-fill { fill: var(--barn-wall); }
.barn-trim { fill: none; stroke: var(--barn-trim); stroke-width: 2.5; opacity: .85; }
.barn-window { fill: #f2b366; opacity: .8; }
.window-glow { opacity: 0; }
.fence { fill: var(--fence); }
.horse { fill: var(--horse); }
.sun { fill: var(--sun); }
.sky-glow { opacity: var(--glow-op); }
.moon { fill: #f3ead2; display: none; }
.moon-crater { fill: #ddd2b4; }
.cloud { fill: var(--cloud); opacity: var(--cloud-op); }
.stars { opacity: var(--star-op); transition: opacity .6s; }
.star { fill: #fff6df; }
.wing { fill: none; stroke: #2c2a33; stroke-width: 2; stroke-linecap: round; }
.flower.f0 { fill: #f6d55c; } .flower.f1 { fill: #f4a3c0; } .flower.f2 { fill: #ffffff; } .flower.f3 { fill: #b9a7f0; }
.grass { fill: none; stroke: #4f6d2c; stroke-width: 1.4; stroke-linecap: round; }
.gleaf.l0 { fill: #c4612a; } .gleaf.l1 { fill: #e0a03a; } .gleaf.l2 { fill: #8f3e1c; }

/* Season-specific elements */
.spring-only, .summer-only, .autumn-only, .snow-only, .snowcap, .trees-pine, .pine-snow { display: none; }
html[data-season="spring"] .spring-only,
html[data-season="summer"] .summer-only,
html[data-season="autumn"] .autumn-only,
html[data-season="winter"] .snow-only,
html[data-season="winter"] .snowcap,
html[data-season="winter"] .trees-pine,
html[data-season="winter"] .pine-snow { display: inline; }
html[data-season="winter"] .trees-leafy { display: none; }
.birds-wrap { display: none; }
html[data-theme="light"][data-season="spring"] .birds-wrap,
html[data-theme="light"][data-season="summer"] .birds-wrap { display: inline; }

/* Night */
html[data-theme="dark"] .sun { display: none; }
html[data-theme="dark"] .moon { display: inline; }
.moon-glow { display: none; opacity: .3; }
html[data-theme="dark"] .sky-glow { display: none; }
html[data-theme="dark"] .moon-glow { display: inline; }
html[data-theme="dark"] .window-glow { opacity: .55; }
html[data-theme="dark"] .barn-window { fill: #ffd27a; opacity: 1; }
html[data-theme="dark"] .grass { stroke: #1d2a3e; }
html[data-theme="dark"] .flower, html[data-theme="dark"] .gleaf { opacity: .35; }

/* ---------- Scene animations ---------- */
.cloud { animation: drift linear infinite; }
.cloud.c1 { animation-duration: 150s; animation-delay: -40s; }
.cloud.c2 { animation-duration: 210s; animation-delay: -150s; }
.cloud.c3 { animation-duration: 180s; animation-delay: -95s; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(1800px); } }

.birds { animation: fly 38s linear infinite; animation-delay: -12s; }
@keyframes fly {
  0% { transform: translate(-120px, 120px); }
  50% { transform: translate(700px, 70px); }
  100% { transform: translate(1600px, 110px); }
}
.wing { transform-box: fill-box; transform-origin: center; animation: flap .6s ease-in-out infinite alternate; }
.wing.w1 { animation-delay: -.3s; }
@keyframes flap { from { transform: scaleY(1); } to { transform: scaleY(-.4); } }

.tail { transform-box: fill-box; transform-origin: 100% 0; animation: swish 3.4s ease-in-out infinite; }
.foal .tail { animation-duration: 2.3s; animation-delay: -1s; }
@keyframes swish {
  0%, 55%, 100% { transform: rotate(0); }
  65% { transform: rotate(14deg); }
  78% { transform: rotate(-7deg); }
  88% { transform: rotate(5deg); }
}
.foal-wrap { animation: hop 8s ease-in-out infinite; }
@keyframes hop {
  0%, 70%, 100% { transform: translateY(0); }
  74% { transform: translateY(-7px); }
  78% { transform: translateY(0); }
  82% { transform: translateY(-4px); }
  86% { transform: translateY(0); }
}
.star { animation: twinkle 3s ease-in-out infinite alternate; }
.star.tw1 { animation-duration: 4.2s; animation-delay: -1s; }
.star.tw2 { animation-duration: 2.4s; animation-delay: -2s; }
.star.tw3 { animation-duration: 5s; animation-delay: -.5s; }
@keyframes twinkle { from { opacity: 1; } to { opacity: .25; } }
.sky-glow { animation: breathe 6s ease-in-out infinite alternate; }
@keyframes breathe { from { opacity: var(--glow-op); } to { opacity: calc(var(--glow-op) * .7); } }
html[data-theme="dark"] .window-glow { animation: flicker 4s ease-in-out infinite; }
@keyframes flicker { 0%, 100% { opacity: .55; } 40% { opacity: .42; } 45% { opacity: .6; } 70% { opacity: .5; } }

/* ---------- Particles (generated by scene.js) ---------- */
.p { position: absolute; top: -20px; will-change: transform; animation-timing-function: linear; animation-iteration-count: infinite; }
.p--snow { border-radius: 50%; background: #fff; opacity: .85; animation-name: fall; }
.p--leaf { border-radius: 0 70% 0 70%; animation-name: fall-spin; }
.p--leaf.v0 { background: #c4612a; } .p--leaf.v1 { background: #e0a03a; } .p--leaf.v2 { background: #9c3f1a; }
.p--petal { border-radius: 70% 0 70% 0; background: #f7c3d4; opacity: .9; animation-name: fall-spin; }
.p--seed { border-radius: 50%; background: radial-gradient(circle, #fff 0 30%, rgba(255, 255, 255, .3) 31% 60%, transparent 61%); animation-name: float-up; top: auto; bottom: 20%; }
.p--firefly { top: auto; border-radius: 50%; background: #ffe98a; box-shadow: 0 0 8px 3px rgba(255, 220, 110, .6); animation-name: wander; animation-timing-function: ease-in-out; animation-direction: alternate; }
@keyframes fall { to { transform: translate3d(var(--drift, 30px), 900px, 0); } }
@keyframes fall-spin { to { transform: translate3d(var(--drift, 60px), 900px, 0) rotate(540deg); } }
@keyframes float-up { 0% { transform: translate3d(0, 0, 0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate3d(var(--drift, 120px), -420px, 0); opacity: 0; } }
@keyframes wander {
  0% { transform: translate3d(0, 0, 0); opacity: .1; }
  30% { opacity: 1; }
  50% { transform: translate3d(var(--drift, 30px), -26px, 0); opacity: .3; }
  75% { opacity: 1; }
  100% { transform: translate3d(calc(var(--drift, 30px) * -1), -48px, 0); opacity: .15; }
}
.paused .p, .paused .hero-scene * { animation-play-state: paused !important; }

/* ---------- Theme & season controls ---------- */
.brand { flex-wrap: wrap; }
.theme-toggle {
  margin-left: auto; display: inline-flex; align-items: center; gap: .45rem;
  border: 1px solid rgba(255, 240, 210, .35); background: rgba(0, 0, 0, .18); color: #fbf4ea;
  border-radius: 999px; padding: .4rem .85rem; cursor: pointer; font-size: .85rem; font-weight: 600;
  backdrop-filter: blur(4px);
}
.theme-toggle:hover { background: rgba(0, 0, 0, .3); }
.theme-toggle svg { width: 16px; height: 16px; }
.season-picker { display: inline-flex; align-items: center; gap: .4rem; }
.season-picker select { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; padding: .2rem .4rem; font-size: .85rem; }

/* ---------- Breeder mode ---------- */
.breeder-hint { font-size: .8rem; color: var(--ink-soft); margin: .2rem 0 .6rem; }
.combos {
  margin: 0 0 1rem; padding: .9rem 1rem; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
  outline: 1.5px dashed rgba(122, 62, 29, .22); outline-offset: -7px;
}
.combos h3 { margin: 0 0 .6rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.combos-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.combo { border: 0; padding: 0; background: none; cursor: pointer; }
.combo .plate { padding: .35rem 1.2rem .3rem; display: block; }
.combo .plate span { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; color: #3a240f; text-shadow: 0 1px 0 rgba(255, 245, 215, .7); }
.combo:hover .plate { animation: swing .9s ease; }
.letters.locked button:not([aria-pressed="true"]) { opacity: .35; pointer-events: none; }

/* ---------- UI micro-animations ---------- */
.card { animation: rise .45s cubic-bezier(.2, .7, .3, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.plate { transform-origin: 50% -30%; }
.card:hover .plate { animation: swing 1s ease; }
@keyframes swing {
  0% { transform: rotate(0); } 20% { transform: rotate(-4deg); } 40% { transform: rotate(3deg); }
  60% { transform: rotate(-1.6deg); } 80% { transform: rotate(.8deg); } 100% { transform: rotate(0); }
}
.shoe.on { animation: shoe-pop .45s cubic-bezier(.3, 1.6, .5, 1) both; }
.shoe.on:nth-child(2) { animation-delay: .07s; } .shoe.on:nth-child(3) { animation-delay: .14s; }
.shoe.on:nth-child(4) { animation-delay: .21s; } .shoe.on:nth-child(5) { animation-delay: .28s; }
@keyframes shoe-pop { from { transform: scale(.2) rotate(-40deg); opacity: 0; } }
.fav.pop { animation: pop .4s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes pop { 50% { transform: scale(1.5); } }
.spotlight[open] .sign--large { animation: drop .8s cubic-bezier(.3, 1.4, .5, 1) both; transform-origin: 50% 0; }
.spotlight .sign--large.again { animation: drop .8s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes drop {
  0% { transform: translateY(-60px) rotate(-8deg); opacity: 0; }
  60% { transform: translateY(4px) rotate(3deg); opacity: 1; }
  80% { transform: rotate(-1.5deg); }
  100% { transform: none; }
}
.theme-anim, .theme-anim * { transition: background-color .5s ease, color .5s ease, border-color .5s ease, fill .5s ease !important; }

/* ---------- "Nachtstall" dark mode (page) ---------- */
html[data-theme="dark"] {
  --bg: #15110e; --surface: #211a15; --ink: #f1e6d6; --ink-soft: #b3a291; --line: #3b3027;
  --brand: #c2703a; --accent-soft: #23332d; --hit: #4a3a22; --straw: #e9d9b4;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
html[data-theme="dark"] body {
  background-image:
    repeating-linear-gradient(115deg, rgba(255, 220, 160, .025) 0 2px, transparent 2px 14px),
    repeating-linear-gradient(65deg, rgba(255, 220, 160, .02) 0 1px, transparent 1px 19px);
}
html[data-theme="dark"] .searchbar { background: #2a211b; color: var(--ink); }
html[data-theme="dark"] .searchbar select,
html[data-theme="dark"] .segmented { background: #17120f; }
html[data-theme="dark"] .segmented button[aria-pressed="true"] { background: #33281f; }
html[data-theme="dark"] .chip, html[data-theme="dark"] .letters button,
html[data-theme="dark"] .btn.ghost, html[data-theme="dark"] .toolbar select,
html[data-theme="dark"] .field input[type="number"], html[data-theme="dark"] .field input[type="text"] {
  background: #2a211b; border-color: var(--line); color: var(--ink);
}
html[data-theme="dark"] .chip[aria-pressed="true"], html[data-theme="dark"] .letters button[aria-pressed="true"] { background: #3f7a69; border-color: #3f7a69; color: #fff; }
html[data-theme="dark"] .active-filters .chip { background: var(--accent-soft); color: #9fd3c2; }
html[data-theme="dark"] .btn[aria-pressed="true"] { background: var(--hit); border-color: #6b532d; }
html[data-theme="dark"] .card { border-color: #3b3027; }
html[data-theme="dark"] .tag { background: #2c241e; color: var(--ink-soft); }
html[data-theme="dark"] .tag.hit { background: #4a3a22; color: #f3d9a4; }
html[data-theme="dark"] .shoe { color: #3e342b; }
html[data-theme="dark"] .shoe.on { color: var(--brass-2); }
html[data-theme="dark"] .filters, html[data-theme="dark"] .toolbar, html[data-theme="dark"] .combos { outline-color: rgba(233, 190, 140, .16); }
html[data-theme="dark"] .skeleton-block, html[data-theme="dark"] .card.skeleton { background: linear-gradient(90deg, #221b16 25%, #2c241d 50%, #221b16 75%); background-size: 200% 100%; }
html[data-theme="dark"] .spotlight { background: var(--surface); color: var(--ink); }
html[data-theme="dark"] .page .todo { color: #f3d9a4; }
html[data-theme="dark"] .fence-divider { opacity: .35; }

@media (max-width: 900px) {
  .hero { padding-bottom: 11rem; }
  .hero-scene { height: 270px; }
  .theme-toggle span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .particles { display: none; }
}
@media (max-width: 700px) {
  /* Keep the moon clear of the hero text on narrow screens */
  .moon, .moon-glow { transform: translate(235px, 62px); }
}

/* Hide untranslated markup until i18n.js ran; reveal after 2 s as a fallback. */
html.i18n-pending body { visibility: hidden; animation: i18n-reveal 0s linear 2s forwards; }
@keyframes i18n-reveal { to { visibility: visible; } }

/* ---------- Language switcher ---------- */
.lang-select {
  border: 1px solid rgba(255, 240, 210, .35); background: rgba(0, 0, 0, .18); color: #fbf4ea;
  border-radius: 999px; padding: .4rem .7rem; font-size: .85rem; font-weight: 600; cursor: pointer;
  backdrop-filter: blur(4px);
}
.lang-select option { color: #2a211b; background: #fffdf9; }
.brand .theme-toggle { margin-left: .5rem; }
.brand .lang-select { margin-left: auto; }

/* ---------- Quick filters below the search ---------- */
.quick-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; max-width: 720px; margin-top: .85rem; }
.quick-filters label { display: flex; flex-direction: column; gap: .25rem; font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: rgba(255, 244, 225, .85); }
.quick-filters select {
  appearance: none; -webkit-appearance: none; width: 100%;
  border: 1px solid rgba(255, 240, 210, .35); border-radius: 12px; padding: .6rem 2rem .6rem .8rem;
  background-color: rgba(255, 253, 249, .94); color: var(--ink);
  background-image: linear-gradient(45deg, transparent 50%, #7a3e1d 50%), linear-gradient(135deg, #7a3e1d 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat;
  font-size: .92rem; text-transform: none; letter-spacing: 0; font-weight: 500; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18); transition: box-shadow .2s, border-color .2s;
}
.quick-filters select.active { border-color: var(--brass-2); box-shadow: 0 0 0 2px rgba(201, 155, 69, .55), 0 4px 14px rgba(0, 0, 0, .18); font-weight: 700; }
html[data-theme="dark"] .quick-filters select { background-color: rgba(42, 33, 27, .95); color: var(--ink); }
html[data-theme="dark"] .quick-filters select option { background: #2a211b; color: var(--ink); }
.hero-stats { margin-top: .9rem; }
@media (max-width: 700px) {
  .quick-filters { grid-template-columns: 1fr 1fr; }
  .brand-tag { display: none; }
}
@media (max-width: 480px) {
  .brand { flex-wrap: nowrap; }
  .brand > [data-i18n="brand.name"] { display: none; }
  .lang-select { padding: .4rem .55rem; }
}
