/* Noor website. Colour tokens (--bg, --accent, --hero-from …, --radius, --font-heading) are generated from
   src/lib/theme.ts into each page, per theme (html[data-theme]) and scheme (html[data-scheme]). */

:root {
  --serif: ui-serif, 'New York', 'Iowan Old Style', Georgia, 'Noto Naskh Arabic', 'Times New Roman', serif;
}

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

html,
body {
  overflow-x: clip;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans Arabic', 'Geeza Pro', Tahoma, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

:lang(ar) body,
html:lang(ar) {
  line-height: 1.75;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent);
}

h1,
h2,
h3 {
  font-family: var(--font-heading, inherit);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

html:lang(ar) h1,
html:lang(ar) h2,
html:lang(ar) h3 {
  letter-spacing: 0;
  line-height: 1.4;
}

h1 {
  font-size: clamp(2.3rem, 5vw + 1rem, 4rem);
  font-weight: 800;
}

h2 {
  font-size: clamp(1.8rem, 2.5vw + 1rem, 2.6rem);
  font-weight: 750;
}

h3 {
  font-size: 1.35rem;
  font-weight: 700;
}

p {
  margin: 0 0 1em;
}

code {
  font: 0.88em/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--accent-soft);
  padding: 0.1em 0.35em;
  border-radius: 6px;
  overflow-wrap: anywhere;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.icon {
  width: 1.2em;
  height: 1.2em;
  fill: currentColor;
  flex: none;
}

.wrap {
  width: min(1120px, 100% - 32px);
  margin-inline: auto;
}

.narrow {
  width: min(760px, 100% - 32px);
}

.center {
  text-align: center;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.88rem;
}

.lead {
  font-size: 1.18rem;
}

.skip {
  position: absolute;
  inset-inline-start: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.skip:focus {
  top: 12px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid var(--line);
}

.header-row {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 750;
  font-size: 1.2rem;
}

.brand img {
  border-radius: 9px;
}

.nav {
  display: flex;
  gap: 4px;
  margin-inline-start: auto;
}

.nav a {
  color: var(--text);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.95rem;
}

.nav a:hover {
  background: var(--accent-soft);
}

.nav .nav-app {
  color: var(--accent);
  font-weight: 600;
}

.menu {
  position: relative;
}

.menu summary {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 0.95rem;
}

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

.lang-menu ul,
.menu-panel {
  position: absolute;
  z-index: 60;
  inset-inline-end: 0;
  top: calc(100% + 6px);
  margin: 0;
  padding: 6px;
  list-style: none;
  min-width: 160px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.16);
}

.lang-menu a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}

.lang-menu a:hover,
.lang-menu a[aria-current] {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Theme menu */
.theme-menu .menu-panel {
  width: 280px;
  padding: 14px;
}

.menu-label {
  margin: 0 0 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.swatches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 14px;
}

.swatches button,
.segmented button {
  font: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.swatches button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  text-align: start;
}

.swatch {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: conic-gradient(var(--a) 0 50%, var(--b) 0 75%, var(--c) 0);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.12);
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 12px;
  background: var(--accent-soft);
}

.segmented button {
  flex: 1;
  padding: 6px 4px;
  border: 0;
}

.swatches button[aria-pressed='true'] {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  font-weight: 600;
}

.segmented button[aria-pressed='true'] {
  background: var(--card);
  font-weight: 600;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.12);
}

/* The logo follows the theme, like the app icon. */
.theme-only {
  display: none;
}

html[data-theme='classic'] .theme-only[data-for='classic'],
html[data-theme='lantern'] .theme-only[data-for='lantern'],
html[data-theme='andalus'] .theme-only[data-for='andalus'],
html[data-theme='qalam'] .theme-only[data-for='qalam'] {
  display: block;
}

@media (max-width: 760px) {
  .nav a:not(.nav-app) {
    display: none;
  }
  .header-row {
    gap: 8px;
  }
  .lang-menu summary span {
    display: none;
  }
  .brand {
    font-size: 1.05rem;
    white-space: nowrap;
    min-width: 0;
  }
  .nav .nav-app {
    white-space: nowrap;
    padding-inline: 8px;
  }
  .theme-menu .menu-panel {
    inset-inline-end: -52px;
  }
}

/* ---------- Buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 20px;
  border-radius: calc(var(--radius, 20px) - 4px);
  text-decoration: none;
  font-size: 1rem;
  line-height: 1.2;
  transition: transform 0.16s ease, background-color 0.16s ease;
}

.button .icon {
  width: 26px;
  height: 26px;
}

.button span {
  display: flex;
  flex-direction: column;
}

.button small {
  font-size: 0.8rem;
  opacity: 0.8;
}

.button:active {
  transform: scale(0.97);
}

.button-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.button-primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, var(--text));
}

.button-secondary {
  background: var(--accent-soft);
  color: var(--accent);
}

.button-ghost {
  border: 1px solid rgb(255 255 255 / 0.35);
  color: #fff;
}

.is-soon {
  cursor: default;
  opacity: 0.75;
}

.is-soon:active {
  transform: none;
}

.button[aria-disabled='true'] {
  pointer-events: none;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.on-dark {
  color: #fff;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  isolation: isolate;
  color: #fff;
  background:
    radial-gradient(1200px 500px at 85% -10%, color-mix(in srgb, var(--hero-accent, var(--gold)) 30%, transparent), transparent 60%),
    linear-gradient(160deg, var(--hero-from), var(--hero-to));
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 48px;
  padding-block: 72px 0;
}

.hero-copy {
  padding-bottom: 72px;
}

.eyebrow {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.14);
  font-size: 0.9rem;
  font-weight: 600;
}

.hero .lead {
  color: rgb(255 255 255 / 0.86);
  max-width: 34em;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 28px 0 20px;
}

.hero .button-primary {
  background: #fff;
  color: var(--hero-from);
}

.hero .button-primary:hover {
  background: rgb(255 255 255 / 0.9);
}

.hero-shot {
  align-self: end;
  display: flex;
  justify-content: center;
}


@media (max-width: 880px) {
  .hero-grid {
    grid-template-columns: 1fr;
    padding-top: 48px;
    gap: 0;
  }
  .hero-copy {
    padding-bottom: 40px;
  }
}

/* ---------- Phone frame ---------- */

.phone {
  margin: 0;
  width: min(300px, 78vw);
  aspect-ratio: 390 / 844;
  border-radius: 44px;
  padding: 10px;
  background: #0d0f0e;
  box-shadow:
    0 0 0 1px rgb(255 255 255 / 0.08) inset,
    0 30px 60px -20px rgb(0 0 0 / 0.45),
    0 12px 24px -12px rgb(0 0 0 / 0.3);
}

.phone img,
.phone-empty {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  border-radius: 34px;
}

.phone-empty {
  background: linear-gradient(160deg, var(--hero-from), var(--hero-to));
}

/* ---------- Sections ---------- */

.section {
  padding-block: 96px;
}

.band {
  background: color-mix(in srgb, var(--card) 45%, transparent);
  border-block: 1px solid var(--glass-line);
}

.section-head {
  max-width: 720px;
  margin-bottom: 48px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 0;
  margin: 28px 0 0;
  list-style: none;
}

.chips a {
  display: block;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.chips a:hover {
  background: var(--accent);
  color: var(--on-accent);
}

.checks {
  list-style: none;
  padding: 0;
  margin: 28px 0;
  display: grid;
  gap: 14px;
}

.checks li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  font-size: 1.08rem;
}

.checks .icon {
  margin-top: 0.15em;
  width: 28px;
  height: 28px;
  padding: 4px;
  border-radius: 50%;
  background: var(--accent-soft);
  fill: var(--accent);
}

/* ---------- Download ---------- */

.cards {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 960px) {
  .cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

.card {
  min-width: 0;
  padding: 28px;
  border-radius: calc(var(--radius, 20px) + 4px);
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
}

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

.card h3 .icon {
  fill: var(--accent);
}

.card-main {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 20px 50px -30px color-mix(in srgb, var(--accent) 60%, transparent);
}

.card .button {
  margin-block: 8px 16px;
}

.badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold);
  font-weight: 700;
  font-size: 0.9rem;
}

.apk-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, max-content));
  justify-content: start;
  gap: 12px 28px;
  margin: 0 0 16px;
}

.apk-meta dt {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

html:lang(ar) .apk-meta dt {
  text-transform: none;
  letter-spacing: 0;
}

.apk-meta dd {
  margin: 2px 0 0;
  font-weight: 600;
  white-space: nowrap;
}

.apk-sum {
  grid-column: 1 / -1;
}

.apk-sum dd {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  align-items: center;
  gap: 10px;
  font-weight: 400;
}

.apk-sum code {
  min-width: 0;
  font-size: 0.8rem;
  word-break: break-all;
  direction: ltr;
  unicode-bidi: isolate;
}

.copy {
  flex: none;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--accent);
  cursor: pointer;
}

.install {
  margin-top: 32px;
  padding: 8px 28px;
  border-radius: calc(var(--radius, 20px) + 4px);
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.install summary {
  cursor: pointer;
  padding-block: 16px;
  list-style-position: inside;
}

.install summary h3 {
  display: inline;
  margin: 0;
}

.install ol {
  padding-inline-start: 1.4em;
  display: grid;
  gap: 10px;
}

/* ---------- Prose (privacy) ---------- */

.prose h1 {
  font-size: clamp(2rem, 3vw + 1rem, 3rem);
}

.prose h2 {
  font-size: 1.6rem;
  margin-top: 1.6em;
}

.prose h3 {
  font-size: 1.25rem;
  margin-top: 1.4em;
}

.prose li + li {
  margin-top: 6px;
}

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

.site-footer {
  padding-block: 48px 32px;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 24px;
}

@media (max-width: 760px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.footer-brand img {
  border-radius: 7px;
}

.footer-links,
.footer-langs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.footer-links a,
.footer-langs a {
  color: var(--text);
  text-decoration: none;
}

.footer-links a:hover,
.footer-langs a:hover {
  color: var(--accent);
}

.sources {
  margin-top: 32px;
  font-size: 0.85rem;
}

/* Tables (sources page) */
.table {
  overflow-x: auto;
  margin: 1.2em 0;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius, 20px) - 6px);
}

.table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.table th,
.table td {
  padding: 10px 12px;
  text-align: start;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.table th {
  background: var(--accent-soft);
  font-weight: 650;
}

.table tr:last-child td {
  border-bottom: 0;
}

.prose {
  overflow-wrap: anywhere;
}

.prose .table {
  overflow-wrap: normal;
}

/* ---------- Glass ----------
   Frosted panels over a slowly drifting aurora in the theme's colours. */

:root {
  --glass: color-mix(in srgb, var(--card) 58%, transparent);
  --glass-strong: color-mix(in srgb, var(--card) 74%, transparent);
  --glass-line: color-mix(in srgb, var(--text) 11%, transparent);
  --glass-shadow: inset 0 1px 0 rgb(255 255 255 / 0.22), 0 24px 60px -32px rgb(0 0 0 / 0.35);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: calc(var(--radius, 20px) + 6px);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
}

.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.aurora i {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.22;
  animation: drift 34s ease-in-out infinite alternate;
}

.aurora i:nth-child(1) {
  background: var(--accent);
  top: -20vmax;
  inset-inline-start: -15vmax;
}

.aurora i:nth-child(2) {
  background: var(--gold);
  top: 30vh;
  inset-inline-end: -25vmax;
  animation-duration: 42s;
  animation-delay: -12s;
}

.aurora i:nth-child(3) {
  background: var(--hero-accent, var(--accent));
  bottom: -30vmax;
  inset-inline-start: 20vw;
  animation-duration: 38s;
  animation-delay: -20s;
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(8vw, 6vh, 0) scale(1.15);
  }
}

/* Revealed as they scroll in (only with JavaScript: without it everything is simply there). */
.js .reveal {
  opacity: 0;
  translate: 0 28px;
  transition:
    opacity 0.8s var(--ease-out),
    translate 0.8s var(--ease-out);
}

.js .reveal.is-in {
  opacity: 1;
  translate: 0 0;
}

/* ---------- Hero ---------- */

.hero-orbs i {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  animation: drift 26s ease-in-out infinite alternate;
}

.hero-orbs i:nth-child(1) {
  width: 420px;
  height: 420px;
  background: var(--hero-accent, var(--gold));
  top: -140px;
  inset-inline-end: 4%;
}

.hero-orbs i:nth-child(2) {
  width: 320px;
  height: 320px;
  background: color-mix(in srgb, var(--hero-to) 70%, #fff);
  bottom: -160px;
  inset-inline-start: 10%;
  opacity: 0.35;
  animation-duration: 31s;
}

.hero-orbs i:nth-child(3) {
  width: 220px;
  height: 220px;
  background: var(--gold);
  top: 40%;
  inset-inline-start: 46%;
  opacity: 0.25;
  animation-duration: 22s;
  animation-delay: -8s;
}

.hero .eyebrow {
  background: rgb(255 255 255 / 0.14);
  border: 1px solid rgb(255 255 255 / 0.22);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.hero .button-ghost {
  background: rgb(255 255 255 / 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* The copy rises in, one line after another. */
.hero-copy > * {
  animation: rise 0.9s var(--ease-out) both;
}

.hero-copy > :nth-child(2) {
  animation-delay: 0.08s;
}

.hero-copy > :nth-child(3) {
  animation-delay: 0.16s;
}

.hero-copy > :nth-child(4) {
  animation-delay: 0.24s;
}

.hero-copy > :nth-child(5) {
  animation-delay: 0.32s;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

/* Three phones fanned out on a sheet of glass. */
.hero-stack {
  position: relative;
  width: min(300px, 64vw);
  margin-bottom: -70px;
}

.hero-plate {
  position: absolute;
  inset: 12% -28% 18%;
  border-radius: 40px;
  background: rgb(255 255 255 / 0.1);
  border: 1px solid rgb(255 255 255 / 0.22);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.3);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  animation: rise 1.1s 0.1s var(--ease-out) both;
}

.hero-stack .phone {
  width: 100%;
}

.hero-front {
  position: relative;
  animation:
    phone-in 1.1s 0.15s var(--ease-out) both,
    float 7s 1.3s ease-in-out infinite alternate;
}

.hero-back {
  position: absolute;
  top: 9%;
  width: 78% !important;
  opacity: 0.92;
  animation: fan-in 1.2s 0.35s var(--ease-out) both;
}

.hero-back.is-start {
  inset-inline-start: -46%;
  --tilt: -9deg;
}

.hero-back.is-end {
  inset-inline-end: -46%;
  --tilt: 9deg;
}

html[dir='rtl'] .hero-back.is-start {
  --tilt: 9deg;
}

html[dir='rtl'] .hero-back.is-end {
  --tilt: -9deg;
}

.hero-back {
  transform: rotate(var(--tilt)) scale(0.96);
}

@keyframes phone-in {
  from {
    opacity: 0;
    transform: translateY(60px) scale(0.96);
  }
}

@keyframes fan-in {
  from {
    opacity: 0;
    transform: rotate(0deg) translateY(40px) scale(0.9);
  }
}

@keyframes float {
  to {
    transform: translateY(-10px);
  }
}

@media (max-width: 880px) {
  .hero-stack {
    width: min(230px, 56vw);
    margin: 8px auto -70px;
  }
  .hero-back.is-start {
    inset-inline-start: -40%;
  }
  .hero-back.is-end {
    inset-inline-end: -40%;
  }
}

/* ---------- The feature story ----------
   The phone stays put while the steps scroll past; its screen follows the step being read. */

.story-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px;
}

.story-stage {
  order: 2;
}

.stage-inner {
  position: sticky;
  top: calc(50vh - min(300px, 38vh) + 32px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.story-phone {
  position: relative;
  width: auto;
  height: min(600px, 76vh);
}

.story-phone img {
  position: absolute;
  inset: 10px;
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  opacity: 0;
  transform: scale(1.04);
  filter: blur(6px);
  transition:
    opacity 0.55s var(--ease-out),
    transform 0.7s var(--ease-out),
    filter 0.55s var(--ease-out);
}

.story-phone img.is-on {
  opacity: 1;
  transform: none;
  filter: none;
}

.story-dots {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.story-dots li {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--glass-line);
  transition:
    height 0.4s var(--ease-out),
    background-color 0.4s;
}

.story-dots li.is-on {
  height: 28px;
  background: var(--accent);
}

.story-steps {
  order: 1;
}

.step {
  min-height: 82vh;
  display: flex;
  align-items: center;
}

.step:first-child {
  min-height: 60vh;
  align-items: flex-start;
}

.step-card {
  padding: 32px;
  opacity: 0.45;
  transform: scale(0.97);
  transition:
    opacity 0.5s var(--ease-out),
    transform 0.5s var(--ease-out);
}

.step.is-current .step-card,
html:not(.js) .step-card {
  opacity: 1;
  transform: none;
}

.step-card p:last-child {
  margin: 0;
  font-size: 1.1rem;
  color: var(--muted);
}

.step-num {
  margin: 0 0 12px;
  font: 700 0.9rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--accent);
  letter-spacing: 0.08em;
}

/* Phones: the phone is pinned near the top on a frosted shelf and the steps slide up under it. */
@media (max-width: 880px) {
  .story-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .story-stage {
    order: 0;
    position: sticky;
    top: 64px;
    z-index: 5;
    margin-inline: -16px;
    padding-block: 12px;
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    backdrop-filter: blur(22px) saturate(1.6);
    -webkit-backdrop-filter: blur(22px) saturate(1.6);
    border-bottom: 1px solid var(--glass-line);
    mask-image: linear-gradient(#000 88%, transparent);
  }
  .stage-inner {
    position: static;
  }
  .story-phone {
    height: min(46vh, 420px);
    border-radius: 30px;
    padding: 7px;
  }
  .story-phone img {
    inset: 7px;
    width: calc(100% - 14px);
    height: calc(100% - 14px);
    border-radius: 24px;
  }
  .step,
  .step:first-child {
    min-height: 62vh;
    align-items: center;
  }
  .step:last-child {
    min-height: 50vh;
  }
  .step-card {
    padding: 24px;
  }
}

/* ---------- Gallery ---------- */

.gallery {
  overflow: hidden;
}

.marquee {
  direction: ltr;
  overflow: hidden;
  padding-block: 12px 40px;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.marquee-track {
  display: flex;
  gap: 28px;
  width: max-content;
  animation: marquee 70s linear infinite;
}

.marquee:hover .marquee-track,
.marquee:focus-within .marquee-track {
  animation-play-state: paused;
}

.gallery-phone {
  width: 220px;
  flex: none;
  border-radius: 34px;
  padding: 8px;
  transition: transform 0.4s var(--ease-out);
}

.gallery-phone img {
  border-radius: 27px;
}

.gallery-phone:nth-child(even) {
  transform: translateY(28px);
}

@keyframes marquee {
  to {
    transform: translateX(calc(-50% - 14px));
  }
}

@media (max-width: 760px) {
  .gallery-phone {
    width: 170px;
  }
}

/* ---------- Languages, translations, privacy ---------- */

.translation-note {
  margin-top: 40px;
  padding: 28px;
  text-align: start;
}

.translation-note p {
  color: var(--muted);
}

.translation-note .button {
  margin-top: 4px;
  min-height: 48px;
}

.privacy-card {
  padding: clamp(24px, 5vw, 48px);
}

/* ---------- Reduced motion: the story still follows the reader, without movement. ---------- */

@media (prefers-reduced-motion: reduce) {
  .aurora i,
  .hero-orbs i,
  .hero-copy > *,
  .hero-plate,
  .hero-front,
  .hero-back {
    animation: none;
  }
  .js .reveal {
    opacity: 1;
    translate: none;
    transition: none;
  }
  .story-phone img {
    transform: none;
    filter: none;
    transition: opacity 0.2s linear;
  }
  .marquee {
    overflow-x: auto;
    mask-image: none;
  }
  .marquee-track {
    animation: none;
  }
}

/* Small phones: the header keeps the name and the two menus ("Open in your browser" is in the hero). */
@media (max-width: 430px) {
  .nav .nav-app {
    display: none;
  }
  .nav {
    margin-inline-start: auto;
  }
}

.hero-copy {
  position: relative;
  z-index: 2;
}

@media (min-width: 881px) and (max-width: 1180px) {
  .hero-stack {
    width: min(260px, 26vw);
  }
  .hero-back.is-start {
    inset-inline-start: -30%;
  }
  .hero-back.is-end {
    inset-inline-end: -30%;
  }
}
