:root {
  color-scheme: dark;
  --bg: #07090d;
  --surface: rgba(18, 23, 31, 0.72);
  --surface-solid: #10151c;
  --text: #e6edf3;
  --muted: #8b97a6;
  --border: #1e2632;
  --border-hi: #2c3a4b;
  --accent: #5eead4;
  --accent-2: #818cf8;
  --glow: rgba(94, 234, 212, 0.18);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max: 920px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(129, 140, 248, 0.16), transparent 60%),
    radial-gradient(700px 420px at 5% 0%, rgba(94, 234, 212, 0.12), transparent 60%),
    linear-gradient(var(--bg), var(--bg));
  background-attachment: fixed;
}

/* Faint engineering grid, fading out toward the bottom */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 75%);
          mask-image: linear-gradient(to bottom, #000 0%, transparent 75%);
}

::selection { background: rgba(94, 234, 212, 0.3); }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(94, 234, 212, 0.3);
  transition: color .15s, border-color .15s;
}
a:hover { color: #99f6e4; border-color: currentColor; }

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

/* Header */
header.site {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(7, 9, 13, 0.7);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.brand {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--text);
  border: 0;
}
.brand::before { content: "~/"; color: var(--accent); }
.brand::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 15px;
  margin-left: 4px;
  vertical-align: -2px;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
.brand:hover { color: var(--text); }

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

nav { display: flex; flex-wrap: wrap; gap: 6px; }

nav a {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 10px;
}
nav a:hover { color: var(--text); border-color: var(--border-hi); }
nav a[aria-current="page"] {
  color: var(--accent);
  border-color: rgba(94, 234, 212, 0.35);
  background: rgba(94, 234, 212, 0.06);
}

main { flex: 1; padding: 88px 0 96px; }

/* Hero */
.hero h1 {
  font-size: clamp(36px, 7vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.035em;
  font-weight: 700;
  margin: 0 0 20px;
  max-width: 16ch;
  background: linear-gradient(120deg, #ffffff 30%, var(--accent) 70%, var(--accent-2));
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}

.hero h1::before {
  content: "// quilateral";
  display: block;
  margin-bottom: 18px;
  font: 500 13px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  -webkit-text-fill-color: var(--accent);
}

.hero p {
  font-size: 19px;
  color: var(--muted);
  max-width: 580px;
  margin: 0;
}

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 56px;
}
.cards + .cards { margin-top: 16px; }

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 22px 24px;
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 22px;
  right: 22px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity .2s;
}
.card:hover {
  border-color: var(--border-hi);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px -12px var(--glow);
}
.card:hover::before { opacity: 1; }

.card h2 {
  font: 600 14px/1.4 var(--mono);
  letter-spacing: 0.02em;
  margin: 0 0 8px;
  color: var(--text);
}
.card h2::before { content: "> "; color: var(--accent); }

.card p { margin: 0; color: var(--muted); font-size: 15px; }
.card p + p { margin-top: 12px; }

/* Long-form pages */
article { max-width: 720px; }

article h1 {
  font-size: clamp(32px, 5vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 10px;
}

article .meta {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

article h2 {
  font-size: 20px;
  letter-spacing: -0.01em;
  margin: 48px 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
article h2::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  flex: none;
}

article h3 {
  font-size: 16px;
  margin: 28px 0 4px;
  color: var(--text);
}

article p, article li { color: #c4ccd6; }
article strong { color: var(--text); }

article ul { padding-left: 0; list-style: none; }
article li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 8px;
}
article li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-family: var(--mono);
}

.callout {
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.07), rgba(129, 140, 248, 0.06));
  border: 1px solid rgba(94, 234, 212, 0.25);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 20px 24px;
  margin: 28px 0;
}
.callout p { margin: 0; }

/* Footer */
footer.site {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font: 13px/1.5 var(--mono);
}

footer.site .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding-top: 24px;
  padding-bottom: 32px;
}

footer.site a { color: var(--muted); border: 0; margin-left: 18px; }
footer.site a:first-child { margin-left: 0; }
footer.site a:hover { color: var(--accent); }

@media (max-width: 560px) {
  header.site .wrap { flex-direction: column; align-items: flex-start; gap: 10px; }
  nav a { padding: 5px 8px; }
  main { padding: 56px 0 72px; }
  .hero p { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .brand::after { animation: none; }
  .card, .card::before, a { transition: none; }
  .card:hover { transform: none; }
}
