/* hexenwerkzeug — base styles.
   Tokens + reset + page chrome + landing widgets.
   IDE-specific layout lives in ide.css, loaded only by /ide-like pages.

   Distilled from chempirical (lab theme, linear-derived landing) and
   the eight patterns in vanilla-declarative.html. */

:root {
  color-scheme: dark;

  /* Background layers — every panel/card picks one. */
  --bg:           #0a0a0b;
  --surface:      #131316;
  --surface-2:    #18181d;
  --elevated:     #1f1f25;
  --border:       #26262d;
  --border-strong:#2f2f37;

  /* Text hierarchy — color alone signals weight. */
  --text:         #e8e8ec;
  --dim:          #8a8a93;
  --faint:        #5a5a63;

  /* Accent + semantic */
  --accent:       #a3e635;
  --accent-d:     #84cc16;
  --accent-dim:   rgba(163, 230, 53, 0.10);
  --blue:         #60a5fa;
  --purple:       #c084fc;
  --amber:        #f59e0b;
  --cyan:         #22d3ee;
  --rose:         #fb7185;

  --sans:         'Geist', 'Inter', system-ui, -apple-system, sans-serif;
  --mono:         'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  --radius:       8px;
  --radius-sm:    4px;
  --gap:          0.75rem;

  /* IDE layout slots — pages override via inline style. */
  --ide-header:   36px;
  --ide-status:   24px;
  --ide-left:     220px;
  --ide-right:    300px;
  --ide-bottom:   200px;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; }

:where(html) {
  font: 14px/1.5 var(--sans);
  color: var(--text);
  background: var(--bg);
  tab-size: 2;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

:where(body) {
  margin: 0;
  min-block-size: 100dvh;
}

:where(h1, h2, h3, h4, h5, h6) {
  margin: 0;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
:where(p, ul, ol, dl, pre, figure) { margin: 0; }
:where(ul, ol) { padding: 0; list-style: none; }

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

:where(button) {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

:where(code, kbd, samp, pre) { font-family: var(--mono); font-size: 0.92em; }
:where(:not(pre) > code) {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.05em 0.4em;
  border-radius: var(--radius-sm);
  color: var(--accent);
}
:where(pre) {
  background: #08080a;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow: auto;
  color: var(--dim);
  line-height: 1.7;
}

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

:where(::selection) { background: var(--accent); color: var(--bg); }

/* Scrollbar that doesn't fight the theme. */
*::-webkit-scrollbar           { width: 8px; height: 8px; }
*::-webkit-scrollbar-track     { background: transparent; }
*::-webkit-scrollbar-thumb     { background: var(--border-strong); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: #3f3f46; }

:where(.icon) {
  --icon-size: 16px;
  inline-size: var(--icon-size);
  block-size: var(--icon-size);
  flex-shrink: 0;
  vertical-align: -2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Skip link — first focusable element on every page. */
.skip-link {
  position: absolute;
  inset-inline-start: 0.5rem;
  inset-block-start: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: var(--accent);
  color: var(--bg);
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ─── Landing page — linear-derived hero + cards ─── */
.page {
  display: grid;
  grid-template-areas: "hero" "tools" "foot";
  max-inline-size: 920px;
  margin-inline: auto;
  padding: 5rem 2rem 4rem;
  gap: 3.5rem;
  position: relative;
}
body.page-host {
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 0%,   rgba(163, 230, 53, 0.08), transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(163, 230, 53, 0.04), transparent 60%);
  background-attachment: fixed;
}

.hero { grid-area: hero; }
.hero h1 {
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.04;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p {
  margin-block-start: 1.25rem;
  color: var(--dim);
  font-size: 1.02rem;
  max-inline-size: 60ch;
}
.hero .meta {
  margin-block-start: 1.75rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--faint);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tools { grid-area: tools; display: grid; gap: 1rem; }
.tools h2 {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
}
.tool-list { display: grid; gap: 0.5rem; }
.tool-list a {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color 120ms, transform 120ms;
}
.tool-list a:hover {
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}
.tool-list a .icon { color: var(--accent); --icon-size: 18px; }
.tool-list a .slug { font-family: var(--mono); font-size: 0.78rem; color: var(--faint); }

.foot {
  grid-area: foot;
  text-align: center;
  font-size: 0.82rem;
  color: var(--faint);
  padding-block-start: 2rem;
  border-block-start: 1px solid var(--border);
  font-family: var(--mono);
}
.foot strong { color: var(--accent); font-weight: 500; }

/* ─── Buttons — opt-in via .btn; semantic <button> stays neutral. ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: border-color 120ms, color 120ms, background 120ms;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn[data-primary] {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 500;
}
.btn[data-primary]:hover { background: var(--accent-d); border-color: var(--accent-d); color: var(--bg); }

/* ─── Site nav (used inside landing + chrome) ─── */
.site-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  border-block-end: 1px solid var(--border);
  background: rgba(10, 10, 11, 0.6);
  backdrop-filter: blur(6px);
  position: sticky;
  inset-block-start: 0;
  z-index: 10;
}
.site-nav [rel="home"] {
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.site-nav [rel="home"] em { font-style: normal; color: var(--accent); }
.site-nav ul { display: flex; gap: 0.25rem; margin-inline-start: auto; }
.site-nav li a {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--dim);
}
.site-nav li a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.site-nav li a[aria-current="page"] { color: var(--accent); background: var(--accent-dim); }

/* ─── Syntax highlighting (shared by code panes anywhere) ─── */
.hl-c { color: var(--faint); font-style: italic; }
.hl-s { color: var(--accent); }
.hl-k { color: var(--purple); }
.hl-n { color: var(--amber); }
.hl-f { color: var(--blue); }
.hl-t { color: var(--cyan); }
