/* ============================================================
   码文说 — CodingHorror-inspired B&W theme
   ============================================================ */

/* ── Typography & font imports ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Core color overrides: strict black & white ── */
:root,
[data-md-color-scheme="default"] {
  --md-primary-fg-color:        #000000;
  --md-primary-fg-color--light: #333333;
  --md-primary-fg-color--dark:  #000000;
  --md-primary-bg-color:        #ffffff;
  --md-primary-bg-color--light: #ffffff;
  --md-accent-fg-color:         #000000;
  --md-accent-fg-color--transparent: rgba(0,0,0,0.1);
  --md-typeset-a-color:         #000000;
  --md-default-fg-color:        #1a1a1a;
  --md-default-fg-color--light: #555555;
  --md-default-fg-color--lighter: #888888;
  --md-default-bg-color:        #ffffff;

  /* Code blocks */
  --md-code-bg-color:           #f5f5f5;
  --md-code-fg-color:           #1a1a1a;

  /* Borders */
  --border-color:               #e0e0e0;
}

/* ── Site header: pure black bar ── */
.md-header {
  background-color: #000000 !important;
  box-shadow: none;
  border-bottom: none;
}

.md-header__title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #ffffff !important;
}

.md-header__button.md-logo {
  color: #ffffff;
}

/* Nav tabs */
.md-tabs {
  background-color: #000000 !important;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.md-tabs__link {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7) !important;
  opacity: 1;
}

.md-tabs__link--active,
.md-tabs__link:hover {
  color: #ffffff !important;
}

/* ── Main content area ── */
.md-main {
  background-color: #ffffff;
}

/* ── Typography ── */
.md-typeset {
  font-size: 1.05rem;
  line-height: 1.8;
  color: #1a1a1a;
}

.md-typeset h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #000000;
  border-bottom: 2px solid #000000;
  padding-bottom: 0.4rem;
  margin-bottom: 1.5rem;
}

.md-typeset h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #000000;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 0.3rem;
  margin-top: 2.5rem;
}

.md-typeset h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: #1a1a1a;
  margin-top: 2rem;
}

.md-typeset h4,
.md-typeset h5,
.md-typeset h6 {
  font-weight: 600;
  color: #1a1a1a;
}

/* Links: underline style, CodingHorror */
.md-typeset a {
  color: #000000;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.md-typeset a:hover {
  color: #555555;
}

/* ── Blockquotes ── */
.md-typeset blockquote {
  border-left: 3px solid #000000;
  padding-left: 1.2rem;
  color: #444444;
  font-style: italic;
  margin: 1.5rem 0;
}

/* ── Code ── */
.md-typeset code {
  background-color: #f5f5f5;
  color: #1a1a1a;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  font-size: 0.88em;
  padding: 0.1em 0.35em;
}

.md-typeset pre code {
  border: none;
  padding: 0;
}

.md-typeset pre {
  background-color: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
}

.highlight {
  background-color: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
}

/* ── Tables ── */
.md-typeset table:not([class]) {
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  font-size: 0.9rem;
}

.md-typeset table:not([class]) th {
  background-color: #000000;
  color: #ffffff;
  font-weight: 600;
  border: none;
  padding: 0.7rem 1rem;
}

.md-typeset table:not([class]) td {
  border-color: #e0e0e0;
  padding: 0.6rem 1rem;
}

.md-typeset table:not([class]) tr:hover {
  background-color: #f8f8f8;
}

/* ── Sidebar navigation ── */
.md-nav__title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #555555 !important;
}

.md-nav__link {
  color: #333333 !important;
  font-size: 0.88rem;
}

.md-nav__link--active,
.md-nav__link:hover {
  color: #000000 !important;
}

.md-nav__link--active {
  font-weight: 600;
}

/* ── Footer ── */
.md-footer {
  background-color: #000000;
  color: rgba(255,255,255,0.7);
}

.md-footer-meta {
  background-color: #000000;
}

.md-footer__link {
  color: rgba(255,255,255,0.7) !important;
}

/* ── Search ── */
.md-search__input {
  background-color: rgba(255,255,255,0.12);
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.2);
}

.md-search__input::placeholder {
  color: rgba(255,255,255,0.5);
}

/* ── Blog cards ── */
.md-post__header,
.md-post__meta {
  font-size: 0.85rem;
  color: #888888;
}

.md-post__excerpt {
  color: #333333;
  line-height: 1.7;
}

/* Category tags */
.md-tag {
  background-color: #1a1a1a !important;
  color: #ffffff !important;
  border-radius: 2px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 0.15em 0.6em;
}

/* ── About page author card ── */
.author-card {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  margin: 2rem 0;
  padding: 2rem;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background: #fafafa;
}

.author-card__meta h2 {
  margin-top: 0;
  border: none;
  font-size: 1.3rem;
}

/* ── Giscus ── */
.giscus,
.giscus-frame {
  width: 100%;
  margin-top: 1rem;
}

/* ── Article date meta ── */
.article-meta {
  font-size: 0.82rem;
  color: #888888;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e0e0e0;
  letter-spacing: 0.02em;
}

/* ── Admonitions: minimal B&W ── */
.admonition {
  border: 1px solid #e0e0e0;
  border-left: 3px solid #000000;
  border-radius: 3px;
  background: #fafafa;
}

.admonition-title {
  background: #f0f0f0;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #000000;
}

/* ── Back to top button ── */
.md-top {
  background-color: #000000;
  color: #ffffff;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track { background: #f5f5f5; }
::-webkit-scrollbar-thumb { background: #cccccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #999999; }

/* ── Definition lists ── */
.md-typeset dd {
  margin-left: 0;
  padding-left: 0;
}

/* ============================================================
   Share bar
   ============================================================ */
.share-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0 2rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid #e0e0e0;
}

.share-bar__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #888888;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.share-bar__buttons {
  display: flex;
  gap: 0.5rem;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid #e0e0e0;
  border-radius: 50%;
  background: #ffffff;
  color: #555555;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none !important;
  padding: 0;
  font-size: 0;
}

.share-btn:hover {
  color: #ffffff;
  border-color: transparent;
}

.share-btn--wechat:hover {
  background: #07c160;
}

.share-btn--twitter:hover {
  background: #000000;
}

.share-btn--bluesky:hover {
  background: #0085ff;
}

/* QR code overlay for WeChat */
.share-qr-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}

.share-qr-card {
  background: #ffffff;
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  position: relative;
  max-width: 320px;
}

.share-qr-card__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 1rem;
}

.share-qr-card__img {
  border: 1px solid #e0e0e0;
  border-radius: 4px;
}

.share-qr-card__url {
  font-size: 0.7rem;
  color: #999999;
  margin: 0.8rem 0 0;
  word-break: break-all;
  line-height: 1.4;
}

.share-qr-card__close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: #999999;
  cursor: pointer;
  padding: 0.25rem;
}

.share-qr-card__close:hover {
  color: #000000;
}
