/* ===== Horizon Custom Styles ===== */

/* --- CSS Variables & Dark Mode (Horizon Dawn) --- */
/* Palette derived from horizon-header.svg sunrise:
   #312e81 deep indigo · #be185d rose · #f97316 orange · #fbbf24 gold
   #4c1d95 mountain purple · #701a75 distant purple                  */
:root {
  --hz-bg: #faf8f5;          /* warm parchment white */
  --hz-surface: #f3f0eb;     /* slightly warm gray */
  --hz-border: #e0dbd3;      /* warm border */
  --hz-text: #2d2a3e;        /* deep indigo-ink */
  --hz-text-muted: #7c7891;  /* muted lavender gray */
  --hz-link: #6d4aaa;        /* mountain purple, lighter */
  --hz-code-bg: #f0ede7;     /* warm code bg */
  --hz-accent: #e0652e;      /* sunrise orange, toned down */
}

@media (prefers-color-scheme: dark) {
  :root {
    --hz-bg: #1a1726;        /* pre-dawn deep purple-black */
    --hz-surface: #231f33;   /* night sky surface */
    --hz-border: #342f4a;    /* indigo border */
    --hz-text: #e8e4f0;      /* moonlight white-lavender */
    --hz-text-muted: #8c86a0; /* muted twilight */
    --hz-link: #f0a848;      /* dawn gold */
    --hz-code-bg: #211d30;   /* deep code bg */
    --hz-accent: #e87040;    /* sunrise orange-coral */
  }
}

/* Apply variables to base elements */
body {
  background-color: var(--hz-bg) !important;
  color: var(--hz-text) !important;
}

a {
  color: var(--hz-link) !important;
}

code {
  background-color: var(--hz-code-bg) !important;
  color: var(--hz-text) !important;
}

pre {
  background-color: var(--hz-code-bg) !important;
  color: var(--hz-text) !important;
  border: 1px solid var(--hz-border) !important;
}

hr {
  border-color: var(--hz-border) !important;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--hz-text) !important;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif !important;
  font-weight: 800 !important;
}

/* Override Cayman header gradient — Horizon sunrise from SVG */
.page-header {
  background: linear-gradient(120deg, #312e81, #be185d, #f97316) !important;
}

.page-header h1,
.page-header h2,
.page-header .project-tagline,
.page-header a {
  color: #fff !important;
}

/* --- Score Badge --- */
.score-badge {
  display: inline-block;
  padding: 0.1em 0.5em;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.75em;
  font-weight: 700;
  color: #fff;
  margin-left: 0.4em;
  vertical-align: middle;
}

.score-badge[data-tier="high"] { background: #be185d; } /* rose — from SVG */
.score-badge[data-tier="good"] { background: #e0652e; } /* sunrise orange */
.score-badge[data-tier="mid"]  { background: #d4a017; } /* warm gold */
.score-badge[data-tier="low"]  { background: #7c7891; } /* muted lavender */

/* --- Tag Pills --- */
.tag-line code {
  border-radius: 3px;
  padding: 0.1em 0.5em;
  font-size: 0.8em;
  background: var(--hz-accent) !important;
  color: #fff !important;
}

@media (prefers-color-scheme: dark) {
  .tag-line code {
    background: #342f4a !important;   /* indigo border */
    color: #f0a848 !important;        /* dawn gold */
  }
}

/* --- Source Line --- */
.source-line {
  font-size: 0.85em;
  color: var(--hz-text-muted);
  border-left: 2px solid var(--hz-accent);
  padding-left: 0.6em;
}

/* --- Collapsible References --- */
.main-content details {
  border: 1px solid var(--hz-border);
  border-radius: 4px;
  margin: 0.8em 0;
}

.main-content details summary {
  cursor: pointer;
  padding: 0.4em 0.8em;
  font-weight: 600;
  color: var(--hz-text-muted);
}

.main-content details > ul {
  padding: 0.4em 0.8em 0.4em 2em;
  margin: 0;
}

/* --- TOC Ordered List --- */
.main-content > ol {
  border: 1px solid var(--hz-border);
  border-radius: 4px;
  padding: 0.8em 0.8em 0.8em 2em;
  background: var(--hz-surface);
}

.main-content > ol > li {
  padding: 0.3em 0;
}

/* --- Summary Blockquote --- */
.main-content > blockquote:first-of-type {
  border-left-color: var(--hz-accent);
  color: var(--hz-text-muted);
  font-style: normal;
}

/* --- Language Toggle (fixed top-right) --- */
.lang-toggle {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 1000;
  display: flex;
  gap: 0;
}

.lang-toggle button {
  padding: 0.3em 1em;
  border: 1px solid rgba(255,255,255,0.4);
  background: rgba(0,0,0,0.15);
  color: #fff;
  font-size: 0.8em;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.lang-toggle button:first-child {
  border-radius: 3px 0 0 3px;
}

.lang-toggle button:last-child {
  border-radius: 0 3px 3px 0;
  border-left: none;
}

.lang-toggle button.active {
  background: var(--hz-accent);
  color: #fff;
  border-color: var(--hz-accent);
}

.lang-section.hidden {
  display: none;
}

/* --- Digest Home --- */
body:has(.digest-home),
body.has-digest-home {
  background:
    radial-gradient(1100px 520px at 82% -12%, oklch(68% 0.09 282 / 0.13), transparent 62%),
    radial-gradient(900px 460px at -10% 2%, oklch(68% 0.09 166 / 0.1), transparent 58%),
    linear-gradient(180deg, oklch(96% 0.007 95), oklch(92% 0.009 92)) !important;
}

@media (prefers-color-scheme: dark) {
  body:has(.digest-home),
  body.has-digest-home {
    background:
      radial-gradient(950px 500px at 82% -12%, oklch(50% 0.08 282 / 0.15), transparent 62%),
      radial-gradient(820px 420px at -10% 2%, oklch(48% 0.08 166 / 0.12), transparent 58%),
      linear-gradient(180deg, oklch(18% 0.012 270), oklch(13% 0.01 270)) !important;
  }
}

body:has(.digest-home) .page-header,
body.has-digest-home .page-header {
  display: none;
}

body:has(.digest-home) .main-content,
body.has-digest-home .main-content {
  padding-top: 56px;
  padding-bottom: 64px;
}

.main-content .digest-home {
  --digest-bg: oklch(98% 0.004 95);
  --digest-surface: oklch(98% 0.005 95);
  --digest-surface-2: oklch(95% 0.008 95);
  --digest-text: oklch(22% 0.012 95);
  --digest-muted: oklch(48% 0.014 95);
  --digest-faint: oklch(63% 0.014 95);
  --digest-border: oklch(23% 0.012 95 / 0.09);
  --digest-border-strong: oklch(23% 0.012 95 / 0.15);
  --digest-shadow: 0 1px 2px oklch(20% 0.01 95 / 0.04), 0 10px 30px oklch(20% 0.01 95 / 0.06);
  --digest-shadow-hover: 0 2px 8px oklch(20% 0.01 95 / 0.07), 0 20px 54px oklch(20% 0.01 95 / 0.11);
  max-width: 780px;
  margin: 0 auto;
  color: var(--digest-text);
  font-family: "Inter", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  .main-content .digest-home {
    --digest-bg: oklch(22% 0.012 270);
    --digest-surface: oklch(24% 0.012 270);
    --digest-surface-2: oklch(28% 0.012 270);
    --digest-text: oklch(91% 0.006 92);
    --digest-muted: oklch(72% 0.01 92);
    --digest-faint: oklch(58% 0.01 92);
    --digest-border: oklch(95% 0.006 92 / 0.1);
    --digest-border-strong: oklch(95% 0.006 92 / 0.18);
    --digest-shadow: 0 1px 2px oklch(0% 0 0 / 0.34), 0 10px 32px oklch(0% 0 0 / 0.38);
    --digest-shadow-hover: 0 2px 8px oklch(0% 0 0 / 0.42), 0 24px 58px oklch(0% 0 0 / 0.5);
  }
}

.digest-home a {
  color: inherit !important;
}

.digest-hero {
  padding: 18px 0 8px;
}

.digest-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--digest-muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.digest-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: oklch(57% 0.14 166);
  box-shadow: 0 0 0 5px oklch(57% 0.14 166 / 0.16);
}

.digest-hero h1 {
  max-width: none;
  margin: 0 0 14px;
  color: var(--digest-text) !important;
  font-size: clamp(1.9rem, 6vw, 3.1rem);
  font-weight: 750 !important;
  line-height: 1.04;
  letter-spacing: 0;
  white-space: nowrap;
}

.digest-lead {
  max-width: 64ch;
  margin: 0;
  color: var(--digest-muted);
  font-size: 16px;
  line-height: 1.75;
}

.digest-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 24px;
}

.digest-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 14px;
  border: 1px solid var(--digest-border);
  border-radius: 999px;
  background: var(--digest-surface);
  color: var(--digest-muted);
  font-size: 13px;
  line-height: 1.2;
  text-decoration: none !important;
  box-shadow: 0 1px 1px oklch(20% 0.01 95 / 0.03);
}

.digest-chip-link:hover {
  border-color: var(--digest-border-strong);
  color: var(--digest-text);
}

.digest-feed {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 40px;
}

.digest-summary-shell {
  margin-top: 40px;
}

.digest-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  color: var(--digest-muted);
  font-size: 13px;
  font-weight: 700;
}

.digest-summary-head a {
  color: var(--digest-muted) !important;
  text-decoration: none !important;
}

.digest-summary-head a:hover {
  color: var(--digest-text) !important;
  text-decoration: underline !important;
}

.digest-summary-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.digest-summary-content > blockquote {
  margin: 0 0 4px;
  padding: 0;
  border: none;
  color: var(--digest-muted);
  font-size: 14px;
}

.digest-summary-content > blockquote p {
  margin: 0;
}

.digest-summary-content > ol,
.digest-summary-content > hr,
.digest-summary-content > p:empty {
  display: none;
}

.digest-card {
  --accent: 58% 0.13 282;
  position: relative;
  overflow: hidden;
  padding: 24px 26px;
  border: 1px solid var(--digest-border);
  border-radius: 20px;
  background: var(--digest-surface);
  box-shadow: var(--digest-shadow);
  transition:
    transform 260ms cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 260ms ease,
    border-color 260ms ease;
}

.digest-card:hover {
  transform: translateY(-4px);
  border-color: var(--digest-border-strong);
  box-shadow: var(--digest-shadow-hover);
}

.digest-card.accent-0 { --accent: 58% 0.13 282; }
.digest-card.accent-1 { --accent: 52% 0.12 166; }
.digest-card.accent-2 { --accent: 55% 0.13 42; }
.digest-card.accent-3 { --accent: 55% 0.12 245; }
.digest-card.accent-4 { --accent: 58% 0.11 76; }

.digest-num {
  position: absolute;
  top: 18px;
  right: 24px;
  color: oklch(var(--accent) / 0.13);
  font-size: 46px;
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1;
  pointer-events: none;
}

.digest-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-right: 52px;
}

.digest-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 13px;
  border-radius: 999px;
  background: oklch(var(--accent) / 0.12);
  color: oklch(var(--accent));
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}

.digest-source {
  color: var(--digest-faint);
  font-size: 13px;
  white-space: nowrap;
}

.digest-card h2 {
  max-width: 88%;
  margin: 0 0 13px;
  color: var(--digest-text) !important;
  font-size: 21px;
  font-weight: 730 !important;
  line-height: 1.35;
  letter-spacing: 0;
}

.digest-card h2 a {
  color: inherit !important;
  text-decoration: none !important;
}

.digest-card h2 a:hover {
  color: oklch(var(--accent)) !important;
}

.digest-item-card h2 {
  margin-top: 0;
}

.digest-item-card h2 .score-badge {
  margin-left: 8px;
  background: oklch(var(--accent)) !important;
}

.digest-item-card .digest-anchor {
  display: none;
}

.digest-card p {
  max-width: 62ch;
  margin: 0;
  color: var(--digest-muted);
  font-size: 15px;
  line-height: 1.72;
}

.digest-item-card ul {
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: 62ch;
  margin: 0;
  padding: 0;
  list-style: none;
}

.digest-item-card li {
  position: relative;
  margin: 0;
  padding-left: 17px;
  color: var(--digest-text);
  font-size: 15px;
  line-height: 1.62;
}

.digest-item-card li::before {
  content: "";
  position: absolute;
  top: 0.73em;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: oklch(var(--accent));
}

.digest-item-card p + p,
.digest-item-card p + details,
.digest-item-card details + p {
  margin-top: 14px;
}

.digest-summary-content img {
  display: none;
}

.digest-item-card details {
  margin-top: 14px;
  border-color: var(--digest-border);
  border-radius: 12px;
  background: var(--digest-surface-2);
}

.digest-item-card details summary {
  color: var(--digest-muted);
}

.digest-item-card .tag-line code {
  border-radius: 999px;
  background: var(--digest-surface-2) !important;
  color: var(--digest-muted) !important;
}

.digest-item-card .source-line {
  border-left: 0;
  padding-left: 0;
}

.digest-source a {
  color: inherit !important;
  text-decoration: none !important;
}

.digest-source a:hover {
  color: oklch(var(--accent)) !important;
}

.digest-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--digest-border);
}

.digest-tags {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 7px;
}

.digest-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 11px;
  border: 1px solid var(--digest-border);
  border-radius: 999px;
  background: var(--digest-surface-2);
  color: var(--digest-muted);
  font-size: 12px;
  line-height: 1.1;
}

.digest-action {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 14px;
  border-radius: 999px;
  background: oklch(var(--accent) / 0.11);
  color: oklch(var(--accent)) !important;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none !important;
  white-space: nowrap;
  transition: transform 160ms ease, background 200ms ease;
}

.digest-action:hover {
  transform: translateY(-1px);
  background: oklch(var(--accent) / 0.18);
}

/* Homepage "detail report only" filter */
.digest-filter-bar {
  display: flex;
  gap: 8px;
  margin: 4px 0 18px;
  flex-wrap: wrap;
}

.digest-filter-btn {
  appearance: none;
  cursor: pointer;
  min-height: 32px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--digest-border);
  background: var(--digest-surface);
  color: var(--digest-muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  transition: border-color 160ms ease, color 160ms ease, background 200ms ease;
}

.digest-filter-btn:hover {
  border-color: var(--digest-border-strong);
  color: var(--digest-text);
}

.digest-filter-btn.active {
  border-color: transparent;
  background: var(--hz-accent);
  color: #fff;
}

/* When the filter is on, hide cards without a detail report. */
.digest-summary-content.filter-reports-only .digest-item-card:not(.has-detail) {
  display: none;
}

.digest-archive {
  margin-top: 44px;
}

.digest-archive h2 {
  margin: 0 0 14px;
  color: var(--digest-text) !important;
  font-size: 18px;
  font-weight: 730 !important;
}

.digest-archive-list {
  display: grid;
  gap: 10px;
}

.digest-archive-item {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--digest-border);
  border-radius: 14px;
  background: var(--digest-surface);
  text-decoration: none !important;
}

.digest-archive-item:hover {
  border-color: var(--digest-border-strong);
}

.digest-archive-item span {
  color: var(--digest-faint);
  font-size: 12px;
}

.digest-archive-item strong {
  color: var(--digest-text);
  font-size: 14px;
  font-weight: 700;
}

.digest-docs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 44px;
  color: var(--digest-faint);
  font-size: 13px;
}

.digest-docs a {
  color: var(--digest-muted) !important;
  text-decoration: none !important;
}

.digest-docs a:hover {
  color: var(--digest-text) !important;
  text-decoration: underline !important;
}

@media (max-width: 640px) {
  body:has(.digest-home) .main-content,
  body.has-digest-home .main-content {
    padding-top: 44px;
  }

  .main-content .digest-home {
    max-width: none;
  }

  .digest-hero {
    padding-top: 4px;
  }

  .digest-card {
    padding: 20px 18px;
    border-radius: 18px;
  }

  .digest-summary-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .digest-card-top {
    align-items: flex-start;
    flex-direction: column;
    padding-right: 42px;
  }

  .digest-num {
    right: 18px;
    font-size: 36px;
  }

  .digest-card h2 {
    max-width: 100%;
    font-size: 19px;
  }

  .digest-foot {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Hide Cayman theme footer ("maintained by … / generated by GitHub Pages") */
.site-footer { display: none !important; }
