/* AusSci · What do living things need? (Year 1): the storybook pages, the simulations' drawings and controls, the
   need buttons, the try-it cards, the job groups and the place in a box. Drawings are on a light plate with fixed
   colours in light and dark mode alike. Every need's colour also has its word, so colour is never the only key. */

/* ---------- drawings ---------- */
.dia { display: block; width: 100%; height: auto; font-family: 'Atkinson Next', system-ui, sans-serif; touch-action: manipulation; }
.plate { background: #fbfbf6; border: 1px solid #d8ded9; border-radius: 4px; color: #15231d; }
.dia text { fill: #15231d; pointer-events: none; }
.d-small { font-size: 11.5px; fill: #34423c; }
.dia text.d-lab, .dia text.d-lab-s, .dia text.d-lab-b, .dia text.d-big, .dia text.d-lab-w { paint-order: stroke; stroke: #fbfbf6; stroke-width: 3.4px; stroke-linejoin: round; }
.dia text.d-lab { font-size: 15px; font-weight: 700; }
.dia text.d-lab-s { font-size: 13px; font-weight: 700; fill: #2c3a34; }
.dia text.d-lab-b { font-size: 16px; font-weight: 800; }
.dia text.d-big { font-size: 22px; font-weight: 800; }
.dia text.d-lab-w { font-size: 14px; font-weight: 800; fill: #ffffff; stroke: rgba(21, 35, 29, 0.78); stroke-width: 3px; }
.dia text.d-ok { fill: #1f7a4d; }
.dia text.d-onDark { fill: #ffffff; stroke: rgba(21, 35, 29, 0.85); }
.art { position: relative; width: 100%; }
.art-cv { display: block; width: 100%; height: auto; border-radius: 4px; background: #fbfbf6; }
.art .art-svg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; max-width: none; overflow: visible; touch-action: manipulation; }
@media (max-width: 640px) { .dia text.d-lab { font-size: 14px; } .dia text.d-lab-b { font-size: 15px; } .dia text.d-lab-s { font-size: 12.5px; } .dia text.d-big { font-size: 19px; } }

/* ---------- the storybook ---------- */
.story { border: 2px solid var(--y-stripe); border-radius: 8px; padding: 0.9rem 1.1rem 1rem; background: var(--box); max-width: 50rem; }
.story-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.8rem; margin-bottom: 0.6rem; }
.story-head .play-tag { margin: 0 !important; }
.story-title { margin: 0; font-weight: 700; color: var(--ink-2); }
.story-pages { display: grid; gap: 1rem; }
.story-page { margin: 0; }
.story-page[hidden] { display: none; }
.story-pic { border-radius: 6px; overflow: hidden; border: 1px solid #d8ded9; background: #fbfbf6; }
.story:not(.is-live) .story-pic { display: none; }
.story-text { margin-top: 0.7rem; font-size: 1.278rem; line-height: 1.55; font-weight: 500; max-width: 42rem; }
.story-n { display: inline-block; font-size: 0.778rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); margin-right: 0.35rem; vertical-align: 0.12em; }
.story-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem; margin-top: 0.8rem; }
.story-nav:empty { display: none; }
.story-at { font-weight: 800; min-width: 7rem; }
.story-nav .btn:disabled { opacity: 0.45; cursor: not-allowed; }
@media (max-width: 640px) { .story { padding: 0.7rem 0.7rem 0.8rem; } .story-text { font-size: 1.167rem; } }

/* ---------- controls ---------- */
.ctl .label { margin-bottom: 0.3rem; }
.ctl + .ctl { margin-top: 0.6rem; }
.lab-run { display: flex; flex-wrap: wrap; gap: 0.5rem 0.8rem; align-items: center; margin-top: 0.6rem; }
.lab-run .btn[hidden], .ctl[hidden] { display: none; }
.seg { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.seg .btn { padding: 0.3rem 0.65rem; }
.seg .btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.seg .btn:disabled, .lab-run .btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- a simulation: the drawing, with its readings ---------- */
.nd-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; margin-top: 0.8rem; }
.nd-main { max-width: 52rem; }
.nd-box { padding: 0.25rem; }
.nd-read { margin: 0.45rem 0 0; font-size: 0.889rem; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.nd-status { min-height: 2.6em; font-size: 1.111rem; }
.nd-todo { margin: 0; color: var(--ink-3); }
.nd-wrap:has(.needs-list) { grid-template-columns: minmax(0, 1fr) minmax(12rem, 16rem); }
@media (max-width: 760px) { .nd-wrap:has(.needs-list) { grid-template-columns: minmax(0, 1fr); } }

/* ---------- screen 1: the two plants' settings ---------- */
.plant-ctls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem 1.2rem; max-width: 48rem; }
.plant-ctl { border: 1px solid var(--rule); border-radius: 6px; padding: 0.55rem 0.75rem 0.65rem; }
.plant-name { margin: 0 0 0.3rem; font-weight: 800; font-size: 1.056rem; }
@media (max-width: 640px) { .plant-ctls { grid-template-columns: minmax(0, 1fr); } }

/* ---------- the need buttons (screens 2, 3 and 5), each with its colour and its word ---------- */
.needs-btns { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.need { border-left-width: 0.45rem; border-radius: 6px; font-weight: 800; padding: 0.4rem 0.8rem; }
/* the needs' colours, checked with a palette validator for the sets shown together (screens 2 and 3: air, water, food,
   shelter; screen 5: water, food, shelter, light; story page 2: light, air and water); every use also has the need's
   name in words. The drawings keep these colours in dark mode; on the dark page the light stripe is a darker gold. */
.need-air { border-left-color: #1baf7a; }
.need-water { border-left-color: #2a78d6; }
.need-food { border-left-color: #e34948; }
.need-shelter { border-left-color: #008300; }
.need-light { border-left-color: #eda100; }
@media (prefers-color-scheme: dark) { .need-light { border-left-color: #c98500; } }
.need[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-top-color: var(--ink); border-right-color: var(--ink); border-bottom-color: var(--ink); }
.need.is-seen::after { content: ' \2713'; color: var(--ok); }
.need[aria-pressed="true"].is-seen::after { color: var(--paper); }

/* ---------- screen 3: the list of places ---------- */
.place-list { margin-top: 0.7rem; max-width: 46rem; }
.place-list summary { cursor: pointer; font-weight: 700; color: var(--ink-2); }
.place-btns { margin-top: 0.45rem; }

/* ---------- screen 5: the jobs and their groups ---------- */
.jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.4rem; max-width: 50rem; }
.job { text-align: left; padding: 0.45rem 0.7rem; border-radius: 6px; }
.job[aria-pressed="true"] { border-color: var(--ok); box-shadow: inset 0.3rem 0 0 var(--ok); }
.job[aria-pressed="true"]::after { content: ' \2713'; color: var(--ok); font-weight: 800; }
.groups { margin-top: 0.9rem; border-top: 1px dashed var(--rule); padding-top: 0.7rem; max-width: 50rem; }
.groups .small { margin: 0 0 0.4rem; color: var(--ink-3); }
.group-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.group-row { display: grid; grid-template-columns: minmax(10rem, 1fr) auto; gap: 0.3rem 0.8rem; align-items: center; border: 1px solid var(--rule); border-radius: 4px; padding: 0.4rem 0.6rem; background: var(--paper); }
.group-row[hidden] { display: none; }
.group-row.is-right { border-color: var(--ok); box-shadow: inset 0.3rem 0 0 var(--ok); }
.group-job { font-weight: 700; }
.group-btns .btn { padding: 0.25rem 0.55rem; font-size: 0.889rem; }
.group-msg { grid-column: 1 / -1; font-weight: 700; color: var(--ink-2); min-height: 0; }
.group-msg:empty { display: none; }
.group-row.is-right .group-msg { color: var(--ok); }
@media (max-width: 640px) { .group-row { grid-template-columns: minmax(0, 1fr); } }

/* ---------- screen 6: the things for the box, and the list of needs ---------- */
.things { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 0.4rem; max-width: 50rem; }
.thing { text-align: left; padding: 0.45rem 0.7rem; border-radius: 6px; }
.thing[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.thing[aria-pressed="true"]::before { content: '\2713 '; }
.needs-list { border: 1px solid var(--rule); border-radius: 6px; padding: 0.6rem 0.8rem; background: var(--paper); }
.needs-list ul { list-style: none; margin: 0.3rem 0 0; padding: 0; display: grid; gap: 0.35rem; }
.needs-list li { display: grid; gap: 0.05rem; }
.needs-list li b { font-size: 1.056rem; }
.needs-list li span { font-size: 0.889rem; color: var(--ink-2); }
.needs-list li.is-met b { color: var(--ok); }
.needs-list li.is-missing b { color: var(--bad, #b5401f); }

/* ---------- the try-it cards ---------- */
.tryit { border: 2px solid var(--y-stripe); border-radius: 6px; padding: 0.9rem 1.1rem 1rem; max-width: 46rem; background: var(--box); }
.play-tag { display: inline-block; font-size: 0.722rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--paper); background: var(--ink); border-radius: 3px; padding: 0.1rem 0.45rem; margin: 0 0 0.45rem !important; }
.tryit p { margin: 0 0 0.5rem; }
.ch-list { margin: 0.4rem 0 0.6rem; padding: 0; list-style: none; display: grid; gap: 0.5rem; counter-reset: ch; }
.ch { border: 1px solid var(--rule); background: var(--paper); border-radius: 4px; padding: 0.55rem 0.75rem 0.5rem 2.6rem; position: relative; counter-increment: ch; }
.ch::before { content: counter(ch); position: absolute; left: 0.6rem; top: 0.5rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 2px solid var(--ink-3); display: grid; place-items: center; font-weight: 800; font-size: 0.833rem; }
.ch.is-done { border-color: var(--ok); box-shadow: inset 0.3rem 0 0 var(--ok); }
.ch.is-done::before { content: '\2713'; border-color: var(--ok); background: var(--ok); color: var(--paper); }
.ch-t { font-weight: 800; margin: 0 0 0.25rem !important; }
.ch-hint summary { cursor: pointer; font-weight: 700; color: var(--ink-2); font-size: 0.944rem; }
.ch-hint p { margin: 0.3rem 0 0.2rem !important; }
.ch-done { margin: 0.2rem 0 0 !important; font-weight: 700; color: var(--ok); }
.ch-done:empty { display: none; }
.ch-count { font-weight: 800; }
.ch-talk { border-top: 1px dashed var(--rule); padding-top: 0.55rem; }
