/* ==========================================================================
   BRAND+ - shared by Discovery Lab and MoreHuman Ed (keep both copies in sync).
   Neo-minimal white space, asymmetric broken grids, bento layouts,
   purposeful motion and microinteractions, SEN-safe type.
   Motion rule: it must direct attention, explain a change, give feedback or
   help an interaction make sense. Nothing loops, nothing hijacks the scroll.
   ========================================================================== */

/* --- 1. SEN-safe reading ------------------------------------------------ */
body { line-height: 1.65; letter-spacing: 0.005em; word-spacing: 0.04em; text-align: left; }
p, li { max-width: 66ch; }
em, i, cite { font-style: normal; font-weight: 700; }   /* italics are hard for dyslexic readers */
.ticker span { font-style: normal !important; }
a:focus-visible, button:focus-visible, .btn:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--accent, #2F7F7C); outline-offset: 3px; border-radius: 4px; }
.btn, .tile, .choice, .nav-toggle { min-height: 44px; }
.lang-switch__btn { padding: .55em .5em; }   /* dyspraxia: generous targets */

/* --- 2. Scroll progress: tells you where you are on the page ------------ */
.bp-progress { position: fixed; inset: 0 0 auto 0; height: 4px; z-index: 90; pointer-events: none; }
.bp-progress i { display: block; height: 100%; width: 100%; background: #E3B230;
  transform: scaleX(var(--p, 0)); transform-origin: left; }

/* --- 3. Reveal: content eases in once, directing the eye down the page --- */
html.bp-js:not([data-reduced-motion="on"]) .bp-reveal {
  opacity: 0; transform: translateY(18px);
  transition: opacity .7s cubic-bezier(.2,.65,.3,1), transform .7s cubic-bezier(.2,.65,.3,1);
  transition-delay: calc(var(--bp-i, 0) * 70ms);
}
html.bp-js:not([data-reduced-motion="on"]) .bp-reveal.bp-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html.bp-js:not([data-reduced-motion="off"]) .bp-reveal { opacity: 1; transform: none; transition: none; }
}

/* --- 4. Kinetic typography: words rise into place once, then stay still -- */
.bp-word { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .12em; margin-bottom: -.12em; }
.bp-word > span { display: inline-block; }
html.bp-js:not([data-reduced-motion="on"]):not([data-dyslexia="on"]) .bp-kinetic:not(.bp-in) .bp-word > span { transform: translateY(105%); }
html.bp-js:not([data-reduced-motion="on"]):not([data-dyslexia="on"]) .bp-kinetic .bp-word > span {
  transition: transform .75s cubic-bezier(.2,.8,.2,1); transition-delay: calc(var(--w, 0) * 55ms); }
@media (prefers-reduced-motion: reduce) {
  html.bp-js:not([data-reduced-motion="off"]) .bp-kinetic .bp-word > span { transform: none !important; transition: none !important; }
}

/* --- 5. Microinteractions: feedback you can feel, never a surprise ------ */
.btn { transition: transform .18s var(--ease, ease), box-shadow .2s var(--ease, ease), background-color .2s; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.985); }
.btn .arrow, .choice__go, .tile__go { display: inline-block; transition: transform .25s var(--ease, ease); }
.btn:hover .arrow, .btn:focus-visible .arrow { transform: translateX(5px); }
.bp-spot { position: relative; }
.bp-spot::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; opacity: 0;
  background: radial-gradient(18rem circle at var(--mx, 50%) var(--my, 50%), #E3B2301F, transparent 70%);
  transition: opacity .3s; }
.bp-spot:hover::after { opacity: 1; }

/* --- 6. Smart rendering: off-screen sections cost nothing until needed --- */
.nav-sec, .site-foot { content-visibility: auto; contain-intrinsic-size: auto 38rem; }

/* --- 7. Bento (MoreHuman Ed cards) and side-by-side tiles (Discovery Lab) --- */
@media (min-width: 900px) {
  .grid-3.bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--sp-5); align-items: stretch; }
  .grid-3.bento > :nth-child(5n+1), .grid-3.bento > :nth-child(5n+2) { grid-column: span 3; }
  .grid-3.bento > :nth-child(5n+3), .grid-3.bento > :nth-child(5n+4), .grid-3.bento > :nth-child(5n) { grid-column: span 2; }
  .grid-3.bento > :nth-child(5n+1):last-child, .grid-3.bento > :nth-child(5n+3):last-child { grid-column: span 6; }
  .grid-3.bento > :nth-child(5n+4):last-child { grid-column: span 4; }
}
/* Discovery Lab tiles always sit beside each other, never in one tall stack */
.grid-tiles { grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: clamp(1rem, 2.4vw, 2rem); align-items: stretch; }
.grid-tiles:has(> :only-child) { grid-template-columns: minmax(0, 30rem); }
.grid-tiles:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-tiles:has(> :nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 720px) { .grid-tiles, .grid-tiles:has(> :nth-child(2):last-child), .grid-tiles:has(> :nth-child(3):last-child) { grid-template-columns: 1fr; } }
.choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 720px) { .choice-grid { grid-template-columns: 1fr; } .choice-grid > :nth-child(2) { margin-top: 0; } }
.tile .badge { align-self: flex-start; }
/* neo-minimal white space */
.nav-sec { padding-block: clamp(3rem, 7vw, 6rem); }
.hero { padding-block: clamp(4rem, 9vw, 8rem) clamp(3rem, 7vw, 6rem); }
@media (min-width: 900px) { .hero__lede { margin-left: clamp(0px, 6vw, 5rem); max-width: 52ch; } }
.hero { margin-bottom: var(--sp-7); }

/* --- 8. Reader settings panel (MoreHuman Ed only; Discovery Lab has its own) --- */
html:not([data-age-band])[data-text-size="l"] { font-size: 115%; }
html:not([data-age-band])[data-text-size="xl"] { font-size: 132%; }
html:not([data-age-band])[data-dyslexia="on"] { --font-ui: "Atkinson Hyperlegible", system-ui, sans-serif; --font-display: "Atkinson Hyperlegible", system-ui, sans-serif; letter-spacing: .02em; word-spacing: .1em; line-height: 1.75; }
html:not([data-age-band])[data-tint="warm"] { --paper: #F6EFDF; --surface: #FFFAF0; }
html:not([data-age-band])[data-tint="cool"] { --paper: #E7EEF2; --surface: #F5FAFD; }
html:not([data-age-band])[data-reduced-motion="on"] *, html:not([data-age-band])[data-reduced-motion="on"] *::before, html:not([data-age-band])[data-reduced-motion="on"] *::after {
  animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
.bp-set { position: fixed; left: 1rem; bottom: 1rem; z-index: 80; font-family: var(--font-ui); }
.bp-set__btn { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: .5rem 1rem; border-radius: 999px;
  background: #2B3036; color: #fff; font-weight: 700; font-size: .9rem; border: 2px solid #E3B230; cursor: pointer; }
.bp-set__panel { position: absolute; left: 0; bottom: 3.4rem; width: min(20rem, 88vw); padding: 1rem 1.1rem; background: #fff; color: #23282D;
  border: 1px solid #23282D3D; border-radius: 12px; box-shadow: 0 12px 40px -12px #23282D66; }
.bp-set__panel[hidden] { display: none; }
.bp-set__panel h2 { font-size: 1rem; margin: 0 0 .6rem; }
.bp-set__row { display: flex; align-items: center; gap: .6rem; min-height: 44px; font-size: .95rem; }
.bp-set__row input { width: 1.4rem; height: 1.4rem; accent-color: #2F7F7C; }
.bp-set__seg { display: flex; gap: .4rem; flex-wrap: wrap; margin: .2rem 0 .5rem; }
.bp-set__seg button { min-height: 44px; min-width: 44px; padding: .3rem .8rem; border-radius: 8px; border: 2px solid #23282D3D; background: #fff; font-weight: 700; cursor: pointer; }
.bp-set__seg button[aria-pressed="true"] { border-color: #2F7F7C; background: #2F7F7C1F; }

/* --- 9. Atmosphere: soft, static shades behind everything (no motion, no strobing) --- */
body { background-color: var(--paper); background-image: none; position: relative; isolation: isolate; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60rem 38rem at 92% -8%, #E3B2302E, transparent 62%),
    radial-gradient(48rem 34rem at -6% 18%, #3A8C8A26, transparent 60%),
    radial-gradient(52rem 40rem at 70% 108%, #C9453B1A, transparent 62%),
    radial-gradient(40rem 30rem at 10% 100%, #2B30361A, transparent 60%); }
html[data-tint="dark"] body::before { opacity: .55; }
/* --- 9b. A notebook in the sky: a faint grid that slowly breathes in and out, and clouds that
   drift and dissolve. Compositor-only (opacity/transform), very slow (40-120 s), never flashes. --- */
html::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(#2B30361A 1px, transparent 1px), linear-gradient(90deg, #2B30361A 1px, transparent 1px);
  background-size: 48px 48px; background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 62% 38%, #000 0%, transparent 78%);
          mask-image: radial-gradient(ellipse 70% 60% at 62% 38%, #000 0%, transparent 78%);
  opacity: 0; animation: bp-grid 46s ease-in-out infinite; will-change: opacity; }
html::after { content: ""; position: fixed; inset: -12% -30%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(22rem 9rem at 18% 22%, #ffffffd9, transparent 70%),
    radial-gradient(30rem 11rem at 44% 30%, #ffffffb8, transparent 72%),
    radial-gradient(24rem 9rem at 72% 18%, #ffffffcc, transparent 70%),
    radial-gradient(34rem 12rem at 60% 62%, #ffffff99, transparent 72%),
    radial-gradient(26rem 10rem at 24% 76%, #ffffffa6, transparent 72%);
  filter: blur(22px); opacity: .85; animation: bp-cloud-a 110s ease-in-out infinite alternate; will-change: transform, opacity; }
body::after { content: ""; position: fixed; inset: -10% -25%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(28rem 10rem at 10% 52%, #ffffff8c, transparent 72%),
    radial-gradient(20rem 8rem at 52% 12%, #ffffffa0, transparent 70%),
    radial-gradient(32rem 11rem at 86% 46%, #ffffff8c, transparent 72%),
    radial-gradient(22rem 9rem at 40% 88%, #E3B23026, transparent 72%);
  filter: blur(30px); opacity: .75; animation: bp-cloud-b 150s ease-in-out infinite alternate; will-change: transform, opacity; }
@keyframes bp-grid { 0%, 100% { opacity: 0; } 35%, 65% { opacity: .9; } }
@keyframes bp-cloud-a { 0% { transform: translate3d(-4%, 0, 0); opacity: .55; } 50% { opacity: .95; } 100% { transform: translate3d(5%, 2%, 0); opacity: .6; } }
@keyframes bp-cloud-b { 0% { transform: translate3d(5%, 1%, 0); opacity: .45; } 55% { opacity: .85; } 100% { transform: translate3d(-5%, -2%, 0); opacity: .5; } }
html[data-tint="dark"]::after, html[data-tint="dark"] body::after { opacity: .12; filter: blur(30px) brightness(.6); }
html[data-tint="dark"]::before { background-image: linear-gradient(#ECEFF114 1px, transparent 1px), linear-gradient(90deg, #ECEFF114 1px, transparent 1px); }
@media (max-width: 720px) { body::after { display: none; } html::before { animation-duration: 60s; } }
/* calm motion: clouds stay put, the grid is not shown at all (kinder for visual stress) */
html[data-reduced-motion="on"]::before { display: none; }
html[data-reduced-motion="on"]::after, html[data-reduced-motion="on"] body::after { animation: none; }
@media (prefers-reduced-motion: reduce) {
  html:not([data-reduced-motion="off"])::before { display: none; }
  html:not([data-reduced-motion="off"])::after, html:not([data-reduced-motion="off"]) body::after { animation: none; }
}

/* --- 10. Depth: tiles and cards tilt a few degrees toward the pointer, layered like glass --- */
.tile, .choice { transform-style: preserve-3d; background: linear-gradient(160deg, #ffffff 0%, #FBFCFB 55%, #F1F4F3 100%);
  box-shadow: 0 1px 0 #ffffff inset, 0 1px 2px #23282D14, 0 14px 30px -14px #23282D40, 0 36px 60px -34px #23282D33;
  will-change: transform; }
html.bp-js:not([data-reduced-motion="on"]) .tile.bp-tilt, html.bp-js:not([data-reduced-motion="on"]) .choice.bp-tilt {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0px));
  transition: transform .25s cubic-bezier(.2,.65,.3,1), box-shadow .3s; }
.tile.bp-tilt:hover, .choice.bp-tilt:hover { --lift: -6px;
  box-shadow: 0 1px 0 #fff inset, 0 2px 4px #23282D1A, 0 26px 44px -16px #23282D55, 0 50px 80px -40px #23282D40; }
.tile__media, .choice__mark, .tile__thumb { transform: translateZ(28px); }
.tile__title, .choice__title { transform: translateZ(16px); }
.hero__mark { filter: drop-shadow(0 18px 24px #00000066); }
@media (prefers-reduced-motion: reduce) { html:not([data-reduced-motion="off"]) .tile.bp-tilt, html:not([data-reduced-motion="off"]) .choice.bp-tilt { transform: none; } }
