/* SIQS.NET showcase site — plain CSS, no build step. */

:root {
  --bg: #0d1117;
  --bg-elev: #161b22;
  --bg-elev-2: #1c2330;
  --border: #2a313c;
  --text: #e6edf3;
  --text-dim: #9aa7b4;
  --accent: #58a6ff;
  --accent-2: #7ee787;
  --accent-3: #d2a8ff;
  --code-bg: #12171e;
  --maxw: 1080px;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f9fc;
    --bg-elev: #ffffff;
    --bg-elev-2: #eef2f7;
    --border: #d7dee7;
    --text: #1c2530;
    --text-dim: #5a6675;
    --accent: #0969da;
    --accent-2: #1a7f37;
    --accent-3: #8250df;
    --code-bg: #f2f5f9;
    --shadow: 0 8px 30px rgba(20, 40, 70, 0.08);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Header / nav ---------- */
header.site {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; }
.brand .mark {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  color: var(--accent-2);
}
.nav-links { display: flex; gap: 1.4rem; align-items: center; }
.nav-links a { color: var(--text-dim); font-size: 0.95rem; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links .ghlink { color: var(--text); font-weight: 600; }
@media (max-width: 720px) {
  .nav-links a:not(.ghlink) { display: none; }
}

/* ---------- Hero ---------- */
.hero { padding: 5rem 0 3.5rem; text-align: center; }
.hero .eyebrow {
  font-family: "SFMono-Regular", Consolas, monospace;
  color: var(--accent-3);
  letter-spacing: 0.08em;
  font-size: 0.85rem;
  text-transform: uppercase;
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  line-height: 1.05;
  margin: 0.6rem 0 0.4rem;
  letter-spacing: -0.02em;
}
.hero .tagline {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  color: var(--text);
  font-weight: 500;
  margin: 0 0 0.5rem;
}
.hero p.lede {
  max-width: 680px;
  margin: 0.5rem auto 2rem;
  color: var(--text-dim);
  font-size: 1.08rem;
}
.cta-row { display: flex; gap: 0.9rem; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid var(--border);
  transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { color: #fff; }
.btn-ghost { background: var(--bg-elev); color: var(--text); }

/* ---------- Sections ---------- */
section { padding: 3.5rem 0; border-top: 1px solid var(--border); }
section h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  letter-spacing: -0.01em;
  margin: 0 0 0.4rem;
}
section .section-lede { color: var(--text-dim); max-width: 680px; margin: 0 0 2rem; }

/* ---------- Feature grid ---------- */
.grid {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card .ico { font-size: 1.6rem; }
.card h3 { margin: 0.6rem 0 0.4rem; font-size: 1.15rem; }
.card p { margin: 0; color: var(--text-dim); font-size: 0.97rem; }

/* ---------- Pipeline ---------- */
.pipeline { display: grid; gap: 0.9rem; counter-reset: step; }
.step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
}
.step .num {
  counter-increment: step;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-weight: 700;
  color: var(--accent-2);
  background: var(--bg-elev-2);
  border-radius: 8px;
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
}
.step .num::before { content: counter(step); }
.step h3 { margin: 0.1rem 0 0.2rem; font-size: 1.05rem; }
.step p { margin: 0; color: var(--text-dim); font-size: 0.95rem; }

/* ---------- Code / congruence callout ---------- */
.math-callout {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  text-align: center;
  margin: 1.6rem 0;
}
.math-callout .eq {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  color: var(--accent-2);
}
.math-callout .caption { color: var(--text-dim); font-size: 0.95rem; margin-top: 0.6rem; }

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  overflow-x: auto;
  font-size: 0.9rem;
}
code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
p code, li code {
  background: var(--bg-elev-2);
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  font-size: 0.88em;
}

/* ---------- Repository table ---------- */
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); }
th { background: var(--bg-elev-2); font-weight: 600; }
tr:last-child td { border-bottom: none; }
td code { color: var(--accent-3); }

/* ---------- Footer ---------- */
footer.site {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  color: var(--text-dim);
  font-size: 0.92rem;
}
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer-inner a { color: var(--text-dim); }
.footer-inner a:hover { color: var(--text); }

.note {
  background: var(--bg-elev-2);
  border-left: 3px solid var(--accent-3);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-top: 1.6rem;
}

/* ---------- TL;DR panel ---------- */
.tldr {
  background: var(--bg-elev);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.8rem 2rem;
  margin: 0 auto;
  max-width: 820px;
  text-align: left;
  box-shadow: var(--shadow);
}
.tldr-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.tldr h2 { margin: 0; font-size: 1.4rem; border: none; }
.badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-2);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  white-space: nowrap;
}
.tldr ol { margin: 0.8rem 0 0; padding-left: 1.3rem; }
.tldr ol li { margin-bottom: 1rem; }
.tldr ol li:last-child { margin-bottom: 0; }
.tldr pre { margin: 0.5rem 0 0; }
.tldr p { margin: 0.3rem 0; }

/* ---------- Article (deep-dive) layout ---------- */
.article {
  max-width: 780px;
  margin: 0 auto;
  padding: 3rem 1.25rem 5rem;
}
.article > h1 {
  font-size: clamp(2rem, 5vw, 2.8rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 0.4rem;
}
.article .subtitle { color: var(--text-dim); font-size: 1.1rem; margin: 0 0 2rem; }
.article h2 {
  font-size: 1.7rem;
  letter-spacing: -0.01em;
  margin: 3rem 0 0.8rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.article h3 { font-size: 1.25rem; margin: 2rem 0 0.6rem; }
.article p { margin: 0.9rem 0; }
.article ul, .article ol { padding-left: 1.5rem; }
.article li { margin: 0.35rem 0; }
.article table { margin: 1rem 0; }
.article .table-scroll { margin: 1rem 0; }
.article blockquote {
  margin: 1.2rem 0;
  padding: 0.2rem 1.2rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-elev);
  border-radius: 0 8px 8px 0;
  color: var(--text-dim);
}

/* Table of contents */
.toc {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem 1.6rem;
  margin: 2rem 0;
}
.toc h2 { margin: 0 0 0.6rem; padding: 0; border: none; font-size: 1.05rem; }
.toc ol { margin: 0; padding-left: 1.4rem; columns: 2; column-gap: 2.5rem; }
.toc li { margin: 0.25rem 0; break-inside: avoid; }
.toc a { color: var(--text-dim); }
.toc a:hover { color: var(--accent); }
@media (max-width: 640px) { .toc ol { columns: 1; } }

/* Display math gets breathing room and horizontal scroll on tiny screens */
.article mjx-container[display="true"] {
  margin: 1.2rem 0 !important;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
}

/* Definition callout used in the deep dive */
.defbox {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-2);
  border-radius: 8px;
  padding: 1rem 1.3rem;
  margin: 1.2rem 0;
}
.defbox .deftitle {
  font-weight: 700;
  color: var(--accent-2);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
}
.defbox p { margin: 0.3rem 0; }

/* Back-to-top / prev-next footer nav on article pages */
.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
