/* JanusHDL site: one stylesheet, dark by default, light on request. */
:root {
  --bg: #0b0e14;
  --bg2: #111622;
  --card: #141a28;
  --line: rgba(255, 255, 255, 0.09);
  --fg: #e8ecf4;
  --muted: #98a2b8;
  --accent: #5ab0ff;
  --accent2: #7ee0a8;
  --accent3: #c39bff;
  --warn: #ffcc66;
  --code: #0f1420;
  --radius: 14px;
  --maxw: 72rem;
  /* The space beside the content: more on middle widths, the same
     content width on wide ones. */
  --gutter: clamp(1.25rem, 5vw, 4rem);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f8fc; --bg2: #eef2f9; --card: #ffffff; --line: rgba(10, 20, 40, 0.1);
    --fg: #121826; --muted: #586378; --accent: #1f6fd0; --accent2: #1f8f55; --accent3: #7a4fd0;
    --warn: #a86b00; --code: #f0f3f9; color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f6f8fc; --bg2: #eef2f9; --card: #ffffff; --line: rgba(10, 20, 40, 0.1);
  --fg: #121826; --muted: #586378; --accent: #1f6fd0; --accent2: #1f8f55; --accent3: #7a4fd0;
  --warn: #a86b00; --code: #f0f3f9; color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--fg);
  font: 16.5px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, kbd { font-family: ui-monospace, "Cascadia Mono", "JetBrains Mono", Consolas, monospace; font-size: 0.92em; }
code { background: var(--code); border: 1px solid var(--line); border-radius: 6px; padding: 0.08em 0.35em; }
pre { background: var(--code); border: 1px solid var(--line); border-radius: 10px; padding: 0.9rem 1rem; overflow-x: auto; line-height: 1.45; }
pre code { background: none; border: 0; padding: 0; }
.wrap { max-width: calc(var(--maxw) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }

/* Header */
header.site {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(140%) blur(10px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line);
}
header.site .wrap { display: flex; align-items: center; gap: 1rem; height: 3.6rem; }
.brand { display: flex; align-items: center; gap: 0.55rem; font-weight: 700; color: var(--fg); letter-spacing: 0.01em; }
.brand:hover { text-decoration: none; }
.brand svg { width: 28px; height: 28px; }
nav.main { display: flex; gap: 0.15rem; margin-left: auto; flex-wrap: wrap; }
nav.main a { color: var(--muted); padding: 0.4rem 0.6rem; border-radius: 8px; font-size: 0.95rem; }
nav.main a:hover, nav.main a.here { color: var(--fg); background: var(--bg2); text-decoration: none; }
.theme { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 0.3rem 0.5rem; cursor: pointer; }
.menu { display: none; background: none; border: 1px solid var(--line); color: var(--fg); border-radius: 8px; padding: 0.3rem 0.6rem; margin-left: auto; }
@media (max-width: 860px) {
  .menu { display: block; }
  nav.main { display: none; position: absolute; top: 3.6rem; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--line); flex-direction: column; padding: 0.5rem 1.25rem 1rem; }
  nav.main.open { display: flex; }
}

/* Hero */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.55; }
.hero .glow { position: absolute; inset: -20% -10% auto -10%; height: 140%; background:
  radial-gradient(40rem 22rem at 20% 30%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
  radial-gradient(36rem 20rem at 85% 60%, color-mix(in srgb, var(--accent3) 18%, transparent), transparent 70%);
  pointer-events: none; }
.hero .wrap { position: relative; padding: 6.5rem var(--gutter) 5.5rem; }
.hero h1 { font-size: clamp(2.3rem, 5.5vw, 4rem); line-height: 1.05; margin: 0 0 1rem; letter-spacing: -0.025em; max-width: 16ch; }
.hero h1 .grad { background: linear-gradient(90deg, var(--accent), var(--accent2) 55%, var(--accent3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.2rem; color: var(--muted); max-width: 44ch; margin: 0 0 2rem; }
.tag { display: inline-flex; gap: 0.5rem; align-items: center; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent2); border: 1px solid color-mix(in srgb, var(--accent2) 45%, transparent); padding: 0.2rem 0.65rem; border-radius: 999px; margin-bottom: 1.2rem; }
.tag::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--accent2); box-shadow: 0 0 10px var(--accent2); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.showcase .wrap { padding-top: 4rem; }
.shot { margin: 2rem auto 0; max-width: 60rem; }
.shot img { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45); }
.shot figcaption { margin-top: 0.9rem; color: var(--muted); font-size: 0.9rem; text-align: center; }
.cta { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.1rem; border-radius: 11px; font-weight: 650; border: 1px solid var(--line); color: var(--fg); background: var(--card); }
.btn:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.btn.primary { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, white), var(--accent)); color: #061224; border-color: transparent; box-shadow: 0 8px 30px color-mix(in srgb, var(--accent) 35%, transparent); }

/* Sections */
section { padding: 4rem 0; }
section.alt { background: var(--bg2); border-block: 1px solid var(--line); }
h2 { font-size: 1.8rem; letter-spacing: -0.015em; margin: 0 0 0.6rem; }
h3 { font-size: 1.15rem; margin: 1.6rem 0 0.4rem; }
.sub { color: var(--muted); margin: 0 0 2rem; max-width: 60ch; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.3rem 1.1rem; transition: transform 0.18s ease, border-color 0.18s ease; }
a.card { color: var(--fg); display: block; }
a.card:hover { text-decoration: none; transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.card h3 { margin: 0.2rem 0 0.4rem; }
.card p { margin: 0; color: var(--muted); }
.card .icon { width: 2.2rem; height: 2.2rem; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); margin-bottom: 0.6rem; font-weight: 700; }
.reveal { opacity: 0; transform: translateY(10px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* Article pages */
main.page { padding: 3rem 0 4rem; }
main.page .wrap { max-width: 50rem; }
main.page h1 { font-size: 2.3rem; letter-spacing: -0.02em; margin: 0 0 0.5rem; }
.meta { color: var(--muted); font-size: 0.92rem; margin-bottom: 2rem; }
.note { border-left: 3px solid var(--accent); background: var(--bg2); padding: 0.8rem 1rem; border-radius: 0 10px 10px 0; margin: 1.2rem 0; }
.note.warn { border-color: var(--warn); }
table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; margin: 1rem 0; }
.table-wrap table { margin: 0; min-width: 40rem; }
.steps { counter-reset: step; list-style: none; padding: 0; }
.steps > li { counter-increment: step; position: relative; padding-left: 2.6rem; margin: 0 0 1.6rem; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0.05rem; width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); font-weight: 700; font-size: 0.9rem; }
.empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 2rem; text-align: center; color: var(--muted); }
details { border: 1px solid var(--line); border-radius: 12px; padding: 0.2rem 1rem; margin: 0.6rem 0; background: var(--card); }
details summary { cursor: pointer; padding: 0.7rem 0; font-weight: 600; }
details[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 0.6rem; }

/* Forms */
form.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; display: grid; gap: 1rem; }
label { display: grid; gap: 0.35rem; font-weight: 600; font-size: 0.95rem; }
label small { font-weight: 400; color: var(--muted); }
input, textarea, select { font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.7rem; }
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 1px; }
textarea { min-height: 8rem; resize: vertical; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.stars { display: flex; gap: 0.25rem; flex-direction: row-reverse; justify-content: flex-end; }
.stars input { display: none; }
.stars label { font-size: 1.6rem; color: var(--line); cursor: pointer; font-weight: 400; }
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: var(--warn); }
.status { min-height: 1.4rem; color: var(--muted); }
.status.ok { color: var(--accent2); }
.status.err { color: #ff7b7b; }

/* Footer */
footer.site { border-top: 1px solid var(--line); padding: 2.2rem 0 3rem; color: var(--muted); font-size: 0.92rem; }
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; }
footer.site nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; }
footer.site a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .tag::before { animation: none; }
  a.card:hover { transform: none; }
}

/* The manual: the chapters beside the text, a readable line */
.manual { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 2.5rem; align-items: start; }
.chapters { position: sticky; top: 4.6rem; font-size: 0.92rem; }
.chapters ol { padding-left: 1.2rem; margin: 0.6rem 0 1rem; display: grid; gap: 0.25rem; }
.chapters a { color: var(--muted, #5b6474); }
.chapters a:hover { color: var(--fg); }
.chapter { max-width: 48rem; min-width: 0; }
.chapter h1 { margin-top: 0; }
.chapter h2 { margin-top: 2.2rem; }
.chapter table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: 0.93rem; display: block; overflow-x: auto; }
.chapter th, .chapter td { border: 1px solid var(--line); padding: 0.4rem 0.6rem; text-align: left; vertical-align: top; }
.chapter pre { overflow-x: auto; }
.contents { columns: 2; column-gap: 3rem; padding-left: 1.4rem; line-height: 2; max-width: 46rem; }
@media (max-width: 860px) {
  .manual { grid-template-columns: 1fr; }
  .chapters { position: static; }
  .contents { columns: 1; }
}

/* Blog posts: a readable line, room between sections */
.post { max-width: 46rem; }
.post h2 { margin-top: 2.2rem; }
.post .lead { font-size: 1.15rem; }
.posts { display: grid; gap: 1rem; max-width: 46rem; margin-top: 1.5rem; }
.posts .card { color: inherit; text-decoration: none; }
.posts .card .meta { margin: 0 0 0.3rem; }

/* The previous release, on the download page */
.previous { padding-left: 1.2rem; display: grid; gap: 0.4rem; }
.previous .sha { display: block; font-size: 0.8rem; color: var(--muted, #9aa3b5); word-break: break-all; }

/* "Why try it": reasons, one a line */
.reasons { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: 0.9rem; max-width: 48rem; }
.reasons li { padding-left: 1.6rem; position: relative; color: var(--muted, #9aa3b5); }
.reasons li::before { content: "\2192"; position: absolute; left: 0; color: var(--accent, #7dd3fc); }
.reasons b { color: var(--fg, #e8ecf5); font-weight: 600; }
