/*
VOICE   warm, plain-spoken farmstead neighbour; calm, generous spacing
IDEA    a pan on a burner: the yard warms from blue to ember as the months turn
PICTURE the aerial photo of the yard with a soft heat glaze, full width
COLOUR  sage (dominant), cream (ground), warm brown (ink + buttons), heat ramp only on the map
TYPE    Fraunces headings, Source Sans 3 body
LAYOUT  one column, mobile first; verdict, map, slider, legend
*/
:root {
  color-scheme: light;
  --sage-900: #2f4636; --sage-700: #4a6650; --sage-500: #7f9c84; --sage-100: #e4ebe0;
  --cream: #f7f1e3; --cream-2: #efe6d2; --paper: #fbf8f0;
  --brown-900: #3d2a1c; --brown-700: #6b4528; --brown-500: #a0734d;
  --ink: var(--brown-900);
  --shadow: 0 1px 2px rgb(61 42 28 / .06), 0 8px 24px rgb(61 42 28 / .08);
  --radius: 18px;
  --heat: linear-gradient(90deg, #2b5c9e 0%, #4f97c9 10%, #9fcfb4 20%, #f2e08a 32%, #f3a65a 55%, #d9534a 78%, #a3272f 100%);
}
* { box-sizing: border-box; min-width: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 17px/1.6 "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif; overflow-x: clip; }
h1, h2, h3 { font-family: Fraunces, Georgia, "Times New Roman", serif; font-weight: 650; line-height: 1.1; text-wrap: balance; margin: 0 0 .4em; color: var(--sage-900); }
h1 { font-size: clamp(2.4rem, 8vw, 3.4rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.5rem, 5vw, 2rem); }
h3 { font-size: 1.15rem; margin-top: 1.4em; }
p { margin: 0 0 1em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--brown-500); outline-offset: 3px; }

/* header */
.top { background: var(--sage-700); color: var(--cream); padding: 14px max(5vw, 18px); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-family: Fraunces, Georgia, serif; font-size: 1.2rem; font-weight: 500; min-height: 44px; }
.leaf { width: 28px; height: 28px; }

main { max-width: 1100px; margin: 0 auto; padding: 0 max(4vw, 16px) 32px; }

/* intro + form */
.intro { padding: clamp(28px, 6vw, 64px) 0 12px; max-width: 760px; }
.lede { font-size: 1.15rem; color: #5a4332; max-width: 60ch; }
.lookup { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-top: 18px; }
.lookup label { display: block; font-weight: 600; margin-bottom: 8px; color: var(--sage-900); }
.field { display: flex; flex-direction: column; gap: 10px; }
input[type=text] { width: 100%; font: inherit; font-size: 17px; padding: 14px 16px; min-height: 54px; border: 0; border-radius: 14px; background: var(--sage-100); color: var(--ink); box-shadow: inset 0 1px 2px rgb(47 70 54 / .12); }
input[type=text]::placeholder { color: #7d6a5a; }
button { font: inherit; cursor: pointer; }
#go { min-height: 54px; padding: 0 26px; border: 0; border-radius: 14px; background: var(--brown-700); color: var(--cream); font-weight: 600; box-shadow: var(--shadow); transition: transform .15s, background .15s; }
#go:hover { background: #5a3920; }
#go:active { transform: translateY(1px); }
#go[disabled] { opacity: .7; cursor: progress; }
.turnstile { margin-top: 12px; min-height: 0; }
.status { margin: 12px 0 0; min-height: 1.6em; color: var(--sage-900); }
.status.error { color: #8a2f1d; font-weight: 600; }
.status.notice { background: var(--sage-100); border-radius: 12px; padding: 12px 14px; }
@media (min-width: 640px) { .field { flex-direction: row; } #go { flex: none; } }

/* results */
.results { padding-top: 26px; }
.verdict { background: var(--sage-700); color: var(--cream); border-radius: var(--radius); padding: 22px 22px 18px; box-shadow: var(--shadow); }
.verdict h2 { color: var(--cream); margin-bottom: .3em; }
.verdict p { margin: 0; font-size: 1.08rem; }
.verdict[data-level=good] { background: var(--sage-700); }
.verdict[data-level=fair] { background: #5e6b4a; }
.verdict[data-level=limited] { background: #6b5240; }

.map { position: relative; margin: 18px calc(-1 * max(4vw, 16px)) 0; aspect-ratio: 1; background: var(--sage-100); overflow: hidden; overflow: clip; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.map.zoomed, .map.placing { touch-action: none; }
.map.zoomed { cursor: grab; }
.map.zoomed.dragging { cursor: grabbing; }
.map.placing { cursor: crosshair; }
.stage { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.stage img, .stage canvas, .stage svg { position: absolute; inset: 0; width: 100%; height: 100%; }
/* wider photo for zooming out; JS sets its size from contextScale (4x → spans -150%..250%) */
.stage img.context { inset: auto; left: -150%; top: -150%; width: 400%; height: 400%; filter: saturate(.7) brightness(1.04); }
.marks { overflow: visible; }   /* a pin placed out in the wide photo still shows */
.map-tools { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 8px; }
.map-tools button { width: 48px; height: 48px; border: 0; border-radius: 14px; background: rgb(251 248 240 / .94); color: var(--brown-900); font-size: 26px; font-weight: 600; line-height: 1; box-shadow: var(--shadow); }
.map-tools button:disabled { opacity: .45; cursor: default; }
.move-bar { width: 100%; max-width: 560px; background: var(--paper); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); }
.move-bar p { margin: 0 0 10px; font-weight: 600; color: var(--sage-900); }
.move-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.move-actions button { min-height: 46px; padding: 0 18px; border: 0; border-radius: 12px; font-weight: 600; background: var(--brown-700); color: var(--cream); }
.move-actions button.ghost { background: var(--cream-2); color: var(--brown-900); }
.move-actions button:disabled { opacity: .5; cursor: default; }
.map-under { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 10px; }
.move-start { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--cream-2); color: var(--brown-900); font-weight: 600; }
.move-start svg { width: 20px; height: 20px; fill: var(--brown-700); }
.map img { object-fit: cover; filter: saturate(.8) brightness(1.03); }
.map canvas { opacity: .62; image-rendering: auto; }
.map-note { font-size: 14px; color: #6d5848; text-align: center; margin: 4px 0 0; max-width: 60ch; }
.marks { pointer-events: none; }
@media (min-width: 700px) {
  .map { margin: 18px auto 0; width: min(100%, 78vh); border-radius: var(--radius); box-shadow: var(--shadow); }
}

/* time control */
.time { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px 18px; margin-top: 16px; }
.time-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.play { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px 0 14px; border: 0; border-radius: 999px; background: var(--sage-700); color: var(--cream); font-weight: 600; }
.play svg { width: 22px; height: 22px; fill: currentColor; }
.play .i-pause, .play[aria-pressed=true] .i-play { display: none; }
.play[aria-pressed=true] .i-pause { display: inline; }
.readout { margin: 0; flex: 1 1 220px; font-size: 1.08rem; font-weight: 600; color: var(--sage-900); }

.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; margin: 14px 0 0; background: transparent; touch-action: pan-y; }
.slider::-webkit-slider-runnable-track { height: 10px; border-radius: 999px; background: var(--heat); }
.slider::-moz-range-track { height: 10px; border-radius: 999px; background: var(--heat); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 36px; height: 36px; margin-top: -13px; border-radius: 50%; background: var(--paper); border: 0; box-shadow: 0 0 0 4px var(--brown-700), 0 4px 10px rgb(61 42 28 / .3); }
.slider::-moz-range-thumb { width: 32px; height: 32px; border-radius: 50%; background: var(--paper); border: 0; box-shadow: 0 0 0 4px var(--brown-700), 0 4px 10px rgb(61 42 28 / .3); }
.ticks { display: grid; grid-template-columns: repeat(12, 1fr); font-size: 13px; color: #6d5848; text-align: center; margin: 2px 6px 0; }
@media (max-width: 420px) { .ticks span:nth-child(even) { visibility: hidden; } }
.seasons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.seasons button { min-height: 48px; border: 0; border-radius: 14px; background: var(--cream-2); color: var(--brown-900); font-weight: 600; }
.seasons button[aria-pressed=true] { background: var(--brown-700); color: var(--cream); }

/* legend */
.legend { margin-top: 16px; padding: 4px 4px 0; }
.bar { height: 14px; border-radius: 999px; background: var(--heat); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .04); }
.legend-labels, .legend-nums { display: flex; justify-content: space-between; font-size: 14px; margin-top: 6px; }
.legend-labels span:nth-child(2) { font-weight: 600; color: var(--sage-900); text-align: center; }
.legend-nums { position: relative; height: 1.4em; font-size: 13px; color: #6d5848; margin: 4px 10px 0; }
.legend-nums span { position: absolute; transform: translateX(-50%); }
/* positions on the fixed 0–7 hour scale */
.legend-nums span:nth-child(1) { left: 0; }
.legend-nums span:nth-child(2) { left: 28.57%; }
.legend-nums span:nth-child(3) { left: 57.14%; }
.legend-nums span:nth-child(4) { left: 85.71%; }
.legend-nums span:nth-child(5) { left: 100%; }
.legend-labels { margin-top: 2px; }
.legend-note { font-size: 15px; color: #5a4332; margin-top: 10px; }
.legend-title { font-size: 1.15rem; margin: 0 0 10px; }
.legend-unit { text-align: center; font-size: 14px; font-weight: 600; color: var(--sage-900); margin: 2px 0 12px; }
.key-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 14px; }
.key-list li { display: grid; grid-template-columns: 22px 1fr; column-gap: 9px; align-items: center; font-size: 15px; line-height: 1.25; }
.key-list li span:last-child { grid-column: 2; font-size: 13.5px; color: #6d5848; }
.key-list .sw { grid-row: span 2; width: 22px; height: 22px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .08); }
.key-list .sw-none { background: repeating-linear-gradient(45deg, #e9e2d2 0 4px, #fbf8f0 4px 8px); }
.legend-month { font-size: 15px; color: var(--sage-900); background: rgb(255 255 255 / .55); border-radius: 10px; padding: 10px 12px; margin: 14px 0 0; }
.verdict .roof-line { margin-top: 6px; }

.more { margin: 8px 0 0; }
.linkish { background: none; border: 0; padding: 10px 0; min-height: 44px; color: var(--brown-700); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.source { font-size: 14px; color: #6d5848; }

.privacy { margin-top: 36px; background: var(--paper); border-radius: var(--radius); padding: 20px 22px 8px; box-shadow: var(--shadow); max-width: 760px; }
.privacy h2 { font-size: 1.3rem; }

.foot { background: var(--sage-900); color: var(--cream); padding: 28px max(5vw, 18px) 36px; margin-top: 40px; }
.foot p { max-width: 70ch; }
.credits { font-size: 14px; opacity: .85; }

/* learn more dialog */
.learn { width: min(640px, calc(100% - 24px)); max-height: calc(100dvh - 32px); border: 0; border-radius: var(--radius); padding: 26px 24px 18px; background: var(--paper); color: var(--ink); box-shadow: 0 20px 60px rgb(61 42 28 / .35); }
.learn::backdrop { background: rgb(47 70 54 / .45); }
.learn .close { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--cream-2); font-size: 26px; line-height: 1; color: var(--brown-900); }
.learn h2 { padding-right: 48px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
