:root {
    --bg: #fbf6ee;
    --panel: #ffffff;
    --border: #ecdfcc;
    --text: #2b2236;
    --muted: #6d6378;
    --accent: #e8962e;
    --accent-hover: #f2a640;
    --accent-text: #2a1a06;
    --soft: #f4ead9;
    --radius: 18px;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #17131a;
        --panel: #221d26;
        --border: #3a3242;
        --text: #f4efe8;
        --muted: #a49cb0;
        --soft: #2b2531;
    }
}
:root[data-theme="dark"] {
    --bg: #17131a;
    --panel: #221d26;
    --border: #3a3242;
    --text: #f4efe8;
    --muted: #a49cb0;
    --soft: #2b2531;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { font-family: "Nunito", "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.55; }
img { max-width: 100%; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1120px; margin: 0 auto; padding: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.2rem; text-decoration: none; }
.brand img { border-radius: 10px; }
.top nav { display: flex; align-items: center; gap: 18px; font-weight: 700; }
.top nav a { text-decoration: none; color: var(--muted); }
.top nav a:hover { color: var(--text); }
.lang { font: inherit; font-weight: 700; color: var(--text); background: var(--soft); border: 1px solid var(--border); border-radius: 99px; padding: 6px 14px; cursor: pointer; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 24px; border-radius: 99px; font-weight: 800; text-decoration: none; border: 2px solid var(--border); background: var(--panel); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-hover); }

/* Hero */
.hero { display: grid; grid-template-columns: 1fr 1.25fr; gap: 40px; align-items: center; max-width: 1120px; margin: 0 auto; padding: 24px 16px 56px; }
.hero h1 { font-size: clamp(2.6rem, 6vw, 4.2rem); font-weight: 900; line-height: 1.05; letter-spacing: -0.02em; }
.tagline { font-size: 1.3rem; margin: 14px 0 26px; max-width: 30ch; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.small { color: var(--muted); font-size: 0.92rem; margin-top: 16px; }

/* The village picture: sky, ground and buildings, restyled by the weather class */
.scene { position: relative; aspect-ratio: 4 / 3; border-radius: 28px; overflow: hidden; box-shadow: 0 20px 50px rgba(60, 40, 20, 0.18); }
.scene .sky, .scene .weather, .scene .ground { position: absolute; inset: 0; }
.scene .sky { background: linear-gradient(#8fd0f5, #d6f0ff 70%); transition: background 0.6s; }
.scene .ground { top: 62%; background: linear-gradient(#8cc66a, #6eae52); border-radius: 50% 50% 0 0 / 14% 14% 0 0; transition: background 0.6s; }
.scene .b { position: absolute; height: auto; transition: filter 0.6s; filter: drop-shadow(0 6px 4px rgba(0, 0, 0, 0.15)); }
.scene .castle { width: 38%; left: 30%; bottom: 33%; }
.scene .mill { width: 20%; left: 4%; bottom: 30%; }
.scene .house { width: 25%; left: 14%; bottom: 8%; }
.scene .tavern { width: 27%; right: 8%; bottom: 10%; }
.scene .t1 { width: 9%; right: 6%; bottom: 40%; }
.scene .t2 { width: 11%; left: 44%; bottom: 6%; }
.weather-picker { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 4px; padding: 4px; background: rgba(255, 255, 255, 0.85); border-radius: 99px; }
.weather-picker button { font: inherit; font-weight: 800; font-size: 0.85rem; color: #2b2236; background: none; border: none; border-radius: 99px; padding: 6px 12px; min-height: 36px; cursor: pointer; }
.weather-picker button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }

.scene.night .sky { background: radial-gradient(1px 1px at 20% 20%, #fff, transparent), radial-gradient(1.5px 1.5px at 70% 12%, #fff, transparent), radial-gradient(1px 1px at 45% 30%, #fff, transparent), radial-gradient(1px 1px at 85% 35%, #fff, transparent), radial-gradient(circle at 80% 18%, #fff7d0 0 5%, transparent 5.5%), linear-gradient(#141a3c, #3a3f6e 70%); }
.scene.night .ground { background: linear-gradient(#3c5a3a, #2e4a30); }
.scene.night .b { filter: brightness(0.55) saturate(0.8) drop-shadow(0 0 10px rgba(255, 200, 120, 0.25)); }
.scene.rain .sky { background: linear-gradient(#8996a6, #c3ccd6 70%); }
.scene.rain .ground { background: linear-gradient(#729e5a, #5a8a48); }
.scene.rain .b { filter: brightness(0.85) saturate(0.85); }
.scene.rain .weather { z-index: 2; background: repeating-linear-gradient(105deg, transparent 0 18px, rgba(255, 255, 255, 0.35) 18px 19px); background-size: 200px 200px; animation: rain 0.5s linear infinite; }
.scene.snow .sky { background: linear-gradient(#b9cfe0, #eef4f8 70%); }
.scene.snow .ground { background: linear-gradient(#ffffff, #e6eef4); }
.scene.snow .weather { z-index: 2; background-image: radial-gradient(3px 3px at 10% 20%, #fff, transparent), radial-gradient(2px 2px at 30% 60%, #fff, transparent), radial-gradient(3px 3px at 55% 35%, #fff, transparent), radial-gradient(2px 2px at 75% 75%, #fff, transparent), radial-gradient(3px 3px at 90% 15%, #fff, transparent); background-size: 220px 220px; animation: snow 6s linear infinite; }
@keyframes rain { to { background-position: -40px 200px; } }
@keyframes snow { to { background-position: 30px 220px; } }
@media (prefers-reduced-motion: reduce) { .scene .weather { animation: none !important; } }

/* Features */
section h2 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); font-weight: 900; margin-bottom: 20px; }
.features, .parents { max-width: 1120px; margin: 0 auto; padding: 48px 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.feature, .card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.feature .art { display: flex; align-items: flex-end; justify-content: center; gap: 6px; height: 120px; margin-bottom: 14px; background: var(--soft); border-radius: 12px; padding: 10px; }
.feature .art img { max-height: 100px; width: auto; object-fit: contain; }
.feature h3 { font-size: 1.15rem; margin-bottom: 6px; }
.feature p { color: var(--muted); }

/* Parents */
.lead { color: var(--muted); font-size: 1.1rem; max-width: 60ch; margin: -8px 0 24px; }
.tools { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.tools li { display: flex; gap: 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.tools svg { width: 26px; height: 26px; flex-shrink: 0; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-top: 2px; }
.tools b { display: block; margin-bottom: 2px; }
.tools span { color: var(--muted); font-size: 0.95rem; }
.short { margin-top: 24px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.short h3 { width: 100%; font-size: 1.2rem; }
.short p { flex: 1 1 320px; }

footer { max-width: 1120px; margin: 0 auto; padding: 32px 16px 48px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.92rem; }
footer .links { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 12px; }
footer .maker { display: inline-flex; align-items: center; gap: 8px; }
footer .maker img { border-radius: 5px; }

@media (max-width: 820px) {
    .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 8px; }
    .top nav a { display: none; }
    .tools { grid-template-columns: 1fr; }
}
