/* Zaid home page. Derives everything from the brand tokens the docs and the
   playground already share; the docs site is the visual reference. */

@import url("./assets/brand/zaid-tokens.css");

@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("./fonts/IBMPlexSansArabic-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("./fonts/IBMPlexSansArabic-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("./fonts/IBMPlexSansArabic-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Kawkab Mono";
  src: url("./fonts/KawkabMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Kawkab Mono";
  src: url("./fonts/KawkabMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --home-bg: var(--zd-bg, #f7f2e8);
  --home-surface: var(--zd-surface, #fdfaf2);
  --home-border: var(--zd-border, #e2d7c2);
  --home-ink: var(--zd-ink, #2a241e);
  --home-muted: var(--zd-muted, #8a7a5f);
  --home-primary: var(--zd-clay, #a8512c);
  --home-primary-deep: var(--zd-clay-deep, #7e3b1f);
  --home-ok: var(--zd-ok, #6e6c3b);
  --home-header: rgba(247, 242, 232, 0.91);
  --home-shadow: 0 18px 48px rgba(63, 45, 27, 0.1);
  --home-card-shadow: 0 10px 30px rgba(63, 45, 27, 0.055);
  --home-radius: 12px;
  --home-max: 1160px;
  --home-header-height: 68px;
  --home-font:
    "IBM Plex Sans Arabic",
    "Noto Sans Arabic",
    "Noto Sans Arabic UI",
    Tahoma,
    Arial,
    sans-serif;
  --home-code-font: "Kawkab Mono", "SFMono-Regular", Consolas, monospace;
}

html[data-theme="night"] {
  color-scheme: dark;
  --home-header: rgba(23, 19, 14, 0.92);
  --home-shadow: 0 20px 52px rgba(0, 0, 0, 0.28);
  --home-card-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  /* Night inverts the link pair for contrast, as the docs do. */
  --home-primary: var(--zd-clay, #d97b4a);
  --home-primary-deep: var(--zd-clay-deep, #e9946a);
}

/* The brand tokens derive the syntax and semantic colors from the base
   palette with var() references declared on :root. A custom property is
   substituted where it is declared, so a night scope that re-declares only
   the base colors still inherits the day-resolved derivations. Re-declaring
   the derived tokens inside every night scope makes them resolve against
   that scope's palette. */
/* On the night page the always-night panels would melt into the background:
   both resolve to the same #17130E. The docs answer is a deeper night code
   tone, so the panels keep reading as islands. */
html[data-theme="night"] .code-figure,
html[data-theme="night"] .repl-card,
html[data-theme="night"] .example-code,
html[data-theme="night"] .road-code {
  --zd-bg: #100d09;
}

html[data-theme="night"],
[data-theme="night"] {
  --zd-syn-kw: var(--zd-clay);
  --zd-syn-name: var(--zd-ink);
  --zd-syn-num: var(--zd-gold);
  --zd-syn-str: var(--zd-olive);
  --zd-syn-lit: var(--zd-madder);
  --zd-syn-comment: var(--zd-muted);
  --zd-syn-punct: var(--zd-muted);
  --zd-syn-edu: var(--zd-plum);
  --zd-syn-edu-bg: var(--zd-plum-tint);
  --zd-repl-marker: var(--zd-clay);
  --zd-error: var(--zd-madder);
  --zd-warn: var(--zd-gold);
  --zd-ok: var(--zd-olive);
}

* {
  box-sizing: border-box;
}

html {
  direction: rtl;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--home-bg);
  color: var(--home-ink);
  direction: rtl;
  text-align: start;
  font-family: var(--home-font);
  font-size: 17px;
  line-height: 1.9;
  min-width: 280px;
  font-synthesis: none;
  font-kerning: normal;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: color-mix(in srgb, var(--home-primary) 24%, var(--home-bg));
}

a {
  color: var(--home-primary-deep);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

h1,
h2,
h3 {
  font-weight: 700;
  letter-spacing: 0;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

code {
  font-family: var(--home-code-font);
  font-size: 0.88em;
  unicode-bidi: isolate;
  padding: 1px 6px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--home-border) 42%, transparent);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Visible only while keyboard-focused; the self-relative transform keeps it
   fully off-screen whatever its rendered height (the docs' device). */
.skip-link {
  position: fixed;
  z-index: 1000;
  inset-block-start: 8px;
  inset-inline-start: 50%;
  padding: 8px 16px;
  transform: translate(-50%, -160%);
  border-radius: 8px;
  background: var(--home-ink);
  color: var(--home-bg);
  font-weight: 700;
}

.skip-link:focus {
  transform: translate(-50%, 0);
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--home-primary) 55%, transparent);
  outline-offset: 3px;
}

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--home-header);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-block-end: 1px solid var(--home-border);
}

.header-inner {
  width: min(100% - 40px, var(--home-max));
  margin-inline: auto;
  height: var(--home-header-height);
  display: flex;
  align-items: center;
  gap: 26px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--home-ink);
  font-size: 21px;
}

.brand:hover {
  text-decoration: none;
}

.brand strong {
  font-weight: 700;
}

.brand-marks {
  display: inline-flex;
}

.brand-mark {
  display: block;
}

.brand-mark-night,
html[data-theme="night"] .brand-mark-day {
  display: none;
}

html[data-theme="night"] .brand-mark-night {
  display: block;
}

.header-actions {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-link {
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--home-ink);
  font-size: 15.5px;
  font-weight: 500;
}

.header-link:hover {
  color: var(--home-primary-deep);
  background: color-mix(in srgb, var(--home-border) 38%, transparent);
  text-decoration: none;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--home-border);
  border-radius: 10px;
  background: var(--home-surface);
  color: var(--home-ink);
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease,
    background-color 140ms ease;
}

.icon-button:hover {
  border-color: color-mix(in srgb, var(--home-primary) 38%, var(--home-border));
  color: var(--home-primary-deep);
  text-decoration: none;
}

.theme-button .moon-icon,
html[data-theme="night"] .theme-button .sun-icon {
  display: none;
}

html[data-theme="night"] .theme-button .moon-icon {
  display: block;
}

/* ------------------------------------------------------------------ hero */

.hero {
  position: relative;
  border-block-end: 1px solid var(--home-border);
  background:
    radial-gradient(
    52rem 30rem at 82% 8%,
    color-mix(in srgb, var(--zd-clay, #a8512c) 12%, transparent),
    transparent 62%
  ),
    radial-gradient(
    44rem 30rem at 12% 96%,
    color-mix(in srgb, var(--zd-plum, #6e4a5e) 9%, transparent),
    transparent 66%
  ),
    var(--home-bg);
}

.hero-inner {
  width: min(100% - 40px, var(--home-max));
  margin-inline: auto;
  padding-block: 84px 88px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 64px;
  align-items: stretch;
}

.hero-copy {
  align-self: center;
}

.hero h1 {
  margin: 0 0 24px;
  font-size: clamp(2.35rem, 5.4vw, 3.65rem);
  line-height: 1.22;
}

.hero-lede {
  margin-block-end: 18px;
  font-size: 19.5px;
  line-height: 1.85;
  color: color-mix(in srgb, var(--home-ink) 82%, var(--home-muted));
  max-width: 52ch;
}

.hero-invite {
  margin-block-end: 36px;
  font-size: 16.5px;
  color: var(--home-muted);
  max-width: 46ch;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.action {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 26px;
  border-radius: 10px;
  font-size: 16.5px;
  font-weight: 700;
  transition: background-color 140ms ease, border-color 140ms ease,
    color 140ms ease, transform 140ms ease;
}

.action:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.action-primary {
  border: 1px solid var(--zd-clay-deep, #7e3b1f);
  background: var(--zd-clay, #a8512c);
  color: var(--zd-bg, #f7f2e8);
}

html[data-theme="night"] .action-primary {
  color: var(--zd-bg, #17130e);
}

.action-primary:hover {
  background: var(--zd-clay-deep, #7e3b1f);
}

html[data-theme="night"] .action-primary:hover {
  background: var(--zd-clay-deep, #e9946a);
}

.action-quiet {
  border: 1px solid var(--home-border);
  background: var(--home-surface);
  color: var(--home-ink);
  font-weight: 500;
}

.action-quiet:hover {
  border-color: color-mix(in srgb, var(--home-primary) 45%, var(--home-border));
  color: var(--home-primary-deep);
}

/* ------------------------------------------------------------- REPL card */

/* The interactive session is a night-scoped island in both themes, exactly
   like the playground's session pane and the docs' code figures: execution
   surfaces are dark, paper stays paper. */
.repl-card {
  --repl-bg: var(--zd-bg, #17130e);
  --repl-surface: var(--zd-surface, #201a12);
  --repl-border: var(--zd-border, #2e261c);
  --repl-ink: var(--zd-ink, #efe7d9);
  --repl-muted: var(--zd-muted, #a99b82);
  display: flex;
  flex-direction: column;
  min-height: 460px;
  max-height: 640px;
  border: 1px solid var(--repl-border);
  border-radius: var(--home-radius);
  background: var(--repl-bg);
  color: var(--repl-ink);
  box-shadow: var(--home-shadow);
  overflow: hidden;
}

.repl-header {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border-block-end: 1px solid var(--repl-border);
  background: var(--repl-surface);
}

.repl-dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--zd-clay, #d97b4a);
}

.repl-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--repl-muted);
}

.repl-channel {
  margin-inline-start: auto;
  padding: 3px 10px;
  border: 1px solid var(--repl-border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--repl-muted);
}

.repl-scroll {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 18px 20px;
  scrollbar-color: var(--repl-border) transparent;
  scrollbar-width: thin;
}

.repl-placeholder {
  margin: auto;
  color: var(--repl-muted);
  font-size: 15px;
  line-height: 2.1;
  max-width: 34ch;
  text-align: center;
}

.repl-placeholder[hidden] {
  display: none;
}

.repl-notice {
  margin-block-start: 10px;
  color: var(--zd-gold, #d0a04a);
  font-size: 13.5px;
  line-height: 1.9;
}

.repl-transcript {
  direction: rtl;
  unicode-bidi: plaintext;
  text-align: start;
  font-family: var(--home-code-font);
  font-size: 15px;
  line-height: 2.15;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.repl-transcript:empty {
  display: none;
}

.session-source-line {
  display: flex;
  align-items: baseline;
  gap: 9px;
  white-space: pre-wrap;
}

.session-line-prompt {
  flex: none;
  color: var(--zd-clay, #d97b4a);
  font-weight: 700;
  user-select: none;
}

.session-output {
  display: block;
  white-space: pre-wrap;
}

.session-result-marker {
  color: var(--zd-repl-marker, #d97b4a);
  font-weight: 700;
}

.session-read-line {
  color: var(--zd-clay, #d97b4a);
  white-space: pre-wrap;
}

.session-failure {
  margin-block: 8px;
  padding: 9px 12px;
  border-inline-start: 3px solid var(--zd-error, #c4614f);
  border-radius: var(--zd-radius, 8px);
  background: color-mix(in srgb, var(--zd-error, #c4614f) 9%, var(--repl-bg));
  font-family: var(--home-font);
  font-size: 14.5px;
  line-height: 1.85;
  white-space: normal;
}

.session-failure strong {
  color: var(--zd-error, #c4614f);
}

.session-failure-location {
  margin-inline-start: 9px;
  color: var(--repl-muted);
  font-family: var(--home-code-font);
  font-size: 12px;
}

.session-failure p {
  margin: 4px 0 0;
}

.session-failure-trace {
  margin: 7px 0 0;
  padding-inline-start: 22px;
  color: var(--repl-muted);
  font-family: var(--home-code-font);
  font-size: 12px;
}

.session-notice {
  margin-block: 8px;
  color: var(--zd-gold, #d0a04a);
  font-family: var(--home-font);
  font-size: 13.5px;
  white-space: normal;
}

.session-inline-input {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-block: 4px;
}

.session-inline-input input {
  min-width: 0;
  width: 16ch;
  padding: 4px 10px;
  border: 1px solid var(--zd-clay, #d97b4a);
  border-radius: 7px;
  background: var(--repl-surface);
  color: var(--repl-ink);
  font-family: var(--home-code-font);
  font-size: 14px;
}

.session-inline-input button {
  padding: 4px 10px;
  border: 1px solid var(--repl-border);
  border-radius: 7px;
  background: var(--repl-surface);
  color: var(--repl-ink);
  font-family: var(--home-font);
  font-size: 12.5px;
  cursor: pointer;
}

.session-inline-input button:hover {
  border-color: var(--zd-clay, #d97b4a);
}

.repl-entry {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-block-start: 1px solid var(--repl-border);
  background: var(--repl-surface);
}

.repl-input-line {
  flex: 1;
  min-width: 120px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-inline-start: 12px;
  border: 1px solid var(--repl-border);
  border-radius: var(--zd-radius, 8px);
  background: var(--repl-bg);
}

.repl-input-line:focus-within {
  border-color: var(--zd-clay, #d97b4a);
}

.repl-prompt {
  flex: none;
  color: var(--zd-clay, #d97b4a);
  font-family: var(--home-code-font);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  user-select: none;
}

.repl-prompt[data-session-state="open"],
.repl-prompt[data-session-state="awaiting-commit"] {
  color: var(--zd-gold, #d0a04a);
}

#repl-input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 8px 2px 8px 12px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--repl-ink);
  /* 16px is the iOS focus-zoom threshold; staying at it keeps pinch-zoom
     available instead of needing the viewport lock the playground uses. */
  font-family: var(--home-code-font);
  font-size: 16px;
}

#repl-input::placeholder {
  color: var(--repl-muted);
}

.repl-submit,
.repl-stop,
.repl-restart {
  flex: none;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--repl-border);
  border-radius: var(--zd-radius, 8px);
  font-family: var(--home-font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.repl-submit {
  border-color: var(--zd-clay, #d97b4a);
  background: var(--zd-clay, #d97b4a);
  color: var(--zd-bg, #17130e);
}

.repl-submit:hover {
  border-color: var(--zd-clay-deep, #e9946a);
  background: var(--zd-clay-deep, #e9946a);
}

.repl-stop {
  border-color: var(--zd-madder, #c4614f);
  background: var(--zd-madder, #c4614f);
  color: var(--zd-bg, #17130e);
}

.repl-restart {
  background: transparent;
  border-color: var(--zd-clay, #d97b4a);
  color: var(--zd-clay, #d97b4a);
}

.repl-chips {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 14px;
  background: var(--repl-surface);
}

.repl-chip {
  padding: 7px 13px;
  border: 1px solid var(--repl-border);
  border-radius: 999px;
  background: var(--repl-bg);
  color: var(--repl-muted);
  font-family: var(--home-code-font);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease;
}

.repl-chip:hover {
  border-color: var(--zd-clay, #d97b4a);
  color: var(--zd-clay, #d97b4a);
}

/* ----------------------------------------------------------------- bands */

.band {
  border-block-end: 1px solid var(--home-border);
}

.band-raised {
  background: var(--home-surface);
}

.band-inner {
  width: min(100% - 40px, var(--home-max));
  margin-inline: auto;
  padding-block: 84px;
}

.band-split {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 64px;
  align-items: center;
}

.band-split-start {
  align-items: start;
}

.band-copy h2 {
  margin: 0 0 16px;
  font-size: clamp(1.65rem, 3vw, 2.3rem);
}

.band-copy p {
  margin-block-end: 14px;
  font-size: 17.5px;
  line-height: 1.9;
  color: color-mix(in srgb, var(--home-ink) 84%, var(--home-muted));
}

.band-copy p:last-child {
  margin-block-end: 0;
}

.band-note {
  color: var(--home-muted);
  font-size: 16px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  margin-block-end: 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.65rem, 3vw, 2.3rem);
}

.section-tag {
  color: var(--home-muted);
  font-size: 15px;
}

.section-link {
  font-size: 15.5px;
}

.section-lede {
  margin-block-end: 44px;
  font-size: 17.5px;
  line-height: 1.9;
  color: color-mix(in srgb, var(--home-ink) 84%, var(--home-muted));
  max-width: 62ch;
}

/* ----------------------------------------------------------------- gloss */

.gloss-table {
  border: 1px solid var(--home-border);
  border-radius: var(--home-radius);
  background: var(--home-bg);
  overflow: hidden;
}

.gloss-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 32px;
  align-items: center;
  padding: 17px 26px;
  border-block-end: 1px solid var(--home-border);
}

.gloss-row:last-child {
  border-block-end: 0;
}

.gloss-code {
  margin: 0;
  font-family: var(--home-code-font);
  font-size: 16.5px;
  line-height: 2;
  white-space: pre-wrap;
  unicode-bidi: plaintext;
}

.gloss-say {
  padding-inline-start: 18px;
  border-inline-start: 2px solid var(--home-border);
  color: var(--home-muted);
  font-size: 15.5px;
  line-height: 1.8;
}

.gloss-result-row {
  background: var(--home-surface);
}

.gloss-output {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-family: var(--home-code-font);
  font-size: 16.5px;
}

.gloss-output-label {
  color: var(--home-primary);
  font-family: var(--home-font);
  font-size: 13px;
  font-weight: 700;
}

/* Syntax classes, exactly as the docs render them (core/highlight.ts kinds).
   Inside a night-scoped figure the --zd-syn-* variables resolve to the night
   palette; in the light gloss table they resolve to the day palette. */
.word {
  color: var(--zd-syn-name);
}

.word.vocabulary {
  color: var(--zd-syn-kw);
  font-weight: 700;
}

.literal {
  color: var(--zd-syn-lit);
}

.number {
  color: var(--zd-syn-num);
}

.string {
  color: var(--zd-syn-str);
}

.comment {
  color: var(--zd-syn-comment);
}

.educational-prefix,
.educational-prose {
  color: var(--zd-syn-edu);
}

.educational-prefix {
  font-weight: 700;
}

/* The docs' plum band over an educational-comment region, rounded at the
   region's first and last lines. */
.educational-line {
  padding-inline: 0.35rem;
  background: var(--zd-syn-edu-bg);
  color: var(--zd-syn-edu);
}

.educational-line-start {
  border-start-start-radius: var(--zd-radius, 8px);
  border-start-end-radius: var(--zd-radius, 8px);
}

.educational-line-end {
  border-end-start-radius: var(--zd-radius, 8px);
  border-end-end-radius: var(--zd-radius, 8px);
}

.delimiter,
.operator,
.punctuation {
  color: var(--zd-syn-punct);
}

/* ---------------------------------------------------------- code figures */

.code-figure {
  margin: 0;
  border: 1px solid var(--zd-border, #2e261c);
  border-radius: var(--home-radius);
  background: var(--zd-bg, #17130e);
  color: var(--zd-ink, #efe7d9);
  box-shadow: var(--home-shadow);
  overflow: hidden;
}

.code-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-block-end: 1px solid var(--zd-border, #2e261c);
  background: var(--zd-surface, #201a12);
  font-size: 13.5px;
  color: var(--zd-muted, #a99b82);
}

.code-heading-mark {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--zd-olive, #9a9456);
}

.code-figure .code-block {
  margin: 0;
  padding: 18px 22px;
  font-family: var(--home-code-font);
  font-size: 15px;
  line-height: 2.15;
  white-space: pre;
  overflow-x: auto;
  tab-size: 2;
  scrollbar-color: var(--zd-border, #2e261c) transparent;
  scrollbar-width: thin;
}

.code-line {
  display: inline-block;
  min-width: 100%;
  unicode-bidi: isolate;
}

/* Keeps a leading indentation run visible at the start of an RTL line; the
   box is made of the original spaces, so copied code stays byte-exact. */
.code-indentation {
  display: inline-block;
  white-space: pre;
}

.code-line[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

.code-line[dir="ltr"] {
  direction: ltr;
  text-align: left;
}

.terminal-strip {
  padding: 12px 22px 16px;
  border-block-start: 1px solid var(--zd-border, #2e261c);
  background: var(--zd-surface, #201a12);
  font-family: var(--home-code-font);
  font-size: 14px;
  line-height: 2.1;
}

.terminal-command {
  display: block;
  color: var(--zd-muted, #a99b82);
  unicode-bidi: isolate;
}

.terminal-command::before {
  content: "$ ";
  color: var(--zd-olive, #9a9456);
}

.terminal-output {
  display: block;
  color: var(--zd-ink, #efe7d9);
  white-space: pre-wrap;
  unicode-bidi: plaintext;
}

.figure-note {
  padding: 11px 18px 14px;
  background: var(--zd-surface, #201a12);
  color: var(--zd-muted, #a99b82);
  font-size: 13.5px;
  line-height: 1.8;
}

.terminal-strip + .figure-note {
  padding-block-start: 0;
}

/* --------------------------------------------------------- why in Arabic */

.why-copy {
  display: grid;
  gap: 16px;
  max-width: 64ch;
  font-size: 18px;
  line-height: 1.95;
  color: color-mix(in srgb, var(--home-ink) 86%, var(--home-muted));
}

/* -------------------------------------------------------------- examples */

.example-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.example-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--home-border);
  border-radius: 15px;
  background: var(--home-bg);
  color: var(--home-ink);
  box-shadow: var(--home-card-shadow);
  transition: border-color 140ms ease, transform 140ms ease;
}

.band .example-card {
  background: var(--home-surface);
}

.example-card:hover {
  border-color: color-mix(in srgb, var(--home-primary) 48%, var(--home-border));
  transform: translateY(-2px);
  text-decoration: none;
}

.example-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.example-head strong {
  font-size: 19px;
  font-weight: 700;
}

.example-level {
  color: var(--home-muted);
  font-size: 13px;
}

.example-code {
  border: 1px solid var(--zd-border, #2e261c);
  border-radius: 10px;
  background: var(--zd-bg, #17130e);
  color: var(--zd-ink, #efe7d9);
  padding: 14px 16px;
  margin: 0;
  font-family: var(--home-code-font);
  font-size: 13.5px;
  line-height: 2.1;
  white-space: pre;
  overflow-x: auto;
}

.example-card .example-code {
  box-shadow: none;
}

.example-note {
  color: var(--home-muted);
  font-size: 14.5px;
  line-height: 1.75;
}

.example-open {
  margin-block-start: auto;
  color: var(--home-primary-deep);
  font-size: 14.5px;
  font-weight: 700;
}

.example-open::after {
  content: " ←";
}

/* --------------------------------------------------------------- roadmap */

.page-hero {
  border-block-end: 1px solid var(--home-border);
  background:
    radial-gradient(
    52rem 26rem at 82% 0%,
    color-mix(in srgb, var(--zd-clay, #a8512c) 10%, transparent),
    transparent 62%
  ),
    var(--home-bg);
}

.page-hero .band-inner {
  padding-block: 64px 56px;
}

.page-hero h1 {
  margin: 0 0 18px;
  font-size: clamp(2rem, 4.6vw, 3rem);
  line-height: 1.24;
}

.page-lede {
  max-width: 58ch;
  font-size: 18px;
  line-height: 1.9;
  color: color-mix(in srgb, var(--home-ink) 84%, var(--home-muted));
}

.status-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-block-start: 22px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.status-chip[data-status="decided"] {
  border-color: color-mix(in srgb, var(--zd-ok, #6e6c3b) 45%, transparent);
  background: color-mix(in srgb, var(--zd-ok, #6e6c3b) 12%, transparent);
  color: var(--zd-ok, #6e6c3b);
}

.status-chip[data-status="design"] {
  border-color: color-mix(in srgb, var(--zd-clay, #a8512c) 45%, transparent);
  background: color-mix(in srgb, var(--zd-clay, #a8512c) 10%, transparent);
  color: var(--home-primary);
}

.status-chip[data-status="research"] {
  border-color: color-mix(in srgb, var(--zd-warn, #a3721f) 45%, transparent);
  background: color-mix(in srgb, var(--zd-warn, #a3721f) 10%, transparent);
  color: var(--zd-warn, #a3721f);
}

.road-list {
  display: grid;
  gap: 20px;
  max-width: 760px;
}

.road-item {
  padding: 24px 26px;
  border: 1px solid var(--home-border);
  border-radius: 15px;
  background: var(--home-surface);
  box-shadow: var(--home-card-shadow);
}

.road-item-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-block-end: 10px;
}

.road-item-head h3 {
  margin: 0;
  font-size: 19px;
}

.road-item p {
  color: color-mix(in srgb, var(--home-ink) 82%, var(--home-muted));
  font-size: 16px;
  line-height: 1.9;
}

.road-code {
  margin-block-start: 14px;
  border: 1px solid var(--zd-border, #2e261c);
  border-radius: 10px;
  background: var(--zd-bg, #17130e);
  color: var(--zd-ink, #efe7d9);
  padding: 14px 18px;
  font-family: var(--home-code-font);
  font-size: 14.5px;
  line-height: 2.1;
  white-space: pre;
  overflow-x: auto;
}

/* ------------------------------------------------------------------- faq */

.faq-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.faq-item {
  padding: 24px;
  border: 1px solid var(--home-border);
  border-radius: 15px;
  background: var(--home-surface);
  box-shadow: var(--home-card-shadow);
}

.faq-item h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.faq-item p {
  color: color-mix(in srgb, var(--home-ink) 82%, var(--home-muted));
  font-size: 15.5px;
  line-height: 1.9;
}

/* ---------------------------------------------------------------- footer */

.site-footer {
  background: var(--home-bg);
}

.footer-inner {
  width: min(100% - 40px, var(--home-max));
  margin-inline: auto;
  padding-block: 64px 36px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(2, minmax(0, 1fr));
  gap: 44px;
  padding-block-end: 44px;
  border-block-end: 1px solid var(--home-border);
}

.footer-brand p {
  margin-block-start: 14px;
  color: var(--home-muted);
  font-size: 15px;
  max-width: 26ch;
}

.footer-column {
  display: flex;
  flex-direction: column;
  gap: 11px;
  font-size: 15px;
}

.footer-column-title {
  color: var(--home-muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.footer-column a {
  color: color-mix(in srgb, var(--home-ink) 82%, var(--home-muted));
  width: fit-content;
}

.footer-column a:hover {
  color: var(--home-primary-deep);
}

.footer-line {
  display: flex;
  align-items: baseline;
  gap: 20px;
  flex-wrap: wrap;
  padding-block-start: 26px;
  color: var(--home-muted);
  font-size: 14px;
}

.footer-line a {
  margin-inline-start: auto;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 1023px) {
  .hero-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
    padding-block: 56px 64px;
  }

  .band-split {
    grid-template-columns: minmax(0, 1fr);
    gap: 36px;
  }

  .example-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .faq-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 849px) {
  body {
    font-size: 16px;
  }

  .header-inner,
  .hero-inner,
  .band-inner,
  .footer-inner {
    width: min(100% - 32px, var(--home-max));
  }

  .band-inner {
    padding-block: 56px;
  }

  .header-link {
    padding-inline: 10px;
    font-size: 15px;
  }
}

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

  .gloss-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 14px 18px;
  }

  .gloss-say {
    padding-inline-start: 12px;
  }

  .gloss-code {
    font-size: 15px;
  }

  .code-figure .code-block {
    padding: 14px 16px;
    font-size: 13.5px;
  }

  .terminal-strip {
    font-size: 13px;
  }

  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .repl-card {
    min-height: 420px;
  }

  .repl-submit {
    display: none;
  }
}

/* The theme sweep, as on the docs and in the playground: the new theme is
   revealed inside a growing circle. The class suppresses the browser's own
   root cross-fade, which would play underneath the circle, and the
   surfaces' colour transitions, which the new snapshot would otherwise
   freeze half-changed. */
:root.theme-sweep *,
:root.theme-sweep *::before,
:root.theme-sweep *::after {
  transition: none !important;
}

:root.theme-sweep::view-transition-old(root),
:root.theme-sweep::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

:root.theme-sweep::view-transition-old(root) {
  z-index: 0;
}

:root.theme-sweep::view-transition-new(root) {
  z-index: 1;
}

/* `sweepTheme` skips the circle under reduced motion; this covers a browser
   that starts a root transition for any other reason. */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }
}

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

  *,
  *::before,
  *::after {
    transition: none !important;
  }

  .action:hover,
  .example-card:hover {
    transform: none;
  }
}
