/* ==========================================================================
   ZENNTAC — Base
   --------------------------------------------------------------------------
   Reset, element defaults, typography roles, focus and reduced motion.
   Element selectors and low-specificity classes only; no layout or
   component styling. Depends on tokens.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

/* The hidden attribute must win over any component display value */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Keep anchored targets and focused elements clear of a sticky header
     (WCAG 2.2 — 2.4.11 Focus Not Obscured). */
  scroll-padding-block-start: calc(var(--header-height) + var(--space-4));
}

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

body {
  min-block-size: 100vh;
  min-block-size: 100dvh;
  background-color: var(--color-background);
  color: var(--color-text-primary);
  font-family: var(--type-body-family);
  font-size: var(--type-body-size);
  font-weight: var(--type-body-weight);
  line-height: var(--type-body-leading);
  letter-spacing: var(--type-body-tracking);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

img,
video {
  block-size: auto;
}

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

button {
  cursor: pointer;
}

textarea {
  resize: vertical;
}

/* Long words and URLs must never cause horizontal overflow */
p,
li,
dd,
blockquote,
figcaption,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

/* --------------------------------------------------------------------------
   2. Typography — elements
   Headings get a default role matching their level. Use the .type-* role
   classes below when the visual size must differ from the semantic level.
   -------------------------------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--color-text-primary);
  text-wrap: balance;
}

h1 {
  font-family: var(--type-h1-family);
  font-size: var(--type-h1-size);
  font-weight: var(--type-h1-weight);
  line-height: var(--type-h1-leading);
  letter-spacing: var(--type-h1-tracking);
}

h2 {
  font-family: var(--type-h2-family);
  font-size: var(--type-h2-size);
  font-weight: var(--type-h2-weight);
  line-height: var(--type-h2-leading);
  letter-spacing: var(--type-h2-tracking);
}

h3 {
  font-family: var(--type-h3-family);
  font-size: var(--type-h3-size);
  font-weight: var(--type-h3-weight);
  line-height: var(--type-h3-leading);
  letter-spacing: var(--type-h3-tracking);
}

h4,
h5,
h6 {
  font-family: var(--type-h4-family);
  font-size: var(--type-h4-size);
  font-weight: var(--type-h4-weight);
  line-height: var(--type-h4-leading);
  letter-spacing: var(--type-h4-tracking);
}

p {
  text-wrap: pretty;
}

small {
  font-size: var(--type-body-small-size);
}

strong,
b {
  font-weight: var(--font-weight-semibold);
}

code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

a {
  color: var(--color-link);
  text-decoration-line: underline;
  text-decoration-thickness: 0.0625em;
  text-underline-offset: 0.2em;
  transition: var(--transition-hover);
}

a:hover {
  color: var(--color-link-hover);
  text-decoration-thickness: 0.125em;
}

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

hr {
  border: 0;
  border-block-start: var(--border-width) solid var(--color-border);
}

::selection {
  background-color: var(--color-selection);
  color: var(--color-text-primary);
}

/* --------------------------------------------------------------------------
   3. Typography — role classes
   Apply a visual role without changing the semantic element,
   e.g. <h2 class="type-display"> or <p class="type-eyebrow">.
   -------------------------------------------------------------------------- */
.type-display {
  font-family: var(--type-display-family);
  font-size: var(--type-display-size);
  font-weight: var(--type-display-weight);
  line-height: var(--type-display-leading);
  letter-spacing: var(--type-display-tracking);
  text-wrap: balance;
}

.type-h1 {
  font-family: var(--type-h1-family);
  font-size: var(--type-h1-size);
  font-weight: var(--type-h1-weight);
  line-height: var(--type-h1-leading);
  letter-spacing: var(--type-h1-tracking);
}

.type-h2 {
  font-family: var(--type-h2-family);
  font-size: var(--type-h2-size);
  font-weight: var(--type-h2-weight);
  line-height: var(--type-h2-leading);
  letter-spacing: var(--type-h2-tracking);
}

.type-h3 {
  font-family: var(--type-h3-family);
  font-size: var(--type-h3-size);
  font-weight: var(--type-h3-weight);
  line-height: var(--type-h3-leading);
  letter-spacing: var(--type-h3-tracking);
}

.type-h4 {
  font-family: var(--type-h4-family);
  font-size: var(--type-h4-size);
  font-weight: var(--type-h4-weight);
  line-height: var(--type-h4-leading);
  letter-spacing: var(--type-h4-tracking);
}

.type-body-large {
  font-family: var(--type-body-large-family);
  font-size: var(--type-body-large-size);
  font-weight: var(--type-body-large-weight);
  line-height: var(--type-body-large-leading);
  letter-spacing: var(--type-body-large-tracking);
}

.type-body {
  font-family: var(--type-body-family);
  font-size: var(--type-body-size);
  font-weight: var(--type-body-weight);
  line-height: var(--type-body-leading);
  letter-spacing: var(--type-body-tracking);
}

.type-body-small {
  font-family: var(--type-body-small-family);
  font-size: var(--type-body-small-size);
  font-weight: var(--type-body-small-weight);
  line-height: var(--type-body-small-leading);
  letter-spacing: var(--type-body-small-tracking);
}

.type-caption {
  font-family: var(--type-caption-family);
  font-size: var(--type-caption-size);
  font-weight: var(--type-caption-weight);
  line-height: var(--type-caption-leading);
  letter-spacing: var(--type-caption-tracking);
  color: var(--color-text-muted);
}

.type-eyebrow {
  font-family: var(--type-eyebrow-family);
  font-size: var(--type-eyebrow-size);
  font-weight: var(--type-eyebrow-weight);
  line-height: var(--type-eyebrow-leading);
  letter-spacing: var(--type-eyebrow-tracking);
  text-transform: var(--type-eyebrow-transform);
  color: var(--color-text-secondary);
}

.type-button {
  font-family: var(--type-button-family);
  font-size: var(--type-button-size);
  font-weight: var(--type-button-weight);
  line-height: var(--type-button-leading);
  letter-spacing: var(--type-button-tracking);
}

/* --------------------------------------------------------------------------
   4. Inline Arabic inside a non-Arabic page
   Page-level Arabic is handled in tokens.css (:root:lang(ar)). This covers
   short passages marked <span lang="ar" dir="rtl"> in EN/FR pages, e.g. the
   language switcher, where tokens have already resolved for Latin script.
   -------------------------------------------------------------------------- */
:not(:root)[lang|="ar"] {
  font-family: var(--font-arabic);
  letter-spacing: 0;
  text-transform: none;
}

/* --------------------------------------------------------------------------
   5. Focus
   Visible keyboard focus everywhere. :focus-visible avoids showing the ring
   on mouse click while always showing it for keyboard users. Never remove
   an outline without providing an equally visible replacement.
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}

/* Elements with tabindex="-1" are never reached by Tab; they only receive
   programmatic focus (e.g. <main tabindex="-1"> after a skip link). A ring
   around a whole region is noise, so it is suppressed for them only. */
[tabindex="-1"]:focus {
  outline: none;
}

/* --------------------------------------------------------------------------
   6. Reduced motion
   Durations collapse in tokens.css; this also stops keyframe animations
   and any transition not built on duration tokens.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
