/* Arabiyya Scout Group / Rover Network — preview v3
   Cinematic chapters. Colours from official emblems only.
   English: Google Sans Flex only. Dhivehi: DhiBakuru. */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-weight: 400;
  color: var(--on-surface);
  background: var(--surface);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-underline-offset: 0.2em; }
a:hover { color: var(--sky-hover); }
button, input, select, textarea { font: inherit; }

html[data-brand="asg"] {
  --illu-fill: #EBF8FE;
  --illu-stroke: #0077A9;
  --illu-accent: #D83647;
}
html[data-brand="rovers"] {
  --illu-fill: #E8F3F8;
  --illu-stroke: #4B0A08;
  --illu-accent: #027EC1;
}
html[data-brand="asg"]:root[data-theme="dark"] {
  --illu-fill: color-mix(in srgb, #00AAF2 18%, transparent);
  --illu-stroke: #B8D4E0;
  --illu-accent: #E26875;
}
html[data-brand="rovers"]:root[data-theme="dark"] {
  --illu-fill: color-mix(in srgb, #ACD5E9 16%, transparent);
  --illu-stroke: #D3B7B6;
  --illu-accent: #5BABD7;
}

h1, h2, h3, h4 { text-wrap: balance; }
p { text-wrap: pretty; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
.skip {
  position: absolute; left: 12px; top: -40px; z-index: 80;
  background: var(--primary); color: var(--on-primary);
  padding: 8px 12px; text-decoration: none;
}
.skip:focus { top: 40px; }

/* Official strip — shared chrome, not rebranded */
.strip { display: none !important; height: 0 !important; overflow: hidden; margin: 0; padding: 0; border: 0; }
.strip .in {
  display: flex; align-items: center; gap: 8px;
  max-width: 1440px; margin: 0 auto; padding: 0 16px; height: 31px;
}
.strip img { width: 20px; height: 20px; border-radius: 50%; flex: none; }
.strip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Header */
.header {
  --header-h: 64px;
  position: sticky;
  top: 0;
  z-index: 40;
  margin-bottom: calc(-1 * var(--header-h));
  color: var(--hero-ink);
  background: var(--tone-deep);
  border-bottom: none;
  box-shadow: none;
  transition: color .15s ease, background-color .15s ease;
  /* No hairline; a hard edge would cut across the section fade. */
}
html:not(.is-on-deep) .header {
  color: var(--on-surface);
  background: var(--surface);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: none;
}
html.is-on-deep .header a:not(.btn) { color: var(--hero-ink); }
html.is-on-deep .header a:not(.btn):hover { color: #fff; }
/* Keep Join on the brand button colour, not white-on-sky (fails contrast). */
html.is-on-deep .header a.btn.primary { color: var(--on-primary); }
html.is-on-deep .header a.btn.primary:hover { color: var(--on-primary); }
html.is-on-deep .header .btn.ghost {
  color: var(--hero-ink);
  border-color: rgba(255,255,255,.28);
}
html.is-on-deep .header .switch button { color: var(--hero-muted); }
html.is-on-deep .header .switch button[aria-pressed="true"] { color: var(--hero-ink); }
html.is-on-deep .header .burger { color: var(--hero-ink); }
/* On a deep field, keep the true-colour emblem (not the blue badge) */
html.is-on-deep .header .logo-dark { display: none !important; }
html.is-on-deep .header .logo-light { display: block !important; }

.bar {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 8px 24px;
  min-height: var(--header-h, 64px);
}
.brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: inherit; flex: none;
}
.brand img { height: 54px; width: auto; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}
/* Rovers has a single true-colour mark; badge it in dark when not on a deep field */
html[data-brand="rovers"]:root[data-theme="dark"] .header .brand img,
html[data-brand="rovers"]:root[data-theme="dark"] .footer .brand img {
  background: #fff8f7;
  border-radius: 8px;
  padding: 4px;
}
@media (prefers-color-scheme: dark) {
  html[data-brand="rovers"]:root:not([data-theme="light"]) .header .brand img,
  html[data-brand="rovers"]:root:not([data-theme="light"]) .footer .brand img {
    background: #fff8f7;
    border-radius: 8px;
    padding: 4px;
  }
}
html[data-brand="rovers"].is-on-deep .header .brand img {
  background: transparent !important;
  padding: 0 !important;
}
.wordmark { display: flex; flex-direction: column; line-height: 1.15; }
.wordmark b { font-weight: 600; font-size: 0.95rem; letter-spacing: -0.01em; }
.nav-panel { display: flex; align-items: center; gap: 20px; flex: 1; min-width: 0; }
.nav { display: flex; gap: 18px; flex: 1; }
.nav a {
  color: inherit; text-decoration: none;
  font-size: 0.875rem; font-weight: 500;
}
.nav a:hover { color: var(--link); }
html.is-on-deep .nav a:hover { color: #fff; }
.tools { display: flex; align-items: center; gap: 14px; margin-inline-start: auto; }
.switch { display: flex; align-items: baseline; gap: 6px; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }
.switch button {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--on-surface-var); letter-spacing: inherit; text-transform: inherit;
}
.switch button[aria-pressed="true"] { color: inherit; font-weight: 600; }
.switch .sep { color: var(--outline-var); font-weight: 400; }
html.is-on-deep .switch .sep { color: rgba(255,255,255,.3); }
.burger {
  display: none; background: none; border: 0; padding: 6px; cursor: pointer; color: inherit;
}
.burger svg { width: 22px; height: 22px; display: block; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 11px 20px;
  text-decoration: none; border: 1px solid transparent;
  font-weight: 600; font-size: 0.9rem; line-height: 1.2;
  cursor: pointer; border-radius: 0;
  transition: background .15s, color .15s, border-color .15s;
}
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--sky-hover); color: var(--on-primary); }
.btn.ghost {
  background: transparent; color: inherit;
  border-color: color-mix(in srgb, currentColor 28%, transparent);
}
.btn.ghost:hover { border-color: currentColor; }
.btn.light {
  background: var(--hero-ink); color: var(--tone-deep);
}
.btn.light:hover { background: #fff; color: var(--tone-deep); }

/* Rope / trail underlines */
.rope, a.line {
  text-decoration: none;
  background: linear-gradient(var(--link), var(--link)) no-repeat 0 100%;
  background-size: 100% 1px;
}
.rope-word { white-space: nowrap; }

/* Page rail + spine */
.page { position: relative; --rail: 0px; min-width: 0; }
@media (max-width: 1240px) {
  .page { --rail: 56px; }
}
.spine {
  position: absolute; top: 0; bottom: 0;
  left: 18px; width: 36px;
  pointer-events: none; z-index: 2;
}
html[dir="rtl"] .spine { left: auto; right: 18px; }
.spine svg { width: 36px; height: 100%; display: block; overflow: visible; }
.spine-path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.spine-route { stroke: var(--primary); stroke-width: 1.15; opacity: 0.22; stroke-dasharray: 1; stroke-dashoffset: 1; }
.spine-progress { stroke: var(--primary); stroke-width: 1.7; opacity: 0.85; stroke-dasharray: 1; stroke-dashoffset: 1; }
.spine.is-drawn .spine-route { animation: draw-route 1.6s ease forwards; }
@keyframes draw-route { to { stroke-dashoffset: 0; } }
.knot {
  position: absolute;
  left: 18px;
  width: 18px; height: 18px;
  margin-left: -9px;
  background: var(--primary);
  mask: url("img/knot-fleur.svg") center / contain no-repeat;
  -webkit-mask: url("img/knot-fleur.svg") center / contain no-repeat;
  opacity: 0.35;
  z-index: 3;
  transform: translateY(-50%);
}
html[data-brand="rovers"] .knot {
  mask-image: url("img/knot-compass.svg");
  -webkit-mask-image: url("img/knot-compass.svg");
}
html[dir="rtl"] .knot { left: auto; right: 18px; margin-left: 0; margin-right: -9px; }
.knot.is-lit { opacity: 1; }
.knot-hero { display: none; } /* emblem is the hero knot now */
@media (max-width: 1240px) {
  /* Full-bleed chapters: the rail is padding on the chapter, not the page. */
  .page { padding-inline-start: 0; }
  .spine { left: 4px; }
  html[dir="rtl"] .spine { left: auto; right: 4px; }
  .knot { left: 22px; }
  html[dir="rtl"] .knot { left: auto; right: 22px; }
}

/* Wrap */
.wrap {
  width: min(1080px, calc(100% - 48px));
  margin-inline: auto;
  padding-inline: 12px;
  min-width: 0;
}
@media (max-width: 1240px) {
  .wrap { width: min(1080px, calc(100% - 24px)); }
}

/* ========== Cinematic hero ========== */
.hero {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  display: grid;
  place-items: center;
  background: var(--hero-gradient);
  color: var(--hero-ink);
  overflow: hidden;
  padding: 96px 24px 72px;
  text-align: center;
}
.hero-backdrop {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0;
}
.hero-line {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 1;
}
.hero-line path {
  fill: none;
  stroke: var(--hero-ink);
  stroke-width: 1.25;
  stroke-linecap: round;
  opacity: 0.72;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}
.hero.is-lined .hero-line path { animation: draw-route 1.8s ease 0.15s forwards; }
.hero-centre {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 42rem;
}
.hero-emblem {
  width: auto;
  height: clamp(148px, 26svh, 268px);
  margin: 0 0 28px;
  filter: drop-shadow(0 18px 36px color-mix(in srgb, #000 35%, transparent));
}
.hero-name {
  font-family: var(--font-en);
  font-weight: 700;
  font-size: clamp(1.7rem, 5.2vw, 4.1rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  margin: 0 0 14px;
  color: var(--hero-ink);
  overflow-wrap: anywhere;
  max-width: 100%;
}
.hero-motto {
  font-family: var(--font-en);
  font-style: normal;
  font-weight: 400;
  font-size: clamp(1rem, 2vw, 1.55rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--hero-ink);
  max-width: min(22em, 100%);
  overflow-wrap: anywhere;
}
.hero-dv {
  font-family: var(--font-dv);
  font-weight: 400;
  font-size: clamp(0.95rem, 2.4vw, 1.05rem);
  line-height: 1.8;
  margin: 14px 0 0;
  color: var(--hero-muted);
  overflow-wrap: anywhere;
  max-width: 100%;
}
html[lang="dv"] .hero-name {
  font-family: var(--font-dv);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.25;
}
html[lang="dv"] .hero-motto {
  font-family: var(--font-dv);
  font-style: normal;
  letter-spacing: 0;
  line-height: 1.45;
}
.hero-name .t-en, .hero-name .t-dv,
.hero-motto .t-en, .hero-motto .t-dv { display: inline; }

.since {
  position: absolute;
  top: 50%;
  right: 28px;
  writing-mode: vertical-rl;
  transform: translateY(-50%) rotate(180deg);
  width: max-content; height: max-content;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--hero-muted);
  opacity: 0.85;
  z-index: 2;
}
html[dir="rtl"] .since { right: auto; left: 28px; }

.scroll-cue {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--hero-muted);
  text-decoration: none;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.scroll-cue:hover { color: var(--hero-ink); }
.scroll-cue .stem {
  width: 1px; height: 36px;
  background: currentColor;
  transform-origin: top;
  animation: cue-pulse 2.2s ease-in-out infinite;
}
@keyframes cue-pulse {
  0%, 100% { opacity: 0.35; transform: scaleY(0.7); }
  50% { opacity: 1; transform: scaleY(1); }
}

/* Photo slot — reserved; add .has-photo and --hero-image later */
.hero-media { display: none; }
.hero-media img[src=""] { display: none; }
.hero.has-photo .hero-media {
  display: block;
  position: absolute; inset: 0; z-index: 0;
  pointer-events: none;
}
.hero.has-photo .hero-media img,
.hero.has-photo .hero-media::before {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
}
.hero.has-photo .hero-media::after {
  content: "";
  position: absolute; inset: 0;
  background: var(--hero-gradient);
  opacity: 0.72;
}

/* ========== Chapters ========== */
.chapter {
  position: relative;
  padding: clamp(5rem, 12vw, 9.5rem) 0;
}
.tone-light { background: var(--surface); color: var(--on-surface); }
.tone-deep {
  background: var(--tone-deep);
  color: var(--hero-ink);
  --on-surface: var(--hero-ink);
  --on-surface-var: var(--hero-muted);
  --link: var(--hero-ink);
  --outline-var: rgba(255,255,255,.16);
  --illu-stroke: var(--hero-ink);
  --illu-fill: color-mix(in srgb, var(--primary) 22%, transparent);
}
html[data-brand="asg"] .tone-deep { --illu-accent: #E26875; }
html[data-brand="rovers"] .tone-deep { --illu-accent: #ACD5E9; }
.tone-deep a { color: var(--hero-ink); }
.tone-deep a:hover { color: #fff; }
.tone-deep .muted { color: var(--hero-muted); }

.chapter-head { margin: 0 0 clamp(2.5rem, 6vw, 4.5rem); max-width: 22em; }
.chapter-kicker {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin: 0 0 14px;
}
.tone-deep .chapter-kicker { color: var(--hero-muted); }
.chapter-kicker .num { color: var(--accent-deep); }
.chapter-title {
  font-family: var(--font-en);
  font-weight: 700;
  font-size: clamp(2rem, 6vw, 4.5rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0;
  overflow-wrap: anywhere;
}
 .chapter-title .t-dv {
  font-family: var(--font-dv);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.45;
}
html[lang="dv"] .chapter-title {
  font-family: var(--font-dv);
  font-weight: 400;
  font-size: clamp(1.9rem, 4.4vw, 3.1rem);
  letter-spacing: 0;
  line-height: 1.45;
}

.lede {
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  line-height: 1.45;
  max-width: 36rem;
  margin: 0 0 1.4em;
}
.prose { max-width: 38rem; }
.prose p { margin: 0 0 1.1em; color: var(--on-surface); }
.muted, .note { color: var(--on-surface-var); }

/* Story figures */
.figures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
  max-width: 42rem;
  border-top: 1px solid var(--outline-var);
}
.figures > div { padding: 1.4rem 1.4rem 0 0; }
.figures .n {
  font-family: var(--font-en);
  font-weight: 500;
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--on-surface);
}
.figures .l { display: block; margin-top: 0.5rem; font-size: 0.88rem; color: var(--on-surface-var); }

/* Timeline — The Sections */
.timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  position: relative;
  list-style: none; margin: 0; padding: 0;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 70px;
  height: 2px;
  background: var(--primary);
  opacity: 0.35;
  mask: url("img/line-wave.svg") repeat-x center / auto 8px;
  -webkit-mask: url("img/line-wave.svg") repeat-x center / auto 8px;
  pointer-events: none;
}
html[data-brand="rovers"] .timeline::before {
  mask-image: url("img/line-trail.svg");
  -webkit-mask-image: url("img/line-trail.svg");
}
.station { position: relative; padding: 0 1.4rem 0 0; }
.station .mark {
  width: 8px; height: 8px;
  border: 1.5px solid var(--primary);
  background: var(--primary);
  transform: rotate(45deg);
  margin: 8px 0 20px 3px;
  box-sizing: content-box;
  position: relative;
  z-index: 1;
}
.tone-deep .station .mark { background: var(--primary); }
.station h3 {
  font-family: var(--font-en);
  font-weight: 500;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  line-height: 1.15;
}
.station .ages {
  font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase;
  font-weight: 600; color: var(--accent-deep); margin: 0 0 10px;
}
.tone-deep .station .ages { color: var(--hero-muted); }
.station p { margin: 0; color: var(--on-surface-var); font-size: 0.95rem; }
.station .illu { margin-top: 18px; }
.illu { width: 72px; height: 72px; color: var(--illu-stroke, var(--primary)); }
.illu-sm { width: 56px; height: 56px; }
.illu svg, .join-illu svg { width: 100%; height: 100%; display: block; overflow: visible; }

@media (min-width: 721px) {
  .timeline:has(> :nth-child(3):last-child) { grid-template-columns: repeat(3, 1fr); }
}

/* Identity — emblem & scarf */
.identity {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}
.identity-mark {
  position: sticky;
  top: 120px;
  display: flex; flex-direction: column; align-items: center;
}
.identity-mark img {
  width: min(100%, 320px);
  height: auto;
  filter: drop-shadow(0 16px 32px color-mix(in srgb, #000 16%, transparent));
}
.identity-mark figcaption {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--on-surface-var);
  text-align: center;
}
.parts { list-style: none; margin: 0; padding: 0; }
.part {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 16px;
  padding: 1.25rem 0;
  border-top: 1px solid var(--outline-var);
}
.part:last-child { border-bottom: 1px solid var(--outline-var); }
.swatch {
  width: 18px; height: 18px;
  margin-top: 4px;
  background: var(--chip);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #000 18%, transparent);
}
.part h3 {
  font-family: var(--font-en);
  font-weight: 500;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.hex {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent-deep);
  margin: 0 0 8px;
}
.tone-deep .hex { color: var(--hero-muted); }
.part p { margin: 0; color: var(--on-surface-var); }

/* Life in the Group — editorial list */
.ed-list { list-style: none; margin: 0; padding: 0; max-width: 42rem; }
.ed-list li {
  display: grid;
  grid-template-columns: 9rem 1fr auto;
  gap: 1.25rem;
  align-items: baseline;
  padding: 1.35rem 0;
  border-top: 1px solid var(--outline-var);
}
.ed-list li:last-child { border-bottom: 1px solid var(--outline-var); }
.ed-list .when {
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--on-surface-var);
}
.ed-list a, .ed-list .ttl {
  font-family: var(--font-en);
  font-weight: 500;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: inherit;
}
.ed-list a:hover { color: var(--link); }
.tone-deep .ed-list a:hover { color: #fff; }
.ed-list .kind {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent-deep);
}
.tone-deep .ed-list .kind { color: var(--hero-muted); }
.sample {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--on-surface-var);
  margin: 0 0 12px;
}

/* Gallery illustrated frames */
.sheets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.sheet {
  border: 1px solid var(--outline-var);
  background: var(--surface);
  aspect-ratio: 4 / 5;
  display: flex; flex-direction: column;
  padding: 16px;
}
.tone-deep .sheet { background: color-mix(in srgb, var(--hero-ink) 4%, var(--tone-deep)); }
.sheet .frame {
  flex: 1;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}
.sheet .illu { width: 120px; height: 120px; }
.sheet figcaption {
  margin-top: 12px;
  font-family: var(--font-en);
  font-style: normal;
  font-weight: 500;
  font-size: 1.1rem;
}

/* Join */
.steps { list-style: none; margin: 0 0 2rem; padding: 0; max-width: 36rem; }
.steps li {
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  gap: 12px;
  padding: 1rem 0;
  border-top: 1px solid var(--outline-var);
  align-items: baseline;
}
.steps li:last-child { border-bottom: 1px solid var(--outline-var); }
.steps .n {
  font-family: var(--font-en);
  font-weight: 500;
  font-size: 1.6rem;
  letter-spacing: -0.03em;
  color: var(--accent-deep);
}
.tone-deep .steps .n { color: var(--hero-muted); }
.join-row {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center;
}
.join-illu { width: 88px; height: 88px; }

/* Footer */
.footer {
  border-top: none;
  padding: 3.5rem 0 2rem;
  background: var(--surface);
  color: var(--on-surface);
}
.foot-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2rem;
}
.footer .brand { margin-bottom: 12px; }
.footer h3 {
  font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase;
  margin: 0 0 12px; font-weight: 600;
}
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin: 0 0 8px; }
.footer a { color: inherit; text-decoration: none; }
.footer a:hover { color: var(--link); }
.legal {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--outline-var);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  font-size: 0.85rem; color: var(--on-surface-var);
}
.sites { display: flex; flex-wrap: wrap; gap: 12px 18px; }

/* One language at a time. The EN / ދިވެހި toggle chooses which is shown. */
.t-en, .t-dv { display: block; }
.t-dv, [lang="dv"] { font-family: var(--font-dv); }
html:not([lang="dv"]) .t-dv,
html:not([lang="dv"]) .lg-dv { display: none !important; }
html[lang="dv"] .t-en,
html[lang="dv"] .lg-en { display: none !important; }
html[lang="dv"] .hero-name .t-dv,
html[lang="dv"] .hero-motto .t-dv,
html:not([lang="dv"]) .hero-name .t-en,
html:not([lang="dv"]) .hero-motto .t-en { display: inline !important; }

/* Reveals */
.reveal {
  opacity: 0;
  transform: translateY(22px);
}
.reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity .85s ease, transform .85s cubic-bezier(.2,.7,.2,1);
}
.reveal.delay-1 { transition-delay: .08s; }
.reveal.delay-2 { transition-delay: .16s; }
.reveal.delay-3 { transition-delay: .24s; }

/* Hide empty modules */
[data-hide-if-empty].is-empty { display: none; }

/* Logo hover — small, desktop only */
@media (hover: hover) and (min-width: 1361px) {
  html[data-brand="asg"] .header .brand img { transition: transform .5s ease; }
  html[data-brand="asg"] .header .brand:hover img { transform: rotate(-8deg); }
  html[data-brand="rovers"] .header .brand img { transition: transform .5s ease; }
  html[data-brand="rovers"] .header .brand:hover img { transform: rotate(12deg); }
}

/* Dark mode surface tweaks */
:root[data-theme="dark"] .tone-light { background: var(--surface); }
:root[data-theme="dark"] .sheet { background: var(--surface-dim, var(--surface)); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tone-light { background: var(--surface); }
}

/* Burger / mobile nav */
@media (max-width: 1360px) {
  .burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    flex: none;
  }
  .bar > a.btn.primary {
    margin-inline-start: auto;
    min-height: 44px;
  }
  .nav-panel {
    display: none;
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--surface);
    color: var(--on-surface);
    border-bottom: 1px solid var(--outline-var);
    flex-direction: column;
    align-items: stretch;
    padding: 16px 24px 24px;
    gap: 16px;
  }
  .header.is-open .nav-panel { display: flex; }
  html.is-on-deep .header.is-open .nav-panel {
    background: var(--tone-deep);
    color: var(--hero-ink);
  }
  .nav { flex-direction: column; gap: 4px; }
  .nav a { min-height: 44px; display: flex; align-items: center; padding-block: 10px; }
  .tools { margin: 0; flex-wrap: wrap; }
  .bar { padding: 8px 16px; }
  .wordmark { display: none; }
}
@media (max-width: 720px) {
  .header { --header-h: 56px; }
  .bar { min-height: 56px; }
  .brand img { height: 46px; }
  .hero { padding: 88px 16px 80px; }
  .hero-emblem { height: clamp(128px, 24svh, 180px); }
  .since { display: none; }
  .timeline { grid-template-columns: 1fr; }
  .timeline::before {
    left: 5px; right: auto; top: 0; bottom: 0; width: 2px; height: auto;
  }
  html[dir="rtl"] .timeline::before { left: auto; right: 5px; }
  .station { padding: 0 0 1.8rem 0; }
  html[dir="rtl"] .station { padding: 0 0 1.8rem 0; }
  .station .illu { display: block; margin: 0 0 14px; }
  .station .mark,
  .timeline::before { display: none; }
  .figures { grid-template-columns: 1fr; }
  .identity { grid-template-columns: 1fr; }
  .identity-mark { position: static; margin-bottom: 8px; }
  .ed-list li { grid-template-columns: 1fr; gap: 4px; }
  .sheets { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr; }
  .wrap { width: calc(100% - 24px); }
}
@media (min-width: 1361px) and (max-width: 1480px) {
  .wordmark { display: none; }
  .nav { gap: 12px; }
  .bar { padding-inline: 16px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .spine-route, .hero-line path, .scroll-cue .stem { animation: none !important; }
  .spine-route, .hero-line path { stroke-dashoffset: 0; }
  .reveal { opacity: 1; transform: none; transition: none; }
  html[data-brand="asg"] .header .brand img,
  html[data-brand="rovers"] .header .brand img { transition: none; }
}

.chapter { position: relative; }
.chapter > .knot {
  top: clamp(5.4rem, 12vw, 9.8rem);
  left: 18px;
}
html[dir="rtl"] .chapter > .knot { left: auto; right: 18px; }
@media (max-width: 1240px) {
  .chapter > .knot { left: calc(-1 * var(--rail) + 22px); }
  html[dir="rtl"] .chapter > .knot { left: auto; right: calc(-1 * var(--rail) + 22px); }
}

@media (prefers-color-scheme: dark) {
  html[data-brand="asg"]:root:not([data-theme="light"]) {
    --illu-fill: color-mix(in srgb, #00AAF2 18%, transparent);
    --illu-stroke: #B8D4E0;
    --illu-accent: #E26875;
  }
  html[data-brand="rovers"]:root:not([data-theme="light"]) {
    --illu-fill: color-mix(in srgb, #ACD5E9 16%, transparent);
    --illu-stroke: #D3B7B6;
    --illu-accent: #5BABD7;
  }
}

.swatch.is-open {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--on-surface) 45%, transparent);
}

/* Person names: only the active language. If name_dv is missing, English is shown. */
.person-name {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.25;
}
.person-name .name-en {
  font-family: var(--font-en);
  font-weight: 600;
}
.person-name .name-dv {
  font-family: var(--font-dv);
  font-weight: 400;
  line-height: 1.8;
}
html[dir="rtl"] .person-name { align-items: flex-end; }
.person .role {
  display: block;
  margin-top: 0.2em;
  font-size: 0.82rem;
  color: var(--on-surface-var);
}
.people-list { list-style: none; margin: 2rem 0 0; padding: 0; max-width: 36rem; }
.people-list li {
  padding: 1rem 0;
  border-top: 1px solid var(--outline-var);
}
.people-list li:last-child { border-bottom: 1px solid var(--outline-var); }

.people-heading {
  font-family: var(--font-en);
  font-weight: 500;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  margin: 2.5rem 0 0;
}

/* Overflow and wrap: long English / Dhivehi must stay in the viewport */
body { overflow-x: clip; }
.t-en, .t-dv, .lede, .prose, .chapter-title, .hero-name, .hero-motto, .hero-dv,
.ed-list .ttl, .station h3, .station p, .part h3, .part p, .wordmark, .nav a, .btn {
  overflow-wrap: anywhere;
  word-wrap: break-word;
}
.hero-centre {
  padding-inline: clamp(0.25rem, 7vw, 4.25rem);
  width: 100%;
  max-width: min(42rem, 100%);
  min-width: 0;
}
.wrap, .page, .chapter, .bar, .nav-panel, .tools, .identity, .figures, .ed-list, .sheets, .foot-grid {
  min-width: 0;
}
.header .bar, .header .brand, .header .wordmark { min-width: 0; }
.wordmark b { overflow-wrap: anywhere; }

@media (max-width: 414px) {
  .bar { gap: 8px; padding: 8px 10px; }
  .btn { padding: 8px 12px; font-size: 0.8rem; }
  .brand img { height: 42px; }
  .hero { padding: 80px 12px 72px; }
  .hero-emblem { height: clamp(110px, 22svh, 160px); margin-bottom: 18px; }
  .figures .n { font-size: clamp(1.8rem, 10vw, 2.6rem); }
}
@media (max-width: 360px) {
  .bar { gap: 6px; padding: 6px 8px; }
  .btn { padding: 7px 10px; font-size: 0.75rem; }
}
@media (min-width: 721px) and (max-width: 1024px) {
  .hero-centre { padding-inline: 3.25rem; }
}

/* Short / landscape viewports: keep emblem, titles, Dhivehi line and scroll cue from colliding or clipping */
@media (max-height: 520px) {
  .hero { padding: 64px 24px 48px; }
  .hero-emblem { height: clamp(64px, 22svh, 108px); margin-bottom: 8px; }
  .hero-name { font-size: clamp(1.25rem, 3.8vw, 2.15rem); margin-bottom: 4px; }
  .hero-motto { font-size: clamp(0.88rem, 1.7vw, 1.12rem); }
  html[lang="dv"] .hero-name { font-size: clamp(1.2rem, 3.4vw, 1.85rem); }
  html[lang="dv"] .hero-motto { font-size: clamp(0.9rem, 2vw, 1.15rem); }
  .scroll-cue { bottom: 8px; gap: 4px; }
  .scroll-cue .stem { height: 14px; }
  .hero-centre { padding-bottom: 4px; }
  .since { font-size: 0.58rem; right: 16px; }
  html[dir="rtl"] .since { left: 16px; }
}
@media (max-height: 420px) {
  .hero { padding: 56px 20px 40px; }
  .hero-emblem { height: clamp(56px, 20svh, 88px); margin-bottom: 6px; }
  .scroll-cue { bottom: 6px; }
}


/* ========== Solid header, full-bleed sections, long colour blends ==========
   The sticky header is opaque. Chapters and the footer paint under the spine.
   Boundaries blend the real section colours in oklab (sRGB fallback), through a
   brand-tinted mid (sky / maroon), so mid-tones read as dusk, not muddy grey.
   The trail sits in the same gradient. A whisper of dither eases banding.
========================================================================== */
:root { --fade-len: 320px; --fade-tint: #00AAF2; }
@media (max-width: 720px) { :root { --fade-len: 240px; } }
@media (min-width: 721px) and (max-width: 1024px) { :root { --fade-len: 280px; } }
html[data-brand="asg"] { --fade-tint: #00AAF2; }
html[data-brand="rovers"] { --fade-tint: #6B0E0B; }

.tone-light, .footer, .page-main, .page-body { --section-bg: var(--surface); }
.tone-deep, .hero, .page-hero { --section-bg: var(--tone-deep); }

/* Spine sits on the same background as the section it passes. */
@media (max-width: 1240px) {
  .page { padding-inline-start: 0; padding-inline-end: 0; }
  .chapter,
  .footer,
  .page-main,
  .maldives-map {
    padding-inline-start: var(--rail);
  }
  .chapter > .knot { left: 22px; }
  html[dir="rtl"] .chapter > .knot { left: auto; right: 22px; }
  .spine { left: 4px; }
  html[dir="rtl"] .spine { left: auto; right: 4px; }
  .knot { left: 22px; }
  html[dir="rtl"] .knot { left: auto; right: 22px; }
}


.chapter, .footer, .maldives-map, .page-hero, .hero {
  --_from: var(--section-bg, var(--surface));
  --_to: var(--fade-to, var(--section-bg, var(--surface)));
  /* Mid: the two ends mixed, then tinted with the brand colour (dusk, not grey). */
  --_mid-fb: color-mix(in srgb, color-mix(in srgb, var(--_from) 50%, var(--_to)) 68%, var(--fade-tint) 32%);
  --_mid: color-mix(in oklab, color-mix(in oklab, var(--_from) 50%, var(--_to)) 68%, var(--fade-tint) 32%);
  /* Bottom-anchored, eased stops. Incoming section stays solid so the header
     meets one clear tone, and so a hero foot already faded to surface is not
     followed by a snap back to deep. */
  --fade-out-fb: linear-gradient(
    180deg,
    var(--_from) 0,
    var(--_from) calc(100% - var(--fade-len)),
    color-mix(in srgb, var(--_from) 88%, var(--_mid-fb)) calc(100% - var(--fade-len) * 0.85),
    color-mix(in srgb, var(--_from) 40%, var(--_mid-fb)) calc(100% - var(--fade-len) * 0.65),
    color-mix(in srgb, var(--_mid-fb) 55%, var(--_to)) calc(100% - var(--fade-len) * 0.40),
    color-mix(in srgb, var(--_mid-fb) 12%, var(--_to)) calc(100% - var(--fade-len) * 0.15),
    var(--_to) 100%
  );
  --fade-out: linear-gradient(
    180deg in oklab,
    var(--_from) 0,
    var(--_from) calc(100% - var(--fade-len)),
    color-mix(in oklab, var(--_from) 88%, var(--_mid)) calc(100% - var(--fade-len) * 0.85),
    color-mix(in oklab, var(--_from) 40%, var(--_mid)) calc(100% - var(--fade-len) * 0.65),
    color-mix(in oklab, var(--_mid) 55%, var(--_to)) calc(100% - var(--fade-len) * 0.40),
    color-mix(in oklab, var(--_mid) 12%, var(--_to)) calc(100% - var(--fade-len) * 0.15),
    var(--_to) 100%
  );
}

/* The blend is the section's own background — not a painted overlay. */
.chapter, .footer, .maldives-map {
  background-color: var(--section-bg, var(--surface));
  background-image: url("/img/fade-dither.png"), var(--fade-out-fb);
  background-repeat: repeat, no-repeat;
  background-size: 64px 64px, auto;
  background-blend-mode: overlay, normal;
}
.hero, .page-hero {
  background-color: var(--tone-deep);
  background-image: url("/img/fade-dither.png"), var(--fade-out-fb), var(--hero-gradient);
  background-repeat: repeat, no-repeat, no-repeat;
  background-size: 64px 64px, auto, cover;
  background-blend-mode: overlay, normal, normal;
}
@supports (color: oklab(0.5 0.1 0.1)) {
  .chapter, .footer, .maldives-map {
    background-image: url("/img/fade-dither.png"), var(--fade-out);
  }
  .hero, .page-hero {
    background-image: url("/img/fade-dither.png"), var(--fade-out), var(--hero-gradient);
  }
}
/* Same-tone neighbours stay solid (JS adds .fade-solid). */
.chapter.fade-solid, .footer.fade-solid, .maldives-map.fade-solid {
  background-image: none;
  background-blend-mode: normal;
}
.hero.fade-solid, .page-hero.fade-solid {
  background: var(--hero-gradient);
}
@media (prefers-reduced-transparency: reduce) {
  .chapter, .footer, .maldives-map, .page-hero, .hero { background-blend-mode: normal; }
  .chapter:not(.fade-solid), .footer:not(.fade-solid), .maldives-map:not(.fade-solid) {
    background-image: var(--fade-out-fb);
  }
  .hero:not(.fade-solid), .page-hero:not(.fade-solid) {
    background-image: var(--fade-out-fb), var(--hero-gradient);
  }
  @supports (color: oklab(0.5 0.1 0.1)) {
    .chapter:not(.fade-solid), .footer:not(.fade-solid), .maldives-map:not(.fade-solid) {
      background-image: var(--fade-out);
    }
    .hero:not(.fade-solid), .page-hero:not(.fade-solid) {
      background-image: var(--fade-out), var(--hero-gradient);
    }
  }
}

/* Content sits above the outgoing fade, not on the mid-tone. Incoming tops are solid. */
.chapter {
  padding-top: clamp(5rem, 12vw, 9.5rem);
}
.chapter:not(.fade-solid), .maldives-map:not(.fade-solid) {
  padding-bottom: max(4rem, calc(var(--fade-len) + 2.5rem));
}
.footer {
  position: relative;
  border-top: none;
  padding-top: 3.5rem;
}
.page-hero {
  padding-bottom: max(3.25rem, calc(var(--fade-len) + 1.5rem));
}

/* Comfortable type and spacing on small phones; Join stays end-aligned. */
@media (max-width: 720px) {
  .hero { padding: 96px 16px 88px; }
  .hero-name { font-size: clamp(1.45rem, 7.2vw, 2rem); }
  html[lang="dv"] .hero-name { font-size: clamp(1.35rem, 6.6vw, 1.85rem); }
  .hero-motto { font-size: clamp(0.95rem, 3.6vw, 1.15rem); }
  .chapter-title { font-size: clamp(1.55rem, 7vw, 2.2rem); }
}
@media (max-width: 360px) {
  .bar { padding-inline: 10px; gap: 8px; }
  .hero { padding-inline: 12px; }
}

/* Clear next-step on each page */
.next-step {
  margin: clamp(2rem, 5vw, 3.5rem) 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
}
.next-step .lede { margin: 0; max-width: 28em; }


/* Share bar on news and articles */
.share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin: 2rem 0 0;
}
.share-label {
  font-weight: 600;
  margin-inline-end: 2px;
}
.share a,
.share button {
  appearance: none;
  background: transparent;
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  color: inherit;
  padding: 8px 14px;
  min-height: 44px;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
}
.share a:hover,
.share button:hover {
  border-color: currentColor;
}
.share button.is-copied { border-color: currentColor; }
.tone-deep .share a,
.tone-deep .share button {
  border-color: color-mix(in srgb, var(--hero-ink) 28%, transparent);
  color: var(--hero-ink);
}


/* Clickable section stations (Leaders and others) */
.station-link {
  display: block;
  color: inherit;
  text-decoration: none;
}
.station-link:hover h3 { color: var(--link, inherit); }

/* Keep hero/page-hero fade clearance after width-specific padding shorthand. */
.hero, .page-hero {
  padding-bottom: max(4.5rem, calc(var(--fade-len) + 1.25rem));
}
