@font-face { font-family: 'Prairie Serif'; src: url('fonts/STIXTwoText-Regular.otf'); font-display: swap; }
@font-face { font-family: 'Prairie Serif'; src: url('fonts/STIXTwoText-Italic.otf'); font-style: italic; font-display: swap; }

:root {
  --serif: 'Prairie Serif', 'STIX Two Text', Georgia, serif;
  --ink: #18211a;
  --paper: #f2eee0;
  --accent: #e7a3d4;
  --glass: rgb(19 27 21 / .78);
  --left: max(12px, env(safe-area-inset-left));
  --right: max(12px, env(safe-area-inset-right));
  --top: max(12px, env(safe-area-inset-top));
  --bottom: max(12px, env(safe-area-inset-bottom));
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--ink); color: var(--paper); font: 16px/1.3 var(--serif); }
body.mono { --accent: #fff; }
button { min-width: 44px; min-height: 44px; padding: 0 14px; border: 0; border-radius: 3px; background: var(--glass); color: inherit; font: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline: none; user-select: none; -webkit-user-select: none; }
#world:active { cursor: grabbing; }

.top { position: fixed; top: var(--top); left: var(--left); right: var(--right); display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; pointer-events: none; }
.where { padding: 6px 11px 7px; border-radius: 3px; background: var(--glass); }
.where h1 { margin: 0; font-size: 20px; font-weight: 400; line-height: 1.1; }
.where p { margin: 2px 0 0; font-size: 14px; font-style: italic; opacity: .8; }
.tools { display: flex; gap: 6px; }
.tools button { display: flex; align-items: center; justify-content: center; gap: 8px; pointer-events: auto; }
.tools svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.half { width: 18px; height: 18px; border: 1.5px solid currentColor; border-radius: 50%; background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
#mono[aria-pressed=true] { background: var(--paper); color: var(--ink); }

.flight { position: fixed; bottom: var(--bottom); left: 50%; translate: -50% 0; display: flex; gap: 2px; white-space: nowrap; }
.flight [aria-pressed=true] { background: var(--paper); color: var(--ink); }
#pause span { display: block; width: 13px; height: 14px; margin: auto; border-left: 4px solid currentColor; border-right: 4px solid currentColor; }
#pause.is-paused span { border: 0; border-left: 13px solid currentColor; border-top: 7px solid transparent; border-bottom: 7px solid transparent; height: 0; }
[data-mode=free] #pause { display: none; }

#place, #spotted { position: fixed; bottom: calc(var(--bottom) + 56px); left: 50%; translate: -50% 0; max-width: calc(100vw - 24px); }
#place { margin: 0; padding: 8px 14px; border-radius: 3px; background: var(--glass); font-size: 18px; font-style: italic; white-space: nowrap; pointer-events: none; }
#spotted { margin: 0; padding: 7px 12px; border-radius: 3px; background: var(--glass); text-align: center; pointer-events: none; }
#spotted b { display: block; font-weight: 400; }
#spotted i { display: block; font-size: 13px; opacity: .75; }

.pad { position: fixed; inset: auto var(--right) calc(var(--bottom) + 56px) var(--left); display: none; justify-content: space-between; align-items: flex-end; pointer-events: none; }
[data-mode=free].touch .pad { display: flex; }
[data-mode=free].touch :is(#place, #spotted) { bottom: auto; top: calc(var(--top) + 64px); }
#stick { position: relative; width: 116px; height: 116px; border: 1.5px solid rgb(242 238 224 / .65); border-radius: 50%; background: rgb(19 27 21 / .3); pointer-events: auto; touch-action: none; }
#stick span { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px; border-radius: 50%; background: var(--paper); opacity: .85; }
.lift { display: grid; gap: 8px; pointer-events: auto; }
.lift button { width: 54px; height: 54px; padding: 0; border-radius: 50%; touch-action: none; user-select: none; -webkit-user-select: none; }

#guide { width: min(1120px, calc(100vw - 20px)); max-height: calc(100dvh - 20px); padding: 0; border: 0; border-radius: 4px; background: var(--paper); color: var(--ink); overscroll-behavior: contain; }
#guide::backdrop { background: rgb(10 14 11 / .55); }
.guide-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 10px 8px 18px; background: var(--paper); border-bottom: 1px solid #d8d0bb; }
.guide-head h2 { margin: 0; font-size: 24px; font-weight: 400; }
.guide-head button { background: transparent; font-size: 30px; }
.guide-body { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 22px; padding: 16px 18px 20px; }
.map-frame { position: relative; }
#map { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; }
.map-stop { position: absolute; translate: -50% -50%; padding: 0; border-radius: 50%; background: transparent; color: #fff; font-size: 15px; isolation: isolate; }
.map-stop::before { content: ''; position: absolute; inset: 9px; z-index: -1; border: 2px solid #fff; border-radius: 50%; background: #17324a; }
#stop-list { columns: 2; margin: 8px 0 0; padding-left: 22px; }
#stop-list button { width: 100%; padding: 0 4px; background: transparent; text-align: left; text-decoration: underline; text-underline-offset: 3px; }
.keys { margin: 7px 0 0; font-size: 14px; }
.keys-touch, .touch .keys-desktop { display: none; }
.touch .keys-touch { display: block; }
.lists h3 { margin: 0 0 4px; font-size: 19px; font-weight: 400; }
.lists ul { margin: 0 0 16px; padding: 0; list-style: none; }
.lists li { display: grid; grid-template-columns: 1fr auto; padding: 4px 0; border-bottom: 1px solid #ddd5c0; font-size: 15px; }
.lists li b { font-weight: 400; }
.lists li i { grid-row: 2; grid-column: 1; color: #5d6355; font-size: 13px; }
.lists li span { grid-row: 1 / 3; grid-column: 2; max-width: 190px; align-self: center; text-align: right; font-size: 13px; }

#loading, .noscript { position: fixed; inset: 0; display: grid; place-items: center; margin: 0; background: var(--ink); color: var(--paper); font-size: 21px; font-style: italic; transition: opacity .9s; }
[data-state=ready] #loading { opacity: 0; pointer-events: none; }
[data-state=fallback] :is(#world, .top, .flight, .pad, #place, #spotted, #loading, #tuning, .tour) { display: none; }
#fallback { position: fixed; inset: 0; overflow: auto; padding: 20px var(--right) 30px var(--left); }
#fallback h1 { font-weight: 400; }

#tuning { position: fixed; top: calc(var(--top) + 56px); right: var(--right); bottom: calc(var(--bottom) + 56px); width: 300px; display: flex; flex-direction: column; border-radius: 4px; background: rgb(19 27 21 / .86); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); font-size: 14px; }
.tuning-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 2px 14px; border-bottom: 1px solid rgb(242 238 224 / .18); }
.tuning-head h2 { margin: 0; font-size: 18px; font-weight: 400; }
.tuning-head button { background: transparent; font-size: 26px; }
#tuning-readout { margin: 0; padding: 7px 14px; border-bottom: 1px solid rgb(242 238 224 / .18); font-variant-numeric: tabular-nums; font-size: 13px; opacity: .85; }
#tuning-list { flex: 1; overflow: auto; padding: 4px 14px 10px; overscroll-behavior: contain; }
#tuning-list h3 { margin: 12px 0 2px; font-size: 13px; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; opacity: .65; }
.tune { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 8px; padding: 3px 0; }
.tune output { font-variant-numeric: tabular-nums; opacity: .8; }
.tune input[type=range] { grid-column: 1 / 3; width: 100%; height: 28px; margin: 0; accent-color: var(--accent); }
.tune-toggle { display: flex; gap: 10px; min-height: 36px; }
.tune-toggle input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.tuning-foot { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid rgb(242 238 224 / .18); }
.tuning-foot button { flex: 1; background: rgb(242 238 224 / .12); }


/* The guided tour's cards: paper, like the field guide, so they read over any sky. */
.tour { --muted: #5d6355; --rule: #ddd5c0; position: fixed; left: var(--left); bottom: var(--bottom); width: 410px; height: min(620px, calc(100dvh - var(--top) - var(--bottom) - 62px)); display: flex; flex-direction: column; border-radius: 4px; background: var(--paper); color: var(--ink); box-shadow: 0 8px 30px rgb(0 0 0 / .28); font-size: 15px; line-height: 1.38; }
.touring :is(#place, #spotted) { display: none; }
/* Beside the card on a wide screen, the flight buttons stay; on a narrow one the card has the bottom. */
@media (max-width: 1120px), (max-height: 460px) { .touring .flight { display: none; } }
.tour-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 12px 6px 6px 18px; }
.tour-kicker { margin: 0; color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.tour-head h2 { margin: 1px 0 0; font-size: 25px; font-weight: 400; line-height: 1.12; }
.tour button { background: transparent; color: inherit; }
.tour-close { font-size: 28px; line-height: 1; }
.tour-body { flex: 1; min-height: 0; overflow: auto; padding: 2px 18px 18px; overscroll-behavior: contain; }
/* A soft edge where the card scrolls, so more below is evident. */
.tour-body.more { -webkit-mask-image: linear-gradient(#000 calc(100% - 34px), transparent); mask-image: linear-gradient(#000 calc(100% - 34px), transparent); }
.tour-body h3 { margin: 10px 0 6px; font-size: 13px; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tour-body p { margin: 0 0 8px; }
.tour-lead { font-size: 17px; }
.tour-hint { color: var(--muted); font-size: 13px; font-style: italic; }
.tour-swatch { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .25); }
.mono .tour-swatch { filter: grayscale(1); }
.tour-look { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; padding: 0; list-style: none; }
.tour .tour-chip { display: flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 12px; border: 1px solid #cfc6ad; border-radius: 20px; background: #fbf9f1; }
.tour .tour-chip:hover { background: #fff; }
.tour-plants { margin: 0; padding: 0; list-style: none; }
.tour-plants > li { padding: 9px 0; border-bottom: 1px solid var(--rule); }
.tour-plants > li:last-child { border-bottom: 0; }
.tour-plants p { margin: 6px 0; }
.tour-plant-head { display: flex; align-items: center; gap: 9px; }
.tour-plant-head > div { flex: 1; min-width: 0; }
.tour-plant-head b { display: block; font-weight: 400; font-size: 17px; }
.tour-plant-head i { display: block; color: var(--muted); font-size: 13px; }
.tour .tour-show { min-height: 36px; padding: 0 10px; border: 1px solid #cfc6ad; border-radius: 18px; font-size: 13px; white-space: nowrap; }
.tour-cal { margin-top: 6px; }
.tour-cal-row { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.tour-cal-row span { padding: 2px 0; border-radius: 2px; background: #e6dfcb; color: #8a8c80; font-size: 11px; text-align: center; }
.tour-cal-row span.on { background: #6f8a52; color: #fff; }
.tour-now { position: absolute; top: -5px; width: 0; height: 0; margin-left: -4px; border: 4px solid transparent; border-top: 5px solid #b8322d; border-bottom: 0; }
.tour-now::after { content: 'now'; position: absolute; bottom: 4px; left: 0; translate: -50% 0; color: #b8322d; font-size: 10px; font-style: normal; }
.tour-cal { padding-top: 9px; }
.tour-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.tour-tags li { padding: 1px 8px; border-radius: 10px; background: #e9e3d2; font-size: 12px; }
.tour-tags .tag-monarch, .tour-tags .tag-caterpillars { background: #f3d9bf; }
.tour-tags .tag-hummingbirds { background: #f2c9cf; }
.tour-tags .tag-bees, .tour-tags .tag-wasps { background: #efe2a8; }
.tour-tags .tag-birds, .tour-tags .tag-cover { background: #d6e1c8; }
.tour-life { margin: 0; }
.tour-life dt { margin-top: 8px; font-size: 17px; }
.tour-life dd { margin: 1px 0 0; padding-left: 12px; border-left: 2px solid #c9bf9f; color: #333a31; }
.tour-cycle { margin: 0; padding: 0; list-style: none; counter-reset: stage; }
.tour-cycle li { position: relative; display: grid; padding: 0 0 12px 40px; counter-increment: stage; }
.tour-cycle li::before { content: counter(stage); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: #e98a2c; color: #fff; display: grid; place-items: center; font-size: 14px; }
.tour-cycle li:not(:last-child)::after { content: ''; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 2px; background: #edc89d; }
.tour-cycle b { font-weight: 400; font-size: 17px; }
.tour-bowl { display: block; width: 100%; height: auto; margin: 2px 0 6px; }
.tour-bowl .ground { fill: none; stroke: #6b5a3e; stroke-width: 2.5; }
.tour-bowl .water { fill: #9cc3cf; }
.tour-bowl .ticks { stroke: #6f8a52; stroke-width: 2; stroke-linecap: round; }
.tour-bowl text { fill: var(--muted); font: 11px var(--serif); text-anchor: middle; }
.tour-zones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tour-zones b { display: block; font-weight: 400; font-size: 16px; }
.tour-zones i { display: block; color: var(--muted); font-size: 12px; }
.tour-zones ul { margin: 6px 0 0; padding: 0; list-style: none; }
.tour-zones li { display: flex; align-items: center; gap: 6px; padding: 2px 0; font-size: 13px; line-height: 1.2; }
.tour-question { font-size: 19px; line-height: 1.3; }
.tour .tour-reveal { border: 1px dashed #a99f83; }
.tour-answer { padding: 9px 12px; border-radius: 3px; background: #e8efdc; }
.tour-where { font-size: 17px; font-style: italic; }
.tour-fit { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0 0 10px; }
.tour-fit div { padding: 6px 8px; border-radius: 3px; background: #e9e3d2; }
.tour-fit dt { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.tour-fit dd { margin: 1px 0 0; font-size: 13px; line-height: 1.25; }
.tour-steps { margin: 0 0 8px; padding-left: 22px; }
.tour-steps li { margin-bottom: 5px; }
.tour-note { padding: 7px 10px; border-left: 3px solid #c79a2c; background: #f6ecc9; font-size: 13px; }
.tour-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px 4px 18px; border-top: 1px solid var(--rule); }
.tour-progress { display: flex; align-items: center; gap: 8px; }
.tour-dots { display: flex; gap: 5px; margin: 0; padding: 0; list-style: none; }
.tour-dots li { width: 7px; height: 7px; border-radius: 50%; background: #d3cab2; }
.tour-dots li.past { background: #9aa287; }
.tour-dots li.on { background: var(--ink); }
.tour-count { margin: 0; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tour-buttons { display: flex; gap: 6px; }
.tour .tour-back:disabled { opacity: .35; cursor: default; }
.tour .tour-next { min-width: 92px; background: var(--ink); color: var(--paper); }
.tour .tour-next.go { background: #3d6b3a; }
.tour .tour-quiet { align-self: flex-start; min-height: 34px; margin: 0 0 4px 8px; color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.tour button:focus-visible { outline-color: #3d6b3a; }
.tour-photo { flex: none; border-radius: 3px; object-fit: cover; background: #e6dfcb; }
.tour-chip .tour-photo { border-radius: 50%; margin-left: -6px; }
.mono .tour-photo { filter: grayscale(1); }
.tour-biome { margin: 4px 0 8px; padding: 8px 12px; border-left: 3px solid #6f8a52; background: #e9e8d6; }
.tour-biome p { margin: 0; font-size: 14px; }
.tour-biome .tour-biome-label { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.tour-biome .tour-biome-name { font-size: 17px; }
.tour-yard { font-style: italic; }
.tour-how { margin: 0; padding: 0; list-style: none; counter-reset: point; }
.tour-how li { position: relative; display: grid; gap: 1px; padding: 0 0 12px 40px; counter-increment: point; }
.tour-how li::before { content: counter(point); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: #6f8a52; color: #fff; display: grid; place-items: center; font-size: 14px; }
.tour-how b { font-weight: 400; font-size: 17px; }
.tour-garden { margin-top: 8px !important; padding: 6px 10px; border-radius: 3px; background: #e8efdc; font-size: 14px; }
.tour-garden b { display: block; color: #3d6b3a; font-size: 11px; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; }
.tour-source, .tour-credit { color: var(--muted); font-size: 11px; }
.tour-source { margin: 6px 0 0 !important; }
.tour a { color: #2f5a2c; text-underline-offset: 2px; }
.tour-life dt { display: flex; align-items: center; gap: 10px; }
.tour-life .tour-photo { border-radius: 50%; }
.tour-credit { display: block; margin-top: 2px; }
.lists li b a { color: inherit; text-underline-offset: 3px; }
.tour-setting { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.tour-setting button { background: #e4ddc8; color: var(--ink); font-size: 14px; }

@media (max-width: 720px) {
  .tour { left: var(--left); right: var(--right); width: auto; height: min(56dvh, 520px); }
  .tour-head h2 { font-size: 22px; }
  .tour-lead { font-size: 16px; }
  #tuning { left: var(--left); right: var(--right); width: auto; top: auto; height: min(58dvh, 520px); }
  .tools .label { display: none; }
  .tools button { width: 44px; padding: 0; }
  .guide-body { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .guide-head h2 { font-size: 20px; }
  #stop-list { columns: 1; }
  .map-stop { font-size: 12px; }
  .map-stop::before { inset: 12px; border-width: 1.5px; }
}
@media (max-height: 460px) {
  .tour { left: var(--left); right: auto; width: min(400px, 58vw); height: calc(100dvh - var(--top) - var(--bottom) - 62px); }
  .tour-head { padding-top: 6px; }
  .tour-head h2 { font-size: 19px; }
  #stick { width: 100px; height: 100px; }
  .pad { bottom: var(--bottom); }
  .lift button { width: 48px; height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  #loading { transition: none; }
}
