/* Reset, typography and the few global rules every page relies on. */

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
  /* Keyboard and controller focus scrolls targets clear of the fixed bars. */
  scroll-padding-top: calc(var(--topbar-height) + var(--banner-height) + var(--safe-top) + 16px);
  scroll-padding-bottom: calc(var(--tabbar-height) + var(--safe-bottom) + 16px);
  touch-action: manipulation;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs-body) / 1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

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

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

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

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

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

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  text-align: inherit;
}

button:disabled {
  cursor: default;
}

::selection {
  background: rgba(76, 125, 255, 0.45);
  color: #fff;
}

::placeholder {
  color: var(--text-placeholder);
  opacity: 1;
}

/* One focus treatment everywhere: a white ring with a dark gap, the convention
   on consoles, legible on art and on flat surfaces alike. */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

/* Headings that receive focus after a page change are not controls. */
[tabindex="-1"]:focus-visible {
  outline: none;
}

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

code {
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  word-break: break-word;
}

/* ---------- type scale ---------- */

.t-display-1,
.t-display-2,
.t-display-3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: var(--tracking-display);
  line-height: 1.05;
}

.t-display-1 {
  font-size: var(--fs-display-1);
}

.t-display-2 {
  font-size: var(--fs-display-2);
}

.t-display-3 {
  font-size: var(--fs-display-3);
}

.t-title-1,
.t-title-2 {
  font-family: var(--font-display);
  font-weight: 650;
  letter-spacing: -0.012em;
  line-height: 1.2;
}

.t-title-1 {
  font-size: var(--fs-title-1);
}

.t-title-2 {
  font-size: var(--fs-title-2);
}

.t-caption {
  font-size: var(--fs-caption);
  line-height: 1.4;
  color: var(--text-2);
}

.t-label {
  font-size: var(--fs-label);
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-2);
}

.t-num {
  font-variant-numeric: tabular-nums;
}

.t-muted {
  color: var(--text-2);
}

/* ---------- icons ---------- */

.icon {
  width: 24px;
  height: 24px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.icon-sm {
  width: 18px;
  height: 18px;
}

.icon-xs {
  width: 16px;
  height: 16px;
}

.icon-lg {
  width: 28px;
  height: 28px;
}

/* ---------- utilities ---------- */

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

.skip-link {
  position: fixed;
  top: calc(var(--safe-top) + 12px);
  left: 12px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: var(--text);
  color: var(--bg);
  font-weight: 650;
  transform: translateY(-200%);
  transition: transform var(--dur) var(--ease);
}

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

.ellipsis {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Scrollbars stay out of the way on dark surfaces. */
html {
  scrollbar-color: #2b303b var(--bg);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
