:root {
  --bg: #000;
  --ink: #efe6d3;
  --ink-dim: #cbc2ad;
  --stripe-ink: #ecebc6;
  --star: #cdd3a0;
  --olive: 78 88 38;
  --latin: "Libre Caslon Text", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }

html {
  background: #000;
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--latin);
  line-height: 1.5;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: .6rem 1rem;
  background: var(--ink);
  color: #000;
}
.skip:focus { top: 1rem; }

/* Hero: the turning night Earth is the background of the whole section. */

.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(17rem, 29%) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.5rem clamp(1rem, 3vw, 3.5rem);
  min-height: clamp(34rem, 100svh, 64rem);
  padding: clamp(1.25rem, 2.4vw, 3rem);
  overflow: hidden;
}

.hero__earth {
  position: absolute;
  inset: 0;
  z-index: -2;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
}
.hero.is-ready .hero__earth { opacity: 1; }

/* Shown only if the browser cannot draw the live Earth. */
.hero.is-static .hero__earth {
  opacity: 1;
  background: radial-gradient(circle 100vw at 50% calc(6% + 100vw), #0a1426 0, #060c18 calc(100vw - 14px), #1a3566 calc(100vw - 2px), transparent 100vw);
}

/* A soft shade behind the headline so it stays readable over the city lights. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, rgb(0 0 0 / .5) 0, rgb(0 0 0 / .3) 26%, transparent 50%);
  pointer-events: none;
}

.wordmark {
  margin: 0 0 1.4rem;
  font-size: .95rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* The headline is sized from its own column so the first line always fits on one line. */
.hero__copy {
  grid-column: 1;
  grid-row: 1;
  container-type: inline-size;
  text-shadow: 0 0 1.1em rgb(0 0 0 / .6), 0 .05em .25em rgb(0 0 0 / .5);
}

h1 {
  margin: 0;
  font-size: clamp(1.9rem, 11.6cqw, 3.75rem);
  font-weight: 700;
  line-height: 1.07;
  letter-spacing: -.005em;
}
h1 span { display: block; }

.hero__link {
  display: inline-block;
  margin-top: 1.9rem;
  font-size: clamp(1.05rem, 1.35vw, 1.4rem);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .32em;
}
.hero__link:hover { color: #fff; }

.hero__art {
  position: relative;
  grid-column: 2;
  grid-row: 1 / span 2;
  justify-self: end;
  width: min(100%, calc((100svh - 5rem) * 1.37));
}

/* Name line at the foot of the hero. Kept very small, set like a letterhead. */
.hero__name {
  grid-column: 1;
  grid-row: 2;
  align-self: end;
  color: var(--ink-dim);
  font-size: .66rem;
  line-height: 1.55;
  letter-spacing: .18em;
  text-transform: uppercase;
  text-shadow: 0 0 1em rgb(0 0 0 / .7);
}
.hero__name p { margin: 0; }
.hero__name-origin {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .2em .85em;
}
.hero__name-origin span + span {
  padding-left: .85em;
  border-left: 1px solid rgb(255 255 255 / .3);
  line-height: 1.1;
}
.hero__name-ps {
  font-family: "Noto Naskh Arabic", "Segoe UI", Tahoma, serif;
  font-weight: 500;
  font-size: 1.75em;
  line-height: 1;
  letter-spacing: 0;
  color: var(--ink);
}
.hero__name-full {
  margin-top: .3rem;
  text-wrap: balance;
}

/* Artwork: the flag, fixed over the Earth. Everything inside scales as one unit. */

.art {
  position: relative;
  width: 100%;
  aspect-ratio: 1140 / 830;
}

.flag {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  aspect-ratio: 2.48;
  container-type: inline-size;
}

/* The stripes are sheer, so the city lights read through them. */
.flag__bands {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: repeat(13, 1fr);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 10%, #000 90%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 10%, #000 90%, transparent 100%);
}
.flag__bands i { display: block; }
.flag__bands i:nth-child(odd) { background: rgb(var(--olive) / .6); }
.flag__bands i:nth-child(even) { background: rgb(0 0 0 / .34); }
.flag__bands i:nth-child(-n+7) { margin-left: 26.05cqw; }

/* Canton: 7 stripes tall, star grid kept at 12 by 10. */
.flag__canton {
  position: absolute;
  left: 0;
  top: 0;
  width: 26.05cqw;
  height: calc(100% * 7 / 13);
  background: linear-gradient(90deg, transparent 0, rgb(0 0 0 / .34) 45%, rgb(0 0 0 / .46) 100%);
}

.flag__stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.flag__stars use {
  fill: var(--star);
  opacity: .8;
}

/* Sparkle: the star turns bright, a bright copy of it swells, and four fine rays open and close across it.
   The copy and the rays sit in a group that is moved onto the star, so they grow from the star's own middle. */
.flag__stars use.is-glint { animation: glint 1.3s ease-in-out 1; }

@keyframes glint {
  0%, 100% { fill: var(--star); opacity: .8; }
  42% { fill: #fffef4; opacity: 1; }
}

.flag__stars .flag__bloom,
.flag__flare {
  fill: #fffef4;
  opacity: 0;
  pointer-events: none;
}
.flag__spark.is-on .flag__bloom { animation: bloom 1.3s ease-in-out 1; }
.flag__spark.is-on .flag__flare { animation: flare 1.3s ease-in-out 1; }

@keyframes bloom {
  0%, 100% { opacity: 0; transform: scale(1); filter: none; }
  42% {
    opacity: 1;
    transform: scale(1.4);
    filter: drop-shadow(0 0 1.6px rgb(255 249 220 / .95)) drop-shadow(0 0 4px rgb(255 240 190 / .7));
  }
}

@keyframes flare {
  0%, 100% { opacity: 0; transform: scale(.15) rotate(0deg); }
  42% { opacity: .92; transform: scale(1) rotate(12deg); }
}

.flag__rows {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-rows: repeat(13, 1fr);
  color: var(--stripe-ink);
  font-size: 1.82cqw;
}

.flag__rows li {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0 7cqw;
  white-space: nowrap;
  line-height: 1;
  letter-spacing: .05em;
  word-spacing: .08em;
  text-shadow: 0 0 .5em rgb(0 0 0 / .55), 0 .06em .12em rgb(0 0 0 / .6);
}
.flag__rows li:nth-child(-n+7) {
  padding-left: 27.5cqw;
  padding-right: 4cqw;
}

.flag__rows span + span::before {
  content: "\00B7";
  display: inline-block;
  margin: 0 1.15em;
  font-family: var(--latin);
  letter-spacing: 0;
  opacity: .85;
}

.flag__rows li:lang(ru) {
  font-family: "Noto Serif", var(--latin);
  font-size: .96em;
  letter-spacing: .03em;
}
.flag__rows li:lang(zh-Hans) {
  font-family: "Noto Serif SC", "Songti SC", SimSun, serif;
  font-weight: 500;
  letter-spacing: .2em;
}
.flag__rows li:lang(ar),
.flag__rows li:lang(fa),
.flag__rows li:lang(ps) {
  font-family: "Noto Naskh Arabic", "Segoe UI", Tahoma, serif;
  font-weight: 500;
  font-size: 1.16em;
  letter-spacing: 0;
  word-spacing: .05em;
}
.flag__rows li:lang(ur) {
  font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Noto Naskh Arabic", serif;
  font-weight: 500;
  font-size: .96em;
  letter-spacing: 0;
  word-spacing: .05em;
}
.flag__rows li:lang(hi) {
  font-family: "Noto Serif Devanagari", "Nirmala UI", serif;
  font-weight: 500;
  letter-spacing: .02em;
}
.flag__rows li:lang(ko) {
  font-family: "Noto Serif KR", "Malgun Gothic", serif;
  font-weight: 500;
  letter-spacing: .1em;
}

/* Pause and play */

.motion-toggle {
  position: absolute;
  right: 0;
  bottom: 0;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 44px;
  padding: .5rem .95rem;
  background: rgb(0 0 0 / .4);
  color: var(--ink-dim);
  border: 1px solid rgb(255 255 255 / .24);
  border-radius: 999px;
  font: inherit;
  font-size: .82rem;
  letter-spacing: .06em;
  cursor: pointer;
}
.motion-toggle:hover { color: #fff; border-color: rgb(255 255 255 / .5); }
.motion-toggle__icon { width: .8rem; height: .8rem; fill: currentColor; }
.motion-toggle__icon--play { display: none; }
.motion-toggle.is-paused .motion-toggle__icon--pause { display: none; }
.motion-toggle.is-paused .motion-toggle__icon--play { display: block; }

/* Capabilities */

.capabilities {
  max-width: 74rem;
  margin: 0 auto;
  padding: clamp(3.5rem, 8vw, 6.5rem) clamp(1.25rem, 2.4vw, 3rem);
  scroll-margin-top: 1rem;
}
.capabilities__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgb(255 255 255 / .16);
}
.capabilities h2 {
  margin: 0;
  font-size: clamp(1.5rem, 2.2vw, 2.1rem);
  font-weight: 400;
}
.capabilities__note {
  margin: 0;
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.capabilities__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(1.5rem, 3vw, 3rem);
  padding-top: 2.25rem;
}
.capabilities h3 {
  margin: 0 0 .6rem;
  font-size: 1.15rem;
  font-weight: 400;
}
.capabilities p { margin: 0; color: var(--ink-dim); }

.footer {
  padding: 2rem clamp(1.25rem, 2.4vw, 3rem);
  border-top: 1px solid rgb(255 255 255 / .12);
  color: var(--ink-dim);
  font-size: .85rem;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.footer p { margin: 0; }

/* Tablet and phone: headline above, flag scaled as one unit below, the Earth behind both. */

@media (max-width: 1100px) {
  .capabilities__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    align-content: start;
    min-height: 0;
    gap: 1.25rem;
    /* Room at the top for the horizon to arc above the wordmark. */
    padding: 4.25rem 0 1.25rem;
  }
  .hero::after {
    background: linear-gradient(180deg, rgb(0 0 0 / .45) 0, rgb(0 0 0 / .25) 30%, transparent 46%);
  }
  .hero__copy,
  .hero__art,
  .hero__name {
    grid-column: auto;
    grid-row: auto;
  }
  .hero__copy { padding: 0 1.25rem; }
  .hero__name { padding: 0 1.25rem; }
  h1 { font-size: clamp(1.9rem, 11.6cqw, 2.6rem); }
  .hero__art {
    justify-self: stretch;
    width: 100%;
  }
  /* Same flag, slightly taller stripes and tighter spacing so the phrases are as large as the width allows. */
  .flag { aspect-ratio: 2.12; }
  .flag__bands {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 5%, #000 95%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 5%, #000 95%, transparent 100%);
  }
  .flag__rows { font-size: 2.15cqw; }
  .flag__rows li {
    padding: 0 3cqw;
    letter-spacing: .02em;
    word-spacing: 0;
  }
  .flag__rows li:nth-child(-n+7) {
    padding-left: 26.8cqw;
    padding-right: 1.5cqw;
  }
  .flag__rows li:lang(ru) { letter-spacing: .01em; }
  .flag__rows span + span::before { margin: 0 .7em; }
  .motion-toggle {
    position: static;
    display: flex;
    width: max-content;
    margin: .5rem 1.25rem 0 auto;
  }
}

@media (max-width: 560px) {
  .capabilities__grid { grid-template-columns: minmax(0, 1fr); }
  .capabilities__head { flex-direction: column; gap: .4rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero__earth { transition: none; }
}
