/* wobmath.com: hand-written CSS, no framework. Colours taken from the book covers:
   cream title boxes, navy text, Wobmat's yellow cap and blue scarf, the forest green
   of Explorer 1, the lagoon teal of Guide 4A and the warm burrow brown of Guide 3A. */

@font-face { font-family: "Baloo 2"; font-weight: 700; font-display: swap; src: url(/static/fonts/baloo-2-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Baloo 2"; font-weight: 800; font-display: swap; src: url(/static/fonts/baloo-2-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family: "Andika"; font-weight: 400; font-display: swap; src: url(/static/fonts/andika-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Andika"; font-weight: 700; font-display: swap; src: url(/static/fonts/andika-latin-700-normal.woff2) format("woff2"); }

:root {
  --cream: #fbf6ea;
  --paper: #ffffff;
  --sand: #f3e9d4;
  --line: #e4d6ba;
  --navy: #1b2550;
  --ink: #26304f;
  --muted: #545d78;
  --yellow: #f5b83d;
  --yellow-soft: #fde9b8;
  --blue: #1f6fbf;
  --green: #2e7a3e;
  --teal: #13777b;
  --brown: #6e4a33;
  --orange: #a8470f;
  --purple: #5a3f9e;
  --focus: #1f6fbf;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(27, 37, 80, .06), 0 8px 24px rgba(27, 37, 80, .08);
  --head: "Baloo 2", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --body: "Andika", ui-sans-serif, "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--cream); color: var(--ink);
  font-family: var(--body); font-size: 1.0625rem; line-height: 1.6;
}
img, svg { max-width: 100%; height: auto; display: block; }
picture { display: block; }
/* grid children may shrink below their images' natural width */
.hero-grid > *, .series-grid > *, .book-detail > *, .pair > *, .explorer-grid > *, .book-card > *, .series-hero-grid > *, .footer-grid > *, .related-list > * { min-width: 0; }
a { color: var(--blue); text-underline-offset: .15em; }
a:hover { color: var(--navy); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { font-family: var(--head); color: var(--navy); line-height: 1.15; margin: 0 0 .5em; font-weight: 800; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.5rem, 3.4vw, 2rem); }
h3 { font-size: 1.25rem; font-weight: 700; }
h4 { font-size: 1.125rem; font-weight: 700; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.25em; }
code { font-size: .9em; background: var(--sand); padding: .05em .35em; border-radius: 6px; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.section { padding-block: clamp(40px, 6vw, 72px); }
.small { font-size: .9rem; }
.muted { color: var(--muted); }
.lead { font-size: 1.2rem; color: var(--ink); }
.kicker { font-family: var(--head); font-weight: 700; color: var(--teal); text-transform: none; letter-spacing: .01em; margin-bottom: .4em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 10; }
.skip:focus { top: 8px; color: #fff; }

/* Claims Payam must confirm before go-live (build refuses target "live" while any remain). */
.tbc { background: #fff1a8; box-shadow: 0 0 0 2px #e0a800 inset; border-radius: 4px; padding: 0 .2em; }
.tbc::after { content: " [to confirm]"; font-family: var(--head); font-weight: 700; color: #8a5a00; font-size: .8em; }
.preview-banner { background: var(--navy); color: #fff; text-align: center; font-family: var(--head); font-weight: 700; padding: 4px 12px; font-size: .9rem; }

/* Buttons and badges */
.btn {
  display: inline-block; font-family: var(--head); font-weight: 800; font-size: 1.05rem; line-height: 1.2;
  background: var(--navy); color: #fff; text-decoration: none; padding: .75em 1.3em; border-radius: 999px;
  border: 2px solid var(--navy); cursor: pointer; transition: transform .12s ease, background .12s ease;
}
.btn:hover { background: #2a3870; border-color: #2a3870; color: #fff; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--navy); }
.btn-ghost:hover { background: var(--navy); color: #fff; }
.badge { display: inline-block; font-family: var(--head); font-weight: 700; font-size: .85rem; padding: .2em .8em; border-radius: 999px; background: var(--sand); color: var(--navy); }
.badge-soon { background: var(--yellow-soft); color: #6b4300; border: 1px solid #ebc45e; }
.grade-badge { display: inline-block; font-family: var(--head); font-weight: 800; font-size: .85rem; padding: .15em .75em; border-radius: 999px; color: #fff; background: var(--blue); white-space: nowrap; }
.grade-badge.g33 { background: var(--orange); }
.grade-badge.g44 { background: var(--teal); }
.grade-badge.g34 { background: var(--green); }

/* Header */
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.header-row { display: flex; align-items: center; gap: 12px 20px; min-height: 64px; flex-wrap: wrap; padding-block: 8px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-family: var(--head); font-weight: 800; font-size: 1.6rem; color: var(--navy); line-height: 1; }
.brand img { width: 40px; height: auto; }
.brand-m { color: var(--teal); }
.main-nav { margin-left: auto; }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px 18px; flex-wrap: wrap; }
.main-nav a { font-family: var(--head); font-weight: 700; color: var(--ink); text-decoration: none; padding: 6px 0; border-bottom: 3px solid transparent; }
.main-nav a:hover { color: var(--navy); border-bottom-color: var(--yellow); }
.main-nav a[aria-current="page"] { color: var(--navy); border-bottom-color: var(--yellow); }
.lang-switch { font-family: var(--head); font-weight: 700; font-size: .95rem; color: var(--navy); text-decoration: none; border: 2px solid var(--line); border-radius: 999px; padding: 4px 14px; white-space: nowrap; }
.lang-switch:hover { border-color: var(--navy); }
@media (max-width: 860px) {
  .site-header { position: static; }
  .main-nav { order: 3; width: 100%; margin-left: 0; overflow-x: auto; }
  .main-nav ul { flex-wrap: nowrap; gap: 18px; padding-bottom: 4px; }
  .main-nav a { white-space: nowrap; }
  .lang-switch { margin-left: auto; }
}

/* Footer */
.site-footer { background: var(--navy); color: #dfe4f3; margin-top: 64px; padding-block: 40px; }
.site-footer a { color: #fff; }
.footer-grid { display: grid; gap: 24px; grid-template-columns: 1.4fr 1fr; }
.footer-brand { font-family: var(--head); font-weight: 800; font-size: 1.5rem; color: #fff; margin-bottom: .3em; }
.footer-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; } }

/* Home hero */
.hero { background: linear-gradient(180deg, var(--paper) 0%, var(--cream) 100%); overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 32px; align-items: center; padding-block: clamp(32px, 6vw, 72px); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.4em; }
.hero-art { position: relative; min-height: 340px; }
.fan { position: relative; height: 100%; min-height: 340px; }
.fan img { position: absolute; width: 46%; border-radius: 6px; box-shadow: var(--shadow); top: 8%; }
.fan-1 { left: 4%; transform: rotate(-9deg); }
.fan-2 { left: 50%; transform: rotate(8deg); }
.fan-3 { left: 26%; top: 0 !important; z-index: 2; }
.hero-wobmat { position: absolute; width: 30%; right: -2%; bottom: -6%; z-index: 3; filter: drop-shadow(0 6px 10px rgba(0,0,0,.15)); }
@media (max-width: 800px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { min-height: 0; aspect-ratio: 16 / 11; max-width: 460px; width: 100%; margin-inline: auto; }
  .fan { min-height: 0; }
}

/* Home: series cards */
.series-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.series-card { display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: transform .15s ease; }
.series-card:hover { transform: translateY(-3px); color: var(--ink); }
.series-covers { display: flex; justify-content: center; gap: 10px; padding: 24px 20px 0; }
.theme-dd .series-covers { background: linear-gradient(180deg, #e9cfa8, #f6ead6); }
.theme-mc .series-covers { background: linear-gradient(180deg, #a9cfa3, #dbeccf); }
.series-covers img { width: 30%; border-radius: 4px 4px 0 0; box-shadow: 0 -2px 12px rgba(0,0,0,.18); }
.series-card-body { padding: 20px 24px 24px; }
.series-card .more { font-family: var(--head); font-weight: 800; color: var(--blue); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: .6em; }
@media (max-width: 760px) { .series-grid { grid-template-columns: 1fr; } }

/* Home: steps and friends */
.band { background: var(--sand); }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: none; }
.step { background: var(--paper); border-radius: var(--radius); padding: 22px; position: relative; box-shadow: var(--shadow); }
.step img { width: 84px; margin-bottom: 8px; }
.step-n { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 50%; background: var(--yellow); color: var(--navy); font-size: .9em; margin-right: 4px; }
.step + .step::before { content: "→"; position: absolute; left: -17px; top: 44%; font-family: var(--head); font-weight: 800; color: var(--brown); font-size: 1.4rem; }
.step p { margin: 0; }
@media (max-width: 820px) { .steps { grid-template-columns: 1fr; } .step + .step::before { content: "↓"; left: 50%; top: -24px; } }

.friends { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.friends li { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px; text-align: center; }
.friends img { height: 110px; width: auto; margin: 0 auto 10px; }
.friends h3 { margin-bottom: .2em; }
.friends p { margin: 0; font-size: .95rem; color: var(--muted); }
@media (max-width: 900px) { .friends { grid-template-columns: repeat(2, 1fr); } .friends li:first-child { grid-column: 1 / -1; } }

.trust { max-width: 760px; }

/* Sign-up */
.signup { display: grid; grid-template-columns: 120px 1fr; gap: 24px; background: var(--paper); border: 2px solid var(--yellow); border-radius: var(--radius); padding: clamp(20px, 4vw, 36px); box-shadow: var(--shadow); max-width: 820px; margin-inline: auto; }
.signup-compact { margin-top: 48px; }
.signup-art img { width: 120px; }
.signup-form { display: grid; gap: 14px; margin-top: .5em; }
.field label, .field legend { display: block; font-weight: 700; margin-bottom: 4px; padding: 0; }
fieldset.field { border: 0; margin: 0; padding: 0; }
.signup input[type="email"] { width: 100%; font: inherit; padding: .65em .8em; border: 2px solid #9aa3bd; border-radius: 12px; background: #fff; color: var(--ink); }
.signup input[type="email"]:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px rgba(31,111,191,.25); }
.choices { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.choices label { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; }
.consent input { margin-top: .3em; width: 1.15em; height: 1.15em; flex: none; }
input[type="radio"], input[type="checkbox"] { accent-color: var(--navy); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-msg { margin: 0; font-weight: 700; min-height: 1.6em; }
.form-msg.ok { color: var(--green); }
.form-msg.err { color: #b3261e; }
.signup-form .btn { justify-self: start; }
.signup-form .btn[disabled] { opacity: .6; cursor: wait; }
@media (max-width: 640px) { .signup { grid-template-columns: 1fr; } .signup-art img { width: 84px; } }

/* Series pages */
.series-hero { background: var(--paper); border-bottom: 1px solid var(--line); }
.theme-dd .series-hero { background: linear-gradient(180deg, #f6ead6, var(--cream)); }
.theme-mc .series-hero { background: linear-gradient(180deg, #dbeccf, var(--cream)); }
.series-hero-grid { display: grid; grid-template-columns: 1fr 180px; gap: 32px; align-items: center; padding-block: clamp(28px, 5vw, 56px); }
.series-hero-grid > div { max-width: 760px; }
.series-hero-art { width: 180px; }
.h1-sub { display: block; font-size: .55em; color: var(--teal); font-weight: 700; margin-top: .2em; }
@media (max-width: 700px) { .series-hero-grid { grid-template-columns: 1fr; } .series-hero-art { width: 120px; order: -1; } }

.unit-jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 8px; }
.unit-jump a { font-family: var(--head); font-weight: 800; text-decoration: none; color: var(--navy); background: var(--paper); border: 2px solid var(--line); border-radius: 12px; padding: 4px 14px; }
.unit-jump a:hover { border-color: var(--navy); }
.grade-heading { margin-top: 48px; padding-bottom: 8px; border-bottom: 3px solid var(--yellow); }
.unit { margin-top: 28px; scroll-margin-top: 90px; }
.unit-title { font-size: 1.45rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.unit-code { font-family: var(--head); background: var(--navy); color: #fff; border-radius: 10px; padding: 0 10px; font-size: 1.05rem; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.explorer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 32px; }
@media (max-width: 860px) { .pair, .explorer-grid { grid-template-columns: 1fr; } }

.book-card { display: grid; grid-template-columns: 140px 1fr; gap: 18px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.book-card-cover img { border-radius: 4px; box-shadow: 0 4px 14px rgba(0,0,0,.18); transition: transform .15s ease; }
.book-card-cover:hover img { transform: translateY(-2px) rotate(-1deg); }
.book-card .kicker { margin-bottom: .2em; font-size: .95rem; }
.book-card .role { color: var(--muted); font-weight: 700; }
.book-card-title { margin-bottom: .35em; }
.book-card-title a { color: var(--navy); text-decoration: none; }
.book-card-title a:hover { text-decoration: underline; }
.book-card-title .sub { display: block; font-size: .9em; color: var(--brown); }
.book-card .short { font-size: .97rem; margin-bottom: .6em; }
.book-card .meta { font-size: .88rem; color: var(--muted); margin-bottom: .7em; }
.meta .grade-badge { margin-right: 6px; }
.kind-p .kicker { color: var(--brown); }
.kind-x .kicker { color: var(--green); }
.buy-mini { list-style: none; padding: 0; margin: 0; display: flex; gap: 6px 12px; flex-wrap: wrap; font-family: var(--head); font-weight: 700; }
@media (max-width: 460px) { .book-card { grid-template-columns: 96px 1fr; gap: 14px; padding: 14px; } }

.cross-link { margin-top: 40px; font-family: var(--head); font-weight: 800; font-size: 1.15rem; }
.cross-link a { text-decoration: none; }

/* Book detail */
.breadcrumb ol { list-style: none; padding: 0; margin: 20px 0; display: flex; flex-wrap: wrap; gap: 4px; font-size: .92rem; }
.breadcrumb li + li::before { content: "›"; margin: 0 6px; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.book-detail { display: grid; grid-template-columns: minmax(240px, 380px) 1fr; gap: clamp(24px, 4vw, 56px); align-items: start; }
.book-cover-col { position: sticky; top: 90px; }
.cover-lg { border-radius: 6px; box-shadow: 0 10px 34px rgba(27,37,80,.25); }
.book-info .subtitle { font-size: 1.1rem; color: var(--muted); }
.book-info h2 { margin-top: 1.4em; font-size: 1.4rem; }
.buy-box { background: var(--paper); border: 2px solid var(--yellow); border-radius: var(--radius); padding: 18px 22px; margin: 18px 0 8px; }
.buy-box h2 { margin: 0 0 .4em; font-size: 1.3rem; }
.buy-box .badge-soon { font-size: 1.05rem; }
.buy-links { list-style: none; padding: 0; margin: 0 0 .6em; display: flex; flex-wrap: wrap; gap: 10px; }
.desc p { margin-bottom: .8em; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0; }
.details dt { font-weight: 700; color: var(--navy); }
.details dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .details { grid-template-columns: 1fr; gap: 0; } .details dd { margin-bottom: 8px; } }
.related { margin-top: 48px; }
.related-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 16px; }
.related-list picture { flex: none; }
.related-list a { display: flex; gap: 14px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-decoration: none; color: var(--navy); font-family: var(--head); font-weight: 700; }
.related-list a:hover { border-color: var(--navy); }
.related-list .kicker { display: block; font-size: .85rem; margin: 0; }
.cover-xs { width: 64px; border-radius: 3px; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
@media (max-width: 760px) {
  .book-detail { grid-template-columns: 1fr; }
  .book-cover-col { position: static; max-width: 300px; margin-inline: auto; }
}

/* Prose pages */
.prose-wrap { padding-top: clamp(28px, 5vw, 56px); }
.prose { max-width: 740px; }
.prose h2 { margin-top: 1.6em; }
.prose h3 { margin-top: 1.2em; }
.prose li { margin-bottom: .35em; }
.signup-page .signup { margin-top: 32px; margin-inline: 0; }
.report-box { background: var(--paper); border: 2px solid var(--yellow); border-radius: var(--radius); padding: 18px 22px; margin: 24px 0; }
.report-box h2 { margin-top: 0; }
.errata-list { list-style: none; padding: 0; margin: 0; }
.errata-list > li { padding: 10px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 90px; }
.errata-list > li:target { background: var(--yellow-soft); }
.errata-list .none { display: block; color: var(--muted); font-size: .95rem; }
.not-found { display: flex; gap: 32px; align-items: center; flex-wrap: wrap; }
.not-found img { width: 160px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .site-header, .site-footer, .signup, .skip { display: none; } body { background: #fff; } }
