/* The app's look: iOS grays, white cards, near-black buttons, the Mali font and the hand-drawn
   icons. The pages are generated by scripts/generate-web.mjs; this file is written by hand. */

@font-face {
  font-family: 'Mali';
  src: url('/assets/fonts/Mali-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Mali';
  src: url('/assets/fonts/Mali-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Mali';
  src: url('/assets/fonts/Mali-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

:root {
  --background: #f2f2f7;
  --surface: #ffffff;
  --separator: #c6c6c8;
  --text: #1c1c1e;
  --text-muted: #6c6c70;
  --text-faint: #8e8e93;
  --accent: #1c1c1e;
  --on-accent: #ffffff;
  --raised: 0 3px 10px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --radius: 22px;
  --width: 720px;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--background);
  color: var(--text);
  font-family: 'Mali', ui-rounded, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1;
  width: 100%;
  max-width: var(--width);
  margin: 0 auto;
  padding: 0 16px 48px;
}

a {
  color: var(--text);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
  text-wrap: balance;
}

p {
  margin: 0;
}

.doodle {
  display: block;
  flex: none;
}

/* ---- Bar ---- */

.bar {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(242, 242, 247, 0.72);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.18);
}

/* As wide as the home page's hero, so the name and the badges line up with it. */
/* The links in the middle of the bar, whatever the widths of the name and the badges. */
.bar-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 28px;
  max-width: 1232px;
  margin: 0 auto;
  padding: 14px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 700;
  text-decoration: none;
}

.bar nav,
.footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.bar nav {
  gap: 4px 24px;
}

.brand {
  justify-self: start;
}

.badges-bar {
  justify-self: end;
}

.bar nav a,
.footer nav a {
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.bar nav a {
  font-size: 17px;
}

.bar nav a:hover,
.footer nav a:hover,
.footer nav a[aria-current='page'],
.bar nav a[aria-current='page'] {
  color: var(--text);
}

/* On a phone, the name and the badges share the first row, the links go under them. */
@media (max-width: 640px) {
  .bar-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 12px;
    padding: 10px 16px 12px;
  }
  .brand {
    font-size: 22px;
  }
  .bar nav {
    order: 1;
    width: 100%;
    justify-content: center;
    gap: 4px 18px;
  }
  .bar nav a {
    font-size: 16px;
  }
}

/* ---- Languages ---- */

.flag {
  flex: none;
}

/* The language menu, last of the bar's links: the page's flag, which opens the languages. */
.bar nav {
  align-items: center;
}

.language-menu {
  position: relative;
}

.language-menu summary {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: -6px 0;
  padding: 2px 0;
  color: var(--text-muted);
  list-style: none;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}

.language-menu summary::-webkit-details-marker {
  display: none;
}

.language-menu summary:active {
  transform: scale(0.92);
  transition-duration: 0.12s;
}

.language-chevron {
  transform: rotate(90deg);
  transition: transform 0.2s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.language-menu[open] .language-chevron {
  transform: rotate(-90deg);
}

.language-options {
  position: absolute;
  top: calc(100% + 12px);
  right: -8px;
  z-index: 2;
  display: grid;
  min-width: 180px;
  padding: 6px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14), 0 1px 3px rgba(0, 0, 0, 0.08);
}

.bar nav .language-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.language-option span {
  flex: 1;
}

.language-option:active {
  transform: scale(0.97);
  transition-duration: 0.12s;
}

@media (hover: hover) and (pointer: fine) {
  .language-option:hover {
    background: var(--background);
  }
}

@media (prefers-reduced-motion: reduce) {
  .language-chevron {
    transition: none;
  }
}

/* Small phones: the flag alone, a little smaller, to share the links' row. */
@media (max-width: 400px) {
  .language-menu summary > .flag {
    width: 24px;
    height: 24px;
  }
  .language-chevron {
    display: none;
  }
}

/* ---- Cards and buttons ---- */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--raised);
  padding: 20px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 26px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
}

/* Pressed things sink a little, as in the app. */
a.button:active {
  transform: scale(0.96);
  transition-duration: 0.12s;
}

/* The official store badges, at the same height. */
.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
}

.badge {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}

.badge:active {
  transform: scale(0.96);
  transition-duration: 0.12s;
}

.badge img {
  display: block;
  width: auto;
  height: 50px;
}

.badges-small {
  margin: 0 0 8px;
}

.badges-small .badge img {
  height: 40px;
}

.badges-bar {
  flex-wrap: nowrap;
  gap: 8px;
  margin: 0;
}

.badges-bar .badge img {
  height: 40px;
}

@media (max-width: 640px) {
  .badges-bar .badge img {
    height: 32px;
  }
}

/* Small phones: everything still fits on the first row. */
@media (max-width: 400px) {
  .brand .logo {
    width: 32px;
    height: 32px;
  }
  .brand {
    font-size: 20px;
  }
  .badges-bar {
    gap: 6px;
  }
  .badges-bar .badge img {
    height: 28px;
  }
  /* The links and the flag share their row. */
  .bar nav {
    gap: 4px 11px;
  }
}

/* ---- Drawings in the margins ---- */

/* Only where the page leaves room on its sides. */
.margin-drawing {
  display: none;
}

@media (min-width: 1200px) {
  .section {
    position: relative;
  }
  .margin-drawing {
    display: block;
    position: absolute;
    top: var(--top, 8px);
    width: var(--size, 150px);
    transform: rotate(var(--tilt, 0deg));
    pointer-events: none;
  }
  /* In the middle of the margin, between the text and the window's edge: (100vw - 688px) / 2 wide,
     less the drawing's width, halved. Never closer to the text than 64px, nor further than 160px. */
  .margin-drawing {
    --gap: clamp(64px, (100vw - 688px) / 4 - var(--size, 150px) / 2, 160px);
  }
  /* In the hero, by the title and the badges. */
  .hero-text,
  .hero-home .badges {
    position: relative;
  }
  .margin-left {
    right: calc(100% + var(--gap));
  }
  .margin-right {
    left: calc(100% + var(--gap));
  }
  .margin-drawing svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
  }
}

/* Each stroke waits for its turn, then the pen runs along it. */
.js .margin-drawing .draw {
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  opacity: 0;
}

.js .margin-drawing .fade {
  opacity: 0;
}

.margin-drawing.drawn .draw {
  stroke-dashoffset: 0;
  opacity: 1;
  transition:
    stroke-dashoffset var(--for) cubic-bezier(0.45, 0.05, 0.55, 0.95) var(--at),
    opacity 0s var(--at);
}

.margin-drawing.drawn .fade {
  opacity: 1;
  transition: opacity 0.3s var(--at);
}

@media (prefers-reduced-motion: reduce) {
  .js .margin-drawing .draw,
  .js .margin-drawing .fade {
    stroke-dashoffset: 0;
    opacity: 1;
    transition: none;
  }
}

/* ---- FAQ ---- */

.faq {
  padding: 0;
}

.faq details + details {
  border-top: 0.5px solid var(--separator);
  margin-left: 20px;
}

.faq details + details summary {
  padding-left: 0;
}

.faq details + details p {
  padding-left: 0;
}

.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding: 14px 20px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq-chevron {
  color: var(--text-faint);
  transform: rotate(90deg);
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.faq details[open] .faq-chevron {
  transform: rotate(-90deg);
}

.faq details p {
  padding: 0 20px 18px;
  color: var(--text-muted);
}

/* ---- Back to top ---- */

.to-top {
  position: fixed;
  right: 16px;
  bottom: 24px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 8px 24px rgba(27, 28, 32, 0.2);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px) scale(0.9);
  transition:
    opacity 0.2s ease,
    transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
  pointer-events: none;
  -webkit-tap-highlight-color: transparent;
}

.to-top .doodle {
  transform: rotate(-90deg);
}

.to-top.shown {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.to-top.shown:active {
  transform: scale(0.92);
  transition-duration: 0.12s;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 2;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 12px 32px rgba(27, 28, 32, 0.2);
  opacity: 0;
  transform: translate(-50%, 16px) scale(0.96);
  transition:
    opacity 0.2s ease,
    transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
  pointer-events: none;
}

.toast.shown {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

/* ---- Home ---- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 56px 0 24px;
  text-align: center;
}

.hero-icon {
  margin-bottom: 4px;
}

.hero h1 {
  max-width: 620px;
  font-size: clamp(34px, 9vw, 56px);
  font-weight: 700;
}

.lead {
  max-width: 560px;
  color: var(--text-muted);
  font-size: 18px;
  text-wrap: balance;
}

.hero .button {
  margin-top: 10px;
}

/* The home page's hero: the promise, then the app in two drawn phones, seen from the first screen.
   Wider, the text goes left and the phones right, past the width of the rest of the page. */
.hero-home {
  gap: 36px;
  padding-top: 40px;
}

.hero-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.hero-phones {
  position: relative;
  width: min(100%, 400px);
  margin: 0 auto;
}

.hero-phones .phone {
  width: 60%;
}

.hero-phones .phone:first-child {
  position: absolute;
  top: 7%;
  right: 0;
  width: 56%;
}

/* Wider, the hero fills the first screen under the bar (about 68px high), so the next section
   starts below the fold, and its title, text, badges and phones grow with the window's height. */
@media (min-width: 880px) {
  .hero-home {
    display: grid;
    grid-template-columns: 1fr clamp(420px, min(72svh - 54px, 36vw), 540px);
    align-items: center;
    gap: 48px;
    min-height: calc(100svh - 72px);
    margin-inline: calc(50% - min(600px, 50vw - 32px));
    padding-block: 24px;
    text-align: left;
  }

  .hero-home .hero-text {
    align-items: flex-start;
    gap: clamp(18px, 3svh, 26px);
  }

  .hero-home h1 {
    max-width: none;
    font-size: clamp(56px, min(8.5svh, 4.6vw), 68px);
  }

  .hero-home .lead {
    max-width: 31em;
    font-size: clamp(18px, 2.6svh, 21px);
  }

  .hero-home .badges {
    justify-content: flex-start;
  }

  .hero-home .badge img {
    height: clamp(50px, 7svh, 58px);
  }

  .hero-phones {
    width: 100%;
  }
}

.section {
  margin-top: 48px;
}

/* A section reached by its link stops under the bar, not behind it. */
.section[id] {
  scroll-margin-top: 112px;
}

.section > h2 {
  margin: 0 0 16px 4px;
  font-size: 24px;
  font-weight: 700;
}

.steps,
.features {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

/* Two steps by row on big phones (the list 392 to 593px wide): the third goes under them, in the
   middle, as wide as they are. */
@media (min-width: 424px) and (max-width: 625.98px) {
  .steps {
    grid-template-columns: repeat(4, 1fr);
  }
  .step {
    grid-column: span 2;
  }
  .step:last-child:nth-child(odd) {
    grid-column: 2 / span 2;
  }
}

.step {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.step h3 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-number {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14px;
  font-weight: 700;
}

/* ---- How it works ----
   With scripts on, the steps wait off screen, then rise in one after the other, and the scene
   plays while it is on screen: its timeline is in assets/scene.css, generated by scripts/web-scene.mjs.
   Without scripts, or for people who asked for less motion, everything is simply there, the
   scene at its last moment. */

.js .step {
  opacity: 0;
  transform: translateY(24px) scale(0.97);
}

.js .revealed .step {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.4s ease calc(var(--step) * 0.18s),
    transform 0.7s cubic-bezier(0.22, 1.25, 0.36, 1) calc(var(--step) * 0.18s);
}

.scene-card {
  margin-bottom: 12px;
  padding: 0;
  overflow: hidden;
}

.scene {
  display: block;
  width: 100%;
  height: auto;
}

/* The step being played fills a bar along its bottom edge. */
.step {
  position: relative;
  overflow: hidden;
}

.step-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
}

@media (prefers-reduced-motion: reduce) {
  .js .step {
    opacity: 1;
    transform: none;
  }
  .js .revealed .step {
    transition: none;
  }
}

.step h3,
.feature h3 {
  font-size: 17px;
  font-weight: 700;
}

.step p,
.feature p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 15px;
}

.features {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

/* ---- In the app ----
   The screenshots in phones drawn by hand, no two alike. On a phone they scroll sideways from one to the next, past the page's side margins; wider, they all
   show, three by row. */

.shots {
  display: flex;
  gap: 16px;
  margin: 0 -16px;
  padding: 4px 16px 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 16px;
  scrollbar-width: none;
  list-style: none;
}

.shots::-webkit-scrollbar {
  display: none;
}

.shot {
  flex: none;
  width: 62%;
  max-width: 240px;
  scroll-snap-align: start;
  text-align: center;
}

.shot p {
  margin-top: 12px;
  font-size: 15px;
  font-weight: 600;
}

/* A phone drawn by scripts/web-phones.mjs: the screenshot under, the drawing over it. */
.phone {
  position: relative;
  aspect-ratio: 276 / 476;
  transform: rotate(var(--tilt, 0deg));
}

.phone img {
  position: absolute;
  display: block;
  object-fit: cover;
  background: var(--background);
}

.phone svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* A phone that opens its screenshot full screen: it rises a little under the mouse, and sinks a
   little when pressed, as in the app. */
a.phone {
  display: block;
  cursor: zoom-in;
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  a.phone:hover {
    transform: rotate(var(--tilt, 0deg)) scale(1.03);
  }
}

a.phone:active {
  transform: rotate(var(--tilt, 0deg)) scale(0.97);
  transition-duration: 0.12s;
}

a.phone:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -2px;
  border-radius: 36px;
}

@media (prefers-reduced-motion: reduce) {
  a.phone {
    transition: none;
  }
}

/* ---- A screenshot full screen ----
   Over a dark veil, as tall as the screen allows, the close button above it, and under it the
   way to the others around its caption, whose height never moves the screenshot. The script in
   scripts/generate-web.mjs moves it. */

.viewing {
  overflow: hidden;
  scrollbar-gutter: stable;
}

.viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: #ffffff;
  overflow: hidden;
}

.viewer[open] {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 68px 16px 24px;
}

.viewer::backdrop {
  background: none;
}

.viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 28, 30, 0.9);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.viewer-image {
  position: relative;
  display: block;
  width: auto;
  height: min(calc(100vh - 160px), calc((100vw - 32px) * 2), 1200px);
  height: min(calc(100dvh - 160px), calc((100vw - 32px) * 2), 1200px);
  aspect-ratio: 1 / 2;
  border-radius: 10% / 5%;
  background: var(--background);
  object-fit: cover;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.viewer-bar {
  position: relative;
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 52px;
}

.viewer-caption {
  width: min(250px, 100vw - 136px);
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  text-wrap: balance;
}

.viewer-button {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}

.viewer-button:active {
  transform: scale(0.92);
  transition-duration: 0.12s;
}

.viewer-button:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}

.viewer-close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.viewer-close .doodle {
  transform: rotate(45deg);
}

.viewer-prev .doodle {
  transform: rotate(180deg);
}

@media (min-width: 640px) {
  .shots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px 24px;
    margin: 0;
    padding: 4px 8px 0;
    overflow: visible;
  }

  .shot {
    width: auto;
    max-width: none;
  }
}

.feature .doodle {
  margin-bottom: 10px;
}

.indie {
  display: flex;
  align-items: center;
  gap: 16px;
}

.indie p {
  color: var(--text-muted);
}

/* ---- Documents ---- */

.document {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 40px;
}

.document h1 {
  font-size: clamp(28px, 6vw, 36px);
  font-weight: 700;
}

.updated {
  margin-top: -6px;
  color: var(--text-faint);
  font-size: 14px;
}

.intro {
  margin: 4px 0 8px;
  font-size: 17px;
}

.document .card h2 {
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 700;
}

.document .card p {
  color: var(--text-muted);
}

.document .card p + p {
  margin-top: 10px;
}

.contact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 28px 20px;
}

.document .contact p.address {
  color: var(--text-faint);
  font-size: 15px;
}

/* ---- Footer ---- */

.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 16px 32px;
  border-top: 0.5px solid rgba(60, 60, 67, 0.18);
  color: var(--text-faint);
  font-size: 14px;
  text-align: center;
}

.footer nav {
  justify-content: center;
}

.footer nav a {
  font-size: 14px;
}

/* The smallest phones (320 px): the bar keeps its two rows. */
@media (max-width: 340px) {
  .brand {
    font-size: 18px;
  }
  .badges-bar .badge img {
    height: 24px;
  }
  .bar nav {
    gap: 4px 8px;
  }
  .bar nav a {
    font-size: 14.5px;
  }
}

/* ---- Phone menu ---- */

/* Wide, the bar's links and badges sit in the bar itself; the menu button is for phones. */
.bar-menu {
  display: contents;
}

.menu-button,
.language-name,
.bar nav .menu-only {
  display: none;
}

/* On a phone, with the script, the bar is one row: the name, and a menu button that opens the
   badges, the links and the languages in a card under it. Without the script, the two rows stay. */
@media (max-width: 640px) {
  .js .bar-inner {
    position: relative;
    flex-wrap: nowrap;
    align-items: center;
    padding: 10px 16px;
  }

  .js .menu-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: -6px -10px -6px auto;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text);
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
    -webkit-tap-highlight-color: transparent;
  }

  .js .menu-button:active {
    transform: scale(0.88);
    transition-duration: 0.12s;
  }

  .menu-line {
    transform-box: view-box;
    transform-origin: 24px 24px;
    transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.2s ease;
  }

  .menu-open .menu-line-1 {
    transform: rotate(45deg) translateY(9.6px);
  }

  .menu-open .menu-line-2 {
    opacity: 0;
    transform: scaleX(0.2);
  }

  .menu-open .menu-line-3 {
    transform: rotate(-45deg) translateY(-10.2px);
  }

  .js .bar-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    padding: 8px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14), 0 1px 3px rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.97);
    transform-origin: top right;
    transition: opacity 0.18s ease, transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1), visibility 0s 0.3s;
  }

  .js .menu-open .bar-menu {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 0.18s ease, transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1), visibility 0s;
  }

  .js .bar nav {
    order: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    width: auto;
  }

  .js .bar nav a,
  .js .bar nav .menu-only {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 14px;
    border-radius: 14px;
    color: var(--text);
    font-size: 18px;
    transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
    -webkit-tap-highlight-color: transparent;
  }

  .js .bar nav a:active {
    transform: scale(0.97);
    transition-duration: 0.12s;
  }

  /* The languages, under a hairline, open in place in the card. */
  .js .language-menu {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 0.5px solid var(--separator);
  }

  .js .language-menu summary {
    gap: 10px;
    min-height: 48px;
    margin: 0;
    padding: 0 14px;
    color: var(--text);
    font-size: 18px;
    font-weight: 600;
  }

  .js .language-menu summary:active {
    transform: scale(0.97);
  }

  .js .language-menu summary > .flag {
    width: 28px;
    height: 28px;
  }

  .js .language-name {
    display: block;
    flex: 1;
  }

  .js .language-chevron {
    display: block;
    color: var(--text-muted);
  }

  .js .language-options {
    position: static;
    min-width: 0;
    padding: 0 0 4px;
    box-shadow: none;
    background: none;
  }

  .js .bar nav .language-option {
    min-height: 44px;
    padding: 0 14px 0 26px;
    font-size: 16px;
    font-weight: 400;
  }

  /* The badges first, the one thing to do. */
  .js .bar-menu .badges-bar {
    order: -1;
    justify-content: center;
    gap: 10px;
    margin-bottom: 4px;
    padding: 8px 0 14px;
    border-bottom: 0.5px solid var(--separator);
  }

  .js .bar-menu .badges-bar .badge img {
    height: 40px;
  }

  /* A section reached by its link stops under the one-row bar. */
  .js .section[id] {
    scroll-margin-top: 76px;
  }
}

@media (max-width: 640px) and (hover: hover) and (pointer: fine) {
  .js .bar nav a:hover {
    background: var(--background);
  }
}

@media (prefers-reduced-motion: reduce) {
  .menu-line,
  .js .bar-menu,
  .js .menu-open .bar-menu {
    transition: none;
  }
}
