/* ==========================================================================
   Base — light reset, typography and shared utilities.
   ========================================================================== */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: var(--header-h); /* keep the fixed header from covering anchored headings */
}

/* Native smooth anchors only when Lenis isn't running (it handles them itself) */
@media (prefers-reduced-motion: no-preference) {
  html:not(.lenis) {
    scroll-behavior: smooth;
  }
}

/* Lenis (smooth wheel scrolling) — rules from its official stylesheet */
html.lenis,
html.lenis body {
  height: auto;
}
.lenis.lenis-stopped {
  overflow: clip;
}
.lenis.lenis-smooth iframe {
  pointer-events: none;
}

main:focus {
  outline: none;
} /* focused by the skip link; no ring around the whole page */

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: 300;
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip; /* clip (not hidden) so position: sticky keeps working */
  transition:
    background-color var(--dur) var(--ease-out),
    color var(--dur) var(--ease-out);
}

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

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

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
  padding: 0;
}

::selection {
  background: var(--kraft);
  color: var(--espresso);
}

/* ---------- Focus: clear for keyboard users, hidden for mouse clicks ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ---------- Typography ---------- */
h1,
h2,
h3,
.display {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

:lang(en) h1,
:lang(en) h2,
:lang(en) h3,
:lang(en) .display {
  font-weight: 500;
  letter-spacing: -0.02em;
}

/* Amiri has tall ascenders/descenders and needs more room than Playfair */
:lang(ar) h1,
:lang(ar) h2,
:lang(ar) h3,
:lang(ar) .display {
  line-height: 1.45;
  letter-spacing: 0;
}

p {
  text-wrap: pretty;
}

/* Strings from the i18n file use \n for line breaks */
[data-i18n] {
  white-space: pre-line;
}

/* Small label above a heading: "01 — THE BEAN" */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 400;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--accent);
}

/* Arabic letters must stay joined — letter-spacing breaks the script */
:lang(ar) .eyebrow {
  letter-spacing: 0.08em;
  font-size: var(--fs-sm);
}

/* Wide tracking wraps long uppercase English labels onto two lines */
:lang(en) .eyebrow {
  letter-spacing: 0.22em;
}

.eyebrow__num {
  font-family: var(--font-display);
  font-style: italic;
  letter-spacing: 0.04em;
}

.eyebrow__rule {
  width: 2.5rem;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.lead {
  font-size: var(--fs-md);
  color: var(--text-muted);
  max-width: 42ch;
}

/* English copy runs longer than Arabic, so the lead gets a wider measure */
:lang(en) .lead {
  max-width: 64ch;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.section {
  padding-block: var(--section-pad);
  position: relative;
}

/* ---------- Utilities ---------- */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  inset-block-start: var(--space-3);
  inset-inline-start: var(--space-3);
  z-index: var(--z-skip);
  padding: var(--space-3) var(--space-5);
  background: var(--accent-fill);
  color: var(--on-accent);
  border-radius: var(--radius-pill);
  transform: translateY(-200%);
  transition: transform var(--dur-fast) var(--ease-out);
}

.skip-link:focus-visible {
  transform: none;
}

/* ---------- Reveal on scroll ----------
   Elements are only hidden once JS is running (.js class on <html>).
   Without JS everything stays visible. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity var(--dur-reveal) var(--ease-out),
    transform var(--dur-reveal) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] {
    transform: none;
  }
}
