/* ── The Sundarbans world (assets/js/sundarbans) ──────────────────────────────
   A fixed WebGL scene behind the page, scoped to html.has-world: the script adds the class after its first
   frame and removes it if the device cannot keep up, which leaves the base design in place. With the world
   on, the page is laid out like an event programme printed straight onto the forest. There are no panels,
   plates, outlines or glows; the scene carries the contrast instead. River mist settles on the land and
   water (never the sky), and the type is plain: mangrove ink by day, then moonlight bone from the Media
   section on, where the sun goes down. Text is always set in the ink; tiger orange marks what can be acted
   on, the short rules that lead each label and the stroke under emphasised words. */

/* Registered so the ink can cross-fade at nightfall: one transition on body carries the whole page. */
@property --ink { syntax: '<color>'; inherits: true; initial-value: #0E1B15; }
@property --ink-soft { syntax: '<color>'; inherits: true; initial-value: #13201A; }
@property --accent { syntax: '<color>'; inherits: true; initial-value: #82360A; }
@property --rule { syntax: '<color>'; inherits: true; initial-value: rgb(14 27 21 / 0.2); }
@property --rule-strong { syntax: '<color>'; inherits: true; initial-value: rgb(14 27 21 / 0.46); }

.world {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.6s var(--ease);
  background: linear-gradient(180deg, #a9c8f3 0%, #bbd4f6 24%, #d6e5fa 50%, #dce9fb 72%, #eef4fd 100%);
}
.world__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.world__grain {
  position: absolute;
  inset: 0;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* The sky gradient stands in at once; the canvas fades in on its first frame. */
html.has-world .world { opacity: 1; transition: none; }
.world__canvas { opacity: 0; transition: opacity 1.4s var(--ease); }
html.world-ready .world__canvas { opacity: 1; }
html.world-night .world { background: linear-gradient(180deg, #0b1322 0%, #172131 55%, #1d2a33 100%); }
/* Always lifted, so when the world hands the page back its fading sky stays beneath the strip and footer too. */
main,
.foot { position: relative; z-index: 1; }
html.has-world .deco { display: none; }
/* Sections share one continuous scene instead of their own bands, so a slightly closer rhythm keeps them connected. */
html.has-world { --section: clamp(4.5rem, 9vw, 8rem); }

/* ── Ink ── */
html.has-world body {
  --ink: #0E1B15;
  --ink-soft: #13201A;
  --accent: #82360A;
  --rule: rgb(14 27 21 / 0.2);
  --rule-strong: rgb(14 27 21 / 0.46);
  --air: rgb(236 242 247 / 0.86);
  font-weight: 500;
  transition: --ink 0.7s var(--ease), --ink-soft 0.7s var(--ease), --accent 0.7s var(--ease), --rule 0.7s var(--ease), --rule-strong 0.7s var(--ease);
}
html.has-world.world-night body {
  --ink: #F3EEE2;
  --ink-soft: #D8D4C9;
  --accent: #F08A46;
  --rule: rgb(243 238 226 / 0.2);
  --rule-strong: rgb(243 238 226 / 0.46);
  --air: rgb(9 15 29 / 0.82);
}

/* Every surface reads the ink from the page instead of setting its own. */
html.has-world :is(.hero, .strip, .statement, .warming, .sec, .lens, .foot, .site-header) {
  --ink: inherit;
  --ink-soft: inherit;
  --accent: inherit;
  --rule: inherit;
  --rule-strong: inherit;
}
html.has-world :is(.hero, .strip, .statement, .warming, .warming__sticky, .sec, .foot),
html.motion.has-world .hero { background: transparent; }

/* ── Header: open over the hero; once the page runs beneath it, it returns on scroll-up as a pane of the same air. ── */
html.has-world .site-header {
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border-bottom-color: transparent;
}
html.has-world .site-header.is-scrolled {
  background: var(--air);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom-color: var(--rule);
}
html.has-world .site-header .logo__light { opacity: 0; }
html.has-world .site-header .logo__dark { opacity: 1; }
html.has-world.world-night .site-header .logo__light,
html.has-world body.menu-open .site-header .logo__light { opacity: 1; }
html.has-world.world-night .site-header .logo__dark,
html.has-world body.menu-open .site-header .logo__dark { opacity: 0; }
html.has-world .nav a:is(:hover, .is-active) { color: var(--ink); }
html.has-world .menu-btn { border-color: transparent; }
html.has-world body.menu-open .site-header {
  --ink: var(--moon);
  --ink-soft: rgb(237 241 234 / 0.76);
  --accent: var(--tiger);
  --rule: rgb(237 241 234 / 0.2);
  --rule-strong: rgb(237 241 234 / 0.5);
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* ── Actions: a tiger pill for the thing to do, a plain underlined link for everything else. ── */
html.has-world .btn:not(.btn--line) {
  background: var(--tiger);
  color: var(--stripe);
  border-color: var(--tiger);
  border-radius: 999px;
}
html.has-world .btn:not(.btn--line):hover {
  background: #F59A5C;
  color: var(--stripe);
  border-color: #F59A5C;
}
html.has-world .btn--line,
html.has-world .btn--line:hover {
  padding-inline: 0;
  background: none;
  color: var(--ink);
  border-color: transparent;
}
html.has-world .btn--line::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(50% + 0.85em);
  height: 2px;
  background: var(--tiger);
  transition: background-color 0.3s var(--ease);
}
html.has-world .btn--line:hover::after { background: var(--ink); }

/* ── Labels: ink after a short tiger rule, so small type never leans on colour. ── */
html.has-world .kicker { color: var(--ink); }
html.has-world .kicker::before {
  content: "";
  flex: none;
  width: 1.75rem;
  height: 2px;
  background: var(--tiger);
}
html.has-world :is(.head__top, .team-block__label) { border-bottom-color: var(--rule-strong); }
html.has-world .team-block__label { color: var(--ink); }
html.has-world .lede { color: var(--ink-soft); }
html.has-world :is(.statement__point .lede, .about__body > .lede, .subtheme p) { color: var(--ink); font-weight: 700; }

/* Emphasis is set in ink and marked with a tiger stroke: a dark orange word cannot hold contrast against
   open sky and misted forest at once. In split headings the stroke draws in once the words have risen.
   Anek's tall Bangla metrics put the Latin baseline 1.25em into the inline box, so the stroke sits just under it. */
html.has-world :is(.display em, .lens h3 em) {
  color: var(--ink);
  background: linear-gradient(var(--tiger), var(--tiger)) 0 1.33em / 100% 0.075em no-repeat;
}
html.motion.has-world .m-split em { background-size: 0% 0.075em; transition: background-size 0.9s var(--ease) 0.55s; }
html.motion.has-world .m-split.m-in em { background-size: 100% 0.075em; }
html.has-world .hero__title .hero__em { background: none; }
html.has-world :is(.statement__big b, .warming__anom) { color: var(--ink); }

/* ── Hero: the title stands in open sky over the river; the forest keeps the right of the frame. ── */
html.has-world .hero__bg { opacity: 0; visibility: hidden; transition: opacity 1.2s var(--ease), visibility 0s 1.2s; }
html.has-world .hero__scrim { display: none; }
html.has-world .hero { align-items: flex-start; }
html.has-world .hero__inner {
  align-items: flex-start;
  gap: clamp(1rem, 2.2vw, 1.5rem);
  padding-top: calc(var(--header) + clamp(1.25rem, 6vh, 4rem));
  padding-bottom: clamp(3rem, 8vh, 5rem);
}
html.has-world .hero__title { max-width: none; }
html.has-world .hero__lede { max-width: 33rem; color: var(--ink); }
html.has-world .hero__meta { gap: 0.5rem 1.75rem; }
html.has-world .hero__date { padding: 0; background: none; color: var(--ink); font-size: 0.86rem; }
html.has-world .hero__pill { color: var(--ink); }
html.has-world .hero__actions { align-items: center; gap: 0.75rem 2rem; margin-top: 0.5rem; }
html.has-world .hero__scroll { color: var(--ink); }

/* ── Statement, stats, facts ── */
html.has-world .stats { border-top: 0; gap: 2rem clamp(1.25rem, 3vw, 2.5rem); }
html.has-world .stats > div { padding: 1.4rem 0 0; text-align: left; border: 0; border-top: 1px solid var(--rule-strong); }
html.has-world .facts { border-color: var(--rule-strong); }

/* ── Warming: the chart draws straight onto the river; labels carry no halo. ── */
html.has-world .wc :is(.wc-paris-label, .wc-tlabel--paris, .wc-note--hot text) { fill: var(--ink); }

/* ── Themes: grids become lists ruled across the top, with no cells. ── */
html.has-world .subthemes { border: 0; gap: clamp(2rem, 3.5vw, 2.75rem) clamp(1.5rem, 3vw, 2.75rem); }
html.has-world .subtheme {
  padding: 1.4rem 0 0;
  border: 0 !important;
  border-top: 1px solid var(--rule-strong) !important;
}
html.has-world .subtheme::before {
  left: 0;
  top: -1px;
  width: 100%;
  height: 2px;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.5s var(--ease);
}
html.has-world .subtheme:hover::before { height: 2px; transform: scaleX(1); }
html.has-world .subtheme h3 span { color: var(--ink-soft); }

/* ── Signature framework ── */
html.has-world .framework__pill {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0;
  background: none;
  color: var(--ink);
}
html.has-world .framework__pill::before,
html.has-world .framework__pill::after { content: ""; width: 1.75rem; height: 2px; background: var(--tiger); }
html.has-world .lenses { gap: clamp(2rem, 3.5vw, 2.75rem) clamp(1.5rem, 3vw, 3rem); }
html.has-world .lens {
  min-height: 0;
  padding: 1.5rem 5.5rem 0 0;
  background: none;
  border: 0;
  border-top: 1px solid var(--rule-strong);
  overflow: visible;
  transition: border-color 0.35s var(--ease);
}
html.has-world .lens:hover { transform: none; border-color: var(--tiger); }
/* One more ring per widening scope, drawn in the accent so the thin strokes hold against the day sky. */
html.has-world .lens__ripple { top: 1.1rem; right: 0; width: 4.25rem; height: 4.25rem; stroke: var(--accent); stroke-width: 4.5; }
html.has-world .lens__dot { fill: var(--accent); }
html.has-world .lens__ring { opacity: 0.55; }
html.motion.has-world .lens__ring { animation-name: ring-pulse-world; }
@keyframes ring-pulse-world { 0%, 100% { opacity: 0.4; } 35% { opacity: 1; } 70% { opacity: 0.4; } }

/* ── Programme ── */
html.has-world .program { border: 0; gap: 2rem clamp(1rem, 2vw, 1.75rem); }
html.has-world .program__day {
  min-height: 0;
  gap: 1.1rem;
  padding: 1.5rem 0 0;
  border: 0 !important;
  border-top: 1px solid var(--rule-strong) !important;
  box-shadow: none;
}
html.has-world .program__day:hover { box-shadow: none; }
html.has-world .program__num { color: var(--ink-soft); }
html.has-world .program__boat { display: none; }
html.has-world .program__theme { margin-top: 0; }
@media (max-width: 960px) {
  html.has-world .program { gap: 0; }
  html.has-world .program__day { padding: 1.1rem 0; }
}

/* ── Partners: an open wall of marks ── */
html.has-world .logos { border: 0; gap: 0.5rem clamp(1rem, 2.5vw, 2rem); }
html.has-world .logos > div { min-height: 96px; padding: clamp(1rem, 2.5vw, 1.75rem) 0.5rem; border: 0; grid-column: auto; }
/* Marks are pressed to one deep grey so pale wordmarks hold on the misted forest; hover restores their colour.
   Marks that come on a white box keep it as a small white tile instead of a grey one. */
html.has-world .logos img:not(.badge) { opacity: 1; filter: grayscale(1) brightness(0.42); transition: opacity 0.3s var(--ease), filter 0.7s var(--ease); }
html.has-world .logos img.boxed { filter: grayscale(1); border-radius: 3px; }
html.has-world .logos img.light, html.has-world .logos > div:hover img.light { filter: grayscale(1) brightness(0.26); }
html.has-world :is(.logos > div:hover, .logos a:focus-visible) img:not(.badge) { filter: none; }
/* Under moonlight every mark reads in white: dark art on transparency is inverted to white, dark plates with
   white lettering invert to white tiles with dark lettering, and boxed marks stay white tiles. */
html.has-world.world-night .logos img:not(.badge):not(.boxed):not(.light) { filter: grayscale(1) invert(1) brightness(1.45); }
html.has-world.world-night .logos img.light, html.has-world.world-night .logos > div:hover img.light { filter: grayscale(1) brightness(1.1); }
html.has-world.world-night .logos img.badge { opacity: 1; filter: grayscale(1) invert(1) brightness(1.1); border-radius: 3px; transition: opacity 0.3s var(--ease), filter 0.7s var(--ease); }
html.has-world.world-night .logos img.boxed { filter: grayscale(1) brightness(1.05); }
html.has-world.world-night :is(.logos > div:hover, .logos a:focus-visible) img:not(.badge):not(.boxed) { filter: grayscale(1) invert(1) brightness(1.9); }
html.has-world.world-night :is(.logos > div:hover, .logos a:focus-visible) img:is(.badge, .boxed) { filter: grayscale(0) brightness(1); }
/* The two organizers lead in their own colours at a larger size, set left on the content edge. */
html.has-world .logos.logos--2 { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem clamp(2.5rem, 7vw, 5.5rem); }
html.has-world .logos.logos--2 > div { min-height: 0; padding: 0.25rem 0; }
html.has-world .logos.logos--2 img { width: auto; max-width: none; max-height: none; opacity: 1; filter: none; }
html.has-world.world-night .logos.logos--2 img:not(.badge) { filter: grayscale(1) invert(1) brightness(1.45); }
html.has-world.world-night .logos.logos--2 img.badge { filter: grayscale(1) invert(1) brightness(1.1); border-radius: 4px; }
html.has-world .logos.logos--2 img.wide { height: clamp(26px, 3vw, 38px); }
html.has-world .logos.logos--2 img.badge { height: clamp(56px, 6vw, 76px); }

/* ── Media and Get involved ── */
html.has-world .media-feature__link { border: 0; }
html.has-world .media-feature__visual { border-radius: var(--r-photo); }
html.has-world .media-feature__body { padding: clamp(1.25rem, 2.5vw, 1.75rem) 0 0; }
@media (min-width: 961px) {
  /* The leading feature sits beside its picture; on the open river it keeps no panel, only a gutter. */
  html.has-world .media-feature:first-child:nth-last-child(odd) .media-feature__body { padding: 0.25rem 0 0 clamp(1.5rem, 3vw, 2.5rem); }
}
html.has-world .media-feature__source { color: var(--ink); }
html.has-world .cards { gap: clamp(2rem, 4vw, 3.5rem); }
html.has-world .card { padding: 1.6rem 0 0; border: 0; border-top: 1px solid var(--rule-strong); box-shadow: none; }
html.has-world .card--accent { border-top: 2px solid var(--tiger); }

/* ── Footer: column heads take the label treatment; links stay ink and pick up a tiger underline. ── */
html.has-world .foot { padding-bottom: 5rem; }
html.has-world .foot h4 { display: flex; align-items: center; gap: 0.7rem; color: var(--ink); }
html.has-world .foot h4::before { content: ""; flex: none; width: 1.25rem; height: 2px; background: var(--tiger); }
html.has-world :is(.foot a:hover, .media-feature__link:is(:hover, :focus-visible) .media-feature__cta) {
  color: var(--ink);
  text-decoration: underline 2px var(--tiger);
  text-underline-offset: 0.35em;
}

/* ── Sound of the forest: a round control in the corner, off until asked for. ── */
.sound {
  position: fixed;
  right: clamp(0.85rem, 2vw, 1.5rem);
  bottom: clamp(0.85rem, 2vw, 1.5rem);
  z-index: 230;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  background: var(--ink, var(--stripe));
  color: var(--tiger);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: translate 0.3s var(--ease), scale 0.3s var(--ease);
}
.sound[hidden] { display: none; }
.sound:hover { scale: 1.06; }
.sound:active { translate: 0 1px; }
html.world-night .sound { color: var(--stripe); }
.sound [data-sound-label] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.sound__bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.sound__bars i { display: block; width: 2px; height: 100%; background: currentColor; transform-origin: bottom; transform: scaleY(0.22); transition: transform 0.4s var(--ease); }
.sound[aria-pressed="true"] .sound__bars i { animation: sound-eq 1.1s ease-in-out infinite; }
.sound[aria-pressed="true"] .sound__bars i:nth-child(2) { animation-duration: 0.85s; animation-delay: -0.3s; }
.sound[aria-pressed="true"] .sound__bars i:nth-child(3) { animation-duration: 1.3s; animation-delay: -0.6s; }
.sound[aria-pressed="true"] .sound__bars i:nth-child(4) { animation-duration: 0.95s; animation-delay: -0.15s; }
.sound[aria-pressed="true"] .sound__bars i:nth-child(5) { animation-duration: 1.2s; animation-delay: -0.45s; }
.sound[aria-pressed="false"]::after {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid var(--tiger);
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  animation: sound-invite 2.8s var(--ease) 3.5s 4;
}
/* A confirmation toast shares this corner; the sound control steps up out of its way. */
html:has(.toast.show) .sound,
html:has(.toast.show) .sound:active { translate: 0 -4.1rem; }

@keyframes sound-eq { 0%, 100% { transform: scaleY(0.25); } 50% { transform: scaleY(1); } }
@keyframes sound-invite { 0% { opacity: 0.75; transform: scale(1); } 100% { opacity: 0; transform: scale(1.5); } }

@media (prefers-reduced-motion: reduce) {
  .sound__bars i,
  .sound::after { animation: none !important; }
}
