/* Prairie Desk: shared styles for every page (hub and, later, the store pages).
   Uses tokens only; no hex values here. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
body > main { flex: 1 0 auto; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, p, ul, ol, figure, fieldset { margin: 0; }
ul, ol { padding: 0; list-style: none; }
fieldset { border: 0; padding: 0; min-width: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link); text-decoration-line: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
a:hover { text-decoration-thickness: 2px; }
::selection { background: var(--placeholder-tint); color: var(--text); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.on-field :focus-visible, .on-field:focus-visible { outline-color: var(--focus-on-field); }
html { scrollbar-color: var(--field-line) var(--bg); }
.tnum { font-variant-numeric: tabular-nums; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--s-4); top: var(--s-2); z-index: 10;
  padding: var(--s-3) var(--s-4); background: var(--surface); color: var(--text);
  border-radius: var(--r-pill); box-shadow: var(--shadow-float);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: calc(var(--container) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--s-5); }
@media (max-width: 767px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: var(--s-4); } }
.section { padding-block: var(--section-pad); }
.panel { margin-inline: var(--panel-inset); background: var(--field); color: var(--text-on-field); border-radius: var(--r-panel); }

/* ---------- Type ---------- */
.display, .h2, .h3, .card-title {
  font-family: var(--font-display);
  text-wrap: balance;
}
.display { font-size: var(--fs-display); line-height: var(--lh-display); font-weight: 700; letter-spacing: -0.01em; }
.h1-page { font-family: var(--font-display); font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: 700; letter-spacing: -0.005em; color: var(--heading); text-wrap: balance; }
.h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: 700; letter-spacing: -0.005em; color: var(--heading); }
.h3 { font-size: var(--fs-h3); line-height: 1.2; font-weight: 600; }
.card-title { font-size: var(--fs-card); line-height: 1.2; font-weight: 600; }
.lead { font-size: var(--fs-lead); line-height: 1.55; }
.small { font-size: var(--fs-small); line-height: 1.5; font-weight: 500; }
.muted { color: var(--text-muted); }
.section-head { max-width: 68ch; margin-bottom: var(--s-7); }
.section-head .h2 + p { margin-top: var(--s-4); }
.prose { max-width: 66ch; }
.prose p + p { margin-top: var(--s-4); }

/* ---------- Wordmark (horizon) ---------- */
.wordmark { display: inline-flex; align-items: center; min-height: 44px; color: var(--text); text-decoration: none; border-radius: 4px; }
.wordmark svg { height: 36px; width: auto; overflow: visible; }
.wordmark text { font-family: var(--font-display); font-weight: 600; font-size: 18px; fill: currentColor; }
.wordmark .rule-long { fill: currentColor; }
.wordmark .rule-short { fill: var(--rule-accent); }
@media (max-width: 767px) { .wordmark svg { height: 32px; } }

/* ---------- Buttons and chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--button-h); padding: 0 var(--button-pad-x);
  border: 0; border-radius: var(--r-pill);
  background: var(--action); color: var(--action-text);
  font-family: var(--font-body); font-size: var(--fs-ui); font-weight: 600; line-height: 1.2;
  text-decoration: none; white-space: nowrap;
  transition: background-color 160ms ease, transform 140ms var(--ease-out);
  touch-action: manipulation;
}
.btn:hover { background: var(--action-hover); }
.btn:active { transform: scale(0.97); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn--sm { min-height: var(--button-h-sm); padding-inline: var(--s-4); }
.btn--cream { background: var(--cream); color: var(--green-800); }
.btn--cream:hover { background: var(--paper); }
.btn--block { width: 100%; }

.chip {
  display: inline-flex; align-items: center; min-height: 28px; padding: 0 var(--s-3);
  border-radius: var(--r-pill);
  font-family: var(--font-display); font-size: var(--fs-chip); font-weight: 600; line-height: 1;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.chip--wheat { background: var(--wheat); color: var(--ink); }
.chip--placeholder {
  background: var(--placeholder-tint); color: var(--ink);
  font-family: var(--font-body); letter-spacing: 0; text-transform: none; font-size: var(--fs-small); font-weight: 600;
}

.text-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; }
.on-field a:not(.btn) { color: var(--text-on-field); }

/* ---------- Placeholder pill (contact) ---------- */
.placeholder-pill {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s-4);
  border: 1.5px dashed var(--placeholder-line); border-radius: var(--r-pill);
  color: var(--text); font-size: var(--fs-small); font-weight: 500;
}
.on-field .placeholder-pill { border-color: var(--wheat); color: var(--text-on-field-soft); }

/* ---------- Header ---------- */
.site-header { position: relative; z-index: 5; height: var(--header-h); background: var(--bg); }
.site-header .container { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--s-5); }
.site-nav { display: flex; align-items: center; gap: var(--s-6); }
.site-nav ul { display: flex; gap: var(--s-5); }
.site-nav a:not(.btn) {
  display: inline-flex; align-items: center; min-height: 44px;
  color: var(--text); font-size: var(--fs-ui); font-weight: 500; text-decoration: none;
}
.site-nav a:not(.btn):hover { text-decoration: underline; text-decoration-thickness: 1.5px; }
.site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 1.5px; }
.menu { display: none; position: relative; }
.menu summary {
  list-style: none; display: inline-flex; align-items: center; gap: var(--s-2);
  min-height: 44px; padding: 0 var(--s-4);
  border: 1.5px solid var(--field-line); border-radius: var(--r-pill);
  font-size: var(--fs-ui); font-weight: 500; cursor: pointer;
  transition: transform 140ms var(--ease-out);
}
.menu summary:active { transform: scale(0.97); }
.menu summary::-webkit-details-marker { display: none; }
.menu summary svg { width: 20px; height: 20px; flex: none; }
.menu[open] summary { background: var(--surface); }
.menu-card {
  position: absolute; right: 0; top: calc(100% + var(--s-2)); width: min(280px, calc(100vw - 32px));
  padding: var(--s-2); background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-float);
  transform-origin: top right;
}
.menu-card a {
  display: flex; align-items: center; min-height: 48px; padding: 0 var(--s-4);
  color: var(--text); font-weight: 500; text-decoration: none; border-radius: var(--r-input);
}
.menu-card a:hover { background: var(--bg); }
@media (prefers-reduced-motion: no-preference) {
  .menu[open] .menu-card { animation: menu-in 180ms var(--ease-out); }
}
@keyframes menu-in { from { opacity: 0; transform: scale(0.96); } }

/* Menu card links beat the desktop nav link rule (which would make them inline). */
.site-nav .menu-card a:not(.btn) { display: flex; width: 100%; min-height: 48px; }
.site-nav .menu-card a.menu-cta:not(.btn) { display: none; font-weight: 600; color: var(--action-text); background: var(--action); border-radius: var(--r-pill); justify-content: center; margin-bottom: var(--s-2); }
.site-nav .menu-card a.menu-cta:not(.btn):hover { background: var(--action-hover); }

@media (max-width: 899px) {
  .site-nav ul { display: none; }
  .site-nav { gap: var(--s-2); }
  .menu { display: block; }
}
/* Phone header: the wordmark never shrinks. Below 400px the Menu pill shows its icon only
   (the word stays for screen readers); below 380px the pill text drops to 15px; below 360px the
   "Get free lessons" pill moves into the menu card. */
.site-header .wordmark { flex: none; }
@media (max-width: 400px) {
  .site-header .container { gap: var(--s-2); }
  .menu summary { width: 44px; padding: 0; justify-content: center; }
  .menu-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .site-header .btn--sm { padding-inline: var(--s-3); }
}
@media (max-width: 380px) {
  .site-header .btn--sm { font-size: var(--fs-small); }
}
@media (max-width: 359px) {
  .site-header .btn--sm { display: none; }
  .site-nav .menu-card a.menu-cta:not(.btn) { display: flex; }
}

/* ---------- Footer ---------- */
.site-footer { background: var(--field); color: var(--text-on-field); padding-block: var(--s-8) var(--s-6); }
.site-footer .wordmark { color: var(--text-on-field); }
.footer-grid { row-gap: var(--s-6); }
.footer-brand { grid-column: 1 / span 4; }
.footer-brand p { margin-top: var(--s-4); color: var(--text-on-field-soft); }
.footer-links { grid-column: 5 / span 4; }
.footer-links a {
  display: inline-flex; align-items: center; min-height: 44px;
  color: var(--text-on-field); font-weight: 500;
}
.footer-contact { grid-column: 9 / span 4; }
.footer-contact p { color: var(--text-on-field-soft); margin-bottom: var(--s-3); }
.footer-mail {
  display: inline-flex; align-items: center; min-height: 44px;
  color: var(--text-on-field); font-weight: 500; overflow-wrap: anywhere;
}
.footer-base {
  margin-top: var(--s-7); padding-top: var(--s-5);
  border-top: 1px solid color-mix(in srgb, var(--cream-soft) 30%, transparent);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-3) var(--s-6);
  color: var(--text-on-field-soft);
}
.footer-base a { display: inline-block; padding-block: 12px; margin-block: -12px; color: var(--text-on-field); }
@media (max-width: 767px) {
  .footer-brand, .footer-links, .footer-contact { grid-column: 1 / -1; }
}

/* ---------- Read pages (How we make these, 404, sign-up result) ---------- */
.read-page { padding-block: var(--s-9) var(--s-10); }
.read-page .grid > * { grid-column: 2 / span 8; }
.read-page .lead { margin-top: var(--s-5); }
.read-page .h2 { margin-top: var(--s-7); margin-bottom: var(--s-3); font-size: var(--fs-h3); line-height: 1.2; }
.read-page .actions { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-6); margin-top: var(--s-6); align-items: center; }
.read-page .placeholder-pill { margin-top: var(--s-5); }
@media (max-width: 1023px) { .read-page .grid > * { grid-column: 1 / -1; } }
@media (max-width: 767px) { .read-page { padding-block: var(--s-8); } }

/* ---------- Forms: the index card (hub sign-up, freebie pages, request) ---------- */
.form-card {
  position: relative;
  padding: calc(var(--s-7) + 2px + var(--s-5)) var(--s-6) var(--s-6);
  background: var(--surface);
  border: 1.5px dashed var(--placeholder-line); border-radius: var(--r-card);
  box-shadow: var(--shadow-float);
}
.form-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: var(--s-7); height: 2px; background: var(--green-800);
}
/* The free-lesson picker is live (Kit pages), so its card drops the dashed placeholder border. */
.form-card--kit { padding-top: var(--s-6); border: 1px solid var(--hairline); border-top: 4px solid var(--green-800); }
.form-card--kit::before { content: none; }
/* Each lesson has its own link; only the checked lesson's link shows. Without :has(), all five show with names. */
.kit-go-wrap { display: grid; gap: var(--s-2); justify-items: start; }
@supports selector(:has(*)) {
  .kit-go { display: none; }
  .form-card--kit:has(input[value="music"]:checked) .kit-go[data-lesson="music"],
  .form-card--kit:has(input[value="ef"]:checked) .kit-go[data-lesson="ef"],
  .form-card--kit:has(input[value="shadow"]:checked) .kit-go[data-lesson="shadow"],
  .form-card--kit:has(input[value="main-idea"]:checked) .kit-go[data-lesson="main-idea"],
  .form-card--kit:has(input[value="zoo"]:checked) .kit-go[data-lesson="zoo"] { display: inline-flex; }
  .kit-go-name {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
}
@supports not selector(:has(*)) {
  .form-card--kit fieldset { display: none; }
  .form-card--kit .form-submit { margin-top: 0; }
  .kit-go { white-space: normal; text-align: left; }
}
.form-card .chip--placeholder { position: absolute; top: calc(var(--s-4) * -1); left: var(--s-5); min-height: var(--s-6); }
.field + .field, .field + fieldset, fieldset + .form-submit { margin-top: var(--s-5); }
.field label, fieldset legend { display: block; margin-bottom: var(--s-2); font-weight: 600; font-size: var(--fs-ui); }
.input {
  display: block; width: 100%; min-height: var(--input-h); padding: 0 var(--s-4);
  background: var(--paper); border: 1.5px solid var(--field-line); border-radius: var(--r-input);
  font-size: var(--fs-ui); font-weight: 500; caret-color: var(--green-800);
}
.input:focus-visible { outline-offset: 2px; }
.input[aria-invalid="true"] { border-color: var(--error); }
.field-error { margin-top: var(--s-2); color: var(--error); font-size: var(--fs-small); font-weight: 500; }
.field-error:empty { display: none; }
.radios { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2) var(--s-4); }
.radio {
  display: flex; align-items: flex-start; gap: var(--s-3); min-height: 44px; padding: var(--s-2) var(--s-3);
  border-radius: var(--r-input); cursor: pointer; line-height: 1.3;
  transition: background-color 160ms ease;
}
.radio:hover { background: var(--bg); }
.radio input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--green-800); }
.radio span { display: block; font-weight: 500; font-size: var(--fs-small); }
.radio span .muted { display: block; font-weight: 500; }
.form-submit { margin-top: var(--s-6); }
.form-submit .small { margin-top: var(--s-3); }
.form-status { font-size: var(--fs-lead); line-height: 1.55; }
.form-status:focus { outline: none; }
@media (prefers-reduced-motion: no-preference) { .form-status { animation: status-in 200ms ease both; } }
@keyframes status-in { from { opacity: 0; filter: blur(2px); } }
.form-card [data-swap] { transition: opacity 200ms ease, filter 200ms ease; }
.form-card .is-leaving { opacity: 0; filter: blur(2px); }
@media (max-width: 767px) {
  .radios { grid-template-columns: 1fr; }
  .form-card { padding-inline: var(--s-4); padding-bottom: var(--s-5); }
  .form-card .btn { width: 100%; }
}

/* ---------- Phase 2 header: Shop menu, Request, search ---------- */
.site-header--store .site-nav { gap: var(--s-5); }
.site-header--sticky { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--hairline); }
.nav-links { align-items: center; }
.shop-menu { position: relative; }
.shop-menu summary {
  list-style: none; display: inline-flex; align-items: center; gap: var(--s-1); min-height: 44px;
  font-size: var(--fs-ui); font-weight: 500; cursor: pointer; border-radius: 4px;
}
.shop-menu summary::-webkit-details-marker { display: none; }
.shop-menu summary svg { width: 16px; height: 16px; transition: transform 160ms var(--ease-out); }
.shop-menu[open] summary svg { transform: rotate(180deg); }
.shop-menu[data-active] summary, .shop-menu summary:hover { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.site-nav .shop-card {
  position: absolute; left: calc(var(--s-4) * -1); top: calc(100% + var(--s-2)); z-index: 30;
  display: block; width: 280px; padding: var(--s-2);
  background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-float);
  transform-origin: top left;
}
.site-nav .shop-card a:not(.btn) { display: flex; width: 100%; min-height: 44px; padding: 0 var(--s-4); border-radius: var(--r-input); }
.site-nav .shop-card a:not(.btn):hover { background: var(--bg); text-decoration: none; }
.site-nav .shop-card a[aria-current="page"] { font-weight: 600; }
.site-nav .shop-card li:first-child a { font-weight: 600; }
.site-nav .shop-card li:last-child { margin-top: var(--s-1); padding-top: var(--s-1); border-top: 1px solid var(--hairline); }
@media (prefers-reduced-motion: no-preference) {
  .shop-menu[open] .shop-card { animation: menu-in 180ms var(--ease-out); }
}

.header-search { position: relative; display: flex; align-items: center; width: 280px; }
.header-search svg { position: absolute; left: var(--s-4); width: 18px; height: 18px; color: var(--text-muted); pointer-events: none; }
.header-search input {
  width: 100%; min-height: 44px; padding: 0 var(--s-4) 0 calc(var(--s-4) + 26px);
  background: var(--paper); border: 1.5px solid var(--field-line); border-radius: var(--r-pill);
  font-size: var(--fs-ui); font-weight: 500; caret-color: var(--green-800);
}
.header-search input::placeholder, .input::placeholder { color: var(--text-muted); opacity: 1; }
.icon-link {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  color: var(--text); border-radius: var(--r-pill);
}
.icon-link:hover { background: var(--surface); }
.icon-link svg { width: 22px; height: 22px; }
.site-nav a.search-link { display: none; }

/* The full search field fits from 1024 up (02b section 7). */
@media (max-width: 1023px) {
  .header-search { display: none; }
  .site-nav a.search-link { display: inline-flex; }
}
@media (max-width: 599px) {
  .site-header .header-cta { display: none; }
  .site-nav .menu-card a.menu-cta:not(.btn) { display: flex; }
}
@media (max-width: 899px) {
  .site-header--store .site-nav { gap: var(--s-1); }
}

/* Page previews can't be dragged out to another tab or long-pressed to save. */
img, picture { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
