/* Future Kid — learning pages, gallery, share form and reviewer view.
   Loaded after styles.css, which provides the tokens, header, buttons and footer. */

:root {
  --topic: var(--lavender);
  --topic-soft: #efe8fd;
  --line: #e6dccb;
  --ok: #0b7a3b;
  --ok-bg: #e3f7e8;
  --bad: #b42318;
  --bad-bg: #fde8e6;
  --info-bg: #eef1ff;
  --card: #ffffff;
}
body[data-topic="coding"]      { --topic: var(--coding);      --topic-soft: #fff4c4; }
body[data-topic="design"]      { --topic: var(--design);      --topic-soft: #dcf0fd; }
body[data-topic="engineering"] { --topic: var(--engineering); --topic-soft: #e2f7da; }
body[data-topic="robotics"]    { --topic: var(--robotics);    --topic-soft: #ece1fd; }

.site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 6px; }

/* ---------- Page scaffolding ---------- */

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding-inline: var(--page-pad);
}
.band { padding-block: clamp(36px, 5vw, 64px); }
.band + .band { padding-top: 0; }
.band h2 {
  font-size: clamp(1.9rem, 3.6vw, 2.8rem);
  margin-bottom: 10px;
}
.band h3 { font-size: clamp(1.3rem, 2.2vw, 1.6rem); line-height: 1.15; }
.lead {
  max-width: 44em;
  font-weight: 600;
  font-size: clamp(1.1rem, 1.6vw, 1.3rem);
  line-height: 1.45;
}
.prose p, .prose li { font-weight: 600; font-size: 1.12rem; line-height: 1.5; }
.prose p + p { margin-top: 10px; }
.prose ul { padding-left: 1.2em; margin: 10px 0 0; }

.eyebrow {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--white);
  border: 2px solid var(--navy);
  font-weight: 900;
  font-size: 1rem;
  letter-spacing: .02em;
}

/* ---------- Subject hero ---------- */

.subject-hero { background: var(--topic); }
.subject-hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  align-items: center;
  gap: clamp(24px, 4vw, 56px);
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(32px, 4.5vw, 60px) var(--page-pad);
}
.subject-hero h1 {
  margin-top: 14px;
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  line-height: .98;
  letter-spacing: -0.015em;
}
.subject-hero p.lead { margin-top: 16px; }
.subject-hero .btn { margin-top: 24px; }
.subject-hero__art {
  justify-self: end;
  width: min(100%, 440px);
  border-radius: 22px;
  overflow: hidden;
  border: 3px solid var(--navy);
  box-shadow: 0 8px 0 rgba(7, 10, 51, .18);
  background: var(--topic);
}
.subject-hero__art img { width: 100%; height: auto; }

/* ---------- Challenge facts & difficulty switch ---------- */

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
.facts li {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--card);
  border: 2px solid var(--line);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.4;
}
.facts strong { display: block; font-weight: 900; font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }

.level-switch {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 22px;
  padding: 6px;
  border-radius: 14px;
  background: var(--card);
  border: 2px solid var(--navy);
}
.level-switch button {
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--navy);
  font: 800 1.1rem/1 var(--font);
  cursor: pointer;
}
.level-switch button[aria-pressed="true"] { background: var(--navy); color: var(--white); }
.level-switch button[aria-pressed="true"]::before { content: "✓ "; }
.level-switch button:hover:not([aria-pressed="true"]) { background: var(--topic-soft); }
.level-note { margin-top: 10px; font-weight: 700; font-size: 1.02rem; }

[data-level-show][hidden] { display: none !important; }

/* ---------- Panels, steps, callouts ---------- */

.panel {
  margin-top: 22px;
  padding: clamp(18px, 2.6vw, 28px);
  border-radius: 20px;
  background: var(--card);
  border: 2px solid var(--line);
}
.panel--topic { background: var(--topic-soft); border-color: transparent; }

.steps {
  counter-reset: step;
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.steps > li {
  counter-increment: step;
  position: relative;
  padding: 16px 18px 16px 70px;
  border-radius: 16px;
  background: var(--card);
  border: 2px solid var(--line);
  font-weight: 600;
  font-size: 1.1rem;
  line-height: 1.45;
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 16px;
  top: 14px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--topic);
  border: 2px solid var(--navy);
  font-weight: 900;
  font-size: 1.2rem;
}
.steps h3 { margin-bottom: 4px; font-size: 1.25rem; }

.illus-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.illus-steps > li {
  counter-increment: step;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  background: var(--card);
  border: 2px solid var(--line);
}
.illus-steps svg { display: block; width: 100%; height: auto; background: var(--topic-soft); }
.illus-steps .illus-steps__text { padding: 16px 18px 18px; font-weight: 600; font-size: 1.08rem; line-height: 1.45; flex: 1; }
.illus-steps h3::before { content: counter(step) ". "; }
.illus-steps h3 { margin-bottom: 6px; font-size: 1.25rem; }

.done-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: 12px;
  font-weight: 800;
  font-size: 1.02rem;
  cursor: pointer;
}
.done-toggle input { width: 24px; height: 24px; accent-color: var(--navy); }

.callout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.callout__icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--topic);
  border: 2px solid var(--navy);
  font-size: 2rem;
}
.example {
  margin-top: 14px;
  padding: 14px 16px;
  border-left: 6px solid var(--topic);
  border-radius: 8px;
  background: var(--card);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.45;
}
.example strong { font-weight: 900; }

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(18px, 3vw, 36px);
  align-items: start;
}

/* ---------- Feedback ---------- */

.feedback {
  min-height: 1.5em;
  margin-top: 14px;
  font-weight: 700;
  font-size: 1.08rem;
  line-height: 1.45;
}
.feedback:empty { display: none; }
.feedback[data-tone] { padding: 12px 16px 12px 48px; border-radius: 12px; position: relative; }
.feedback[data-tone]::before { position: absolute; left: 14px; top: 10px; font-size: 1.3rem; font-weight: 900; }
.feedback[data-tone="ok"]   { background: var(--ok-bg); color: #08471f; border: 2px solid var(--ok); }
.feedback[data-tone="ok"]::before { content: "✓"; color: var(--ok); }
.feedback[data-tone="bad"]  { background: var(--bad-bg); color: #6f130c; border: 2px solid var(--bad); }
.feedback[data-tone="bad"]::before { content: "!"; color: var(--bad); }
.feedback[data-tone="info"] { background: var(--info-bg); color: var(--navy); border: 2px solid #9aa6f2; }
.feedback[data-tone="info"]::before { content: "→"; color: var(--blue); }

/* ---------- Shared small controls ---------- */

.btn--compact {
  min-height: 48px;
  padding: 0 18px;
  font-size: 1.1rem;
}
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn--outline[disabled]:hover { background: var(--white); color: var(--navy); }
.btn--primary[disabled]:hover { background: var(--blue); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 2px solid var(--navy);
  background: var(--white);
  color: var(--navy);
  font: 800 1rem/1 var(--font);
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--navy); color: var(--white); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Grid activities (coding + robotics) ---------- */

.activity {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: clamp(18px, 3vw, 32px);
  align-items: start;
}
.board {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 18px;
  background: #cfe7a8;
  border: 3px solid var(--navy);
  width: 100%;
  max-width: 560px;
}
.cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  background: #e8f4cf;
  display: grid;
  place-items: center;
}
.cell--water { background: #8fd0f5; }
.cell--trail::after {
  content: "";
  width: 22%;
  height: 22%;
  border-radius: 50%;
  background: rgba(7, 10, 51, .28);
}
.cell--goal { background: #ffe58a; }
.cell--sensed { box-shadow: inset 0 0 0 4px #ff7a00; }
.cell svg { width: 86%; height: 86%; position: relative; z-index: 1; }
.cell .token { position: absolute; inset: 7%; display: grid; place-items: center; z-index: 2; transition: transform .2s ease; }
.cell .token svg { width: 100%; height: 100%; }
.cell--bump { animation: bump .35s ease; }
@keyframes bump { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .cell--bump { animation: none; } .cell .token { transition: none; } }

.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 12px 0 0; padding: 0; list-style: none; font-weight: 700; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend svg { width: 26px; height: 26px; }

.pad { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.pad button {
  min-height: 56px;
  border-radius: 12px;
  border: 2px solid var(--navy);
  background: var(--topic);
  color: var(--navy);
  font: 900 1.05rem/1.1 var(--font);
  cursor: pointer;
}
.pad button span { display: block; font-size: 1.5rem; }
.pad button:hover { filter: brightness(.95); }
.pad button[disabled] { opacity: .45; cursor: not-allowed; }

.queue {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 60px;
  margin: 10px 0 0;
  padding: 10px;
  border-radius: 12px;
  border: 2px dashed #b9ad97;
  background: #fffdf8;
  list-style: none;
}
.queue:empty::before { content: attr(data-empty); align-self: center; color: #5b5a70; font-weight: 600; }
.queue button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 10px;
  border: 2px solid var(--navy);
  background: var(--white);
  color: var(--navy);
  font: 800 1rem/1 var(--font);
  cursor: pointer;
}
.queue button .n { font-size: .8rem; color: #5b5a70; }
.queue button.is-current { background: var(--blue); color: var(--white); border-color: var(--blue); }
.queue button.is-current .n { color: #dfe4ff; }
.queue button.is-done { background: var(--ok-bg); border-color: var(--ok); }
.queue button.is-error { background: var(--bad-bg); border-color: var(--bad); box-shadow: 0 0 0 2px var(--bad); }
.queue button.is-error::after { content: "✗"; color: var(--bad); margin-left: 2px; }

.label-strong { display: block; margin-top: 18px; font-weight: 900; font-size: 1.1rem; }

.rules { display: grid; gap: 12px; margin-top: 10px; }
.rule {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--topic-soft);
  border: 2px solid transparent;
  font-weight: 800;
  font-size: 1.08rem;
}
.rule.is-fired { border-color: var(--navy); background: var(--topic); }
.rule select {
  min-height: 46px;
  padding: 0 10px;
  border-radius: 10px;
  border: 2px solid var(--navy);
  background: var(--white);
  color: var(--navy);
  font: 800 1.05rem var(--font);
}

.log {
  max-height: 280px;
  overflow: auto;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: #fffdf8;
}
.log:empty::before { content: attr(data-empty); display: block; padding: 12px; color: #5b5a70; font-weight: 600; }
.log li { padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 600; line-height: 1.4; }
.log li:last-child { border-bottom: 0; background: var(--topic-soft); }
.log b { font-weight: 900; }

.offline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 260px);
  gap: 20px;
  align-items: center;
}
.squared {
  width: 100%;
  max-width: 260px;
  justify-self: end;
}

/* ---------- Results table (engineering) ---------- */

.results { width: 100%; border-collapse: separate; border-spacing: 0; font-weight: 700; font-size: 1.05rem; }
.results caption { text-align: left; font-weight: 900; font-size: 1.25rem; margin-bottom: 8px; }
.results th, .results td { padding: 10px 12px; border-bottom: 2px solid var(--line); text-align: left; vertical-align: middle; }
.results thead th { background: var(--topic); border-bottom: 2px solid var(--navy); }
.results thead th:first-child { border-top-left-radius: 12px; }
.results thead th:last-child { border-top-right-radius: 12px; }
.results input {
  width: 6.5em;
  min-height: 46px;
  padding: 0 10px;
  border-radius: 10px;
  border: 2px solid var(--navy);
  font: 800 1.1rem var(--font);
  color: var(--navy);
}
.results tbody tr { background: var(--card); }
.table-scroll { overflow-x: auto; }

/* ---------- Gallery cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: 18px;
  overflow: hidden;
  background: var(--card);
  border: 2px solid var(--line);
}
.card__media { aspect-ratio: 4 / 3; width: 100%; object-fit: cover; background: #eee6d6; }
.card__media--wide { aspect-ratio: 788 / 300; }
.card__nomedia { display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--topic-soft); font-weight: 800; padding: 16px; text-align: center; }
.card__body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 { font-size: 1.35rem; line-height: 1.15; }
.card p { font-weight: 600; line-height: 1.45; }
.card__by { color: #4b4a63; font-size: .98rem; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-weight: 800; font-size: .88rem; border: 2px solid var(--navy); background: var(--white); }
.badge--coding { background: var(--coding); }
.badge--design { background: var(--design); }
.badge--engineering { background: var(--engineering); }
.badge--robotics { background: var(--robotics); }
.badge--wip { background: #fff; border-style: dashed; }
.card a.text-link { font-size: 1.05rem; min-height: 44px; }

.feature-card {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  border-radius: 20px;
  overflow: hidden;
  background: var(--card);
  border: 2px solid var(--line);
}
.feature-card img { width: 100%; height: 100%; object-fit: cover; min-height: 220px; }
.feature-card__body { padding: clamp(18px, 2.6vw, 28px); display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.feature-card h3 { font-size: clamp(1.5rem, 2.6vw, 2rem); line-height: 1.08; }
.feature-card p { font-weight: 600; font-size: 1.08rem; line-height: 1.45; }

.empty {
  padding: 22px;
  border-radius: 18px;
  border: 2px dashed #b9ad97;
  background: #fffdf8;
  font-weight: 700;
  font-size: 1.08rem;
  line-height: 1.45;
}

.share-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 22px;
  padding: 18px 22px;
  border-radius: 18px;
  background: var(--topic);
  border: 2px solid var(--navy);
}
.share-cta p { font-weight: 800; font-size: 1.15rem; max-width: 34em; }

/* ---------- Forms (share) ---------- */

.form { display: grid; gap: 22px; max-width: 760px; }
.form fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.form fieldset[disabled] { opacity: .6; }
.field { display: grid; gap: 6px; }
.field__label, .form legend { font-weight: 900; font-size: 1.15rem; padding: 0; }
.field__hint { font-weight: 600; color: #4b4a63; font-size: 1rem; line-height: 1.4; }
.field__error { font-weight: 800; color: var(--bad); font-size: 1rem; }
.field__error:empty { display: none; }
.field__error:not(:empty)::before { content: "! "; }
.form input[type="text"], .form input[type="url"], .form textarea, .form input[type="file"] {
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid var(--navy);
  background: var(--white);
  color: var(--navy);
  font: 600 1.1rem/1.4 var(--font);
}
.form textarea { min-height: 110px; resize: vertical; }
.form [aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 2px var(--bad); }
.topic-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 8px; }
.topic-pick label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 14px;
  border-radius: 14px;
  border: 2px solid var(--navy);
  font-weight: 900;
  font-size: 1.1rem;
  cursor: pointer;
}
.topic-pick input { width: 22px; height: 22px; accent-color: var(--navy); }
.topic-pick label:has(input:checked) { box-shadow: 0 0 0 3px var(--navy); }
.topic-pick label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; font-weight: 800; font-size: 1.1rem; cursor: pointer; }
.check input { width: 26px; height: 26px; accent-color: var(--navy); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.grown-up {
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--info-bg);
  border: 2px solid #9aa6f2;
  font-weight: 700;
  line-height: 1.45;
}

/* ---------- Reviewer ---------- */

.review { max-width: 1100px; margin: 0 auto; padding: 32px var(--page-pad) 60px; }
.review h1 { font-size: 2.4rem; }
.review__intro { margin: 10px 0 18px; font-weight: 600; font-size: 1.08rem; line-height: 1.5; max-width: 56em; }
.review__tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.review__list { display: grid; gap: 18px; margin-top: 18px; }
.review-who { margin-left: auto; font-weight: 800; }
.review-card { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 18px; padding: 16px; border-radius: 18px; background: var(--card); border: 2px solid var(--line); }
.review-card__media { width: 100%; max-height: 320px; object-fit: contain; background: #f3ede2; border-radius: 12px; }
.review-card__nomedia { display: grid; place-items: center; min-height: 160px; background: #f3ede2; border-radius: 12px; font-weight: 800; }
.review-card h2 { font-size: 1.5rem; margin-bottom: 8px; }
.review-card__facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0 0 12px; font-size: 1rem; }
.review-card__facts dt { font-weight: 900; }
.review-card__facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.review-card textarea { width: 100%; margin-top: 6px; padding: 8px 10px; border-radius: 10px; border: 2px solid var(--navy); font: 600 1rem var(--font); }
.review-card__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }

/* ---------- Footer on inner pages ---------- */
.page .site-footer { margin-top: 24px; }

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .activity { grid-template-columns: 1fr; }
  .board { margin-inline: auto; }
  .illus-steps { grid-template-columns: 1fr; }
  .illus-steps > li { flex-direction: row; }
  .illus-steps svg { width: 42%; flex: none; }
}

@media (max-width: 760px) {
  .subject-hero__inner { grid-template-columns: 1fr; }
  .subject-hero__art { justify-self: start; width: min(100%, 420px); }
  .facts { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .feature-card { grid-template-columns: 1fr; }
  .offline { grid-template-columns: 1fr; }
  .squared { justify-self: start; }
  .topic-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-card { grid-template-columns: 1fr; }
  .callout { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .illus-steps > li { flex-direction: column; }
  .illus-steps svg { width: 100%; }
  .level-switch { display: flex; }
  .level-switch button { flex: 1 1 auto; }
  .pad button { min-height: 60px; }
  .steps > li { padding-left: 62px; }
}
