/* ========================================
   Terminal Blog — CRT 显像管终端风格
   ======================================== */

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

:root {
  --green: #33ff33;
  --green-dim: #1a8c1a;
  --green-glow: #66ff66;
  --green-dark: #0f3a0f;
  --amber: #ffb000;
  --red: #ff3333;
  --bg: #0a0a0a;
  --bg-panel: #0d0d0d;
  --border: #1a2a1a;
  --border-bright: #1a5c1a;
  --font-size: 14px;
  --line-height: 1.7;
  --max-width: 1060px;
}

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

html, body {
  width: 100%;
  min-height: 100%;
  background: #050505;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: var(--font-size);
  line-height: var(--line-height);
  color: var(--green);
  -webkit-font-smoothing: antialiased;
}

/* ---- Global CRT Effects ---- */
.crt-overlay {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.5) 100%);
  animation: crt-flicker 0.15s infinite;
}

.scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 998;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    rgba(0,0,0,0.06) 2px, rgba(0,0,0,0.06) 4px
  );
}

@keyframes crt-flicker {
  0%   { opacity: 0.97; }
  5%   { opacity: 0.95; }
  10%  { opacity: 0.99; }
  15%  { opacity: 0.96; }
  20%  { opacity: 0.98; }
  50%  { opacity: 0.97; }
  80%  { opacity: 0.98; }
  90%  { opacity: 0.96; }
  100% { opacity: 0.97; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ========================================
   BOOT OVERLAY
   ======================================== */

.boot-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #050505;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease-out;
}

.boot-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.boot-overlay .crt-overlay { z-index: 1001; }
.boot-overlay .scanlines   { z-index: 1000; }

.boot-content {
  position: relative;
  z-index: 1002;
  max-width: 900px;
  width: 95%;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 14px;
  color: var(--green);
  text-shadow: 0 0 4px rgba(51,255,51,0.5);
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
}

.boot-content .boot-line {
  opacity: 0;
  animation: fadeIn 0.3s ease forwards;
}

.boot-content .ascii-art {
  color: var(--green-glow);
  text-shadow: 0 0 12px var(--green), 0 0 24px var(--green-dim);
  font-size: 12px;
  line-height: 1.2;
}

.boot-content .boot-highlight {
  color: var(--amber);
  text-shadow: 0 0 6px rgba(255,176,0,0.4);
}

.boot-content .warn {
  color: var(--amber);
}

/* ========================================
   MAIN PAGE
   ======================================== */

.main-page {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.main-page.visible {
  opacity: 1;
}

/* ---- Header ---- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(10,10,10,0.95);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.site-logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 700;
}

.logo-icon {
  color: var(--green);
  text-shadow: 0 0 6px var(--green);
}

.logo-text {
  color: var(--green-glow);
  text-shadow: 0 0 8px var(--green);
  letter-spacing: 1px;
}

.logo-cursor {
  color: var(--green);
  text-shadow: 0 0 10px var(--green);
  animation: blink 1s step-end infinite;
}

.site-nav {
  display: flex;
  gap: 24px;
}

.nav-link {
  color: var(--green-dim);
  text-decoration: none;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: all 0.2s;
  position: relative;
}

.nav-link::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 100%;
  height: 1px;
  background: var(--green);
  transition: right 0.25s ease;
}

.nav-link:hover {
  color: var(--green);
  text-shadow: 0 0 6px var(--green);
}

.nav-link:hover::before {
  right: 0;
}

.nav-link.active {
  color: var(--green-glow);
  text-shadow: 0 0 6px var(--green);
  border-bottom-color: var(--green);
}

/* ---- Site Body ---- */
.site-body {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 32px;
  padding: 32px 24px;
  flex: 1;
  width: 100%;
}

.main-content {
  min-width: 0;
}

/* ---- Sidebar ---- */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-panel {
  border: 1px solid var(--border);
  background: var(--bg-panel);
  padding: 18px;
}

.sidebar-panel .panel-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--amber);
  text-shadow: 0 0 4px rgba(255,176,0,0.3);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ---- Search Box ---- */
.search-box {
  display: flex;
  gap: 0;
}

.search-box input {
  flex: 1;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border-bright);
  padding: 10px 14px;
  color: var(--green);
  font-family: inherit;
  font-size: 13px;
  caret-color: var(--green);
  min-width: 0;
}

.search-box input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 8px rgba(51,255,51,0.15);
}

.search-box input::placeholder {
  color: #0f3a0f;
}

.search-box button {
  background: rgba(51,255,51,0.06);
  border: 1px solid var(--border-bright);
  border-left: none;
  padding: 10px 14px;
  color: var(--green);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.search-box button:hover {
  background: rgba(51,255,51,0.15);
  text-shadow: 0 0 6px var(--green);
}

/* ---- Tag Cloud ---- */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--green-dim);
  border: 1px solid var(--green-dim);
  cursor: pointer;
  text-decoration: none;
  user-select: none;
  transition: all 0.2s;
}

.tag:hover {
  color: var(--green-glow);
  border-color: var(--green-glow);
  background: rgba(51,255,51,0.08);
  text-shadow: 0 0 6px var(--green);
  box-shadow: 0 0 8px rgba(51,255,51,0.15);
}

.tag.active {
  color: #000;
  background: var(--green);
  border-color: var(--green);
  font-weight: 700;
  text-shadow: none;
}

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  background: rgba(10,10,10,0.95);
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 24px;
  text-align: center;
  font-size: 11px;
  color: #0f3a0f;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.footer-sep {
  color: #1a2a1a;
}

/* ========================================
   ARTICLE CARDS (Home Page)
   ======================================== */

.article-card {
  border: 1px solid var(--border);
  background: var(--bg-panel);
  padding: 22px 24px;
  margin-bottom: 20px;
  cursor: pointer;
  transition: all 0.25s;
  animation: fadeIn 0.4s ease forwards;
  position: relative;
  overflow: hidden;
}

.article-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(51,255,51,0.015) 100%);
  pointer-events: none;
}

.article-card:hover {
  border-color: var(--green-dim);
  box-shadow: 0 0 12px rgba(51,255,51,0.06), inset 0 0 30px rgba(51,255,51,0.02);
  transform: translateY(-1px);
}

.article-card:active {
  transform: translateY(0);
}

/* Pinned tag highlight */
.tag-pinned {
  color: var(--amber) !important;
  border-color: var(--amber) !important;
  text-shadow: 0 0 6px rgba(255,176,0,0.4);
}

.pinned-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--amber);
  text-shadow: 0 0 6px rgba(255,176,0,0.4);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.search-result-card.pinned {
  border-left: 2px solid var(--amber);
}

.pinned-badge-small {
  font-size: 10px;
  font-weight: 700;
  color: var(--amber);
  text-shadow: 0 0 4px rgba(255,176,0,0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-right: 8px;
  padding: 1px 6px;
  border: 1px solid var(--amber);
  border-radius: 2px;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--green-glow);
  text-shadow: 0 0 6px var(--green);
  margin-bottom: 8px;
  line-height: 1.3;
}

.article-card:hover .card-title {
  text-shadow: 0 0 12px var(--green), 0 0 24px var(--green-dim);
}

.card-meta {
  font-size: 12px;
  color: #1a6a1a;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.card-meta .meta-date {
  color: #0f4a0f;
}

.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.card-excerpt {
  color: #1a8a1a;
  font-size: 13px;
  margin-top: 10px;
  line-height: 1.6;
  text-shadow: 0 0 2px rgba(51,255,51,0.15);
}

.card-read-more {
  display: inline-block;
  margin-top: 12px;
  font-size: 12px;
  color: var(--amber);
  text-shadow: 0 0 4px rgba(255,176,0,0.3);
}

.article-card:hover .card-read-more {
  text-shadow: 0 0 8px rgba(255,176,0,0.5);
}

/* ========================================
   ARTICLE DETAIL
   ======================================== */

.article-detail {
  animation: fadeIn 0.4s ease forwards;
}

.article-detail .back-link {
  display: inline-block;
  color: var(--green-dim);
  text-decoration: none;
  font-size: 12px;
  margin-bottom: 20px;
  transition: all 0.2s;
}

.article-detail .back-link:hover {
  color: var(--green);
  text-shadow: 0 0 6px var(--green);
}

.article-detail .article-header-block {
  border-bottom: 1px dashed var(--border-bright);
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.article-detail .article-title-main {
  font-size: 24px;
  font-weight: 700;
  color: var(--green-glow);
  text-shadow: 0 0 10px var(--green), 0 0 20px var(--green-dim);
  margin-bottom: 10px;
  line-height: 1.3;
}

.article-detail .article-meta-line {
  font-size: 12px;
  color: #1a6a1a;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

/* ---- Markdown Content ---- */
.article-body {
  text-shadow: 0 0 2px rgba(51,255,51,0.25);
  line-height: 1.8;
}

.article-body h1, .article-body h2, .article-body h3, .article-body h4 {
  color: var(--green-glow);
  text-shadow: 0 0 8px var(--green);
  margin: 1.3em 0 0.5em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.article-body h1 { font-size: 1.5em; }
.article-body h2 { font-size: 1.3em; }
.article-body h3 { font-size: 1.12em; }
.article-body h4 { font-size: 1em; }

.article-body p { margin: 0.7em 0; }

.article-body a {
  color: var(--amber);
  text-shadow: 0 0 4px rgba(255,176,0,0.3);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.article-body a:hover { color: #ffcc33; }

.article-body blockquote {
  border-left: 3px solid var(--green-dim);
  padding: 10px 18px;
  margin: 1em 0;
  color: #1a9a1a;
  background: rgba(51,255,51,0.025);
}

.article-body code {
  background: rgba(51,255,51,0.07);
  padding: 2px 7px;
  font-size: 0.9em;
  color: var(--green-glow);
}

.article-body pre {
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border);
  padding: 18px;
  margin: 1em 0;
  overflow-x: auto;
  position: relative;
}

.article-body pre::before {
  content: "SRC";
  position: absolute;
  top: 6px;
  right: 14px;
  font-size: 10px;
  color: #0a2a0a;
  letter-spacing: 2px;
}

.article-body pre code {
  background: none;
  padding: 0;
  font-size: 0.83em;
  color: var(--green);
}

.article-body hr {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 1.8em 0;
}

.article-body strong {
  color: var(--green-glow);
  text-shadow: 0 0 4px var(--green);
}

.article-body em { color: #4dff4d; }

.article-body ul, .article-body ol {
  padding-left: 2em;
  margin: 0.6em 0;
}

.article-body li { margin: 0.3em 0; }

.article-body li::marker { color: var(--green-dim); }

.article-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
}

.article-body th, .article-body td {
  border: 1px solid var(--border);
  padding: 8px 14px;
  text-align: left;
}

.article-body th {
  background: rgba(51,255,51,0.05);
  color: var(--green-glow);
}

.article-body img {
  max-width: 100%;
  border: 1px solid var(--border);
}

/* ---- Article Footer ---- */
.article-footer-signal {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  color: #1a5c1a;
  font-size: 12px;
}

/* ========================================
   SEARCH PAGE
   ======================================== */

.search-page-header {
  margin-bottom: 24px;
}

.search-page-header .search-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--green-glow);
  text-shadow: 0 0 8px var(--green);
  margin-bottom: 16px;
}

.search-page-header .search-input-large {
  width: 100%;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border-bright);
  padding: 12px 16px;
  color: var(--green);
  font-family: inherit;
  font-size: 15px;
  caret-color: var(--green);
}

.search-page-header .search-input-large:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 10px rgba(51,255,51,0.15);
}

.search-page-header .search-input-large::placeholder {
  color: #0f3a0f;
}

.search-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0 20px;
}

.search-filter-bar .filter-label {
  color: var(--amber);
  font-size: 12px;
  text-shadow: 0 0 4px rgba(255,176,0,0.3);
  white-space: nowrap;
}

.search-result-count {
  color: #1a5c1a;
  font-size: 12px;
  margin-bottom: 16px;
}

.search-no-results {
  color: #1a3a1a;
  text-align: center;
  padding: 40px 20px;
  border: 1px dashed var(--border);
}

/* Search result cards (reuse article-card style but not clickable-to-detail by default) */
.search-result-card {
  border: 1px solid var(--border);
  background: var(--bg-panel);
  padding: 18px 22px;
  margin-bottom: 14px;
  transition: all 0.2s;
  animation: fadeIn 0.3s ease forwards;
}

.search-result-card:hover {
  border-color: var(--green-dim);
  box-shadow: 0 0 8px rgba(51,255,51,0.05);
}

.search-result-card .result-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.search-result-card .result-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--green-glow);
  text-shadow: 0 0 4px var(--green);
  text-decoration: none;
}

.search-result-card .result-title:hover {
  text-shadow: 0 0 10px var(--green);
}

.search-result-card .result-idx {
  color: var(--green-dim);
  font-size: 11px;
}

.search-result-card .result-meta {
  font-size: 11px;
  color: #0f4a0f;
  margin-bottom: 6px;
}

.search-result-card .result-snippet {
  font-size: 12px;
  color: #1a7a1a;
  font-style: italic;
  margin-top: 6px;
}

mark.search-highlight {
  background: rgba(255,176,0,0.25);
  color: var(--amber);
  padding: 1px 3px;
}

/* ========================================
   ABOUT PAGE
   ======================================== */

/* ========================================
   FRIEND PAGE
   ======================================== */

.friend-block {
  animation: fadeIn 0.4s ease forwards;
}

.friend-block .friend-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--green-glow);
  text-shadow: 0 0 8px var(--green);
  margin-bottom: 20px;
}

.friend-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.friend-card {
  display: block;
  position: relative;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  padding: 16px 18px;
  text-decoration: none;
  transition: all 0.25s;
  overflow: hidden;
}

.friend-card:hover {
  border-color: var(--green-dim);
  box-shadow: 0 0 12px rgba(51,255,51,0.06), inset 0 0 30px rgba(51,255,51,0.02);
  transform: translateY(-1px);
}

.friend-card.pinned {
  border-left: 2px solid var(--amber);
  box-shadow: 0 0 8px rgba(255,176,0,0.12);
}

.friend-card.pinned:hover {
  border-left-color: var(--amber);
  box-shadow: 0 0 16px rgba(255,176,0,0.18);
}

.friend-card .pinned-badge {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 10px;
  font-weight: 700;
  color: var(--amber);
  text-shadow: 0 0 6px rgba(255,176,0,0.4);
  text-transform: uppercase;
  letter-spacing: 2px;
  padding: 6px 12px;
}

.friend-card-body {
  display: flex;
  align-items: center;
  gap: 14px;
}

.friend-logo {
  flex-shrink: 0;
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(51,255,51,0.03);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.friend-logo img {
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.friend-info {
  min-width: 0;
}

.friend-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--green-glow);
  text-shadow: 0 0 4px rgba(51,255,51,0.3);
  line-height: 1.4;
  margin-bottom: 3px;
  word-break: break-all;
}

.friend-name p {
  margin: 0;
}

.friend-name strong {
  color: #33ff33;
}

.friend-desc {
  font-size: 12px;
  color: #33aa33;
  line-height: 1.5;
  margin-bottom: 2px;
}

.friend-desc p {
  margin: 0;
}

.friend-url {
  font-size: 11px;
  color: #1a6a1a;
  word-break: break-all;
  transition: color 0.2s;
}

.friend-card:hover .friend-url {
  color: var(--green-dim);
}

.friend-empty {
  color: #1a6a1a;
  padding: 40px 0;
  text-align: center;
}

/* ========================================
   ABOUT PAGE
   ======================================== */

.about-block {
  animation: fadeIn 0.4s ease forwards;
}

.about-block .about-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--green-glow);
  text-shadow: 0 0 8px var(--green);
  margin-bottom: 16px;
}

.about-block .about-field {
  margin: 6px 0;
}

.about-block .about-field .field-label {
  color: var(--amber);
  text-shadow: 0 0 4px rgba(255,176,0,0.3);
}

.about-block .about-bio {
  margin-top: 16px;
  color: #1a7a1a;
  line-height: 1.7;
  padding: 14px 18px;
  border: 1px solid var(--border);
  background: rgba(51,255,51,0.02);
}

.about-block .about-body {
  color: #33ff33;
  line-height: 1.8;
}

.about-block .about-body div {
  margin: 6px 0;
}

/* ========================================
   SIDEBAR WHOAMI (rich text from API)
   ======================================== */

.whoami-body {
  font-size: 12px;
  color: #1a6a1a;
  line-height: 1.6;
}

.whoami-body h3 {
  color: #33ff33;
  font-weight: 700;
  margin: 0 0 6px 0;
  font-size: 13px;
}

.whoami-body ul {
  margin: 4px 0;
  padding-left: 16px;
}

.whoami-body li {
  margin: 2px 0;
}

.whoami-body p {
  margin: 4px 0;
}

/* ========================================
   SCROLLBAR
   ======================================== */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #050505; }
::-webkit-scrollbar-thumb { background: #1a2a1a; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #2a4a2a; }

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
  .site-body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: -1;
  }

  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .site-nav {
    gap: 16px;
  }

  .article-detail .article-title-main {
    font-size: 20px;
  }

  :root { --font-size: 13px; }

  .boot-content {
    font-size: 10px;
    max-width: 100%;
    overflow-x: auto;
  }

  .boot-content .ascii-art {
    font-size: 8px;
  }
}
