/* ---------- Fonts (self-hosted, SIL Open Font License) ---------- */

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Syne";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/assets/fonts/syne-latin-800-normal.woff2") format("woff2");
}

/* ---------- Tokens ---------- */

:root {
  --bg: #0b0b0e;
  --text: #f2f2f5;
  --text-soft: #c3c3ce;
  --text-mute: #9a9aa8;
  --line: #454554;          /* contour lines */
  --accent: #8587ff;        /* every 4th contour line */
  --name: #9ea0ff;          /* wordmark fill */
  --name-edge: #5d5fb8;     /* wordmark edge */
  --border: #3a3a52;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  /* ASCII cell size; main.js reads the computed values */
  --cell-font: 14px;
  --cell-line: 17px;

  color-scheme: dark;
}

@media (max-width: 640px) {
  :root {
    --cell-font: 8px;
    --cell-line: 10px;
  }
}

/* ---------- Base ---------- */

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

html {
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */

.page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 6vw, 80px);
}

.content {
  position: relative;
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  text-align: center;
}

/* Reserves the space where main.js draws the ASCII wordmark */
.spacer {
  width: 100%;
  height: clamp(92px, 16vw, 210px);
}

.lead {
  margin: 0;
  max-width: 54ch;
  font-size: clamp(15px, 1.3vw, 17px);
  line-height: 1.7;
  color: var(--text-soft);
  text-wrap: pretty;
}

.note {
  margin: 0;
  max-width: 54ch;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-mute);
}

/* ---------- ASCII layers ---------- */

.layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.grid {
  font-family: var(--mono);
  font-size: var(--cell-font);
  line-height: var(--cell-line);
}

.grid pre {
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
  font: inherit;
  user-select: none;
}

.lines  { color: var(--line); }
.accent { color: var(--accent); }
.edge   { color: var(--name-edge); }
.name   { color: var(--name); }

.probe {
  position: absolute;
  visibility: hidden;
  white-space: pre;
}

.veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse 58% 62% at 50% 50%,
    rgba(11, 11, 14, 0.97) 0%,
    rgba(11, 11, 14, 0.92) 48%,
    rgba(11, 11, 14, 0) 100%
  );
}

/* ---------- Links ---------- */

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(11, 11, 14, 0.6);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}

.button svg {
  flex: none;
  color: var(--name);
}

.button:hover {
  color: #a9abff;
  border-color: var(--accent);
  background: rgba(133, 135, 255, 0.1);
}

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

/* ---------- Heading ---------- */

/* With JavaScript the name is drawn in ASCII; the real heading stays for
   screen readers and search engines. */
.title {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Without JavaScript: show the plain heading instead. */
.no-js .title {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip-path: none;
  font-family: "Syne", system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(72px, 15vw, 200px);
  line-height: 0.85;
  letter-spacing: -0.04em;
  color: var(--name);
}

.no-js .spacer {
  display: none;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 640px) {
  /* Taller wordmark area: the letters are stretched to fill it */
  .spacer {
    height: 132px;
  }

  /* Content spans the full width here, so the veil has to as well */
  .veil {
    background: radial-gradient(
      ellipse 130% 52% at 50% 50%,
      rgba(11, 11, 14, 0.97) 0%,
      rgba(11, 11, 14, 0.92) 62%,
      rgba(11, 11, 14, 0) 100%
    );
  }
}

@media (prefers-reduced-motion: reduce) {
  .button {
    transition: none;
  }
}
