/* ===========================================================================
   Aratus Academy — reset, document shell, typography primitives, utilities.
   Mobile-first throughout. Directional values use logical properties only.
   =========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-block-start: calc(var(--header-h) + var(--sp-4));
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  position: relative;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  letter-spacing: var(--tracking-body);
  /* Belt and braces against horizontal scroll at 360px. The layouts below are
     built so this never actually has to clip anything. */
  overflow-x: hidden;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Film-grain veil. Inlined as a data URI so there is no extra request and no
   dependency on the oversized legacy image set. */
body::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)'/%3E%3C/svg%3E");
}

/* Scroll lock while the mobile drawer is open (set by app.js). */
html.nav-open,
html.nav-open body { overflow: hidden; }

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

img { height: auto; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--ink); }

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

button {
  cursor: pointer;
  border: 0;
  background: none;
  text-align: inherit;
}

/* Native controls must honour the document direction. */
input,
textarea,
select { text-align: start; }

/* The 44px touch-target floor applies to every control, not only the ones
   wrapped in .form-field — a bare <select> in a language switcher counts. */
button,
select,
textarea,
summary,
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
  min-block-size: var(--tap);
}

textarea { resize: vertical; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: var(--lh-head);
  letter-spacing: var(--tracking-head);
  margin: 0;
  text-wrap: balance;
}

p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
dl, dd, dt { margin: 0; }
figure { margin: 0; }

hr {
  border: 0;
  border-block-start: 1px solid var(--line);
  margin-block: var(--sp-7);
}

table { border-collapse: collapse; width: 100%; }
th { text-align: start; font-weight: 500; }

/* app.js toggles the hidden attribute to filter cards; component rules set
   display, so hidden has to win. */
[hidden] { display: none !important; }

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

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--gold);
  font-family: var(--font-sans);
  font-size: var(--fs-eyebrow);
  font-weight: 500;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: var(--case-eyebrow);
}

.eyebrow::before {
  content: "";
  flex: none;
  inline-size: 28px;
  block-size: 1px;
  background: var(--gold);
}

.lead {
  color: var(--muted);
  font-size: 1.02rem;
  max-width: var(--max-prose);
}

.gold { color: var(--gold-2); }
.serif { font-family: var(--font-serif); }
.muted { color: var(--dim); font-size: 0.86rem; }

.tiny {
  color: var(--dim);
  font-size: 0.8rem;
  margin-block-start: var(--sp-3);
}

.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.text-center { text-align: center; }
.text-start { text-align: start; }
.text-end { text-align: end; }
.full { inline-size: 100%; }

@media (min-width: 600px) {
  .lead { font-size: 1.08rem; }
}

/* ---- accessibility -------------------------------------------------------- */

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

.skip-link {
  position: absolute;
  inset-block-start: var(--sp-2);
  inset-inline-start: var(--sp-2);
  z-index: var(--z-modal);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-sm);
  background: var(--gold);
  color: var(--ink-on-gold);
  font-weight: 500;
  transform: translateY(-200%);
  transition: transform var(--dur) var(--ease);
}

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

::selection {
  background: var(--gold);
  color: var(--ink-on-gold);
}

/* Gold focus ring on every focusable thing. This is a paid product; do not
   remove or narrow these selectors. */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
details:focus-visible,
[tabindex]:focus-visible,
[contenteditable]:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

:focus:not(:focus-visible) { outline: none; }

/* Thin gold scrollbars on the panels that scroll internally. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

::-webkit-scrollbar { inline-size: 10px; block-size: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: var(--radius-pill);
}

/* ---- reduced motion ------------------------------------------------------- */

@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;
    scroll-behavior: auto !important;
  }

  /* The marquee and the skeleton sweep are purely decorative loops. */
  .marquee-track,
  .skeleton::after {
    animation: none !important;
    transform: none !important;
  }
}
