/*
 * Base and reset. Design tokens arrive as custom properties, generated by
 * inc/tokens.php so CSS values cannot drift from the tested ones.
 */

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

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

body {
  margin: 0;
  background: var(--ad-color-bg);
  color: var(--ad-color-text);
  font-family: var(--ad-font-sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Hebrew swaps the whole page to Heebo. Mono labels keep their own face. */
html[lang^="he"] body { font-family: var(--ad-font-hebrew); }

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 700;
  line-height: 1.1;
}

p { margin: 0; }

a {
  color: var(--ad-color-text);
  text-decoration: none;
}

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

img, svg, video {
  max-width: 100%;
  height: auto;
}

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

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

/*
 * Focus. The prototype used outline:none with no replacement, which fails
 * SC 2.4.7. The offset keeps the ring clear of the sticky glass header,
 * which SC 2.4.11 requires.
 */
:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--ad-color-accent);
  outline-offset: 3px;
}

/* Screen-reader-only, with a visible-on-focus variant for the skip link. */
.ad-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.ad-sr-focusable:focus-visible {
  position: fixed;
  top: 8px;
  inset-inline-start: 8px;
  width: auto;
  height: auto;
  margin: 0;
  padding: 12px 18px;
  overflow: visible;
  clip-path: none;
  white-space: normal;
  background: var(--ad-color-accent);
  color: var(--ad-color-on-accent);
  font-weight: 700;
  z-index: 10000;
}

/* Latin runs inside RTL copy: phone numbers, emails, URLs. */
bdi { unicode-bidi: isolate; }

/*
 * Honour the OS preference. Spec section 6.3 explains why this is paired
 * with a focus-reachable pause control rather than a visible one.
 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/*
 * The slab that carries every section after the hero. It slides OVER the
 * pinned hero, so it needs its own stacking context and an opaque
 * background: without both, the sticky hero paints on top of it.
 */
.ad-slab {
  position: relative;
  z-index: 1;
  background: var(--ad-color-bg);
}
