/* Math Practice Press - warm paper, editorial blog look */

:root {
  --paper: #fbf6ec;
  --paper-2: #f3ead8;
  --ink: #2b2420;
  --ink-soft: #5e544b;
  --rule: #e2d6bf;
  --red: #d4472a;
  --red-dark: #b23819;
  --mustard: #f2b632;
  --leaf: #2f6b4f;
  --white: #fffdf8;
  --serif: 'Young Serif', Georgia, 'Times New Roman', serif;
  --sans: 'Source Sans 3', 'Segoe UI', Arial, sans-serif;
  --hand: 'Caveat', 'Comic Sans MS', cursive;
  --w: 1360px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--red-dark); text-underline-offset: 3px; }
a:hover { color: var(--red); }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.2; margin: 0 0 .5em; color: var(--ink); }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 3.2vw, 2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

.wrap { max-width: var(--w); margin: 0 auto; padding: 0 22px; }
.narrow { max-width: 1160px; margin: 0 auto; padding: 0 22px; }

/* masthead */
.masthead { border-bottom: 3px double var(--rule); background: var(--paper); }
.masthead .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; padding-top: 18px; padding-bottom: 14px; flex-wrap: wrap; }
.brand { font-family: var(--serif); font-size: 1.55rem; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand span { color: var(--red); }
.nav { display: flex; gap: 22px; flex-wrap: wrap; font-size: 1rem; }
.nav a { color: var(--ink); text-decoration: none; border-bottom: 2px solid transparent; padding-bottom: 2px; }
.nav a:hover { border-bottom-color: var(--mustard); color: var(--ink); }
.nav a.shop { color: var(--red-dark); font-weight: 700; }
/* drop-down menus */
.masthead { position: sticky; top: 0; z-index: 20; }
.nav { align-items: baseline; }

/* buttons */
.btn { display: inline-block; background: var(--red); color: #fff; text-decoration: none; padding: 12px 22px; border-radius: 4px; font-weight: 700; font-size: 1rem; border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); transition: transform .1s, box-shadow .1s; }
.btn:hover { color: #fff; transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.alt { background: var(--white); color: var(--ink); }
.btn.alt:hover { color: var(--ink); }
.btn.small { padding: 8px 16px; font-size: .95rem; }

/* home intro */
.intro { padding: 48px 0 40px; }
.intro .wrap { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.intro .kicker { font-family: var(--hand); font-size: 1.6rem; color: var(--red-dark); line-height: 1; margin-bottom: 8px; }
.intro p.lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 34em; }
.intro .actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 22px; }
/* whole-page doodle background (fixed, drifts slowly; sits behind all content) */
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: url(/images/doodle-tile.svg) 0 0 / 360px 360px repeat; opacity: .17; animation: bgdrift 90s linear infinite; }
@keyframes bgdrift { to { background-position: 360px 360px; } }
.masthead { background: rgba(251, 246, 236, .95); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.band.tint { background: rgba(243, 234, 216, .82); }
@media (prefers-reduced-motion: reduce) { body::before { animation: none; } }
/* hero background: self-drawing doodles + floating numbers (decorative) */
.intro { position: relative; overflow: hidden; }
.intro .wrap { position: relative; z-index: 1; }
.hero-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.hero-bg .doodle { position: absolute; height: auto; stroke-width: 2.4; opacity: .55; }
.hero-bg .doodle path, .und-line path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.8s ease-out forwards; }
.d-star { left: 4%; top: 16%; stroke: var(--mustard); transform: rotate(-10deg); }
.d-sun { left: 47%; top: 4%; stroke: var(--red); opacity: .4 !important; }
.d-squig { left: 41%; bottom: 5%; stroke: var(--leaf); }
.d-star2 { right: 3%; bottom: 8%; stroke: var(--red); transform: rotate(14deg); }
.hero-bg .num { position: absolute; font-family: var(--hand); font-weight: 600; line-height: 1; opacity: .2; animation: drift 10s ease-in-out infinite alternate; }
.num.c1 { color: var(--red); } .num.c2 { color: var(--leaf); } .num.c3 { color: #b8860b; }
.und { position: relative; white-space: nowrap; }
.und-line { position: absolute; left: 0; bottom: -.12em; width: 100%; height: .22em; stroke: var(--red); stroke-width: 5; vector-effect: non-scaling-stroke; }
.und-line path { animation-delay: 2.4s; animation-duration: 1.2s; vector-effect: non-scaling-stroke; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes drift { from { transform: translateY(0) rotate(-6deg); } to { transform: translateY(-16px) rotate(7deg); } }
@media (max-width: 700px) { .hero-bg .num.x, .d-sun, .d-squig { display: none; } .d-star { left: auto; right: 4%; top: 3%; } }
@media (prefers-reduced-motion: reduce) { .hero-bg .num { animation: none; } .hero-bg .doodle path, .und-line path { animation: none; stroke-dashoffset: 0; } }
.quick, .toc { background: var(--white); border: 1px solid var(--rule); border-left: 4px solid var(--mustard); padding: 16px 22px; margin: 22px 0; }
.quick ol, .toc ol { margin: 8px 0 0; padding-left: 1.3em; }
.toc a { text-decoration: none; border-bottom: 1px dotted var(--ink-soft); }
.article h3[id] { scroll-margin-top: 90px; }
.article h2[id] { scroll-margin-top: 90px; }
.starter { background: var(--white); border: 1px solid var(--rule); padding: 22px 26px 18px; box-shadow: 4px 8px 18px rgba(60,40,10,.14); transform: rotate(1.5deg); max-width: 380px; justify-self: center; }
.starter .hand { font-family: var(--hand); font-size: 1.9rem; color: var(--red-dark); line-height: 1; margin-bottom: 10px; }
.starter ul { margin: 0; padding-left: 1.1em; }
.starter li { margin: 0 0 10px; font-size: 1.05rem; }
.stack { position: relative; height: 340px; }
.stack img { position: absolute; border: 1px solid var(--rule); background: #fff; box-shadow: 0 2px 0 rgba(0,0,0,.04), 4px 8px 18px rgba(60,40,10,.18); }
.stack .p1 { width: 62%; left: 2%; top: 14px; transform: rotate(-5deg); }
.stack .p2 { width: 62%; right: 2%; top: 0; transform: rotate(4deg); }
.stack .note { position: absolute; left: 6%; bottom: 0; font-family: var(--hand); font-size: 1.45rem; color: var(--ink-soft); transform: rotate(-2deg); }

/* sections */
.band { padding: 44px 0; border-top: 1px solid var(--rule); }
.band.tint { background: var(--paper-2); }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.sec-head h2 { margin: 0; }
.sec-head .more { font-size: .98rem; }
.small-note { font-size: .92rem; color: var(--ink-soft); }

/* free download feature */
.free { display: grid; grid-template-columns: 220px 1fr; gap: 32px; align-items: center; background: var(--white); border: 2px solid var(--ink); padding: 26px; box-shadow: 6px 6px 0 var(--mustard); }
.free img { border: 1px solid var(--rule); box-shadow: 3px 5px 12px rgba(60,40,10,.18); }
.free h2 { margin-bottom: .3em; }
.free ul { margin: 0 0 18px; padding-left: 1.1em; color: var(--ink-soft); }

/* grade list */
.grades { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; list-style: none; margin: 0; padding: 0; }
.grades li { background: var(--white); border: 1px solid var(--rule); padding: 12px 14px; border-left: 6px solid var(--leaf); }
.grades li:nth-child(2n) { border-left-color: var(--red); }
.grades li:nth-child(3n) { border-left-color: var(--mustard); }
.grades b { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.05rem; }
.grades span { font-size: .9rem; color: var(--ink-soft); line-height: 1.3; display: block; }

/* shop picks */
.pick { display: grid; grid-template-columns: 150px 1fr auto; gap: 24px; align-items: center; padding: 22px 0; border-bottom: 1px dashed var(--rule); }
.pick:first-of-type { padding-top: 0; }
.pick img { border: 1px solid var(--rule); box-shadow: 2px 4px 10px rgba(60,40,10,.16); }
.pick h3 { margin-bottom: .25em; }
.pick .meta { font-size: .88rem; color: var(--leaf); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.pick p { margin: 0; color: var(--ink-soft); font-size: 1rem; }
.pick .buy { text-align: right; white-space: nowrap; }
.pick .price { font-family: var(--serif); font-size: 1.5rem; display: block; margin-bottom: 8px; }

.minis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px; margin-top: 26px; }
.minis a { text-decoration: none; color: var(--ink); font-size: .95rem; line-height: 1.3; }
.minis img { margin-bottom: 8px; border: 1px solid var(--rule); box-shadow: 2px 3px 8px rgba(60,40,10,.14); }
.minis b { display: block; font-weight: 700; }
.minis span { color: var(--ink-soft); }

.disclose { border-left: 4px solid var(--mustard); background: var(--white); padding: 10px 16px; font-size: .95rem; color: var(--ink-soft); margin: 0 0 24px; }

/* article pages */
.page-head { padding: 40px 0 10px; }
.crumbs { font-size: .92rem; color: var(--ink-soft); margin-bottom: 14px; }
.crumbs a { color: var(--ink-soft); }
.article { padding: 10px 0 40px; }
.article h2 { margin-top: 1.7em; }
.article ul, .article ol { padding-left: 1.2em; }
.article li { margin-bottom: .4em; }
.sheets { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 22px; margin: 22px 0 28px; }
.sheets figure { margin: 0; }
.sheets img { border: 1px solid var(--rule); box-shadow: 3px 5px 12px rgba(60,40,10,.16); background: #fff; }
.sheets figcaption { font-size: .92rem; color: var(--ink-soft); margin-top: 8px; line-height: 1.35; }
.sheets figcaption b { color: var(--ink); }
.byline { font-size: .95rem; color: var(--ink-soft); border-top: 1px solid var(--rule); padding-top: 14px; margin-top: 30px; }

/* footer */
.foot { border-top: 3px double var(--rule); margin-top: 20px; padding: 30px 0 40px; font-size: .95rem; color: var(--ink-soft); }
.foot .wrap { display: flex; justify-content: space-between; gap: 30px; flex-wrap: wrap; }
.foot a { color: var(--ink-soft); }
.foot .brand { font-size: 1.2rem; display: block; margin-bottom: 4px; }
.foot nav { display: flex; gap: 20px; flex-wrap: wrap; }

@media (max-width: 800px) {
  body { font-size: 17px; }
  .intro .wrap { grid-template-columns: 1fr; gap: 28px; }
  .stack { height: 300px; max-width: 420px; }
  .free { grid-template-columns: 1fr; }
  .free img { max-width: 200px; }
  .pick { grid-template-columns: 100px 1fr; gap: 16px; }
  .pick .buy { grid-column: 1 / -1; text-align: left; display: flex; align-items: center; gap: 16px; }
  .pick .price { margin: 0; }
}

/* affiliate guides */
.updated { font-size: .92rem; color: var(--ink-soft); margin: -4px 0 6px; }
.tag { display: inline-block; font-size: .82rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--leaf); margin: 0 0 6px; }
.by { display: block; font-size: .98rem; color: var(--ink-soft); margin: -6px 0 6px; }
.compare { width: 100%; border-collapse: collapse; margin: 14px 0 8px; font-size: .98rem; background: var(--white); }
.compare th, .compare td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.compare th { font-family: var(--serif); font-weight: 400; background: var(--paper-2); }
.item { display: grid; grid-template-columns: 56px 1fr; gap: 14px; padding: 26px 0; border-bottom: 1px dashed var(--rule); }
.item .num { font-family: var(--serif); font-size: 2.6rem; line-height: 1; color: var(--red); }
.item h3 { margin: 0 0 4px; font-size: 1.35rem; }
.item p { margin: 0 0 .7em; }
.item .fit { color: var(--ink-soft); font-size: 1rem; margin-bottom: .35em; }
.item .fit b { color: var(--ink); }
.item .btn { margin-top: 10px; }
.guide-list { list-style: none; margin: 0; padding: 0; }
.article ul.guide-list { padding-left: 0; }
.guide-list li { padding: 18px 0; border-bottom: 1px dashed var(--rule); }
.guide-list li:first-child { padding-top: 0; }
.guide-list a.t { font-family: var(--serif); font-size: 1.3rem; color: var(--ink); text-decoration: none; }
.guide-list a.t:hover { color: var(--red-dark); text-decoration: underline; }
.guide-list p { margin: 4px 0 0; color: var(--ink-soft); }
@media (max-width: 800px) { .item { grid-template-columns: 38px 1fr; gap: 10px; } .item .num { font-size: 2rem; } .compare th:nth-child(3), .compare td:nth-child(3) { display: none; } }

/* batch 3: jokes list, riddles */
.jokes li { padding: 10px 0; border-bottom: 1px dashed var(--rule); }
.jokes li b { color: var(--red-dark); }
.article details { border-bottom: 1px dashed var(--rule); padding: 12px 0; }
.article summary { cursor: pointer; font-weight: 600; }
.article details p { margin: 8px 0 0; color: var(--red-dark); font-weight: 600; }
.article h3 { font-family: var(--serif); font-size: 1.15rem; margin: 1.1em 0 .2em; }

/* guide cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; margin: 8px 0 24px; }
.card { display: flex; flex-direction: column; background: var(--white); border: 2px solid var(--ink); border-radius: 14px; overflow: hidden; text-decoration: none; color: var(--ink); box-shadow: 5px 5px 0 var(--rule); transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translate(-2px, -3px); box-shadow: 8px 8px 0 var(--mustard); }
.card-img { border-bottom: 2px solid var(--ink); line-height: 0; }
.card-img svg { width: 100%; height: auto; display: block; }
.card-body { padding: 16px 18px 20px; display: flex; flex-direction: column; flex: 1; }
.card .tag { align-self: flex-start; font-family: var(--hand); font-size: 1.2rem; line-height: 1; color: var(--red-dark); background: #fbe3a6; padding: 3px 10px 4px; border-radius: 999px; margin-bottom: 10px; }
.card h3 { font-family: var(--serif); font-size: 1.3rem; line-height: 1.25; margin: 0 0 8px; font-weight: 400; }
.card p { margin: 0 0 14px; color: var(--ink-soft); }
.card .more { margin-top: auto; font-weight: 600; color: var(--red-dark); }
.card .more::after { content: " \2192"; }
.card:hover .more { text-decoration: underline; }
@media (max-width: 900px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .cards { grid-template-columns: 1fr; } }

/* homepage: topic tiles, situations, trust */
.sec-intro { margin: -8px 0 22px; color: var(--ink-soft); max-width: 44em; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.tile { display: flex; flex-direction: column; background: var(--white); border: 2px solid var(--ink); border-radius: 14px; padding: 20px 20px 18px; text-decoration: none; color: var(--ink); box-shadow: 5px 5px 0 var(--rule); transition: transform .15s, box-shadow .15s; }
a.tile:hover { transform: translate(-2px, -3px); box-shadow: 8px 8px 0 var(--mustard); }
.tile .t-icon { line-height: 0; margin-bottom: 12px; }
.tile h3 { font-family: var(--serif); font-weight: 400; font-size: 1.25rem; margin: 0 0 6px; }
.tile p { margin: 0 0 14px; color: var(--ink-soft); font-size: .98rem; }
.tile .badge { margin-top: auto; align-self: flex-start; font-family: var(--hand); font-size: 1.2rem; line-height: 1; padding: 3px 10px 4px; border-radius: 999px; background: #cfe5d6; color: var(--leaf); }
.tile .badge.soon { background: var(--paper-2); color: var(--ink-soft); }
.tile.soon { border-style: dashed; box-shadow: none; opacity: .8; }
.situations { list-style: none; margin: 0; padding: 0; }
.situations li { display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: baseline; padding: 18px 0; border-bottom: 1px dashed var(--rule); }
.situations li:first-child { padding-top: 0; }
.situations .say { font-family: var(--hand); font-size: 1.7rem; line-height: 1.1; color: var(--red-dark); }
.situations a { font-family: var(--serif); font-size: 1.25rem; color: var(--ink); text-decoration: none; }
.situations a:hover { color: var(--red-dark); text-decoration: underline; }
.situations p { margin: 4px 0 0; color: var(--ink-soft); }
.trust { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.trust h3 { font-family: var(--serif); font-weight: 400; font-size: 1.2rem; margin: 0 0 6px; }
.trust p { margin: 0; color: var(--ink-soft); }
@media (max-width: 900px) { .tiles { grid-template-columns: repeat(2, 1fr); } .trust { grid-template-columns: 1fr; gap: 18px; } .situations li { grid-template-columns: 1fr; gap: 4px; } }
@media (max-width: 500px) { .tiles { grid-template-columns: 1fr; } }

/* hero niche visual */
.niche-visual { justify-self: center; width: 100%; max-width: 470px; }
.niche-visual svg { width: 100%; height: auto; display: block; overflow: visible; }
.stk { animation: stkbob 6s ease-in-out infinite; transform-box: fill-box; }
@keyframes stkbob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@media (prefers-reduced-motion: reduce) { .stk { animation: none; } }

/* homepage v2: trust line, featured app, age tiles */
.band.tight { padding: 18px 0; }
.trustline { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 28px; justify-content: center; color: var(--ink-soft); font-size: .98rem; }
.trustline li::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--leaf); margin-right: 9px; }
.feature { display: grid; grid-template-columns: 340px 1fr; gap: 32px; align-items: center; background: var(--white); border: 2px solid var(--ink); border-radius: 16px; padding: 22px; box-shadow: 6px 6px 0 var(--rule); }
.feature-art svg { width: 100%; height: auto; display: block; border-radius: 10px; border: 2px solid var(--ink); }
.feature-body h3 { font-family: var(--serif); font-weight: 400; font-size: 1.7rem; margin: 0 0 8px; }
.feature-line { font-size: 1.08rem; margin: 0 0 12px; }
.bestfor { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 22px; }
.soon-btn { background: var(--paper-2); color: var(--ink-soft); border: 2px dashed var(--ink-soft); cursor: default; box-shadow: none; }
.tiles.three { grid-template-columns: repeat(3, 1fr); }
.agebig { font-family: var(--hand); font-size: 2.6rem; line-height: 1; color: var(--brick, #d4472a); }
@media (max-width: 800px) { .feature { grid-template-columns: 1fr; } .tiles.three { grid-template-columns: 1fr; } }
.topnote { background: var(--paper-2); border-bottom: 1px solid var(--rule); font-size: .88rem; color: var(--ink-soft); padding: 7px 0; text-align: center; }
.faq { max-width: 46em; }
.faq h3 { font-family: var(--serif); font-weight: 400; font-size: 1.2rem; margin: 22px 0 6px; }
.faq h3:first-child { margin-top: 0; }
.faq p { margin: 0; color: var(--ink-soft); }

/* ---- how-to-choose page ---- */
.fig { margin: 22px 0; }
.fig img { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--rule); background: #fff; }
.fig figcaption { font-size: .92rem; color: var(--ink-soft); margin-top: 8px; }
.fig.wide { margin-top: 6px; }
.fig.narrowfig { max-width: 560px; margin-left: auto; margin-right: auto; }
.qcard { background: var(--white); border: 1px solid var(--rule); border-left: 5px solid var(--mustard); border-radius: 10px; padding: 18px 22px 8px; margin: 18px 0; }
.qcard:nth-of-type(2n) { border-left-color: var(--leaf); }
.qcard:nth-of-type(3n) { border-left-color: var(--red); }
.qhead { display: flex; gap: 16px; align-items: center; margin-bottom: 8px; }
.qicon { flex: 0 0 56px; }
.qnum { font-size: .82rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--leaf); }
.qcard h3 { margin: 0; font-size: 1.25rem; }
.redflag { color: var(--red-dark); }
.compare th[scope="row"] { font-family: var(--sans); font-weight: 700; background: transparent; }
.agegrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 18px 0; }
.agecard { background: var(--white); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; padding-bottom: 6px; }
.agecard .fig { margin: 0; }
.agecard .fig img { border-radius: 0; border: 0; border-bottom: 1px solid var(--rule); }
.agecard h3 { margin: 12px 16px 4px; }
.agecard p { margin: 0 16px 12px; font-size: .96rem; color: var(--ink-soft); }
.sources li { font-size: .95rem; }
@media (max-width: 760px) { .agegrid { grid-template-columns: 1fr; } .qcard { padding: 16px 16px 6px; } }


.sec-intro { margin: -12px 0 22px; color: var(--ink-soft); max-width: 70ch; }

/* ---- worksheet pages ---- */
.ws-top { display: grid; grid-template-columns: 1.5fr 1fr; gap: 44px; align-items: center; }
.ws-top > img { max-width: 300px; justify-self: center; border: 1px solid var(--rule); background: #fff; box-shadow: 4px 8px 18px rgba(60,40,10,.18); }
.ws-age { display: inline-block; background: #fbe3a6; color: var(--red-dark); border-radius: 999px; padding: 1px 12px; font-size: .88rem; font-weight: 700; margin-bottom: 10px; }
.ws-lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 34em; }
.article ol.ws-list { list-style: none; padding: 0; }
.article .ws-list li { display: grid; grid-template-columns: 120px 1fr; gap: 20px; align-items: start; padding: 16px 0; border-bottom: 1px dashed var(--rule); margin: 0; }
.ws-list img { border: 1px solid var(--rule); background: #fff; box-shadow: 2px 4px 10px rgba(60,40,10,.14); }
.article .ws-list h3 { margin: 0 0 4px; font-size: 1.1rem; }
.ws-list p { margin: 0; color: var(--ink-soft); }
.article ul.ws-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin: 0 0 30px; }
.article .ws-grid li { display: flex; margin: 0; }
.ws-grid a { flex: 1; background: var(--white); border: 2px solid var(--ink); border-radius: 14px; padding: 18px; text-decoration: none; color: var(--ink); box-shadow: 5px 5px 0 var(--rule); }
.ws-grid a:hover { color: var(--ink); box-shadow: 8px 8px 0 var(--mustard); }
.ws-grid img { width: 62%; margin: 0 auto 14px; border: 1px solid var(--rule); background: #fff; }
.article .ws-grid h2 { font-size: 1.2rem; margin: 0 0 6px; }
.ws-grid p { margin: 0; color: var(--ink-soft); font-size: .98rem; }
@media (max-width: 900px) { .article ul.ws-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) {
  .ws-top { grid-template-columns: 1fr; gap: 20px; }
  .ws-top > img { max-width: 240px; }
  .article .ws-list li { grid-template-columns: 84px 1fr; gap: 14px; }
}
@media (max-width: 560px) { .article ul.ws-grid { grid-template-columns: 1fr; } }

/* compact sticky header on phones */
@media (max-width: 760px) {
  .masthead .wrap { gap: 4px; padding-top: 10px; padding-bottom: 8px; }
  .brand { font-size: 1.3rem; }
  .nav { gap: 2px 14px; font-size: .9rem; line-height: 1.5; }
}

/* ---- Christmas math article ---- */
.xm-scroll { overflow-x: auto; }
.xm-table { width: 100%; border-collapse: collapse; background: var(--white); font-size: .96rem; }
.xm-table th, .xm-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.xm-table th { background: var(--paper-2); font-family: var(--serif); font-weight: 400; }
.xm-hero { width: 100%; height: auto; max-height: 360px; object-fit: cover; border-radius: 14px; display: block; margin: 0 0 18px; }
.xm-jump { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0 8px; }
.xm-jump a { text-align: center; padding: 12px 6px; border: 2px solid var(--ink); border-radius: 10px; background: var(--red-dark); color: #fff; text-decoration: none; font-weight: 700; }
.xm-jump a:hover { color: #fff; background: var(--ink); }
.xm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin: 18px 0 26px; align-items: start; }
.xm-card { background: var(--white); border: 2px solid var(--ink); border-radius: 14px; overflow: hidden; scroll-margin-top: 90px; }
.xm-card svg { display: block; width: 100%; height: auto; border-bottom: 2px solid var(--ink); }
.xm-body { padding: 14px 18px 6px; }
.article .xm-body h3 { margin: 0 0 8px; font-size: 1.25rem; }
.xm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.xm-chips span { background: var(--paper-2); border-radius: 20px; padding: 3px 12px; font-size: .88rem; font-weight: 700; color: var(--leaf); }
.xm-body p { margin: 0 0 10px; }
.article .xm-body ol { margin: 0 0 12px; }
.xm-say { border-left: 5px solid var(--mustard); background: var(--paper); padding: 8px 12px; }
.article .xm-body details { border-bottom: 0; border-top: 1px dashed var(--rule); }
.article .xm-body details p { color: var(--ink); font-weight: 400; }
.xm-print { display: flex; gap: 20px; align-items: center; border: 2px dashed var(--ink); border-radius: 14px; padding: 18px; background: var(--white); margin: 26px 0; }
.xm-print img { width: 120px; height: auto; border: 1px solid var(--rule); }
.article .xm-print h2 { margin: 0 0 6px; font-size: 1.3rem; scroll-margin-top: 90px; }
.xm-sheets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin: 14px 0; }
.xm-sheets a { text-decoration: none; text-align: center; font-weight: 700; font-size: .95rem; }
.xm-sheets img { width: 100%; height: auto; display: block; border: 1px solid var(--rule); margin-bottom: 6px; }
@media (max-width: 700px) {
  .xm-grid { grid-template-columns: 1fr; }
  .xm-jump { grid-template-columns: 1fr 1fr; }
  .xm-print { flex-direction: column; text-align: center; }
  .xm-sheets { grid-template-columns: repeat(2, 1fr); }
  .xm-table th:nth-child(n+4), .xm-table td:nth-child(n+4) { display: none; }
}

/* ---- home: featured article grid ---- */
.posts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.post { display: flex; flex-direction: column; background: var(--white); border: 2px solid var(--ink); border-radius: 12px; overflow: hidden; color: var(--ink); text-decoration: none; box-shadow: 4px 4px 0 var(--ink); transition: transform .1s, box-shadow .1s; }
.post:hover { color: var(--ink); transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.post img { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; border-bottom: 2px solid var(--ink); display: block; }
.post img[src*="/sheets/"] { object-position: top; }
.post-body { padding: 14px 18px 18px; }
.post-tag { font-size: .82rem; font-weight: 700; color: var(--leaf); text-transform: uppercase; letter-spacing: .04em; }
.post h3 { font-family: var(--serif); font-weight: 400; font-size: 1.2rem; line-height: 1.3; margin: 6px 0 8px; }
.post p { margin: 0; color: var(--ink-soft); font-size: .98rem; }
@media (max-width: 900px) { .posts { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .posts { grid-template-columns: 1fr; } }

/* two download buttons side by side or stacked, never touching */
.ws-top .btn, .xm-print .btn, .article .btn { margin: 0 8px 10px 0; }

.article .ws-list li { scroll-margin-top: 90px; }
.article .ws-list li p { margin: 0 0 6px; }

/* worksheet previews in a row */
.ws-prev { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 14px 0; }
.ws-prev figure { margin: 0; }
.ws-prev img { width: 100%; height: auto; display: block; border: 1px solid var(--rule); box-shadow: 0 6px 14px rgba(43,36,32,.12); }
.ws-prev figcaption { font-size: .9rem; text-align: center; margin-top: 6px; color: var(--ink-soft); }
.article h2[id] { scroll-margin-top: 90px; }
@media (max-width: 600px) { .ws-prev { grid-template-columns: 1fr 1fr; gap: 10px; } }

/* ---- dropdown menu ---- */
.nav .has-sub { position: relative; }
.nav .has-sub > button { font: inherit; color: var(--ink); background: none; border: 0; border-bottom: 2px solid transparent; padding: 0 0 2px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.nav .has-sub > button:hover, .nav .has-sub.open > button { border-bottom-color: var(--mustard); }
.nav .caret { width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.nav .sub { display: none; position: absolute; top: 100%; left: -14px; min-width: 230px; background: var(--white); border: 2px solid var(--ink); border-radius: 10px; box-shadow: 4px 4px 0 var(--ink); padding: 6px; z-index: 30; }
/* invisible bridge so the menu stays open while the mouse moves down to it */
.nav .has-sub::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 6px; }
.nav .sub a { display: block; padding: 8px 12px; border: 0; border-radius: 6px; white-space: nowrap; line-height: 1.35; }
.nav .sub a:hover, .nav .sub a:focus-visible { background: var(--paper-2); }
.nav .has-sub:last-child .sub { left: auto; right: -8px; }
.nav .has-sub.open .sub, .nav .has-sub:focus-within .sub { display: block; }
@media (hover: hover) and (min-width: 761px) { .nav .has-sub:hover .sub { display: block; } }
@media (max-width: 760px) {
  .nav .has-sub, .nav .has-sub:last-child { position: static; }
  .nav .has-sub::after { display: none; }
  .nav .sub, .nav .has-sub:last-child .sub { left: 12px; right: 12px; min-width: 0; max-height: 70vh; overflow-y: auto; }
  .nav .sub a { white-space: normal; padding: 10px 12px; }
}

/* ---- worksheets by skill ---- */
.skills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.skill { display: flex; flex-direction: column; background: var(--white); border: 2.5px solid var(--ink); border-radius: 20px; overflow: hidden; box-shadow: 6px 6px 0 var(--ink); transition: transform .15s, box-shadow .15s; scroll-margin-top: 110px; }
.skill:hover { transform: translate(-2px, -3px); box-shadow: 9px 10px 0 var(--ink); }
.skill-top { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-bottom: 2.5px solid var(--ink);
  background: radial-gradient(rgba(255, 255, 255, .75) 2.5px, transparent 3px) 0 0 / 20px 20px, var(--band); }
.skill-top svg { flex: none; background: #fffdf8; border: 2.5px solid var(--ink); border-radius: 16px; padding: 4px; box-sizing: content-box; width: 68px; height: 68px; transform: rotate(-4deg); }
.skill:hover .skill-top svg { transform: rotate(3deg) scale(1.05); }
.skill-top svg { transition: transform .15s; }
.skill h3, .article .skill h3 { font-family: var(--serif); font-weight: 400; font-size: 1.3rem; margin: 0 0 4px; }
.skill p, .article .skill p { margin: 0; color: var(--ink); font-size: .98rem; line-height: 1.4; }
.article .skill ul, .skill ul { list-style: none; margin: 0; padding: 16px 18px 18px; display: flex; flex-wrap: wrap; gap: 10px; }
.skill li { margin: 0; }
.skill li a, .article .skill li a { display: inline-block; border: 2px solid var(--ink); border-radius: 999px; padding: 6px 15px; font-size: .95rem; font-weight: 700; line-height: 1.3; text-decoration: none; color: var(--ink); background: var(--soft); box-shadow: 2px 2px 0 var(--ink); }
.skill li a:hover { color: var(--ink); background: var(--band); transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
@media (prefers-reduced-motion: reduce) { .skill, .skill-top svg, .skill:hover, .skill:hover .skill-top svg { transition: none; transform: none; } }
.article .ws-grid h3 { font-family: var(--serif); font-weight: 400; }
h2#grades, h2#skills { scroll-margin-top: 110px; }
@media (max-width: 700px) { .skills { grid-template-columns: 1fr; } .skill-top { gap: 12px; padding: 14px; } .skill-top svg { width: 56px; height: 56px; } }

/* home headline: three set lines */
.intro h1.hero-h1 { font-size: clamp(1.35rem, 6.4vw, 2.5rem); }
.hero-h1 .hl { display: block; }
@media (min-width: 801px) { .intro h1.hero-h1 { font-size: clamp(1.75rem, 3.6vw, 2.5rem); } }

/* ---- colorful grade cards ---- */
.gcards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.gcard { display: flex; flex-direction: column; background: var(--white); color: var(--ink); text-decoration: none; border: 2.5px solid var(--ink); border-radius: 20px; overflow: hidden; box-shadow: 6px 6px 0 var(--ink); transition: transform .15s, box-shadow .15s; }
.gcard:hover { color: var(--ink); transform: translate(-2px, -3px); box-shadow: 9px 10px 0 var(--ink); }
.gcard-top { display: flex; align-items: center; gap: 14px; padding: 16px 18px; min-height: 106px; border-bottom: 2.5px solid var(--ink);
  background: radial-gradient(rgba(255, 255, 255, .75) 2.5px, transparent 3px) 0 0 / 20px 20px, var(--band); }
.gnum { flex: none; display: grid; place-items: center; width: 66px; height: 66px; background: #fffdf8; border: 2.5px solid var(--ink); border-radius: 50%; font-family: var(--hand); font-size: 2.7rem; line-height: 1; color: var(--red-dark); transform: rotate(-6deg); transition: transform .15s; }
.gcard:hover .gnum { transform: rotate(5deg) scale(1.06); }
.gcard h3 { font-family: var(--serif); font-weight: 400; font-size: 1.2rem; line-height: 1.25; margin: 0; }
.gcard-body { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 16px 18px 18px; }
.gcard-body p { margin: 0; font-size: .98rem; line-height: 1.45; }
.gpill { margin-top: auto; display: inline-block; border: 2px solid var(--ink); border-radius: 999px; padding: 6px 15px; font-size: .95rem; font-weight: 700; background: var(--soft); box-shadow: 2px 2px 0 var(--ink); }
.gcard:hover .gpill { background: var(--band); }
@media (max-width: 900px) { .gcards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .gcards { grid-template-columns: 1fr; } }
.ws-grid a, .article .ws-grid a { border-width: 2.5px; border-radius: 20px; box-shadow: 6px 6px 0 var(--ink);
  background: radial-gradient(rgba(255, 255, 255, .75) 2.5px, transparent 3px) 0 0 / 20px 20px, var(--band, var(--white)); transition: transform .15s, box-shadow .15s; }
.ws-grid a:hover, .article .ws-grid a:hover { transform: translate(-2px, -3px); box-shadow: 9px 10px 0 var(--ink); }
.ws-grid a img { border: 2px solid var(--ink); border-radius: 10px; }
.ws-grid a .ws-age { background: #fffdf8; border: 2px solid var(--ink); }
.ws-grid a p { color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .gcard, .gcard:hover, .gnum, .gcard:hover .gnum, .ws-grid a:hover { transition: none; transform: none; } }

/* ---- who the site is for ---- */
.who-tag { display: inline-block; margin-bottom: 14px; padding: 5px 16px; border: 2px solid var(--ink); border-radius: 999px; background: #ffe3a3; box-shadow: 3px 3px 0 var(--ink); font-weight: 700; font-size: 1.02rem; }
.wrap.who { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; padding-top: 8px; padding-bottom: 8px; }
.who-card { border: 2.5px solid var(--ink); border-radius: 20px; padding: 18px 22px; box-shadow: 6px 6px 0 var(--ink); }
.who-card.parents { background: #ffd0c4; }
.who-card.teachers { background: #cdeccf; }
.who-card h2 { font-size: 1.35rem; margin: 0 0 6px; }
.who-card p { margin: 0 0 12px; }
.who-card p.who-links { margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.who-links a { display: inline-block; border: 2px solid var(--ink); border-radius: 999px; padding: 5px 14px; background: var(--white); color: var(--ink); text-decoration: none; font-weight: 700; font-size: .95rem; box-shadow: 2px 2px 0 var(--ink); }
.who-links a:hover { color: var(--ink); background: #fff2cf; }
@media (max-width: 700px) { .wrap.who { grid-template-columns: 1fr; } }

/* ---- wider layout on big screens ---- */
.wrap { padding-left: 32px; padding-right: 32px; }
@media (max-width: 700px) { .wrap { padding-left: 22px; padding-right: 22px; } }
@media (min-width: 1100px) { .niche-visual { max-width: 540px; } .intro h1.hero-h1 { font-size: min(3.5vw, 2.9rem); } .intro p.lead { font-size: 1.25rem; } }

/* trust pages: shorter lines */
.narrow.reading { max-width: 860px; }

/* ---- times table cards (multiplication page) ---- */
.ttables, .article .ttables { list-style: none; margin: 18px 0 26px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; }
.ttables li { margin: 0; display: flex; flex-direction: column; background: var(--white); border: 2.5px solid var(--ink); border-radius: 18px; overflow: hidden; box-shadow: 5px 5px 0 var(--ink); transition: transform .15s, box-shadow .15s; }
.ttables li:hover { transform: translate(-2px, -3px); box-shadow: 8px 9px 0 var(--ink); }
.ttables .tt-main, .article .ttables .tt-main { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 14px 10px 12px; color: var(--ink); text-decoration: none;
  background: radial-gradient(rgba(255, 255, 255, .75) 2.5px, transparent 3px) 0 0 / 18px 18px, var(--band); }
.tt-num { display: grid; place-items: center; width: 58px; height: 58px; background: var(--white); border: 2.5px solid var(--ink); border-radius: 50%; font-family: var(--serif); font-size: 1.7rem; line-height: 1; }
.tt-name { font-weight: 700; }
.tt-tip { font-size: .88rem; line-height: 1.3; }
.ttables .tt-ink, .article .ttables .tt-ink { display: block; text-align: center; padding: 6px; border-top: 2px solid var(--ink); color: var(--ink); font-size: .9rem; font-weight: 700; text-decoration: none; }
.ttables .tt-ink:hover { background: var(--paper-2); color: var(--ink); }
@media (max-width: 420px) { .ttables, .article .ttables { grid-template-columns: 1fr 1fr; gap: 12px; } }
@media (prefers-reduced-motion: reduce) { .ttables li, .ttables li:hover { transition: none; transform: none; } }

/* an odd last skill card uses the whole row */
.skills .skill:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* four featured cards */
@media (min-width: 901px) { .posts { grid-template-columns: repeat(4, 1fr); } }
.post img[src*="/pins/"] { object-position: top; }

/* six menu items: keep them on one line on small laptops and tablets */
@media (min-width: 761px) and (max-width: 1040px) { .nav { gap: 11px; font-size: .9rem; } .masthead .wrap { gap: 12px; padding-left: 18px; padding-right: 18px; } .masthead .brand { font-size: 1.25rem; } .nav .has-sub > button { gap: 4px; } }

/* question sections as colorful cards, on every page */
.faq-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.faq-card { background: var(--soft); border: 2px solid #2b2420; border-radius: 18px; overflow: hidden; box-shadow: 5px 5px 0 rgba(43, 36, 32, .16); }
.faq-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.faq-top { display: flex; align-items: center; gap: 14px; background: var(--band); border-bottom: 2px solid #2b2420; padding: 14px 20px; }
.faq-pic { flex: 0 0 66px; height: 66px; border-radius: 50%; background: #fffdf8; border: 2px solid #2b2420; display: flex; align-items: center; justify-content: center; }
.faq-card h3 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 1.22rem; line-height: 1.3; }
.faq-card p { margin: 0; padding: 18px 22px 22px; color: #3f3731; }
@media (max-width: 800px) { .faq-cards { grid-template-columns: 1fr; gap: 16px; } .faq-top { padding: 12px 14px; gap: 12px; } .faq-pic { flex-basis: 54px; height: 54px; } .faq-pic svg { width: 42px; height: 42px; } .faq-card h3 { font-size: 1.08rem; } .faq-card p { padding: 14px 16px 18px; } }
.article .faq-cards { margin: 18px 0 28px; }
.article .faq-card h3 { margin: 0; font-size: 1.15rem; }
.article .faq-card p { margin: 0; }

/* five featured cards */
@media (min-width: 1200px) { .posts:has(> .post:nth-child(5)) { grid-template-columns: repeat(5, 1fr); gap: 18px; } }
@media (min-width: 901px) and (max-width: 1199px) { .posts:has(> .post:nth-child(5)) { grid-template-columns: repeat(3, 1fr); } }

/* six featured cards sit in two rows of three */
@media (min-width: 901px) { .posts:has(> .post:nth-child(6)) { grid-template-columns: repeat(3, 1fr); gap: 24px; } }
