:root {
  --bg: #ffffff;
  --surface: #f4f5f7;
  --text: #14161a;
  --muted: #4a505c;
  --accent: #2547d0;
  --border: #dfe2e8;
  --max: 68rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1014;
    --surface: #181b21;
    --text: #eceef2;
    --muted: #a7adb9;
    --accent: #8ea6ff;
    --border: #2a2e37;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
}

a {
  color: var(--accent);
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--bg);
}

.skip-link:focus {
  left: 1rem;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

header.site {
  border-bottom: 1px solid var(--border);
}

header.site .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.brand {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

nav a {
  color: var(--muted);
  text-decoration: none;
}

nav a:hover,
nav a[aria-current="page"] {
  color: var(--text);
}

main {
  padding: 3rem 0 4rem;
}

h1 {
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 1.15;
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.5rem;
  margin: 2.5rem 0 0.75rem;
}

.lead {
  font-size: 1.25rem;
  color: var(--muted);
  max-width: 42rem;
}

.button {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.card {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
}

.card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
}

.card p {
  margin: 0;
  color: var(--muted);
}

.prose {
  max-width: 42rem;
}

.notice {
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--accent);
  background: var(--surface);
}

footer.site {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9375rem;
}

footer.site .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

footer.site a {
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

.brand img {
  display: block;
  height: 36px;
  width: auto;
}

.tag {
  display: inline-block;
  margin-bottom: 0.5rem;
  padding: 0.125rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8125rem;
}

.posts {
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.posts li {
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}

.posts h3 {
  margin: 0 0 0.25rem;
  font-size: 1.125rem;
}

.posts p,
.meta {
  margin: 0;
  color: var(--muted);
}

.card .meta {
  margin-top: 0.5rem;
}

/* Home page hero with the transformer animation. */
.hero {
  display: grid;
  gap: 2rem;
  align-items: center;
}

@media (min-width: 52rem) {
  .hero {
    grid-template-columns: 1.1fr 1fr;
  }
}

.tf-figure {
  margin: 0;
}

.tf-figure figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.tf {
  display: block;
  width: 100%;
  max-width: 30rem;
  height: auto;
  margin: 0 auto;
}

.tf-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: var(--sw);
  stroke-linecap: round;
  stroke-dasharray: 3 5;
  opacity: calc(var(--w) * 0.3);
  animation: tf-attend 5s ease-in-out infinite, tf-flow 1.2s linear infinite;
}

.w1 { --w: 1; --sw: 2.75px; }
.w2 { --w: 0.7; --sw: 1.75px; }
.w3 { --w: 0.45; --sw: 1px; }

.tf-l1 .tf-line { animation-delay: 0.3s, 0s; }
.tf-l2 .tf-line { animation-delay: 1.3s, 0s; }
.tf-l3 .tf-line { animation-delay: 2.3s, 0s; }

.tf-node {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 2px;
  animation: tf-fire 5s ease-out infinite;
}

.tf-n1 .tf-node { animation-delay: 1s; }
.tf-n2 .tf-node { animation-delay: 2s; }
.tf-n3 .tf-node { animation-delay: 3s; }

.tf-token rect {
  fill: var(--surface);
  stroke: var(--border);
}

.tf-token text,
.tf-label {
  fill: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-anchor: middle;
}

.tf-label {
  fill: var(--muted);
  font-size: 11px;
  text-anchor: start;
}

.tf-out-line {
  stroke: var(--accent);
  stroke-width: 2px;
  stroke-dasharray: 3 4;
}

.tf-out rect {
  fill: var(--accent);
  stroke: none;
}

.tf-out text {
  fill: var(--bg);
}

.tf-out,
.tf-out-line {
  animation: tf-predict 5s ease-in-out infinite;
}

@keyframes tf-attend {
  0%, 100% { opacity: calc(var(--w) * 0.3); }
  10% { opacity: var(--w); }
  35% { opacity: calc(var(--w) * 0.3); }
}

@keyframes tf-flow {
  to { stroke-dashoffset: -16; }
}

@keyframes tf-fire {
  0%, 20%, 100% { fill: var(--surface); }
  6% { fill: var(--accent); }
}

@keyframes tf-predict {
  0%, 66%, 100% { opacity: 0.15; }
  76%, 94% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .tf-line,
  .tf-node,
  .tf-out,
  .tf-out-line {
    animation: none;
  }

  .tf-line {
    opacity: calc(var(--w) * 0.8);
  }
}

.tf-canvas {
  display: block;
  width: 100%;
  max-width: 30rem;
  aspect-ratio: 440 / 330;
  margin: 0 auto;
}

.tf-3d .tf {
  display: none;
}
