/* Shared styles for every page: tokens, type, header, footer, buttons, reveals. */

/* Type follows the original site: JetBrains Mono (the same 2020 file the original loaded) for
   headings, buttons and small code-style labels, and Open Sans for everything else. */
@font-face {
  font-family: "JetBrains Mono Original";
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-original.woff2") format("woff2");
}

:root {
  --blue: #66d6ff;
  --blue-ink: #0b7fae;        /* readable blue for text on light backgrounds */
  --ink: #15171c;
  --ink-2: #3a3f48;
  --muted: #6a707b;
  --paper: #ededeb;
  --paper-2: #e2e2df;
  --card: #ffffff;
  --line: #d3d3cf;
  --night: #0f1216;
  --night-2: #181c23;
  --night-line: #2b313b;
  --night-muted: #9aa2af;

  --sans: "Open Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono Original", "Courier New", monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 12px 32px -12px rgb(0 0 0 / 0.22);
  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 88px;
}

@view-transition { navigation: auto; }

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; }

h1, h2, h3, h4 { margin: 0; }
h1, h2 {
  font-family: var(--mono);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.07em;
  color: #3d4451;
}
h3, h4 {
  font-weight: 600;
  line-height: 1.3;
}
.on-dark h1, .on-dark h2 { color: inherit; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

button { font: inherit; color: inherit; }

[hidden] { display: none !important; }

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

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

.wrap {
  width: min(var(--wrap), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--blue);
  color: var(--ink);
  font-family: var(--mono);
  transform: translateY(-150%);
}
.skip-link:focus { transform: none; }

/* ---------- The highlighter ---------- */
/* The blue marker stroke behind text is the site's signature. It sweeps in when revealed. */

.hl {
  color: var(--ink);
  background: linear-gradient(var(--blue), var(--blue)) no-repeat 0 0 / 100% 100%;
  padding: 0.04em 0.22em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.reveal .hl,
.hl.reveal {
  background-size: 0% 100%;
  transition: background-size 0.9s var(--ease-out) 0.25s;
}
.reveal.is-in .hl,
.hl.reveal.is-in { background-size: 100% 100%; }

.kicker {
  display: inline-block;
  margin-bottom: 14px;
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.kicker::before { content: "// "; color: var(--blue-ink); }
.on-dark .kicker { color: var(--night-muted); }
.on-dark .kicker::before { color: var(--blue); }

.section-title {
  font-size: clamp(38px, 6vw, 68px);
  margin-bottom: 18px;
}

.lede {
  max-width: 62ch;
  font-size: 19px;
  color: var(--ink-2);
}
.on-dark .lede { color: var(--night-muted); }

.mono { font-family: var(--mono); }

/* Phones: same hierarchy, less weight. */
@media (max-width: 760px) {
  .section-title { font-size: clamp(30px, 8.6vw, 38px); margin-bottom: 12px; }
  .lede { font-size: 17px; }
  .kicker { font-size: 13px; margin-bottom: 8px; }
}

/* ---------- Buttons ---------- */
/* Like the original site: a flat fill and a soft drop shadow on hover. The fill darkens a step
   on hover and another on press. Borders, padding and weight never change, so the text never moves. */

.btn {
  --btn-bg: var(--blue);
  --btn-bg-hover: #4fcdfb;
  --btn-bg-active: #36c1f2;
  --btn-fg: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.12);
  transition: background-color 0.2s ease-out, box-shadow 0.25s ease-out;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover,
.btn:focus-visible {
  background: var(--btn-bg-hover);
  box-shadow: 0 5px 11px rgb(0 0 0 / 0.16), 0 3px 12px rgb(0 0 0 / 0.1);
}
.btn:active {
  background: var(--btn-bg-active);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.16);
}

.btn--light {
  --btn-bg: #fff;
  --btn-bg-hover: #f3f4f5;
  --btn-bg-active: #e7e9eb;
  border-color: #d5d7da;
}
.btn--small { padding: 7px 12px; font-size: 13px; font-weight: 400; }
.btn:disabled { opacity: 0.6; cursor: default; }

@media (max-width: 760px) {
  .btn { padding: 11px 16px; font-size: 14px; }
}

/* ---------- Header ---------- */

.site-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 50;
  height: var(--header-h);
  color: var(--ink);
}
.site-header--dark { color: #fff; }

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo { display: block; flex-shrink: 0; }
.logo img { width: clamp(200px, 22vw, 260px); height: auto; margin: 0; }
.logo .logo-white { display: none; }
.site-header--dark .logo .logo-black,
.site-header.is-open .logo .logo-black { display: none; }
.site-header--dark .logo .logo-white,
.site-header.is-open .logo .logo-white { display: block; }

.nav {
  display: flex;
  align-items: center;
  gap: clamp(20px, 3vw, 40px);
}

.nav ul {
  display: flex;
  gap: clamp(16px, 2.4vw, 34px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav a {
  font-size: 16px;
  text-decoration: none;
}

.nav-link {
  position: relative;
  padding: 2px 3px;
  background: linear-gradient(var(--blue), var(--blue)) no-repeat 0 100% / 0% 100%;
  transition: background-size 0.35s var(--ease-out), color 0.2s;
}
.nav-link:hover,
.nav-link[aria-current="page"] {
  background-size: 100% 100%;
  color: var(--ink);
}

.social { display: flex; gap: 14px; }
.social a {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  transition: color 0.2s;
}
.social a:hover { color: var(--blue); }
.social svg { width: 26px; height: 26px; fill: currentColor; }

.nav-toggle {
  display: none;
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.nav-toggle span {
  position: absolute;
  left: 10px;
  right: 10px;
  height: 2px;
  background: currentColor;
  transition: transform 0.3s var(--ease-out), opacity 0.2s;
}
.nav-toggle span:nth-child(1) { top: 15px; }
.nav-toggle span:nth-child(2) { top: 21px; }
.nav-toggle span:nth-child(3) { top: 27px; }
.is-open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.is-open .nav-toggle span:nth-child(2) { opacity: 0; }
.is-open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 820px) {
  :root { --header-h: 72px; }
  .logo img { width: 190px; }
  .nav-toggle { display: block; z-index: 2; }
  .site-header.is-open { color: #fff; }
  .nav {
    position: fixed;
    inset: 0;
    flex-direction: column;
    justify-content: center;
    gap: 40px;
    background: var(--night);
    color: #fff;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
  }
  .is-open .nav { opacity: 1; visibility: visible; }
  .nav ul { flex-direction: column; align-items: center; gap: 22px; }
  .nav a { font-size: 30px; }
  .nav-link:hover, .nav-link[aria-current="page"] { color: var(--ink); }
  .site-header.is-open .logo { position: relative; z-index: 2; }
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--night);
  color: #fff;
  padding: 64px 0 40px;
}

.site-footer .wrap {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px 40px;
}

.site-footer .logo img { width: 220px; }
.site-footer .nav { justify-content: center; }
.site-footer .nav ul { gap: 28px; }
.site-footer .nav-link:hover { color: var(--ink); }

.footer-note {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 24px;
  border-top: 1px solid var(--night-line);
  font-family: var(--mono);
  font-size: 14px;
  color: var(--night-muted);
}

@media (max-width: 820px) {
  .site-footer .wrap { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .site-footer .nav { position: static; flex-direction: row; background: none; opacity: 1; visibility: visible; }
  .site-footer .nav ul { flex-direction: row; gap: 22px; }
  .site-footer .nav a { font-size: 17px; }
  .footer-note { justify-content: center; }
}

/* ---------- Reveal on scroll ---------- */
/* Things fade and fly in as they scroll into view, the way the original site did it. */

.js .reveal,
.js .reveal-left,
.js .reveal-right,
.js .reveal-zoom {
  opacity: 0;
  transition: opacity 0.95s ease-out, transform 0.95s var(--ease-out);
  transition-delay: var(--delay, 0s);
}
.js .reveal { transform: translateY(90px); }
.js .reveal-left { transform: translateX(-140px); }
.js .reveal-right { transform: translateX(140px); }
.js .reveal-zoom { transform: scale(0.9); }
.js .is-in { opacity: 1 !important; transform: none !important; }

@media (max-width: 760px) {
  .js .reveal-left { transform: translateX(-60px); }
  .js .reveal-right { transform: translateX(60px); }
}

/* ---------- Typewriter caret ---------- */

.caret {
  display: inline-block;
  width: 0.08em;
  height: 0.9em;
  margin-left: 0.06em;
  background: var(--blue);
  vertical-align: -0.08em;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
