/* The public pages. Colours are var(--ss-*) from lib/theme/themes.ts; the swirl's
   are set by site.js. Sizes and motion come from app/globals.css. */

@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url(./fonts/inter-normal-400.woff2) format("woff2");
  unicode-range:
    U+0-FF, U+131, U+152-153, U+2BB-2BC, U+2C6, U+2DA, U+2DC, U+304, U+308, U+329, U+2000-206F, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter Tight";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(./fonts/inter-tight-normal.woff2) format("woff2");
  unicode-range:
    U+0-FF, U+131, U+152-153, U+2BB-2BC, U+2C6, U+2DA, U+2DC, U+304, U+308, U+329, U+2000-206F, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  overscroll-behavior-y: none;
}
body {
  overscroll-behavior-y: none;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ss-page);
  color: var(--ss-fg);
  font-family: var(--ss-font-sans);
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--ss-link);
}
a:focus-visible {
  outline: 2px solid var(--ss-focus);
  outline-offset: 3px;
}
::selection {
  background: var(--ss-selection);
  color: var(--ss-selection-fg);
}

/* The swirl: pastel washes on slow orbits, picked per visit by site.js. */
.swirl {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--swirl-base, var(--ss-surface));
  color: var(--swirl-deep, var(--ss-fg));
}
.orbit {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  aspect-ratio: 1;
  transform-origin: var(--ox) var(--oy);
  animation: spin var(--dur) linear infinite;
  animation-direction: var(--dir);
  animation-delay: var(--delay);
  will-change: transform;
}
.drift {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--c) 0%, var(--c) 22%, transparent 100%);
  opacity: var(--o);
  animation: drift var(--dur2) ease-in-out infinite alternate;
  animation-delay: var(--delay);
  will-change: transform;
}
.paused .orbit,
.paused .drift {
  animation-play-state: paused;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes drift {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(var(--dx), var(--dy)) scale(1.12);
  }
  100% {
    transform: translate(calc(var(--dx) * -0.6), calc(var(--dy) * 0.8)) scale(0.92);
  }
}
.grain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.35;
  mix-blend-mode: soft-light;
  pointer-events: none;
}
.layer {
  position: relative;
  z-index: 1;
}

/* The wordmark: Inter Tight, no mark. */
.wordmark {
  color: inherit;
  font-family: var(--ss-font-display);
  font-weight: 600;
  font-size: 24px;
  line-height: 30px;
  letter-spacing: -0.02em;
  text-decoration: none;
}

/* Sign in on the swirl: a pill tinted with the palette, in its deep tone.
   On hover the tint fills in. */
.signin {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--swirl-pill, var(--ss-surface));
  color: inherit;
  font-size: var(--text-body);
  line-height: var(--text-body--line-height);
  font-weight: 500;
  text-decoration: none;
}
.signin {
  transition: background-color 0.2s ease;
}
@media (hover: hover) {
  .signin:hover {
    background: var(--swirl-pill-hover, var(--ss-hover));
  }
}
.swirl a:focus-visible {
  outline-color: currentColor;
}

/* The bar at the top of the reading pages: the swirl, 88 px, no inkblot. */
.bar {
  height: 88px;
  flex: none;
}
.bar .layer {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(20px, 5vw, 64px);
}

/* Page frame and opening. */
.page {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 88px clamp(20px, 5vw, 64px) 120px;
  flex: 1 0 auto;
}
.opening {
  max-width: 672px;
  margin-bottom: 56px;
}
.label {
  margin: 0 0 16px;
  font-size: var(--text-label);
  line-height: var(--text-label--line-height);
  font-weight: 500;
  color: var(--ss-fg-3);
}
h1 {
  margin: 0;
  font-family: var(--ss-font-display);
  font-weight: 500;
  font-size: 56px;
  line-height: 60px;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.meta {
  margin: 16px 0 0;
  font-size: var(--text-meta);
  line-height: var(--text-meta--line-height);
  color: var(--ss-fg-3);
}
.lead {
  margin: 20px 0 0;
  font-size: var(--text-lead);
  line-height: 30px;
  color: var(--ss-fg-2);
}

/* Legal pages: a contents list beside a 672px text column. */
.cols {
  display: flex;
  flex-wrap: wrap;
  gap: 64px;
  align-items: flex-start;
}
.toc {
  flex: 0 0 200px;
  position: sticky;
  top: 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 6px;
}
.toc a {
  font-size: var(--text-meta);
  line-height: var(--text-meta--line-height);
  color: var(--ss-fg-2);
  text-decoration: none;
}
.toc a:hover {
  color: var(--ss-fg);
}
.text {
  flex: 999 1 560px;
  min-width: 0;
  max-width: 672px;
}

/* Sections. */
.part {
  max-width: 672px;
  scroll-margin-top: 32px;
}
.part + .part {
  margin-top: 48px;
}
h2 {
  margin: 0 0 12px;
  font-family: var(--ss-font-display);
  font-weight: 500;
  font-size: var(--text-title);
  line-height: var(--text-title--line-height);
  letter-spacing: var(--tracking-title);
}
h3 {
  margin: 0 0 4px;
  font-size: var(--text-lead);
  line-height: var(--text-lead--line-height);
  font-weight: 500;
}
.doc {
  font-size: 17px;
  line-height: 28px;
}
.doc p,
.doc ul {
  margin: 0;
}
.doc > :not(:first-child) {
  margin-top: 16px;
}
.doc ul {
  padding-left: 20px;
}
.doc li + li {
  margin-top: 10px;
}
.doc strong {
  font-weight: 500;
}
.doc .lead {
  margin: 0;
}

/* Tables sit in a ringed box that scrolls sideways on a phone. */
.scroll {
  overflow-x: auto;
  border: 1px solid var(--ss-border);
  border-radius: var(--radius-row);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-body);
  line-height: var(--text-body--line-height);
}
th,
td {
  text-align: left;
  vertical-align: top;
  padding: 12px 16px;
}
th {
  font-weight: 500;
  background: var(--ss-surface);
}
td {
  border-top: 1px solid var(--ss-border);
}
td + td {
  color: var(--ss-fg-2);
}

/* The foot: copyright and the two legal links, quiet. */
.legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 20px;
  padding: 24px;
  font-size: var(--text-meta);
  line-height: var(--text-meta--line-height);
  color: var(--ss-fg-3);
}
.legal a {
  color: inherit;
  text-decoration: none;
}
.legal a:hover {
  color: var(--ss-fg);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 860px) {
  .toc {
    display: none;
  }
  h1 {
    font-size: 40px;
    line-height: 46px;
  }
  .page {
    padding-top: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .orbit,
  .drift {
    animation: none;
  }
}
