@font-face {
  font-family: "HackJBMLigaturedCCG-Regular";
  src: url("/assets/fonts/HackJBMLigaturedCCG-Regular.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --primary: #e65100;
  --bg: #fff;
  --text: #373737;
  --strong: #000;
  --muted: #707070;
  --border: rgba(0, 0, 0, 0.12);
  --nav: #fff;
  --nav-text: #373737;
  --card: #f5f5f5;
  --quote: #fff2eb;
  --code: #ff1744;
  --code-bg: #f8f8f8;
  --mark: rgba(230, 81, 0, 0.5);
  --selection: rgba(239, 187, 53, 0.65);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --max: 1040px;
  --nav-h: 64px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #ffa726;
  --bg: #1d232c;
  --text: #dadada;
  --strong: #fff;
  --muted: #9e9e9e;
  --border: rgba(255, 255, 255, 0.12);
  --nav: #222831;
  --nav-text: #fff;
  --card: #252d38;
  --quote: #252d38;
  --code: #16f0a0;
  --code-bg: #222831;
  --mark: rgba(255, 167, 38, 0.5);
  --selection: rgba(33, 66, 131, 0.85);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --primary: #ffa726;
    --bg: #1d232c;
    --text: #dadada;
    --strong: #fff;
    --muted: #9e9e9e;
    --border: rgba(255, 255, 255, 0.12);
    --nav: #222831;
    --nav-text: #fff;
    --card: #252d38;
    --quote: #252d38;
    --code: #16f0a0;
    --code-bg: #222831;
    --mark: rgba(255, 167, 38, 0.5);
    --selection: rgba(33, 66, 131, 0.85);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 62.5%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Helvetica Neue", BlinkMacSystemFont, "Microsoft Yahei", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", sans-serif;
  font-size: 1.6rem;
  line-height: 1.6;
}
img { max-width: 100%; height: auto; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--selection); }
button, input { font: inherit; color: inherit; }

.site-wrapper { min-height: 100vh; }
.site-nav {
  position: relative;
  z-index: 20;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4vw;
  background: var(--nav);
  color: var(--nav-text);
  border-bottom: 1px solid var(--border);
}
.nav-spacer { display: none; }
.site-nav-left, .site-nav-right, .site-nav-content, .nav { display: flex; align-items: center; }
.site-nav-left { min-width: 0; }
.site-nav-right { margin-left: auto; gap: 4px; }
.site-nav-logo img { display: block; height: 32px; width: auto; }
.nav { list-style: none; margin: 0 0 0 18px; padding: 0; gap: 16px; }
.nav a { color: var(--nav-text); font-weight: 600; font-size: 1.5rem; }
.nav-current a { color: var(--primary); }
.nav-dropdown { position: relative; }
.nav-dropdown > button {
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 600;
  font-size: 1.5rem;
  cursor: pointer;
}
.nav-dropdown ul {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 30;
  min-width: 180px;
  margin: 0;
  padding: 8px 0;
  list-style: none;
  background: var(--nav);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.nav-dropdown.is-open ul { display: block; }
.nav-dropdown li a { display: block; padding: 8px 16px; color: var(--nav-text); font-weight: 600; white-space: nowrap; }
.join-glt {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1400;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  background: #15171a;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  text-decoration: none;
}
.join-glt:hover { color: #fff; text-decoration: none; }
.menu-toggle, .dark-mode-toggle, [data-search-open] {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.menu-toggle { display: none; padding: 8px; }
.menu-toggle svg { display: block; }
.dark-mode-toggle { width: 40px; height: 40px; padding: 8px; }
.dark-mode-toggle svg { width: 100%; height: 100%; }
[data-search-open] { padding: 8px 10px; font-weight: 600; }
.so-cial-links { display: flex; align-items: center; }
.so-cial-link { display: inline-flex; opacity: 0.8; padding: 0 2px; color: var(--nav-text); }
.so-cial-link:hover { opacity: 1; text-decoration: none; }
.so-cial-link i { display: flex; padding: 8px; }
.so-cial-link svg { width: 1.5rem; height: 1.5rem; }
.is-hidden { display: none !important; }

.search-panel {
  display: none;
  position: absolute;
  top: var(--nav-h);
  right: 4vw;
  z-index: 1100;
  width: min(420px, 90vw);
  padding: 12px;
  background: var(--nav);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.search-panel.is-open { display: block; }
.search-panel input { width: 100%; margin-bottom: 8px; padding: 8px; background: var(--bg); border: 1px solid var(--border); }
.search-panel ul { list-style: none; margin: 0; padding: 0; }
.search-panel li { padding: 6px 0; }

.site-home-header { position: relative; }
.site-header-background {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 42vh;
  color: #fff;
  background: #15171a center / cover no-repeat;
}
.site-home-header .site-header-background { min-height: 46vh; }
.site-header-background::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
}
.site-header-content { position: relative; z-index: 1; padding: 8vh 5vw 6vh; text-align: center; }
.site-title { margin: 0; }
.site-logo { max-height: 55px; width: auto; }
.site-description { margin: 12px 0 0; font-size: 2.1rem; font-weight: 400; }

.site-main { padding: 28px 0 10px; }
.inner { max-width: var(--max); margin: 0 auto; padding: 0 5vw; }
.post-feed {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 36px 28px;
  padding-top: 28px;
}
.post-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.post-card-large {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  gap: 28px;
  padding-bottom: 8px;
}
.post-card-large .post-card-image-link,
.post-card-large .post-card-content { flex: 1; min-width: 0; }
.post-card-image-link { display: block; overflow: hidden; border-radius: 3px; background: var(--card); }
.post-card-image { display: block; width: 100%; height: 180px; object-fit: cover; }
.post-card-large .post-card-image { height: 280px; }
.post-card-primary-tag { font-size: 1.3rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.post-card-title { margin: 8px 0; font-size: 2.4rem; line-height: 1.3; color: var(--strong); }
.post-card-content-link { color: inherit; text-decoration: none; }
.post-card-content-link:hover { text-decoration: none; }
.post-card-byline-date, .post-card-excerpt { color: var(--muted); }
.post-card-excerpt p { margin: 8px 0 0; }

.pagination-footer { padding: 8px 5vw 48px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; }
.pagination-list { list-style: none; margin: 0; padding: 0 12px; color: var(--strong); font-weight: 600; }
.pagination-previous, .pagination-next {
  min-width: 8rem;
  text-align: center;
  color: var(--strong);
  font-weight: 600;
}
.pagination-previous[disabled], .pagination-next[disabled] { color: var(--muted); pointer-events: none; opacity: 0.45; }

.post-full { max-width: var(--max); margin: 0 auto; padding: 12px 5vw 40px; }
.post-full-header { max-width: 720px; margin: 0 auto 24px; text-align: center; }
.post-full-title { margin: 12px 0; font-size: 3.6rem; line-height: 1.25; color: var(--strong); }
.post-full-custom-excerpt { color: var(--muted); font-size: 1.8rem; }
.post-full-byline-content { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 16px; }
.author-list { list-style: none; margin: 0; padding: 0; }
.author-profile-image { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.author-name { margin: 0; font-size: 1.6rem; }
.author-name a { color: var(--strong); }
.byline-meta-content { color: var(--muted); font-size: 1.4rem; }
.post-full-image { margin: 0 auto 28px; max-width: 1000px; }
.post-full-image img { display: block; width: 100%; cursor: zoom-in; }
.post-full-content {
  max-width: 720px;
  margin: 0 auto;
  font-size: 1.8rem;
  line-height: 1.7;
}
.post-full-content h2 { margin: 1.6em 0 0.6em; font-size: 2.4rem; color: var(--strong); }
.post-full-content p, .post-full-content ul, .post-full-content ol { margin: 0 0 1.2em; }
.post-full-content ul, .post-full-content ol { padding-left: 1.4em; }
.post-full-content blockquote, .kg-blockquote-alt {
  margin: 0 0 1.4em;
  padding: 12px 20px;
  background: var(--quote);
  border-left: 3px solid var(--primary);
}
.post-full-content code {
  padding: 0.1em 0.35em;
  color: var(--code);
  background: var(--code-bg);
  border-radius: 3px;
  font-family: "HackJBMLigaturedCCG-Regular", Menlo, Consolas, Monaco, monospace;
}
.post-full-content pre code { padding: 0; color: inherit; background: transparent; }
.post-full-content mark { background: var(--mark); }
.post-full-content img { cursor: zoom-in; }
.post-full-tg { max-width: 720px; margin: 32px auto 0; }
.tg-block { display: flex; gap: 12px; align-items: center; margin: 12px 0; }
.tg-icon { width: 36px; height: 36px; }

.site-footer { margin-top: 20px; padding: 28px 5vw 40px; background: var(--nav); color: var(--nav-text); border-top: 1px solid var(--border); }
.site-footer-content { max-width: var(--max); margin: 0 auto; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: inherit; }
.site-footer-nav { display: flex; gap: 16px; }

.kg-card { margin: 0 0 1.6em; }
.kg-image-card img, .kg-gallery-image img { display: block; width: 100%; }
.kg-card figcaption, .kg-image-card figcaption { margin-top: 8px; text-align: center; color: var(--muted); font-size: 1.4rem; }
.kg-width-wide { max-width: min(1100px, 100%); }
.kg-gallery-row { display: flex; gap: 8px; margin-top: 8px; }
.kg-gallery-row:first-child { margin-top: 0; }
.kg-gallery-image { flex: 1; min-width: 0; }
.kg-gallery-image img { height: 100%; object-fit: cover; }
.kg-bookmark-card a { color: inherit; text-decoration: none; }
.kg-bookmark-container { display: flex; min-height: 120px; border: 1px solid var(--border); border-radius: 3px; overflow: hidden; background: var(--card); }
.kg-bookmark-content { flex: 1; padding: 16px 18px; }
.kg-bookmark-title { margin: 0 0 6px; color: var(--strong); font-size: 1.6rem; }
.kg-bookmark-description { margin: 0; color: var(--muted); font-size: 1.4rem; }
.kg-bookmark-metadata { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 1.3rem; }
.kg-bookmark-icon { width: 16px; height: 16px; }
.kg-bookmark-thumbnail { flex: 0 0 28%; max-width: 180px; }
.kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; cursor: default; }
.kg-callout-card { display: flex; gap: 12px; padding: 16px 18px; background: var(--card); border-radius: 3px; }
.kg-callout-card-green { background: color-mix(in srgb, #1f8a4c 16%, var(--card)); }
.kg-embed-card iframe, .kg-video-card video { display: block; width: 100%; max-width: 100%; background: #000; }
.kg-video-overlay, .kg-video-player-container { display: none; }
.kg-signup-card { padding: 20px; border: 1px solid var(--border); border-radius: 3px; background: var(--card); }
pre.shiki, .post-full-content pre {
  overflow-x: auto;
  margin: 0 0 1.6em;
  padding: 16px 18px;
  background: #222831;
  color: #a9b7c6;
  font-size: 1.4rem;
  line-height: 1.5;
  font-family: "HackJBMLigaturedCCG-Regular", Menlo, Consolas, Monaco, monospace;
}
pre.shiki code .line::before {
  content: counter(step);
  counter-increment: step;
  width: 1.6rem;
  margin-right: 1.2rem;
  display: inline-block;
  text-align: right;
  color: rgba(169, 183, 198, 0.35);
}
pre.shiki code { counter-reset: step; }

.zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 4vw;
  background: rgba(0, 0, 0, 0.88);
  opacity: 0;
  transition: opacity 180ms ease;
}
.zoom-overlay.is-open { opacity: 1; }
.zoom-overlay img {
  max-width: min(1200px, 100%);
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  transform: scale(0.94);
  transition: transform 220ms ease;
  cursor: zoom-out;
}
.zoom-overlay.is-open img { transform: scale(1); }
@media (prefers-reduced-motion: reduce) {
  .zoom-overlay, .zoom-overlay img { transition: none; }
}

@media (max-width: 800px) {
  .post-feed { grid-template-columns: 1fr; }
  .post-card-large, .post-card { flex-direction: column; }
  .post-card-large .post-card-image, .post-card-image { height: 200px; }
  .post-full-title { font-size: 2.8rem; }
  .kg-bookmark-thumbnail { display: none; }
  .menu-toggle { display: inline-flex; }
  .site-nav-content { display: none; }
  .site-nav.is-open .site-nav-content {
    display: block;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    padding: 12px 5vw 16px;
    background: var(--nav);
    border-bottom: 1px solid var(--border);
  }
  .site-nav.is-open .nav { flex-direction: column; align-items: flex-start; margin: 0; }
}
