/* Dark-first, one column on a faint dot grid, everything set in a monospace face.
   The font files live in /fonts (IBM Plex Mono, SIL Open Font License), so nothing is downloaded from other sites. */

@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  --bg: #0b0e15;
  --surface: #111724;
  --fg: #d9e2f2;
  --muted: #8b95a7;
  --line: #283349;
  --accent: #8fb0f7;
  --dot: #151b28;

  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --font-body: var(--font-mono);

  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f9fc;
    --surface: #ffffff;
    --fg: #17202d;
    --muted: #5c6678;
    --line: #cdd8e7;
    --accent: #3e66ad;
    --dot: #e4eaf3;
    color-scheme: light;
  }
}

:root[data-theme="light"] {
  --bg: #f6f9fc;
  --surface: #ffffff;
  --fg: #17202d;
  --muted: #5c6678;
  --line: #cdd8e7;
  --accent: #3e66ad;
  --dot: #e4eaf3;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.875rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

.page {
  max-width: 42rem;
  margin: 0 auto;
  padding-block: 2rem 3rem;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
}

/* Top bar */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.9375rem;
}

.site-name {
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
}

.site-name::before {
  content: "~/";
  color: var(--accent);
}

.site-nav {
  display: flex;
  gap: 1.25rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  text-transform: lowercase;
}

.site-nav a::before {
  content: "/ ";
  color: var(--line);
}

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

.site-nav a[aria-current="page"]::before {
  color: var(--accent);
}

/* Home intro */

.intro {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-block: 2rem 0;
}

.intro h1 {
  font-size: clamp(1.75rem, 5.5vw, 2.5rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.cursor {
  display: inline-block;
  width: 0.5em;
  height: 0.85em;
  margin-left: 0.08em;
  background: var(--accent);
  vertical-align: -0.05em;
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cursor {
    animation: none;
  }
}

/* Text */

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
  text-wrap: balance;
}

h1 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

h2 {
  margin-top: 2.75rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

h2::before {
  content: "## ";
  color: var(--accent);
}

h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

p,
ul {
  margin: 1rem 0 0;
}

h1 + p,
h2 + p,
h2 + ul {
  margin-top: 0.75rem;
}

ul {
  padding-left: 1.25rem;
}

li + li {
  margin-top: 0.45rem;
}

li::marker {
  color: var(--accent);
}

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

.lead p {
  margin: 0;
}

.lead p + p {
  margin-top: 0.25rem;
}

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

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent);
  text-underline-offset: 0.22rem;
}

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

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

.label {
  color: var(--muted);
}

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

/* Link buttons on the home page */

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.links li + li {
  margin-top: 0;
}

.links a {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}

.links a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.links a::after {
  content: " ↗";
  color: var(--muted);
}

/* Project card */

.project {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.project > p:first-of-type {
  margin-top: 0.5rem;
  color: var(--muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.tags li + li {
  margin-top: 0;
}

.tags li {
  padding: 0.1rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent);
}

/* Footer */

.site-footer {
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.site-footer p {
  margin: 0;
}

/* Narrow screens */

@media (max-width: 30rem) {
  .project {
    padding: 1.125rem 1rem;
  }
}

a {
  overflow-wrap: anywhere;
}
