:root {
  color-scheme: dark;
  --bg: #0c0d0f;
  --surface: #141619;
  --surface-2: #1b1e22;
  --text: #f4f3ef;
  --muted: #a8abb0;
  --line: #34383e;
  --line-strong: #555b63;
  --signal: #e45843;
  --cyan: #65c8d0;
  --gold: #d8ae59;
  --green: #78b98a;
  --max: 1240px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
  line-height: 1.5;
}

a { color: inherit; }

.site-header {
  min-height: 68px;
  padding: 0 max(22px, calc((100vw - var(--max)) / 2));
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-decoration: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  color: var(--signal);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 11px;
}

.site-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 11px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.meta-divider { width: 1px; height: 12px; background: var(--line); }

main {
  width: min(calc(100% - 44px), var(--max));
  margin: 0 auto;
}

.library-heading {
  min-height: 235px;
  padding: 54px 0 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 390px);
  align-items: end;
  gap: 60px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--signal);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 11px;
  font-weight: 700;
}

h1 {
  margin: 0;
  max-width: 100%;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: clamp(38px, 5vw, 68px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: 0;
}

.lede { margin: 16px 0 0; color: var(--muted); font-size: 15px; }

.search-field { display: block; color: var(--muted); font-size: 12px; }

.search-control {
  height: 48px;
  margin-top: 8px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-control:focus-within { border-color: var(--cyan); }

.search-control svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.7;
}

.search-control input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.search-control input::placeholder { color: #777c83; }

.guide-section { padding: 29px 0 72px; }

.section-bar {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-bar h2 { margin: 0; font-size: 13px; font-weight: 700; }

.section-bar span {
  color: var(--muted);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 11px;
}

.guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }

.guide-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
  transition: border-color 160ms ease, transform 160ms ease;
}

.guide-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }

.guide-card[hidden] { display: none; }

.cover-link {
  position: relative;
  display: block;
  aspect-ratio: 3 / 1.55;
  overflow: hidden;
  background: #090b0d;
}

.cover-link img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 350ms ease;
}

.guide-card:hover .cover-link img { transform: scale(1.025); }

.cover-index {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 5px 7px;
  border: 1px solid rgba(255,255,255,.45);
  background: rgba(12,13,15,.78);
  color: #fff;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 9px;
  font-weight: 700;
}

.guide-body { padding: 20px; }

.guide-kicker {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 9px;
}

.guide-kicker span:first-child { color: var(--cyan); }

.guide-card:nth-child(2) .guide-kicker span:first-child { color: var(--gold); }

.guide-body h3 { margin: 12px 0 2px; font-family: Georgia, "Noto Serif SC", serif; font-size: 25px; font-weight: 500; }

.guide-body h3 a { text-decoration: none; }

.guide-body h3 a:focus-visible, .open-link:focus-visible, .cover-link:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.guide-body > p { margin: 0; color: var(--muted); font-size: 14px; }

.feature-list {
  min-height: 44px;
  margin: 19px 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 7px;
  list-style: none;
}

.feature-list li {
  padding: 4px 8px;
  border: 1px solid var(--line);
  color: #c7c9cc;
  font-size: 11px;
}

.guide-footer {
  min-height: 39px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.progress-status { color: var(--muted); font-size: 11px; }

.open-link { color: var(--text); font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; }

.open-link:hover { color: var(--cyan); }

.empty-state { padding: 72px 0; color: var(--muted); text-align: center; }

.site-footer {
  min-height: 72px;
  padding: 0 max(22px, calc((100vw - var(--max)) / 2));
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 10px;
}

@media (max-width: 820px) {
  .library-heading { min-height: 0; grid-template-columns: 1fr; gap: 30px; padding: 42px 0 30px; }
  .guide-grid { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .site-header { min-height: 60px; padding: 0 16px; }
  .brand { font-size: 11px; }
  .brand-mark { width: 28px; height: 28px; }
  .site-meta .meta-divider, .site-meta span:last-child { display: none; }
  main { width: min(calc(100% - 28px), var(--max)); }
  h1 { font-size: 40px; }
  .lede { max-width: 28ch; }
  .cover-link { aspect-ratio: 3 / 1.8; }
  .guide-body { padding: 17px; }
  .guide-body h3 { font-size: 22px; }
  .guide-footer { align-items: flex-end; }
  .site-footer { min-height: 88px; padding: 18px 16px; align-items: flex-start; flex-direction: column; justify-content: center; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
