:root {
  --yellow: #ffd60a; --yellow-d: #e6b800; --ink: #1d2f5c; --ink-2: #44547a; --sky: #eaf4ff; --paper: #fffdf7;
  --line: #dfe6f1; --white: #fff; --coral: #ef6f6c; --green: #2e9e6b; --c: #3d8bd9;
  --r: 16px; --shadow: 0 2px 0 rgba(29,47,92,.06), 0 8px 24px rgba(29,47,92,.08);
  --font: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #eaf0ff; --ink-2: #b4c0de; --sky: #1a2744; --paper: #121a30; --line: #2a3860; --white: #1b2746; --shadow: 0 8px 24px rgba(0,0,0,.35); }
  .logo { color: #1d2f5c; } .hl { background: var(--yellow); color: #1d2f5c; padding: 0 .15em; border-radius: 6px; } .tint { background: #16213d !important; } .btn { color: #1d2f5c; }
  .prose img, .card-media img, .act-hero { filter: brightness(.92); }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--paper); line-height: 1.6; font-size: 1.0625rem; -webkit-text-size-adjust: 100%; }
img { max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 3px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
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 { width: min(1120px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(760px, 100% - 32px); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: var(--yellow); color: #1d2f5c; padding: 8px 14px; border-radius: 8px; z-index: 99; }
:focus-visible { outline: 3px solid #3d8bd9; outline-offset: 2px; border-radius: 4px; }

/* header */
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.logo { background: var(--yellow); color: #1d2f5c; font-weight: 800; font-size: 1.6rem; text-decoration: none; padding: 2px 10px; letter-spacing: -.02em; border-radius: 4px; line-height: 1.3; }
.logo-sm { font-size: 1.2rem; display: inline-block; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav > a, .dd > summary { padding: 8px 12px; border-radius: 10px; text-decoration: none; font-weight: 700; cursor: pointer; list-style: none; display: block; font-size: 1rem; }
.dd > summary::-webkit-details-marker { display: none; }
.dd > summary::after { content: " ▾"; font-size: .75em; }
.nav > a:hover, .dd > summary:hover, .dd[open] > summary { background: var(--sky); }
.nav-cta { background: var(--yellow); color: #1d2f5c !important; margin-left: 6px; } .nav-cta:hover { background: var(--yellow-d) !important; }
.dd { position: relative; }
.dd-menu { position: absolute; top: 100%; left: 0; min-width: 190px; background: var(--white); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 8px; display: grid; gap: 2px; }
.dd-wide { grid-template-columns: 1fr 1fr; min-width: 380px; }
.dd-menu a { padding: 7px 10px; border-radius: 8px; text-decoration: none; display: flex; align-items: center; gap: 8px; } .dd-menu a:hover { background: var(--sky); }
.dd-menu i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dd-h { grid-column: 1 / -1; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); padding: 6px 10px 2px; font-weight: 700; }
.menu-btn { display: none; font: inherit; font-weight: 700; padding: 8px 16px; border: 2px solid var(--ink); border-radius: 999px; background: transparent; color: inherit; cursor: pointer; }

/* hero */
.hero { background: linear-gradient(180deg, var(--sky), var(--paper)); padding: clamp(28px, 6vw, 64px) 0 clamp(20px, 4vw, 40px); }
.hero-in { display: grid; grid-template-columns: 1.15fr .85fr; gap: 32px; align-items: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; font-weight: 800; color: var(--ink-2); margin-bottom: .6em; }
.hl { background: linear-gradient(transparent 60%, var(--yellow) 60%); }
.lead { font-size: 1.2rem; color: var(--ink-2); max-width: 60ch; }
.hero-art img { width: 100%; border-radius: 28px; box-shadow: var(--shadow); display: block; object-fit: cover; aspect-ratio: 4/3; }
.hero-note { font-weight: 700; margin-top: 14px; color: var(--green); }
.search { display: flex; gap: 8px; max-width: 520px; margin-top: 18px; }
.search input, .filters input, .filters select, .contact input, .contact textarea { font: inherit; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--white); color: inherit; width: 100%; }
.search input:focus, .filters input:focus, .filters select:focus, .contact input:focus, .contact textarea:focus { border-color: #3d8bd9; outline: none; }
button, .btn { font: inherit; cursor: pointer; }
.search button, .btn { background: var(--yellow); color: #1d2f5c; border: 0; border-radius: 12px; padding: 12px 20px; font-weight: 800; text-decoration: none; display: inline-block; white-space: nowrap; box-shadow: 0 3px 0 var(--yellow-d); }
.search button:hover, .btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-ghost { background: transparent; border: 2px solid var(--line); box-shadow: none; color: var(--ink); width: 100%; margin-top: 8px; }

/* bands */
.band { padding: clamp(28px, 5vw, 56px) 0; } .tint { background: var(--sky); }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; } .sec-head a { font-weight: 700; }
.years { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.year-btn { background: var(--c); color: #fff; text-decoration: none; border-radius: var(--r); padding: 16px 10px; text-align: center; display: grid; gap: 2px; box-shadow: 0 4px 0 rgba(0,0,0,.18); transition: transform .12s; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.year-btn:hover { transform: translateY(-3px); } .year-btn b { font-size: 1.35rem; } .year-btn small { opacity: .9; font-weight: 700; } .year-btn span { font-size: .85rem; opacity: .95; }
.topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.topic { background: var(--white); border: 2px solid var(--line); border-radius: var(--r); text-decoration: none; padding: 14px; display: grid; gap: 2px; justify-items: start; }
.topic:hover { border-color: var(--yellow-d); transform: translateY(-2px); } .topic span { font-size: 1.6rem; } .topic small { color: var(--ink-2); }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; counter-reset: s; }
.steps li { background: var(--white); border: 2px solid var(--line); border-radius: var(--r); padding: 20px; counter-increment: s; display: grid; gap: 6px; }
.steps li::before { content: counter(s); background: var(--yellow); color: #1d2f5c; font-weight: 800; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; }
.steps b { font-size: 1.2rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.ticks { list-style: none; padding: 0; margin: 0 0 1em; } .ticks li { padding-left: 30px; position: relative; margin: .45em 0; } .ticks li::before { content: "✔"; position: absolute; left: 0; color: var(--green); font-weight: 800; }

/* cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin-top: 18px; }
.card { background: var(--white); border-radius: var(--r); overflow: hidden; border: 2px solid var(--line); border-top: 6px solid var(--c); display: flex; flex-direction: column; transition: transform .12s, box-shadow .12s; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-media { display: block; aspect-ratio: 16/9; background: color-mix(in srgb, var(--c) 14%, var(--white)); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-icon { display: grid; place-items: center; height: 100%; font-size: 3rem; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.card h3 { margin: 2px 0 6px; font-size: 1.15rem; } .card h3 a { text-decoration: none; } .card h3 a::after { content: ""; position: absolute; inset: 0; } .card { position: relative; }
.card-meta { font-size: .82rem; color: var(--ink-2); font-weight: 700; margin: 0; }
.card-sum { color: var(--ink-2); font-size: .95rem; flex: 1; margin-bottom: 8px; }
.card-tags { margin: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: .78rem; font-weight: 700; padding: 2px 10px; background: var(--sky); border-radius: 999px; text-decoration: none; position: relative; z-index: 1; }
a.tag:hover { background: var(--yellow); color: #1d2f5c; }
.chip { display: inline-block; padding: 2px 12px; border-radius: 999px; font-weight: 800; font-size: .85rem; text-decoration: none; }
.chip-year { background: var(--c); color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.25); }

/* page heads, filters, crumbs */
.page-head { background: linear-gradient(180deg, var(--sky), var(--paper)); padding: clamp(24px, 5vw, 48px) 0 18px; }
.year-head { background: linear-gradient(180deg, color-mix(in srgb, var(--c) 22%, var(--paper)), var(--paper)); border-bottom: 6px solid var(--c); }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 10px; margin-top: 16px; }
.count { margin: 12px 0 0; color: var(--ink-2); font-weight: 700; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pill { border: 2px solid var(--line); background: var(--white); color: inherit; padding: 6px 14px; border-radius: 999px; font-weight: 700; }
.pill.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.crumbs { font-size: .9rem; color: var(--ink-2); padding: 12px 0 0; } .crumbs i { font-style: normal; opacity: .6; } .crumbs a { text-decoration: none; } .crumbs a:hover { text-decoration: underline; }
.year-nav { display: flex; justify-content: space-between; margin-top: 28px; font-weight: 800; }
.empty { text-align: center; padding: 24px; color: var(--ink-2); }

/* activity */
.act-head { padding: 18px 0 8px; }
.act-head h1 { margin-bottom: .3em; }
.act-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; }
.glance { background: var(--white); border: 2px solid var(--line); border-top: 6px solid var(--c); border-radius: var(--r); padding: 18px; position: sticky; top: 84px; order: 2; }
.glance h2 { font-size: 1.1rem; text-transform: uppercase; letter-spacing: .08em; }
.glance dl { margin: 0; } .glance dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); font-weight: 800; margin-top: 12px; } .glance dd { margin: 2px 0 0; font-weight: 600; }
.act-hero { width: 100%; border-radius: var(--r); margin-bottom: 18px; display: block; }
.prose { font-size: 1.12rem; max-width: 70ch; }
.prose img { border-radius: 12px; margin: .5em 0 1em; display: block; }
.prose ul, .prose ol { padding-left: 1.4em; } .prose li { margin: .3em 0; }
.prose h2 { margin-top: 1.4em; } .prose a { color: #1f65b8; } @media (prefers-color-scheme: dark) { .prose a { color: #8fc1ff; } }
.reveal { border: 2px dashed var(--c); border-radius: 12px; margin: 1em 0; background: color-mix(in srgb, var(--c) 8%, var(--white)); }
.reveal summary { padding: 12px 16px; font-weight: 800; cursor: pointer; } .reveal[open] summary { border-bottom: 2px dashed var(--c); }
.reveal-body { padding: 4px 16px 8px; }
.callout { border-left: 6px solid var(--yellow); background: color-mix(in srgb, var(--yellow) 14%, var(--white)); border-radius: 0 12px 12px 0; padding: 12px 18px 4px; margin: 1.2em 0; }
.callout h3 { margin-bottom: .3em; } .callout-talk { border-color: #3d8bd9; background: color-mix(in srgb, #3d8bd9 10%, var(--white)); } .callout-challenge { border-color: #8e6bd1; background: color-mix(in srgb, #8e6bd1 10%, var(--white)); } .callout-safety { border-color: var(--coral); background: color-mix(in srgb, var(--coral) 10%, var(--white)); }
.share { background: var(--yellow); color: #1d2f5c; border-radius: var(--r); padding: 16px 20px 6px; margin-top: 28px; max-width: 70ch; }
.related { margin: 48px 0 24px; }

.notice { padding: 12px 16px; border-radius: 12px; font-weight: 700; } .ok { background: #d9f5e6; color: #14532d; } .err { background: #fde2e2; color: #7f1d1d; }
.contact { display: grid; gap: 14px; } .contact label { display: grid; gap: 6px; font-weight: 700; } .contact small { font-weight: 400; color: var(--ink-2); } .hp { position: absolute; left: -9999px; }
.play { background: var(--ink); color: var(--paper); border-radius: 24px; padding: 32px; } .play .btn { box-shadow: none; }

/* footer */
.site-footer { background: var(--ink); color: #eaf0ff; padding: 36px 0 12px; margin-top: 40px; }
.foot { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 24px; }
.foot a { display: block; text-decoration: none; padding: 2px 0; opacity: .9; } .foot a:hover { text-decoration: underline; opacity: 1; } .foot .logo { display: inline-block; }
.foot h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; opacity: .7; }
.legal { opacity: .7; font-size: .85rem; border-top: 1px solid rgba(255,255,255,.15); padding-top: 12px; margin-top: 20px; }
@media (prefers-color-scheme: dark) { .site-footer { background: #0c1224; } }

@media (max-width: 900px) {
  .hero-in, .two, .act-layout { grid-template-columns: 1fr; }
  .glance { position: static; order: -1; }
  .years { grid-template-columns: repeat(3, 1fr); } .steps { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; } .filters input { grid-column: 1 / -1; }
  .foot { grid-template-columns: 1fr 1fr; }
  .menu-btn { display: block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--paper); border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; padding: 8px 16px 16px; max-height: calc(100vh - 68px); overflow: auto; }
  .nav.open { display: flex; }
  .dd-menu { position: static; box-shadow: none; border: 0; padding: 0 0 8px 12px; } .dd-wide { min-width: 0; grid-template-columns: 1fr 1fr; }
  .nav-cta { margin: 6px 0 0; text-align: center; }
}
@media (max-width: 480px) { .years { grid-template-columns: repeat(2, 1fr); } .search { flex-direction: column; } .grid { grid-template-columns: 1fr; } .filters { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

@media print {
  .site-header, .site-footer, .crumbs, .related, .glance button, .skip { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .act-layout { display: block; } .glance { position: static; border: 1px solid #999; margin-bottom: 14px; break-inside: avoid; }
  .share { background: #fff; border: 1px solid #999; color: #000; }
  .reveal { break-inside: avoid; } a { text-decoration: none; }
  .act-head::before { content: "maths.life"; display: inline-block; background: #ffd60a; font-weight: 800; padding: 0 8px; margin-bottom: 6px; }
}

/* fixes */
.card-media { text-decoration: none; }
.home .grid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .home .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .home .grid { grid-template-columns: 1fr; } }

/* hero banner */
.hero { background-size: cover; background-position: right center; background-repeat: no-repeat; position: relative; min-height: clamp(340px, 34vw, 440px); display: flex; align-items: center; padding: clamp(32px, 6vw, 64px) 0; isolation: isolate; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(255,253,247,.96) 0%, rgba(255,253,247,.86) 38%, rgba(255,253,247,.25) 68%, rgba(255,253,247,0) 100%); }
.hero-in { display: block; width: min(1120px, 100% - 32px); }
.hero-copy { max-width: 600px; }
@media (prefers-color-scheme: dark) { .hero::before { background: linear-gradient(90deg, rgba(18,26,48,.96) 0%, rgba(18,26,48,.85) 40%, rgba(18,26,48,.3) 70%, rgba(18,26,48,0) 100%); } }
@media (max-width: 700px) { .hero::before { background: rgba(255,253,247,.88); } @media (prefers-color-scheme: dark) { .hero::before { background: rgba(18,26,48,.88); } } }

/* step boxes */
.flow { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; max-width: 760px; counter-reset: none; }
.step { position: relative; display: grid; grid-template-columns: 48px 1fr; gap: 14px; background: var(--white); border: 2px solid var(--line); border-left: 6px solid var(--c); border-radius: var(--r); padding: 18px 20px 8px 16px; margin-bottom: 44px; box-shadow: 0 2px 0 rgba(29,47,92,.05); }
.step:last-child { margin-bottom: 0; }
.step::after { content: ""; position: absolute; left: 50%; bottom: -38px; width: 28px; height: 28px; margin-left: -14px; background: var(--c); clip-path: polygon(0 0, 100% 0, 50% 100%); border-radius: 3px; }
.step:last-child::after { display: none; }
.step::before { content: ""; position: absolute; left: 50%; bottom: -14px; width: 4px; height: 14px; margin-left: -2px; background: var(--c); display: none; }
.num { width: 40px; height: 40px; border-radius: 50%; background: var(--c); color: #fff; font-weight: 800; font-size: 1.2rem; display: grid; place-items: center; text-shadow: 0 1px 1px rgba(0,0,0,.25); }
.step-body { min-width: 0; font-size: 1.1rem; }
.step-body > :first-child { margin-top: .35em; }
.step-body h2 { font-size: 1.3rem; margin: .2em 0 .5em; }
.step-body img { border-radius: 12px; margin: .4em 0 1em; display: block; }
.step-body ul, .step-body ol { padding-left: 1.3em; } .step-body li { margin: .3em 0; }
.step-body a { color: #1f65b8; } @media (prefers-color-scheme: dark) { .step-body a { color: #8fc1ff; } }
.callout-parents { border-color: var(--green); background: color-mix(in srgb, var(--green) 10%, var(--white)); max-width: 760px; margin-top: 28px; }
.act-main .share { max-width: 760px; }
@media (max-width: 560px) { .step { grid-template-columns: 1fr; padding: 16px 16px 6px; } .num { width: 34px; height: 34px; font-size: 1.05rem; } }
@media print { .step { break-inside: avoid; margin-bottom: 16px; } .step::after { display: none; } }
@media (prefers-color-scheme: dark) { .hl { background: var(--yellow); color: #1d2f5c; padding: 0 .15em; border-radius: 6px; } }

/* hidden cards must really hide */
[hidden] { display: none !important; }
.filters { grid-template-columns: 2fr 1fr 1fr 1fr auto; }
.f-actions { display: flex; gap: 8px; }
.f-actions .btn { width: auto; margin: 0; padding: 12px 18px; }
@media (max-width: 900px) { .filters { grid-template-columns: 1fr 1fr; } .f-actions { grid-column: 1 / -1; } .f-actions .btn { flex: 1; } }
@media (max-width: 480px) { .filters { grid-template-columns: 1fr; } }

/* headline highlight: solid marker that follows each wrapped line at any width */
.hl, .hl:is(*) { background: var(--yellow); color: #1d2f5c; padding: .02em .22em; border-radius: .2em; -webkit-box-decoration-break: clone; box-decoration-break: clone; line-height: 1.35; }
