/* ==========================================================================
   Base: reset, typography defaults, utilities
   ========================================================================== */

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

* {
  margin: 0;
  padding: 0;
  border: 0 solid;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  min-height: 100vh;
  background: hsl(var(--white));
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

/* :where() keeps specificity at zero so components can hide/resize icons */
:where(svg.icon) {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}

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

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

button {
  cursor: pointer;
}

ul,
ol {
  list-style: none;
}

h1,
h2,
h3,
h4 {
  font-weight: inherit;
  font-size: inherit;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

::selection {
  background: hsl(var(--brand) / 0.22);
}

:focus-visible {
  outline: 2px solid hsl(var(--brand));
  outline-offset: 2px;
}

.theme-dark :focus-visible {
  outline-color: hsl(var(--signal));
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: hsl(var(--navy-950));
}
::-webkit-scrollbar-thumb {
  background: hsl(var(--navy-line));
  border: 2px solid hsl(var(--navy-950));
}
::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--brand) / 0.6);
}

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: hsl(var(--brand));
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.skip-link:focus {
  top: 1rem;
}

/* --------------------------------------------------------------------------
   Utilities (kept deliberately small)
   -------------------------------------------------------------------------- */

.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }
.mt-12 { margin-top: 3rem; }
.mt-14 { margin-top: 3.5rem; }
.mt-16 { margin-top: 4rem; }

.maxw-2xl { max-width: 42rem; }
.mono { font-family: var(--font-mono); }
.text-muted { color: var(--c-muted); font-size: 0.875rem; line-height: 1.625; }

.text-ok { color: hsl(var(--ok)); }
.text-warn { color: hsl(var(--warn)); }
.text-crit { color: hsl(var(--crit)); }
.text-signal { color: hsl(var(--signal)); }
.text-brand { color: hsl(var(--brand)); }

.bg-ok { background: hsl(var(--ok) / 0.7); }
.bg-warn { background: hsl(var(--warn) / 0.8); }
.bg-crit { background: hsl(var(--crit) / 0.8); }

.clamp-3,
.clamp-4 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.clamp-3 { -webkit-line-clamp: 3; line-clamp: 3; }
.clamp-4 { -webkit-line-clamp: 4; line-clamp: 4; }

.text-gradient {
  background-image: linear-gradient(100deg, hsl(222 100% 62%), hsl(var(--signal)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.spin {
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   Scroll reveal (only when JS is running, so content never stays hidden)
   -------------------------------------------------------------------------- */

.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .js .reveal {
    opacity: 1;
    transform: none;
  }
}
