/* Host-site overrides for cast-bootstrap5 tokens. */
:root {
  --cast-bg: #f8f9fa;
  --cast-bg-alt: #f0f1f3;
  --cast-surface: #ffffff;

  --cast-text: #212529;
  --cast-text-muted: #6c757d;
  --cast-text-light: #adb5bd;

  --cast-accent: #0066cc;
  --cast-accent-hover: #004c99;
  --cast-accent-light: #e6f0ff;
  --cast-link-on-white: #004c99;

  --cast-border: #e9ecef;
  --cast-border-strong: #dee2e6;

  --cast-code-bg: #f0f1f3;
  --cast-code-text: #212529;

  --cast-modal-backdrop: rgba(0, 0, 0, 0.85);
  --cast-gallery-body-bg: rgba(255, 255, 255, 0.8);
  --cast-gallery-header-bg: rgba(255, 255, 255, 1);
  --cast-gallery-footer-bg: rgba(255, 255, 255, 1);
}

[data-bs-theme="dark"] {
  --cast-bg: #0f172a;
  --cast-bg-alt: #1e293b;
  --cast-surface: #283548;

  --cast-text: #f8fafc;
  --cast-text-muted: #94a3b8;
  --cast-text-light: #64748b;

  --cast-accent: #38bdf8;
  --cast-accent-hover: #0ea5e9;
  --cast-accent-light: #0b1f34;
  --cast-link-on-white: #38bdf8;

  --cast-border: #334155;
  --cast-border-strong: #475569;

  --cast-code-bg: #1e293b;
  --cast-code-text: #f8fafc;

  --cast-modal-backdrop: rgba(0, 0, 0, 0.85);
  --cast-gallery-body-bg: rgba(15, 23, 42, 0.9);
  --cast-gallery-header-bg: rgba(40, 53, 72, 1);
  --cast-gallery-footer-bg: rgba(40, 53, 72, 1);
}

/* Search modal contrast and palette alignment */
.cast-search-overlay {
  background: var(--cast-modal-backdrop);
}

.cast-search-modal {
  background: var(--cast-surface);
}

.cast-search-modal-close,
.cast-btn-clear {
  color: #5f6770;
}

[data-bs-theme="dark"] .cast-search-modal-close,
[data-bs-theme="dark"] .cast-btn-clear {
  color: #a8b3c0;
}

[data-bs-theme="dark"] .cast-btn-search,
[data-bs-theme="dark"] .cast-ordering-pills .tag-pill.active {
  color: #0f172a;
}

/* Hero typography from prototype */
.cast-hero .blog-title {
  font-size: clamp(2.5rem, 5vw, var(--s4));
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: var(--s-2);
  color: #1a1a2e;
}

[data-bs-theme="dark"] .cast-hero .blog-title {
  color: #f1f5f9;
}

.cast-hero .blog-title .tilde {
  font-family: var(--cast-font-mono);
  font-weight: 400;
  opacity: 0.5;
}

.cast-hero .intro.lead {
  font-size: var(--s1);
  line-height: 1.5;
  margin-top: var(--s-1);
  font-style: italic;
  color: #5a6072;
}

[data-bs-theme="dark"] .cast-hero .intro.lead {
  color: #94a3b8;
}

.cast-hero .intro.lead strong,
.cast-hero .intro.lead b {
  font-style: normal;
  font-weight: 600;
  color: #1a1a2e;
}

[data-bs-theme="dark"] .cast-hero .intro.lead strong,
[data-bs-theme="dark"] .cast-hero .intro.lead b {
  color: #f1f5f9;
}

.cast-hero .intro.lead p {
  margin-bottom: 0;
}

/* Weeknote link collections keep the old h2 + ul rhythm with structured metadata. */
.post-body .weeknote-links {
  margin-block: var(--s1);
  --weeknote-link-description-color: color-mix(in srgb, var(--cast-text) 92%, var(--cast-text-muted));
}

.post-body .weeknote-links h2 {
  margin-block-end: var(--s-2);
}

.post-body .weeknote-link-list {
  padding-inline-start: 1.25rem;
}

.post-body .weeknote-link-item {
  margin-block: 0.75rem;
  padding-inline-start: 0.1rem;
}

.post-body .weeknote-link-head {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.55rem;
  margin: 0;
}

.post-body .weeknote-link-title {
  font-weight: 500;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.post-body .weeknote-link-source {
  color: var(--cast-text-muted);
  font-size: 0.9em;
  white-space: nowrap;
}

.post-body .weeknote-link-source a {
  color: inherit;
  text-decoration-color: currentColor;
}

.post-body .weeknote-link-description {
  color: var(--weeknote-link-description-color);
  font-size: 0.96em;
  line-height: 1.55;
  margin-block-start: 0.1rem;
}

.post-body .weeknote-link-description p {
  margin: 0;
}

.post-body .weeknote-link-description p + p {
  display: block;
  margin-block-start: 0.35rem;
}
