/* ============================================================================
   base.css — reset, document defaults, shared primitives.
   Component styling lives in main.css.
   ========================================================================== */

/* ---- Reset -----------------------------------------------------------
   The old site used `* { transition: all .25s }`, which forced the browser
   to watch every animatable property on every element in the document —
   including ones that trigger layout. Transitions are declared per
   component instead, on transform/opacity/colour only.                   */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

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

body {
  min-height: 100svh;
  background-color: var(--c-bg);
  color: var(--c-ink-2);
  font-family: var(--f-body);
  font-size: var(--t-body);
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

img {
  height: auto;
}

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

ul[class],
ol[class] {
  list-style: none;
  padding: 0;
}

/* ---- Headings --------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  font-family: var(--f-display);
  color: var(--c-ink);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

/* ---- Links ------------------------------------------------------------ */
a {
  color: var(--c-violet);
  text-decoration-color: rgba(192, 132, 252, 0.35);
  text-underline-offset: 0.22em;
  transition: color var(--dur-fast) var(--ease),
              text-decoration-color var(--dur-fast) var(--ease);
}

a:hover {
  color: var(--c-ink);
  text-decoration-color: currentColor;
}

/* ---- Focus -----------------------------------------------------------
   Visible, branded, and never removed. :focus-visible so a mouse click
   doesn't leave a ring behind but keyboard navigation always does.       */
:focus-visible {
  outline: 2px solid var(--c-violet);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

/* ---- Selection & scrollbar -------------------------------------------- */
::selection {
  background: rgba(168, 85, 247, 0.32);
  color: #fff;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(168, 85, 247, 0.5) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--c-bg);
}

::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.42);
  border: 2px solid var(--c-bg);
  border-radius: var(--r-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(168, 85, 247, 0.7);
}

/* ---- Layout primitives ------------------------------------------------ */
.wrap {
  width: 100%;
  max-width: var(--w-max);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

.section {
  position: relative;
  padding-block: var(--s-section);
}

.section--alt {
  background: var(--c-bg-alt);
  border-block: 1px solid var(--c-line);
}

/* ---- Accessibility helpers -------------------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 999;
  padding: var(--s-3) var(--s-5);
  background: var(--c-raised);
  color: var(--c-ink);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--c-line-hi);
  border-radius: 0 0 var(--r-md) var(--r-md);
  transform: translate(-50%, -110%);
  transition: transform var(--dur-fast) var(--ease);
}

.skip-link:focus-visible {
  transform: translate(-50%, 0);
}

/* ---- Scroll-reveal ----------------------------------------------------
   Deliberately scoped to `.js`. The class is added by an inline script in
   <head> before first paint, so if that script never runs — JS disabled, a
   CSP block, a failed request — the rule below never applies and every
   element renders normally. Hiding content by default and *hoping* a script
   arrives to reveal it is how portfolios end up as a blank page.          */
.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--dur-slow) var(--ease),
              transform var(--dur-slow) var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}

.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

/* ---- Reduced motion ---------------------------------------------------
   Honours the OS setting: kills the aurora drift, the reveal shift and
   smooth scrolling for anyone who has asked for less movement.           */
@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;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }
}
