/*
 * SPDX-License-Identifier: MIT
 * Copyright (c) 2026 Jeremiah van Oosten
 *
 * The project site's styles (site/README.md), on the brand's tokens (brand/css/vgl-tokens.css,
 * from docs/assets/brand). They follow the system's light or dark scheme, unless theme.js has
 * set data-theme on the root.
 */

:root {
  --bg: var(--vgl-surface);
  --bg-raised: var(--vgl-surface-raised);
  --bg-code: var(--vgl-surface-raised);
  --border: var(--vgl-border);
  --text: var(--vgl-text);
  --text-muted: var(--vgl-text-muted);
  --accent: var(--vgl-link);
  --accent-strong: var(--vgl-accent);
  --on-accent: #ffffff;
  --radius: 10px;
  --wrap: 1120px;
}

/* What the dark theme changes, by the system's scheme or by choice. The .for-light and .for-dark
   elements are the logo and the switch's icon for each theme. */

.for-dark {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --on-accent: var(--vgl-orbital);
  }

  :root:not([data-theme="light"]) .for-light {
    display: none;
  }

  :root:not([data-theme="light"]) .for-dark {
    display: block;
  }
}

:root[data-theme="dark"] {
  --on-accent: var(--vgl-orbital);
}

:root[data-theme="dark"] .for-light {
  display: none;
}

:root[data-theme="dark"] .for-dark {
  display: block;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--vgl-font-body);
}

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

a:hover {
  text-decoration: underline;
}

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

code,
pre {
  font: 14px/1.5 var(--vgl-font-mono);
}

pre {
  margin: 16px 0;
  padding: 14px 16px;
  overflow-x: auto;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

:not(pre) > code {
  padding: 1px 5px;
  background: var(--bg-code);
  border-radius: 4px;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 16px;
}

/* Navigation bar. */

.bar {
  position: sticky;
  top: 0;
  z-index: 1;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
}

.brand img {
  height: 34px;
  width: auto;
}

h1,
h2,
h3 {
  font-family: var(--vgl-font-display);
}

.hero-logo img {
  width: min(100%, 320px);
  height: auto;
  margin-bottom: 24px;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}

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

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

nav {
  align-items: center;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

.theme-switch:hover {
  color: var(--text);
  border-color: var(--accent);
}

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

.theme-switch svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Hero. */

.hero {
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--border);
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 40px;
  align-items: center;
}

h1 {
  margin: 0 0 16px;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.12;
  letter-spacing: -0.01em;
}

.lead {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 18px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-block;
  padding: 10px 18px;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-weight: 600;
}

.button:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.button.primary {
  color: var(--on-accent);
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.meta {
  margin: 20px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

figure {
  margin: 0;
}

.hero-image img,
.gallery img {
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Sections. */

section.wrap {
  padding-top: 48px;
}

h2 {
  margin: 0 0 20px;
  font-size: 28px;
  line-height: 1.25;
}

h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.grid {
  display: grid;
  gap: 20px;
}

.features {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}

.features article {
  padding: 20px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

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

.gallery {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
}

figcaption {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 14px;
}

.two {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 32px;
}

ol {
  padding-left: 22px;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-muted);
  font-weight: 600;
}

.links {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}

.card {
  display: block;
  padding: 18px 20px;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.card strong {
  display: block;
  margin-bottom: 4px;
}

.card span {
  color: var(--text-muted);
  font-size: 14px;
}

/* Footer. */

footer {
  margin-top: 64px;
  padding: 28px 0 40px;
  color: var(--text-muted);
  font-size: 14px;
  border-top: 1px solid var(--border);
}

footer p {
  margin: 0 0 10px;
}

.credits {
  font-size: 12px;
}

@media (max-width: 800px) {
  .hero {
    padding-top: 32px;
  }

  .hero-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
}
