/* Grow Your Forest — loaded only on /forest/ (and inlined into the preview bundle). */

.forest-head { padding-bottom: var(--s-3); }
.forest { padding-bottom: var(--s-6); --f-accent: #1e5a3c; }

/* ---------- the woodland ---------- */
.forest__stagewrap { position: relative; margin-bottom: var(--s-2); }
.forest__stage { position: relative; border-radius: 6px; overflow: hidden; background: #e6efe4; aspect-ratio: 1200 / 760; }
.forest-svg { display: block; width: 100%; height: 100%; }
.forest__storage { background: var(--sun-soft); border-left: 3px solid var(--sun-mid); padding: 0.8rem 1rem; margin: 0 0 var(--s-2); font-size: var(--fs-sm); }

/* plots: calm focus and hover states; generous hit areas */
.forest .plot { cursor: pointer; outline: none; }
.forest .plot__ring { stroke: transparent; stroke-width: 3; transition: stroke 0.2s; }
.forest .plot:hover .plot__ring, .forest .plot:focus-visible .plot__ring { stroke: #ffffff; }
.forest .plot:focus-visible .plot__ring { stroke: #1e5a3c; stroke-width: 4; }
.forest .plot.is-selected .plot__ring { stroke: #1e5a3c; stroke-width: 4; }
.forest .is-planting .plot--empty .plot__ring, .forest .plot.is-target .plot__ring { stroke: #ffffff; stroke-dasharray: 6 6; }
.forest .critter__hit { cursor: pointer; outline: none; }
.forest .critter__hit:focus-visible { outline: 3px solid #1e5a3c; }

/* gentle movement: crowns sway a little, out of step with each other */
.forest-svg .crown { transform-box: fill-box; transform-origin: 50% 100%; animation: sway 7s ease-in-out infinite; animation-delay: var(--sway-delay, 0s); }
.forest-svg .plot--birch .crown { animation-duration: 5.5s; }
.forest-svg .plot--pine .crown { animation-duration: 9s; }
@keyframes sway { 0%, 100% { transform: rotate(-0.6deg); } 50% { transform: rotate(0.6deg); } }

/* planting: a seed lands, then the seedling unfurls */
.forest-svg .seedfall { animation: seedfall 0.7s cubic-bezier(.4, 0, .6, 1) both; }
@keyframes seedfall { 0% { transform: translateY(-160px); opacity: 0; } 15% { opacity: 1; } 80% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(0); opacity: 0; } }
.forest-svg .anim-plant .tree { transform-box: fill-box; transform-origin: 50% 100%; animation: sprout 0.9s 0.55s cubic-bezier(.2, .8, .3, 1.2) both; }
@keyframes sprout { from { transform: scale(0.05); opacity: 0; } to { transform: scale(1); opacity: 1; } }
/* growing: the new shape rises out of the old one */
.forest-svg .anim-grow .tree { transform-box: fill-box; transform-origin: 50% 100%; animation: growup 1.1s cubic-bezier(.2, .7, .3, 1) both; }
@keyframes growup { from { transform: scale(0.45, 0.35); opacity: 0.4; } to { transform: scale(1); opacity: 1; } }
/* the jay flies in once, then keeps its perch */
.forest-svg .jay--arrive { animation: jayin 2.2s cubic-bezier(.3, .1, .3, 1) both; }
@keyframes jayin { 0% { transform: translate(1300px, 160px) scale(1.35); } 70% { transform: translate(640px, 520px) scale(1.35); } 100% { transform: translate(612px, 536px) scale(1.35); } }
.forest-svg .unlock { animation: fadein 1.2s ease both; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.forest.is-paused .forest-svg *, .returns__forest .forest-svg * { animation-play-state: paused; }
.returns__forest:hover .forest-svg * { animation-play-state: running; }
@media (prefers-reduced-motion: reduce) {
  .forest-svg *, .forest-svg .crown { animation: none !important; transition: none !important; }
  .forest-svg .seedfall { display: none; }
}

.forest__toast { position: absolute; left: var(--s-2); right: var(--s-2); bottom: var(--s-2); max-width: 30rem; background: #fff; border-left: 3px solid var(--f-accent); padding: 0.8rem 1rem; font-size: var(--fs-sm); box-shadow: 0 6px 24px rgba(20, 30, 20, 0.12); animation: rise 0.4s var(--ease) both; }
.forest__toast p { margin: 0; }
.forest__toast p + p { margin-top: 0.4rem; }

/* ---------- plain status line, not cards ---------- */
.forest__status { display: flex; flex-wrap: wrap; gap: 0.4rem 2.5rem; margin: 0 0 var(--s-4); padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
.forest__status div { display: flex; align-items: baseline; gap: 0.6rem; }
.forest__status dt { font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.forest__status dd { margin: 0; font-family: var(--display); font-size: 1.5rem; font-weight: 500; }
.forest__complete { background: var(--leaf-soft); padding: 1rem 1.2rem; margin: calc(-1 * var(--s-2)) 0 var(--s-4); border-left: 3px solid var(--leaf); }

/* ---------- panel + sidebar ---------- */
.forest__grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: var(--s-5); align-items: start; }
.forest__panel { min-height: 16rem; }
.forest__panel .label { margin-bottom: 0.5rem; }
.fp__title { font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.5rem); line-height: 1.12; margin: 0 0 0.8rem; }
.fp__title:focus { outline: none; }
.fp__latin { display: block; font-family: var(--text); font-size: var(--fs-sm); font-style: italic; font-weight: 400; color: var(--ink-3); margin-top: 0.4rem; }
.fp__text { font-size: var(--fs-lg); color: var(--ink-2); margin: 0 0 var(--s-3); max-width: 36rem; }
.fp__prompt strong { color: var(--ink); }
.fp__aside { font-size: var(--fs-sm); color: var(--ink-3); margin: var(--s-2) 0 0; }
.fp__aside .textbtn { min-height: 0; padding: 0; }
.fp__seeds { display: flex; align-items: center; gap: 0.55rem; font-weight: 600; margin: 0 0 var(--s-2); }
.seedicon { width: 0.75rem; height: 1rem; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: #8a6440; display: inline-block; transform: rotate(-20deg); }
.fp__earned { font-family: var(--display); font-size: 1.5rem; color: var(--f-accent); margin: 0 0 0.4rem; }
.fp__earned span { display: block; font-family: var(--text); font-size: var(--fs-sm); color: var(--ink-3); margin-top: 0.2rem; }
.fp__facts { margin: 0 0 0.6rem; padding-left: 1.2rem; font-size: var(--fs-lg); line-height: 1.5; }
.fp__facts li { margin-bottom: 0.35rem; }
.fp__facts li::marker { color: var(--f-accent); }
.fp__src, .q__src { font-size: var(--fs-xs); color: var(--ink-3); margin: 0 0 var(--s-3); }
.fp__src a, .q__src a { color: var(--ink-3); }
.fp__note { font-size: var(--fs-sm); color: var(--ink-3); margin: 0 0 var(--s-2); }
.fp__back { min-height: 2.25rem; margin-bottom: var(--s-2); text-decoration: none; color: var(--ink-3); }
.fp__tomorrow { margin-top: var(--s-4); padding-top: var(--s-3); border-top: 1px solid var(--line); color: var(--ink-2); }
.fp__tomorrow p { margin: 0; }
.fp__actions { display: flex; flex-wrap: wrap; gap: 0 var(--s-3); margin-top: var(--s-2); }
.fp__reads { margin-top: var(--s-3); }
.fp__reads ul { margin: 0; padding-left: 1.2rem; }

.btn--forest { background: var(--f-accent); color: #fff; border: 0; transition: background-color var(--fast), transform var(--fast); }
.btn--forest:hover { background: #164a31; }
.btn--forest:active { transform: translateY(1px); }
.btn--forest:focus-visible { outline: 3px solid var(--f-accent); outline-offset: 3px; }
.btn--forest[disabled] { background: var(--line-2); color: var(--ink-3); cursor: not-allowed; }
.btn--danger { background: var(--coral); color: #fff; border: 0; }

/* species choice */
.species { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); }
.species__btn { display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; padding: 0.9rem; border: 1px solid var(--line-2); border-radius: 6px; background: #fff; cursor: pointer; text-align: left; transition: border-color var(--fast), background-color var(--fast); }
.species__btn:hover, .species__btn:focus-visible { border-color: var(--f-accent); background: var(--leaf-soft); outline: none; }
.species__name { font-weight: 600; }
.species__latin { font-size: var(--fs-xs); font-style: italic; color: var(--ink-3); }
.species__thumb { width: 2.6rem; height: 2.6rem; margin-bottom: 0.4rem; border-radius: 50%; background: var(--leaf-soft); position: relative; }
.species__thumb::before, .species__thumb::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%); }
.species__thumb--oak::before { bottom: 0.35rem; width: 0.25rem; height: 0.8rem; background: #5d4732; }
.species__thumb--oak::after { top: 0.35rem; width: 1.8rem; height: 1.3rem; border-radius: 50%; background: #467339; box-shadow: -0.35rem 0.2rem 0 -0.1rem #5b8745; }
.species__thumb--birch::before { bottom: 0.3rem; width: 0.16rem; height: 1.7rem; background: #f1eee6; border: 1px solid #b9b3a5; }
.species__thumb--birch::after { top: 0.3rem; width: 1.05rem; height: 1.6rem; border-radius: 50%; background: #a2c062; opacity: 0.9; }
.species__thumb--pine::before { bottom: 0.3rem; width: 0.2rem; height: 1.6rem; background: #c26c37; }
.species__thumb--pine::after { top: 0.45rem; width: 1.9rem; height: 0.7rem; border-radius: 50%; background: #2f5848; box-shadow: 0.2rem 0.45rem 0 -0.1rem #3d6a57; }

/* questions inside the panel reuse the journal's quiz styles */
.q--forest .q__prompt { font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); }
.fq__dots { list-style: none; padding: 0; margin: 0 0 var(--s-3); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.35rem; max-width: 16rem; }
.fq__dots li { height: 5px; border-radius: 3px; background: var(--line); }
.fq__dots li.is-done { background: var(--f-accent); }
.fq__dots li.is-now { background: var(--leaf-mid); }
.q--forest .q__feedback p { margin: 0 0 0.4rem; }
.levels { display: flex; gap: var(--s-3); margin-bottom: var(--s-2); }

/* sidebar */
.fside { border-top: 2px solid var(--ink); padding-top: var(--s-2); }
.forest__side { display: grid; gap: var(--s-4); }
.fside__h { font-family: var(--text); font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; margin: 0 0 var(--s-2); }
.fside__rules { margin: 0 0 var(--s-2); padding-left: 1.1rem; font-size: var(--fs-sm); color: var(--ink-2); }
.fside__rules li { margin-bottom: 0.45rem; }
.fside__note { font-size: var(--fs-sm); color: var(--ink-3); margin: 0 0 0.4rem; }
.ms-list { list-style: none; padding: 0; margin: 0; }
.ms { display: grid; grid-template-columns: 1.1rem minmax(0, 1fr); gap: 0.7rem; padding: 0.7rem 0; border-top: 1px solid var(--line); }
.ms:first-child { border-top: 0; padding-top: 0; }
.ms__mark { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 2px solid var(--line-2); margin-top: 0.15rem; }
.ms.is-done .ms__mark { border-color: var(--f-accent); background: var(--f-accent); box-shadow: inset 0 0 0 3px #fff; }
.ms__name { font-weight: 600; margin: 0; }
.ms__cond, .ms__reward { margin: 0.1rem 0 0; font-size: var(--fs-sm); color: var(--ink-3); }
.ms.is-done .ms__reward { color: var(--f-accent); }

.fside--list, .fside--tools { margin-top: var(--s-5); }
.plotlist { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--s-4); }
.plotlist li { display: flex; justify-content: space-between; align-items: center; gap: var(--s-2); border-top: 1px solid var(--line); padding: 0.15rem 0; font-size: var(--fs-sm); }
.plotlist .textbtn { min-height: 2.5rem; padding: 0.3rem 0; white-space: nowrap; }
.ftools { display: flex; flex-wrap: wrap; gap: 0 var(--s-3); align-items: center; }
.ftools__reset { color: var(--ink-3); }
.fconfirm { margin-top: var(--s-2); padding: 1rem 1.2rem; background: var(--surface); border-radius: 6px; display: flex; flex-wrap: wrap; gap: 0.6rem var(--s-3); align-items: center; }
.fconfirm p { flex-basis: 100%; margin: 0; }
.ftools__msg { font-size: var(--fs-sm); color: var(--ink-2); margin: var(--s-2) 0 0; min-height: 1.4em; }
.ftools__msg.is-error { color: var(--coral); }

@media (max-width: 900px) {
  .forest__grid { grid-template-columns: minmax(0, 1fr); gap: var(--s-4); }
}
@media (max-width: 600px) {
  .forest__stage { margin-left: calc(-1 * var(--gutter, 1rem)); margin-right: calc(-1 * var(--gutter, 1rem)); border-radius: 0; }
  .forest__status { gap: 0.3rem 1.4rem; }
  .forest__status dd { font-size: 1.25rem; }
  .species { grid-template-columns: minmax(0, 1fr); }
  .species__btn { flex-direction: row; align-items: center; gap: 0.8rem; }
  .species__thumb { margin: 0; flex: none; }
  .plotlist { grid-template-columns: minmax(0, 1fr); }
  .forest__toast { position: static; margin-top: var(--s-2); box-shadow: none; }
}
.fconfirm[hidden], .forest__toast[hidden], .forest__complete[hidden], .forest__storage[hidden] { display: none; }
.forest__stagewrap, .forest__panel { scroll-margin-top: calc(var(--header-h) + 1rem); }
.forest__hint { position: absolute; top: var(--s-2); left: var(--s-2); margin: 0; background: #fff; color: var(--ink); font-size: var(--fs-sm); font-weight: 600; padding: 0.5rem 0.85rem; border-radius: 999px; box-shadow: 0 2px 10px rgba(20, 30, 20, 0.12); pointer-events: none; }
.forest__hint[hidden] { display: none; }
@media (max-width: 600px) { .forest__hint { position: static; display: inline-block; margin-top: var(--s-2); box-shadow: none; background: var(--leaf-soft); } }
@media (max-width: 600px) { .forest__stage { aspect-ratio: 1160 / 650; } }
