/* Reset, font, typography, focus, view transitions, reduced motion. Requires tokens.css. */

/* Font: official file, unmodified (see docs/ConnectionGuide.txt) */
@font-face {
  font-family: "General Sans";
  src: url("../fonts/GeneralSans-Variable.woff2") format("woff2");
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}

/* Cross-document view transitions (progressive enhancement) */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }

  @keyframes vt-fade-out {
    to { opacity: 0; }
  }

  @keyframes vt-slide-in-forward {
    from {
      opacity: 0;
      transform: translateY(12px);
    }
  }

  @keyframes vt-slide-in-back {
    from {
      opacity: 0;
      transform: translateY(-12px);
    }
  }

  :active-view-transition-type(forward)::view-transition-old(root) {
    animation: 180ms var(--ease) both vt-fade-out;
  }

  :active-view-transition-type(forward)::view-transition-new(root) {
    animation: 260ms var(--ease) both vt-slide-in-forward;
  }

  :active-view-transition-type(back)::view-transition-old(root) {
    animation: 180ms var(--ease) both vt-fade-out;
  }

  :active-view-transition-type(back)::view-transition-new(root) {
    animation: 260ms var(--ease) both vt-slide-in-back;
  }
}

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

* {
  margin: 0;
}

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

body {
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: var(--fw-body);
  letter-spacing: var(--ls-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

img,
video {
  height: auto;
}

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

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

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

table {
  border-collapse: collapse;
}

dialog {
  padding: 0;
  border: 0;
}

[hidden] {
  display: none !important;
}

/* Typography */
h1,
h2,
h3,
h4 {
  color: var(--ink);
  overflow-wrap: break-word;
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-hero);
  font-weight: var(--fw-hero);
  letter-spacing: var(--ls-hero);
  line-height: var(--lh-hero);
}

h2,
h3 {
  font-size: var(--fs-h3);
  font-weight: var(--fw-h3);
  letter-spacing: var(--ls-h3);
  line-height: var(--lh-h3);
}

h4 {
  font-size: var(--fs-body);
  font-weight: var(--fw-h3);
  line-height: var(--lh-body);
}

p {
  overflow-wrap: break-word;
  text-wrap: pretty;
}

strong {
  font-weight: var(--fw-h3);
}

small {
  font-size: var(--fs-small);
  font-weight: var(--fw-small);
  letter-spacing: var(--ls-small);
  line-height: var(--lh-small);
}

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

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

/* Focus */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Utilities */
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.sr-only,
.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.skip-link {
  position: fixed;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 100;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-control);
  background: var(--ink);
  color: var(--bg);
  font-size: var(--fs-small);
  font-weight: var(--fw-small);
  letter-spacing: var(--ls-small);
  line-height: var(--lh-small);
  transform: translateY(-200%);
}

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

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}
