/* Reset, base typography, layout primitives. Logical properties throughout. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-block-start: calc(var(--header-h) + 16px);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-feature-settings: 'ss01' on, 'cv11' on;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img,
svg,
picture {
  display: block;
  max-inline-size: 100%;
}

img {
  block-size: auto;
}

/* Cropped media frames: the <picture> wrapper must fill the frame for object-fit to work. */
[class$='__media'] > picture {
  inline-size: 100%;
  block-size: 100%;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

ul[role='list'],
ol[role='list'] {
  list-style: none;
  padding: 0;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

address {
  font-style: normal;
}

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

main:focus {
  outline: none;
}

::selection {
  background: var(--sand-400);
  color: var(--ink-950);
}

[hidden] {
  display: none !important;
}

/* ---------- utilities ---------- */

.visually-hidden {
  position: absolute !important;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  inset-inline-start: var(--s-4);
  inset-block-start: -100px;
  z-index: 100;
  padding: var(--s-3) var(--s-4);
  background: var(--sand-400);
  color: var(--ink-950);
  font-weight: 700;
  border-radius: var(--radius-input);
  text-decoration: none;
}

.skip-link:focus {
  inset-block-start: var(--s-4);
}

.container {
  inline-size: 100%;
  max-inline-size: calc(var(--max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: var(--section-y);
}

/* Dark bands set their own semantic colours so nested components adapt. */
.band-dark {
  --text: var(--on-dark);
  --text-muted: var(--on-dark-muted);
  --rule: var(--rule-dark);
  --focus: var(--sand-400);
  background: var(--ink-950);
  color: var(--text);
}

.band-tint {
  background: var(--mist-100);
}

/* ---------- typography ---------- */

.display,
.h1,
.h2,
.h3 {
  font-family: var(--font-display);
  color: var(--text);
  text-wrap: balance;
}

.display {
  font-size: var(--fs-display);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-display);
  font-weight: 700;
}

.h1 {
  font-size: var(--fs-h1);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-display);
  font-weight: 700;
}

.h2 {
  font-size: var(--fs-h2);
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-heading);
  font-weight: 700;
}

.h3 {
  font-size: var(--fs-h3);
  line-height: 1.3;
  letter-spacing: -0.01em;
  font-weight: 650;
}

[dir='rtl'] .h3 {
  letter-spacing: 0;
  font-weight: 600;
}

.lead {
  font-size: var(--fs-lead);
  line-height: 1.6;
  color: var(--text-muted);
  max-inline-size: 60ch;
  text-wrap: pretty;
}

[dir='rtl'] .lead {
  line-height: 1.85;
}

p {
  text-wrap: pretty;
}

/* Eyebrow: mono caps in Latin scripts, plain weight in Arabic (no case, no tracking). */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  margin-block-end: var(--s-4);
  font-family: var(--font-mono);
  font-size: var(--fs-eyebrow);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
}

.eyebrow::before {
  content: '';
  inline-size: 24px;
  block-size: 1px;
  background: var(--sand-400);
  flex: none;
}

.eyebrow .icon {
  inline-size: 18px;
  block-size: 18px;
  color: var(--text);
}

.eyebrow:has(.icon)::before {
  display: none;
}

[dir='rtl'] .eyebrow {
  font-family: var(--font-body);
  text-transform: none;
  font-weight: 600;
}

.eyebrow--light {
  color: var(--sand-400);
}

.fine-print {
  display: flex;
  gap: var(--s-2);
  align-items: flex-start;
  margin-block-start: var(--s-5);
  font-size: var(--fs-xs);
  line-height: 1.55;
  color: var(--text-muted);
  max-inline-size: 72ch;
}

.fine-print .icon {
  inline-size: 16px;
  block-size: 16px;
  flex: none;
  margin-block-start: 2px;
}

.prose p + p {
  margin-block-start: var(--s-5);
}

.prose__lead {
  font-size: var(--fs-lead);
  color: var(--text);
}

/* ---------- icons ---------- */

.icon {
  inline-size: 20px;
  block-size: 20px;
  flex: none;
}

[dir='rtl'] .icon--directional {
  transform: scaleX(-1);
}

.icon--back {
  transform: scaleX(-1);
}

[dir='rtl'] .icon--back {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
