@import url("https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&family=Literata:opsz,wght@7..72,600;7..72,700&display=swap");

:root {
  --bg: #14120f;
  --bg-raise: #1c1914;
  --surface: #232017;
  --surface-2: #2c281f;
  --fg: #f4efe6;
  --muted: #a39888;
  --faint: #6f675c;
  --line: #3a342b;
  --accent: #c4622d;
  --accent-ink: #2a140c;
  --ok: #8fb59a;
  --warn: #e2c27a;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --sans: "Figtree", "Avenir Next", "Segoe UI", sans-serif;
  --display: "Literata", "Iowan Old Style", Palatino, serif;
  --mono: "IBM Plex Mono", "ui-monospace", "SFMono-Regular", Menlo, monospace;
  --radius: 14px;
  --pad: 20px;
  --max: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(196, 98, 45, 0.16), transparent 60%),
    var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--warn); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--fg); }

.wrap { width: min(var(--max), calc(100% - 32px)); margin: 0 auto; }
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(20, 18, 15, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.top-row {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 68px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark {
  width: 36px; height: 36px; flex: none;
  border-radius: 9px;
  background: var(--fg);
  color: var(--bg);
  display: grid; place-items: center;
  font-family: var(--display);
  font-weight: 680;
  letter-spacing: -0.04em;
}
.brand h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 680;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  min-width: min(420px, 46vw);
  height: 44px;
}
.search input {
  border: 0; outline: 0; background: transparent; width: 100%;
}
.search svg { flex: none; opacity: 0.7; }
.rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 12px;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.chip, .ghost, .solid, .icon-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  min-height: 40px;
  padding: 0 14px;
  color: var(--fg);
  white-space: nowrap;
}
.chip[aria-pressed="true"], .solid {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
}
a.solid { display: inline-flex; align-items: center; text-decoration: none; margin: 0 0 16px; }
.ghost { background: transparent; }
.icon-btn { width: 40px; padding: 0; display: grid; place-items: center; border-radius: 10px; }
.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; padding: 28px 0 72px; }
main { min-width: 0; }
.card, .grid, .section-block, .table-wrap, .link-row, .panel-box, .tool-panel { min-width: 0; max-width: 100%; }
.desc, .note, h2, h3, .group-name { overflow-wrap: anywhere; }
.side { position: sticky; top: 128px; align-self: start; display: flex; flex-direction: column; gap: 6px; }
.side button {
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  min-height: 40px;
  padding: 0 12px;
}
.side button[aria-current="true"] { background: var(--surface); color: var(--fg); }
.kicker {
  margin: 0 0 8px;
  color: var(--faint);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 18px; }
.stat {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 13px;
}
.stat b { color: var(--fg); font-weight: 650; }
.note {
  background: var(--bg-raise);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  color: var(--muted);
  margin: 0 0 16px;
  border-radius: 0 10px 10px 0;
}
.section-block { margin: 0 0 28px; scroll-margin-top: 150px; }
.section-block h2 {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 680;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
}
.group-name {
  margin: 18px 0 8px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px 12px;
}
.card h3 { margin: 0; font-size: 16px; font-weight: 650; }
.card-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tag {
  font-size: 12px;
  color: var(--warn);
  background: rgba(226, 194, 122, 0.08);
  border: 1px solid rgba(226, 194, 122, 0.25);
  border-radius: 999px;
  padding: 2px 8px;
}
.desc { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.links { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.link-row { display: flex; gap: 8px; align-items: center; }
.link-row a, .link-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--fg);
}
.panel-box, .tool-panel, .table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row input, .stack input, .stack textarea, .stack select {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 44px;
  padding: 0 12px;
}
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack textarea { min-height: 140px; padding: 12px; resize: vertical; font-family: var(--mono); font-size: 13px; }
.saved-item { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--faint); font-weight: 560; }
.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--fg);
  color: var(--bg);
  border-radius: 999px;
  padding: 10px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  font-weight: 650;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.empty { color: var(--muted); padding: 28px 0; }
footer.site {
  border-top: 1px solid var(--line);
  padding: 28px 0 48px;
  color: var(--muted);
  font-size: 14px;
}
.tool-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
ol.steps { margin: 0 0 18px; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 8px; }
ol.steps li {
  counter-increment: step;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px 12px 52px;
  position: relative;
  overflow-wrap: anywhere;
}
ol.steps li::before {
  content: counter(step);
  position: absolute;
  left: 14px;
  top: 14px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
}
ol.steps strong { font-weight: 650; }
pre.rule {
  margin: 8px 0 0;
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 12px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
}
.concept h3 { font-family: var(--display); font-size: 20px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding-top: 18px; }
  .side { display: none; }
  .search { min-width: 0; flex: 1; }
  .top-row { flex-wrap: wrap; padding-top: 10px; }
  .brand p { display: none; }
  .split { grid-template-columns: 1fr; }
  .wrap { width: min(var(--max), calc(100% - 20px)); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
