/* feng.md — terminal editorial theme inspired by jibot.md */

:root {
  color-scheme: dark;
  --bg: #0d1117;
  --fg: #e6edf3;
  --fg-dim: #8b949e;
  --fg-bright: #f0f6fc;
  --accent-link: #58a6ff;
  --accent-link-soft: #7aa9e6;
  --accent-success: #7ee787;
  --border: #21262d;
  --panel: #161b22;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
  --font-zh: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

@view-transition {
  navigation: auto;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fbfaf7;
  --fg: #24292f;
  --fg-dim: #68717d;
  --fg-bright: #111827;
  --accent-link: #0969da;
  --accent-link-soft: #2f6fab;
  --accent-success: #1a7f37;
  --border: #d8dee4;
  --panel: #f1f4f8;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  line-height: 1.7;
  min-height: 100vh;
  position: relative;
  transition: background-color 0.2s ease, color 0.2s ease;
}

body.zh {
  font-family: var(--font-zh), var(--font-mono);
}

.top-controls {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  font-weight: 600;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  color: var(--fg-dim);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--accent-link);
  color: var(--accent-link);
}

.theme-icon {
  position: absolute;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.theme-icon-sun {
  opacity: 0;
  transform: rotate(90deg) scale(0.65);
}

:root[data-theme="light"] .theme-icon-moon {
  opacity: 0;
  transform: rotate(-90deg) scale(0.65);
}

:root[data-theme="light"] .theme-icon-sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.lang-pill-link {
  color: var(--fg-dim);
  text-decoration: none;
  padding: 0.05rem 0.25rem;
  border-radius: 4px;
  transition: color 0.15s;
}

.lang-pill-link:hover {
  color: var(--accent-link);
  text-decoration: none;
}

.lang-pill-link.active {
  color: var(--fg-bright);
  pointer-events: none;
  cursor: default;
}

.lang-pill-sep {
  color: var(--border);
  user-select: none;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 1.5rem 6rem;
}

.home-nav {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1.5rem 0;
}

.home-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg-dim);
  font-size: 0.85rem;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}

.home-icon:hover {
  border-color: var(--accent-link);
  color: var(--fg);
  text-decoration: none;
}

.feng-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-success);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  line-height: 1;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--fg-bright);
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

h1 {
  font-size: 1.5rem;
  margin-top: 0;
}

h1 .subtitle {
  display: block;
  font-size: 1rem;
  font-weight: 400;
  color: var(--fg-dim);
  margin-top: 0.25rem;
}

h2 {
  font-size: 1.25rem;
}

h3 {
  font-size: 1.1rem;
}

/* Blockquote (epigraph) */
blockquote {
  border-left: 3px solid #3b4854;
  padding: 0.5rem 1rem;
  margin: 1.5rem 0;
  color: var(--fg-dim);
  font-style: italic;
}

/* Links */
a {
  color: var(--accent-link);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  text-decoration: underline;
}

main p a,
main li a,
main blockquote a {
  color: var(--accent-link-soft);
  text-decoration: underline;
  text-decoration-color: rgba(122, 169, 230, 0.4);
  text-underline-offset: 3px;
}

main p a:hover,
main li a:hover,
main blockquote a:hover {
  color: var(--accent-link);
  text-decoration-color: currentColor;
}

/* Paragraphs */
p {
  margin-bottom: 1rem;
  text-wrap: pretty;
}

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* Inline code */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--panel);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

/* Lists */
ul, ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.3rem;
}

.latest-post {
  margin-bottom: 2rem;
}

.latest-post .post-meta {
  color: var(--fg-dim);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.latest-post h1,
.latest-post h2 {
  margin-top: 0;
}

.latest-post h2,
.feed-title span,
.post-header h1 {
  contain: layout;
}

.post-title-arrive {
  will-change: transform, opacity;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 1rem;
}

.post-header {
  margin-bottom: 1.5rem;
}

.post-header h1 {
  margin-bottom: 0.75rem;
}

.post-description {
  color: var(--fg-dim);
  font-size: 0.95rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}

.tag-list li {
  margin: 0;
}

.tag-list span {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  color: var(--fg-dim);
  font-size: 0.75rem;
}

.post-footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

.feed {
  margin: 1.5rem 0 2rem;
}

.feed-item {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px dashed var(--border);
  align-items: baseline;
}

.feed-title a {
  color: var(--accent-link);
  text-decoration: none;
}

.feed-title a:hover {
  text-decoration: underline;
}

.feed-item .date {
  text-align: right;
  font-size: 0.85rem;
  color: var(--fg-dim);
  white-space: nowrap;
}

.feed-item .dek {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--fg-dim);
}

.post-list {
  list-style: none;
  margin-left: 0;
  padding-left: 0;
}

/* Post page */
.post-meta {
  color: var(--fg-dim);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.post-content {
  margin-top: 1rem;
}

/* Footer */
footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--fg-dim);
}

.site-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

footer p {
  margin-bottom: 0;
}

.footer-icons {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
}

.footer-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  color: var(--fg-dim);
  border-radius: 999px;
  transition: color 0.2s ease, transform 0.2s ease;
}

.footer-icons a:hover {
  color: var(--accent-link);
  text-decoration: none;
  transform: rotate(6deg);
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.22s;
}

::view-transition-group(*) {
  animation-duration: 0.36s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}

::view-transition-old(*),
::view-transition-new(*) {
  animation-duration: 0.36s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(*),
  ::view-transition-new(*),
  ::view-transition-group(*) {
    animation-duration: 0.001s;
  }
}

/* Source link */
.source-link {
  color: var(--fg-dim);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.source-link:hover {
  color: var(--accent-link);
}

/* Emissions/Elsewhere layout */
.section-label {
  color: var(--fg-dim);
  margin-bottom: 0.5rem;
}

@media (max-width: 600px) {
  .home-nav {
    padding: 0.75rem 1rem 0;
  }

  main {
    padding: 2rem 1.25rem 4rem;
  }

  h1 {
    font-size: 1.3rem;
  }

  h2 {
    font-size: 1.15rem;
  }

  .top-controls {
    top: 0.5rem;
    right: 0.5rem;
    gap: 0.35rem;
  }

  .lang-pill {
    font-size: 0.7rem;
  }

  .site-footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .feed-item {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .feed-item .date {
    text-align: left;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 15px;
  }
}
