*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Tokens: light (Anthropic-inspired) ──────────────────────────────────── */
:root {
  --bg:          #e8e6dc;
  --surface:     #edeae0;
  --surface-hi:  #f2efe6;
  --border:      rgba(20, 20, 19, 0.15);
  --border-hi:   rgba(20, 20, 19, 0.3);
  --text:        #141413;
  --subtle:      #30302e;
  --muted:       rgba(20, 20, 19, 0.45);
  --accent:      #d97757;
  --accent-lo:   rgba(217, 119, 87, 0.1);
  --green:       #3a6b4a;
  --amber:       #8a6400;
  --radius:      4px;
  --serif:       'Newsreader', Georgia, serif;
  --sans:        'Inter', system-ui, sans-serif;
  --mono:        'IBM Plex Mono', monospace;
}

/* ── Tokens: dark ─────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:          #1a1917;
  --surface:     #1f1e1c;
  --surface-hi:  #252422;
  --border:      rgba(232, 230, 220, 0.1);
  --border-hi:   rgba(232, 230, 220, 0.22);
  --text:        #e8e6dc;
  --subtle:      #b8b5aa;
  --muted:       rgba(232, 230, 220, 0.38);
  --accent:      #d97757;
  --accent-lo:   rgba(217, 119, 87, 0.12);
  --green:       #6aab7e;
  --amber:       #c9a84c;
}

/* ── Base ────────────────────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 28px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}
/* ── Logo dropdown ───────────────────────────────────────────────────────── */
.logo-dropdown {
  position: relative;
  flex-shrink: 0;
}
.logo-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-style: normal;
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.01em;
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: var(--radius);
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.logo-switch:hover,
.logo-dropdown.open .logo-switch {
  background: var(--surface);
  border-color: var(--border);
}
.logo-chevron {
  color: var(--muted);
  transition: transform 0.15s;
  flex-shrink: 0;
}
.logo-dropdown.open .logo-chevron { transform: rotate(180deg); }
.logo-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 210px;
  background: var(--surface-hi);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(20, 20, 19, 0.08);
  overflow: hidden;
  z-index: 200;
}
[data-theme="dark"] .logo-menu {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
.logo-dropdown.open .logo-menu { display: block; }
.logo-menu-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  font-family: var(--serif);
  font-size: 14px;
  color: var(--subtle);
  cursor: pointer;
  text-align: left;
  transition: background 0.1s, color 0.1s;
}
.logo-menu-item:hover { background: var(--surface); color: var(--text); }
.logo-menu-item.active { color: var(--accent); }
.logo-icon {
  width: 26px; height: 26px;
  background: var(--text);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--sans);
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  color: var(--bg);
  flex-shrink: 0;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.header-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.updated-at {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.theme-toggle {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: border-color 0.15s, color 0.15s;
}
.theme-toggle:hover { border-color: var(--border-hi); color: var(--text); }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
aside {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  overflow-y: auto;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
}
.series-group { margin-bottom: 8px; }
.series-label {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 18px 4px;
  display: block;
}
.version-btn {
  display: block;
  width: 100%;
  padding: 5px 18px;
  background: none;
  border: none;
  border-left: 2px solid transparent;
  color: var(--subtle);
  font-family: var(--mono);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  text-align: left;
}
.version-btn:hover  { color: var(--text); }
.version-btn.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-lo);
}

/* ── Main ────────────────────────────────────────────────────────────────── */
main {
  overflow-y: auto;
  padding: 48px 56px 80px;
  max-width: 880px;
}

/* ── Loading ─────────────────────────────────────────────────────────────── */
.state-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 80px 40px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}
.spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--border-hi);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Changelog header ────────────────────────────────────────────────────── */
.changelog-header {
  margin-bottom: 44px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.changelog-version {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 12px;
}
.changelog-version h1 {
  font-family: var(--serif);
  font-style: normal;
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
}
.release-badge {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  padding: 3px 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  color: var(--muted);
  background: none;
  position: relative;
  top: -2px;
}
.badge-feature-lg  { color: var(--green);  border-color: var(--green); }
.badge-bugfix-lg   { color: var(--muted);  border-color: var(--border-hi); }
.badge-breaking-lg { color: var(--amber);  border-color: var(--amber); }
.badge-release-lg  { color: var(--muted);  border-color: var(--border-hi); }

.changelog-intro {
  color: var(--subtle);
  font-size: 15px;
  line-height: 1.75;
  max-width: 64ch;
  margin-bottom: 14px;
}
.source-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.15s;
}
.source-link:hover { color: var(--accent); }

/* ── Sections ────────────────────────────────────────────────────────────── */
.section { margin-bottom: 40px; }
.section-heading {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--subtle);
  margin-bottom: 0;
  padding-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.section-heading::after { display: none; }
.section-heading.enhancements { color: var(--green); }
.section-heading.bug-fixes    { color: var(--subtle); }
.section-heading.breaking     { color: var(--amber); }

/* ── Items ───────────────────────────────────────────────────────────────── */
.item-list { display: flex; flex-direction: column; }
.item {
  padding: 12px 28px 12px 0;
  border-bottom: 1px solid var(--border);
  background: none;
  transition: padding-left 0.12s;
  position: relative;
}
.item-share-btn {
  position: absolute;
  right: 0;
  top: 14px;
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  border-radius: var(--radius);
  opacity: 0;
  transition: opacity 0.12s, color 0.12s;
}
.item:hover .item-share-btn { opacity: 0.45; }
.item-share-btn:hover { opacity: 1 !important; color: var(--accent); }
.item-share-btn.copied { opacity: 1 !important; color: var(--green); }
.item:last-child { border-bottom: none; }
.item-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--subtle);
}
.item-text code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--subtle);
}
[data-theme="dark"] .item-text code {
  background: var(--surface-hi);
}
.item-text a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(217, 119, 87, 0.4);
  text-underline-offset: 2px;
}
.item-text a:hover { text-decoration-color: var(--accent); }
.item-tickets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.item-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.item-bullets li {
  font-size: 14px;
  line-height: 1.7;
  color: var(--subtle);
  padding-left: 16px;
  position: relative;
}
.item-bullets li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--muted);
  font-size: 12px;
}


/* ── Code blocks ─────────────────────────────────────────────────────────── */
.code-block {
  margin-top: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.65;
  color: var(--subtle);
  white-space: pre;
}
[data-theme="dark"] .code-block {
  background: var(--surface-hi);
}

/* ── System req ──────────────────────────────────────────────────────────── */
.sysreq {
  margin-top: 40px;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.sysreq-label {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.sysreq-text {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--subtle);
  line-height: 1.75;
}
.sysreq-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sysreq-list li {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--subtle);
  line-height: 1.65;
  padding-left: 14px;
  position: relative;
}
.sysreq-list li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--muted);
}

/* ── Filter bar ──────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 0;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.filter-chip {
  padding: 7px 16px;
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
  margin-bottom: -1px;
}
.filter-chip:hover  { color: var(--text); }
.filter-chip.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Badges (sidebar — hidden) ───────────────────────────────────────────── */
.badge { display: none; }

/* ── Error ───────────────────────────────────────────────────────────────── */
.error-box {
  padding: 20px 24px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--subtle);
  line-height: 1.75;
}
.error-box a { color: var(--accent); }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state { padding: 80px 0; }
.empty-state h2 {
  font-family: var(--serif);
  font-style: normal;
  font-size: 28px;
  font-weight: 400;
  margin-bottom: 12px;
}
.empty-state p { color: var(--muted); max-width: 44ch; line-height: 1.75; font-size: 14px; }

/* ── Header search ───────────────────────────────────────────────────────── */
.header-search {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
#search-input {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
#search-input::placeholder { color: var(--muted); }
#search-input:focus { border-color: var(--border-hi); }
.search-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Search results ──────────────────────────────────────────────────────── */
.search-results { display: flex; flex-direction: column; gap: 32px; }
.search-result-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.search-result-version {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.search-result-version:hover { background: var(--surface-hi); }
.search-result-version-num {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
}
.search-result-count {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.search-result-item {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-section {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.search-result-section.enhancements { color: var(--green); }
.search-result-section.bug-fixes    { color: var(--subtle); }
.search-result-section.breaking     { color: var(--amber); }

/* ── Search highlight ────────────────────────────────────────────────────── */
mark {
  background: rgba(217, 119, 87, 0.2);
  color: var(--accent);
  border-radius: 2px;
  padding: 0 1px;
}

/* ── Sidebar match count ─────────────────────────────────────────────────── */
.sidebar-match-count {
  display: inline-block;
  margin-left: 6px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--accent);
  background: var(--accent-lo);
  border: 1px solid rgba(217, 119, 87, 0.2);
  border-radius: var(--radius);
  padding: 0 4px;
  vertical-align: middle;
}
.version-btn.dim { opacity: 0.35; }
.version-btn.hover-highlight {
  color: var(--text);
  border-left-color: var(--border-hi);
  background: var(--surface-hi);
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
footer {
  padding: 14px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
}
footer p {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}
footer a { color: var(--muted); text-decoration: underline; }
footer a:hover { color: var(--text); }
.footer-domain {
  margin-top: 6px;
  font-family: var(--serif);
  font-size: 11px;
  color: var(--muted);
  opacity: 0.5;
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 2px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  header { gap: 10px; padding: 0 14px; }
  .updated-at, .header-meta { display: none; }
  .search-count { display: none; }
  .app { grid-template-columns: 1fr; }
  aside {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0;
    overflow-x: auto;
    white-space: nowrap;
    display: flex;
  }
  .series-group { display: inline-flex; align-items: center; }
  .series-label { display: none; }
  .version-btn {
    display: inline-block;
    width: auto;
    padding: 10px 14px;
    border-left: none;
    border-bottom: 2px solid transparent;
  }
  .version-btn.active {
    border-bottom-color: var(--accent);
    border-left-color: transparent;
    background: none;
  }
  main { padding: 24px 18px 48px; }
  .logo-switch { font-size: 14px; }
}

/* ── Share button ─────────────────────────────────────────────────────────── */
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
  flex-shrink: 0;
  position: relative;
  top: -1px;
}
.share-btn:hover { color: var(--text); border-color: var(--border-hi); }
.share-btn.copied { color: var(--green); border-color: var(--green); }

/* ── HtoA compat strip (inside changelog header) ─────────────────────────── */
.compat-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 14px;
}
.compat-strip-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--subtle);
}
.compat-strip-label {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.compat-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  padding: 1px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── Compatibility table view ────────────────────────────────────────────── */
.compat-table {
  width: 100%;
  border-collapse: collapse;
}
.compat-table th {
  text-align: left;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 16px 12px 0;
  border-bottom: 1px solid var(--border);
}
.compat-table td {
  font-family: var(--mono);
  font-size: 12px;
  padding: 9px 16px 9px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--subtle);
}
.compat-version-cell {
  color: var(--accent) !important;
  cursor: pointer;
  white-space: nowrap;
}
.compat-version-cell:hover { text-decoration: underline; }
.compat-tags { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.compat-none { color: var(--muted); }

/* ── Sidebar compatibility nav button ────────────────────────────────────── */
.compat-nav-btn {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  border-left-color: transparent;
  margin-bottom: 8px;
}
.compat-nav-btn:hover { color: var(--text); }
.compat-nav-btn.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-lo);
}
