/* Reset, typography, shared components (buttons, links, chips), reveal states. */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--outer-bg);
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--outer-bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.55;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

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

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

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

::selection {
  background: #f5f5f5;
  color: #080808;
}

/* ---- focus: always visible, never removed ---- */
:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}
:focus:not(:focus-visible) {
  outline: none;
}
#main:focus {
  outline: none;
}

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

.skip-link {
  position: fixed;
  z-index: 200;
  top: 12px;
  left: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: #f5f5f5;
  color: #080808;
  font-size: var(--fs-small);
  font-weight: 500;
  transform: translateY(-160%);
  transition: transform 0.25s var(--ease);
}
.skip-link:focus {
  transform: none;
  outline-color: #080808;
}

/* page is hidden only until the content is rendered (boot.js guarantees it can never stay hidden) */
.outer {
  transition: opacity 0.6s var(--ease);
}
html.js:not(.ready) .outer {
  opacity: 0;
}

/* ---- typographic helpers ---- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
}
.eyebrow .num {
  color: var(--text-3);
  margin-right: 0.9em;
}

.accent {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.015em;
}
.accent--fade {
  background: linear-gradient(180deg, #fff 8%, rgba(255, 255, 255, 0.42) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: rgba(255, 255, 255, 0.7); /* fallback when background-clip:text is unsupported */
  /* italic glyphs overhang their box; keep the gradient from clipping them */
  padding-inline-end: 0.12em;
  margin-inline-end: -0.12em;
}

/* ---- buttons ---- */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--text);
  --btn-bd: var(--border-strong);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding: 0 22px 0 24px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
  transition: color 0.35s var(--ease), border-color 0.35s var(--ease), background-color 0.35s var(--ease), transform 0.5s var(--ease);
  will-change: transform;
}
.btn::before {
  /* the inversion layer that slides in on hover */
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--btn-fg);
  transform: translateY(101%);
  transition: transform 0.5s var(--ease);
  border-radius: inherit;
}
.btn .btn__icon {
  width: 16px;
  height: 16px;
  flex: none;
  transition: transform 0.5s var(--ease);
}
.btn--primary {
  --btn-bg: #f5f5f5;
  --btn-fg: #080808;
  --btn-bd: #f5f5f5;
}
.btn--primary::before {
  background: #080808;
}
.btn:hover,
.btn:focus-visible {
  color: var(--btn-bg-hover, #080808);
}
.btn--primary:hover,
.btn--primary:focus-visible {
  color: #f5f5f5;
  border-color: #f5f5f5;
}
.btn:hover::before,
.btn:focus-visible::before {
  transform: none;
}
.btn:hover .btn__icon,
.btn:focus-visible .btn__icon {
  transform: translate(2px, 2px);
}
.btn--ghost:hover,
.btn--ghost:focus-visible {
  color: #080808;
  border-color: #f5f5f5;
}
.btn--sm {
  height: 38px;
  padding: 0 16px 0 18px;
  font-size: var(--fs-small);
}

/* ---- underline-grow link ---- */
.link-u {
  position: relative;
  display: inline-block;
}
.link-u::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s var(--ease);
}
.link-u:hover::after,
.link-u:focus-visible::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* ---- chips ---- */
.chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.04em;
  color: var(--text-2);
  white-space: nowrap;
}

/* ---- scroll reveal (only when animations are on; otherwise everything is simply visible) ---- */
html.anim [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
  transition-delay: var(--d, 0ms);
}
html.anim [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* ---- page transition (View Transitions API, progressive enhancement) ---- */
#main {
  view-transition-name: page;
}
::view-transition-old(page) {
  animation: 260ms var(--ease-in-out) both vt-out;
}
::view-transition-new(page) {
  animation: 520ms var(--ease) both vt-in;
}
@keyframes vt-out {
  to {
    opacity: 0;
    transform: translateY(-12px);
  }
}
@keyframes vt-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

/* ---- reduced motion: no movement, no long fades ---- */
@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;
  }
}

/* ---- icons ---- */
.icon {
  width: 1em;
  height: 1em;
  flex: none;
}

/* magnetic buttons move with `translate`, so it needs its own (slightly looser) transition */
.btn[data-magnetic] {
  transition-property: color, border-color, background-color, transform, translate;
  transition-duration: 0.35s, 0.35s, 0.35s, 0.5s, 0.45s;
  transition-timing-function: var(--ease);
}
