/* === Air Chrysalis — 空氣蛹週記 === */

:root {
  --bg: #fff;
  --text: #1a1a1a;
  --text-muted: #999;
  --border: #e5e5e5;
  --hover-bg: #f8f8f8;
  --card-bg: #fff;
  --shadow: rgba(0, 0, 0, 0.1);
  --code-bg: rgba(0, 0, 0, 0.05);
  --pre-bg: #2c2c2c;
  --pre-text: #e8e6e1;
  --font-base: 'Source Serif 4', 'Iansui', Georgia, serif;
  --font-mono: 'SF Mono', 'Menlo', 'Consolas', monospace;
  --font-meta: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --max-width: 680px;
}

html:lang(en) {
  --font-base: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* === Dark Mode === */

[data-theme="dark"] {
  --bg: #161616;
  --text: #e0e0e0;
  --text-muted: #777;
  --border: #2e2e2e;
  --hover-bg: #1e1e1e;
  --card-bg: #1c1c1c;
  --shadow: rgba(0, 0, 0, 0.4);
  --code-bg: rgba(255, 255, 255, 0.08);
  --pre-bg: #111;
  --pre-text: #ccc;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-base);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}

/* === Layout === */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

/* === Header === */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2rem 0 1.5rem;
  margin-bottom: 1.5rem;
}

header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

header h1 a {
  color: inherit;
  text-decoration: none;
}

header nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
}

header nav a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

header nav a:hover,
header nav a.active {
  color: var(--text);
}

header nav .sep {
  color: var(--border);
  user-select: none;
}

/* === Article List === */

.article-list {
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.article-list li {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  gap: 0.75rem;
}

.article-list li:last-child {
  border-bottom: none;
}

.article-list li:hover {
  background: var(--hover-bg);
}

.article-list .icon {
  color: var(--text-muted);
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  opacity: 0.4;
}

.article-list .title {
  flex: 1;
  min-width: 0;
}

.article-list .title a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.article-list .location,
.article-list .date {
  font-family: var(--font-meta);
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* === About Page === */

.about {
  line-height: 1.9;
}

.about p {
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

.about strong {
  font-weight: 600;
}

.about em {
  font-style: italic;
}

.about a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.about a:hover {
  text-decoration-thickness: 2px;
}

/* === Article Page === */

.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  transition: color 0.15s;
}

.back-link:hover { color: var(--text); }

article .meta {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

article .meta h1 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 0.4rem;
}

article .meta .date {
  font-family: var(--font-meta);
  font-size: 0.8rem;
  color: var(--text-muted);
}

article .meta .location {
  font-family: var(--font-meta);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: 0.75rem;
}

/* === Article Content === */

.content h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 2.5rem 0 1rem;
}

.content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
}

.content p {
  margin-bottom: 1.25rem;
}

.content blockquote {
  border-left: 2px solid var(--border);
  padding: 0.5rem 1rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
}

.content ul, .content ol {
  margin: 1rem 0 1.25rem 1.5rem;
}

.content li {
  margin-bottom: 0.4rem;
}

.content code {
  background: var(--code-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.85em;
  font-family: var(--font-mono);
}

.content pre {
  background: var(--pre-bg);
  color: var(--pre-text);
  padding: 1.25rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.82rem;
  line-height: 1.6;
}

.content pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.content a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.content a:hover {
  text-decoration-thickness: 2px;
}

.content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

.content strong {
  font-weight: 600;
}

/* === Wiki Tooltip === */

.wiki-tip {
  position: relative;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  cursor: help;
}

.wiki-card {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  padding: 0.85rem 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 16px var(--shadow);
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--text-muted);
  z-index: 100;
  pointer-events: none;
}

.wiki-card::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--border);
}

.wiki-tip:hover .wiki-card {
  display: block;
}

/* === Online Counter === */

.online-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.online-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
}

/* === Theme Toggle === */

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.theme-toggle:hover {
  color: var(--text);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

/* === Footer === */

footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 0 3rem;
  margin-top: 3rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

footer nav {
  display: flex;
  gap: 1.25rem;
}

footer nav a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

footer nav a:hover {
  color: var(--text);
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* === Responsive === */

@media (max-width: 600px) {
  html { font-size: 15px; }
  header { padding: 1.5rem 0 1rem; }
  .container { padding: 0 1rem; }
  .article-list .location { display: none; }
}
