/* =============================================================================
 * Tweak these variables in :root to rebrand.
 * ========================================================================== */
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("fonts/schibsted.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

/* Castle 11 Labs palette — dark only, matching the main site
   (globals.css tokens). */
:root {
  --bg: #141414;
  --surface: #1a1a1a;
  --surface-2: #1f1f1f;
  --border: #2a2a2a;
  --text: #f5f1e8;
  --muted: #8a857b;
  --accent: #ddd0b3;
  --accent-hover: #e8dcc0;
  --accent-soft: rgba(221, 208, 179, .1);
  /* Download buttons use the brand accent (like the site's primary button):
     warm tan with near-black text. */
  --btn-bg: #ddd0b3;
  --btn-bg-hover: #e8dcc0;
  --btn-text: #161310;
  --btn-sub: rgba(22, 19, 16, .66);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --maxw: 1080px;
  --font: "Schibsted Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }

/* ---- Header / footer -------------------------------------------------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: -webkit-sticky; position: sticky; top: 0; z-index: 10;
}
.site-header .wrap { display: flex; align-items: center; height: 60px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-wordmark { height: 20px; width: auto; display: block; }
.brand-page {
  color: var(--muted); font-weight: 500; font-size: 14px;
  padding-left: 12px; border-left: 1px solid var(--border);
}

.site-footer { margin-top: 48px; padding: 24px 0; border-top: 1px solid var(--border); font-size: 14px; }

/* ---- Layout ----------------------------------------------------------- */
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 28px;
  padding-top: 32px;
  align-items: start;
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; gap: 20px; }
  .site-header .wrap { height: 54px; }
}

/* ---- Product list ----------------------------------------------------- */
.sidebar-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 0 0 10px 4px; font-weight: 600;
}
.product-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.product-list .loading { padding: 8px 4px; }

.product-item {
  width: 100%; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 1fr auto; column-gap: 8px;
  align-items: baseline;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  font: inherit; color: var(--text);
  transition: border-color .12s, background .12s, transform .04s;
}
.product-item:hover { border-color: var(--accent); }
.product-item:active { transform: translateY(1px); }
.product-item.active { border-color: var(--accent); background: var(--accent-soft); }
.product-item-name { font-weight: 600; }
.product-item-ver { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.product-item-tag { grid-column: 1 / -1; font-size: 13px; margin-top: 2px; }

/* Divider between snap-to-top / un-pinned / snap-to-bottom groups. */
.product-divider { list-style: none; margin: 8px 4px; }
.product-divider hr { border: none; border-top: 1px solid var(--border); margin: 0; }

/* ---- Detail pane ------------------------------------------------------- */
.detail {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  min-height: 320px;
}
.detail-inner { padding: 28px 30px 32px; }
.empty-state { padding: 60px 30px; text-align: center; }

/* "Out of date" banner (shown when arriving via ?name=…&outdated=1). */
.outdated-banner {
  display: flex; align-items: center; gap: 10px;
  background: rgba(120, 53, 15, .3); color: #f0b35e; border: 1px solid rgba(180, 83, 9, .4);
  border-radius: var(--radius-sm); padding: 11px 15px; margin: 0 0 20px;
  font-size: 14px; font-weight: 500;
}
.outdated-icon { font-size: 16px; line-height: 1; }
.detail-message { padding: 40px 30px; }
.detail-message.error strong { color: #ff8a80; }

.detail-header { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }
.detail-title { font-size: 26px; margin: 0; line-height: 1.2; }

.badge {
  font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-latest { background: var(--accent-soft); color: var(--accent); }
.badge-old { background: var(--surface-2); color: var(--muted); }
.badge-channel { background: rgba(120, 53, 15, .3); color: #f0b35e; text-transform: capitalize; }

/* ---- Markdown body ----------------------------------------------------- */
.markdown-body { margin: 18px 0 26px; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { line-height: 1.25; margin: 1.2em 0 .5em; }
.markdown-body h1 { font-size: 22px; }
.markdown-body h2 { font-size: 19px; }
.markdown-body h3 { font-size: 16px; }
.markdown-body p { margin: .6em 0; }
.markdown-body ul, .markdown-body ol { padding-left: 1.4em; margin: .5em 0; }
.markdown-body li { margin: .2em 0; }
.markdown-body a { color: var(--accent); }
.markdown-body code {
  font-family: var(--mono); font-size: .9em;
  background: var(--surface-2); padding: .12em .4em; border-radius: 5px;
}
.markdown-body pre {
  background: var(--surface-2); padding: 14px 16px; border-radius: var(--radius-sm);
  overflow: auto; border: 1px solid var(--border);
}
.markdown-body pre code { background: none; padding: 0; }
.markdown-body blockquote {
  margin: .8em 0; padding: .2em 1em; border-left: 3px solid var(--border); color: var(--muted);
}
.markdown-body img { max-width: 100%; border-radius: var(--radius-sm); }
.markdown-body table { border-collapse: collapse; width: 100%; margin: .8em 0; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }

/* ---- Downloads -------------------------------------------------------- */
.downloads { border-top: 1px solid var(--border); padding-top: 22px; }
.downloads-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 14px; }

.old-notice {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px; margin: 0 0 16px; font-size: 14px;
}
.linklike {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--accent); font: inherit; font-weight: 600;
}
.linklike:hover { text-decoration: underline; }

.dl-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
/* Each button stacks above its optional "Requires …" line. */
.dl-item { display: flex; flex-direction: column; gap: 5px; }
.dl-req { font-size: 12px; color: var(--muted); padding-left: 4px; }
/* Every download button looks the same — no "primary" colour. */
.dl-btn {
  display: inline-flex; align-items: center; gap: 12px;
  text-decoration: none; cursor: pointer;
  background: var(--btn-bg); color: var(--btn-text);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 12px 18px; min-width: 210px;
  transition: background .12s, transform .04s, box-shadow .12s;
}
.dl-btn:hover { background: var(--btn-bg-hover); }
.dl-btn:active { transform: translateY(1px); }
.dl-icon { display: inline-flex; color: currentColor; }
.dl-text { display: flex; flex-direction: column; line-height: 1.2; }
.dl-label { font-weight: 600; font-size: 15px; }
.dl-sub { font-size: 12px; color: var(--btn-sub); }

/* ---- Version picker + meta -------------------------------------------- */
.version-picker { margin-top: 22px; display: flex; flex-direction: column; gap: 6px; max-width: 320px; }
.version-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.version-select {
  font: inherit; padding: 9px 34px 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background-color: var(--surface); color: var(--text);
  cursor: pointer;
  /* Strip the native control (Safari/Firefox show the OS dropdown otherwise)
     and draw our own caret. */
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.version-select:focus-visible, .product-item:focus-visible, .dl-btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.version-meta { margin-top: 22px; font-size: 14px; display: flex; flex-direction: column; gap: 7px; }
.meta-row { display: flex; gap: 10px; }
.meta-key { min-width: 130px; }
.meta-val { font-variant-numeric: tabular-nums; }

.checksums { margin-top: 4px; }
.checksums summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.sum-row { display: flex; gap: 10px; align-items: baseline; margin-top: 8px; }
.sum-hash { font-family: var(--mono); font-size: 12px; word-break: break-all; }
