/* ==========================================================================
   AORI — Base layer
   Reset, page chrome, typography and a small utility set.
   ========================================================================== */

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

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  font-feature-settings: "cv05" 1, "cv08" 1, "tnum" 0;  /* legible l, curved 7 */
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}

h1, h2, h3, h4, p, figure, dl, dd, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }
code, pre, .mono { font-family: var(--font-mono); font-variant-ligatures: none; }
summary { cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }

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

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Circular wipe used when switching themes (see theme.js). */
.theme-wipe {
  position: fixed;
  z-index: 9999;
  border-radius: 50%;
  pointer-events: none;
  transform: scale(0);
  transform-origin: center;
  will-change: transform;
}

/* ==========================================================================
   Layout shell
   ========================================================================== */

.shell {
  width: 100%;
  max-width: var(--shell-max);
  margin-inline: auto;
  padding-inline: var(--s-6);
}

@media (max-width: 640px) {
  .shell { padding-inline: var(--s-4); }
}

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page__body { flex: 1 0 auto; padding-bottom: var(--s-9); }

/* ==========================================================================
   Utilities — a deliberately small set, matched to the templates
   ========================================================================== */

.row    { display: flex; align-items: center; gap: var(--s-3); }
.row--top { align-items: flex-start; }
.row--wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.center  { justify-content: center; }
.end     { justify-content: flex-end; }
.stack   { display: flex; flex-direction: column; gap: var(--s-4); }
.stack--sm { gap: var(--s-3); }
.stack--lg { gap: var(--s-5); }
.grow    { flex: 1 1 auto; min-width: 0; }
.shrink-0 { flex-shrink: 0; }

.grid { display: grid; gap: var(--s-3); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--auto { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

@media (max-width: 900px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .grid--4, .grid--3, .grid--2 { grid-template-columns: minmax(0, 1fr); }
}

.mt-1 { margin-top: var(--s-1); }  .mt-2 { margin-top: var(--s-2); }
.mt-3 { margin-top: var(--s-3); }  .mt-4 { margin-top: var(--s-4); }
.mt-5 { margin-top: var(--s-5); }  .mt-6 { margin-top: var(--s-6); }
.mb-2 { margin-bottom: var(--s-2); } .mb-3 { margin-bottom: var(--s-3); }
.mb-4 { margin-bottom: var(--s-4); } .mb-6 { margin-bottom: var(--s-6); }

.t-2xs { font-size: var(--fs-2xs); }
.t-xs  { font-size: var(--fs-xs); }
.t-sm  { font-size: var(--fs-sm); }
.t-md  { font-size: var(--fs-md); }
.t-lg  { font-size: var(--fs-lg); }
.t-xl  { font-size: var(--fs-xl); }
.t-2xl { font-size: var(--fs-2xl); }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 650; }

.muted  { color: var(--fg-2); }
.dim    { color: var(--fg-3); }
.brand  { color: var(--accent); }
.ok     { color: var(--ok); }
.warn   { color: var(--warn); }
.err    { color: var(--err); }
.info   { color: var(--info); }

.upper { text-transform: uppercase; letter-spacing: 0.05em; }
.tabular { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.prewrap { white-space: pre-wrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 {
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.text-center { text-align: center; }
.text-right  { text-align: right; }

.hide { display: none !important; }
@media (max-width: 760px) { .hide-sm { display: none !important; } }

/* ==========================================================================
   Scrollbars
   ========================================================================== */

* { scrollbar-width: thin; scrollbar-color: var(--stroke-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--stroke-strong);
  border: 3px solid transparent;
  border-radius: var(--r-pill);
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--fg-3); background-clip: content-box; }

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
}
