/* ==========================================================================
   blog.ttf2.cn — Shared Typography, Safe Markdown Styles, Lightbox & Markdown Studio
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "HarmonyOS Sans SC", "Hiragino Sans GB", "Microsoft YaHei UI", sans-serif;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  --bg: #080b10;
  --bg-elevated: #111621;
  --surface: #141a26;
  --surface-hover: #1c2434;
  --code-bg: #0d121b;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.17);
  --ink: #f1f5f9;
  --ink-body: #dce4ee;
  --ink-secondary: #94a3b8;
  --ink-muted: #64748b;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.13);
  --accent-ink: #04111d;
  --draft-color: #f59e0b;
  --draft-soft: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-lg: 0 22px 54px rgba(0, 0, 0, 0.36);

  /* Syntax highlight tokens */
  --tok-kw: #7dd3fc;
  --tok-str: #86efac;
  --tok-cmt: #64748b;
  --tok-num: #fcd34d;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Reading Progress Bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2.5px;
  width: 0%;
  background: var(--accent);
  z-index: 1000;
  transition: width 0.08s linear;
}

/* Bespoke FERRO Octagonal Rotor-Core Emblem */
.ferro-emblem {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.ferro-emblem svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Homepage Subtle Personal Telemetry Strip */
.ferro-identity-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 18px;
  margin-bottom: 22px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
}

.ferro-id-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-secondary);
}

.ferro-spec-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--border);
}

/* ==========================================================================
   ABOUT PAGE: 驭铁个人档案与志趣图谱 (.dossier-*)
   ========================================================================== */

.dossier-wrap {
  padding-top: 26px;
}

.dossier-hero {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 22px;
  margin-bottom: 24px;
}

.dossier-main-card,
.dossier-id-card {
  padding: 26px 28px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.dossier-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.dossier-name {
  margin: 0 0 10px;
  font-size: clamp(26px, 3vw, 36px);
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.dossier-lead {
  margin: 0 0 18px;
  font-size: 15px;
  line-height: 1.72;
  color: var(--ink-body);
}

.morse-plate {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
}

.morse-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: morsePulse 1.8s infinite ease-in-out;
}

@keyframes morsePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.25; transform: scale(0.85); }
}

.id-plate-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  margin: 6px 0 14px;
}

.id-plate-emblem {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.id-plate-emblem svg {
  width: 26px;
  height: 26px;
}

.id-spec-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.id-spec-cell {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--code-bg);
  border: 1px solid var(--border);
}

.id-spec-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  text-transform: uppercase;
  margin-bottom: 3px;
}

.id-spec-value {
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.id-plate-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.dossier-bento {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.dossier-tile {
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.dossier-tile:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.dossier-tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dossier-tile-code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.08em;
}

.dossier-tile h3 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
  color: var(--ink);
}

.dossier-tile p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.62;
  color: var(--ink-secondary);
  flex: 1;
}

.dossier-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

@media (max-width: 980px) {
  .dossier-hero {
    grid-template-columns: 1fr;
  }
  .dossier-bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .dossier-bento,
  .id-spec-grid {
    grid-template-columns: 1fr;
  }
  .dossier-main-card,
  .dossier-id-card {
    padding: 20px 18px;
  }
}

/* Shared Buttons & Badges */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 550;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-hover);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  font-weight: 600;
}

.btn-primary:hover {
  filter: brightness(1.06);
  background: var(--accent);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.28);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 7px;
}

.badge-draft {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  background: var(--draft-soft);
  color: var(--draft-color);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-pin {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  background: var(--accent-soft);
  color: var(--accent);
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-secondary);
  transition: all 0.14s;
}

.tag-pill:hover, .tag-pill.is-active {
  border-color: var(--accent);
  color: var(--accent);
}

.demo-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  font-size: 12.5px;
  color: var(--ink-secondary);
  margin-bottom: 22px;
}

/* ==========================================================================
   LONG-FORM MARKDOWN TYPOGRAPHY (.md-prose)
   Carefully tuned for desktop & mobile reading comfort
   ========================================================================== */

.md-prose {
  font-size: 16.5px;
  line-height: 1.82;
  color: var(--ink-body);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.md-prose .md-p {
  margin: 0 0 1.25em;
}

.md-prose .md-heading {
  color: var(--ink);
  font-weight: 700;
  line-height: 1.32;
  margin: 1.85em 0 0.68em;
  scroll-margin-top: 28px;
  position: relative;
}

.md-prose .md-h1 { font-size: 1.75em; }
.md-prose .md-h2 {
  font-size: 1.38em;
  padding-bottom: 0.32em;
  border-bottom: 1px solid var(--border);
}
.md-prose .md-h3 { font-size: 1.16em; }
.md-prose .md-h4 { font-size: 1.02em; }

.md-prose .md-anchor {
  opacity: 0;
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 0.8em;
  color: var(--accent);
  transition: opacity 0.15s;
}

.md-prose .md-heading:hover .md-anchor {
  opacity: 0.85;
}

.md-prose .md-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.md-prose .md-inline-code {
  font-family: var(--font-mono);
  font-size: 0.87em;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--ink);
}

/* Code Blocks */
.md-prose .md-code-block {
  margin: 1.4em 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--code-bg);
  border: 1px solid var(--border-strong);
}

.md-prose .md-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  background: rgba(127, 127, 127, 0.08);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-muted);
}

.md-prose .md-code-copy {
  padding: 3px 9px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-secondary);
  font-size: 11.5px;
}

.md-prose .md-code-copy:hover {
  color: var(--ink);
  border-color: var(--accent);
}

.md-prose .md-code-block pre {
  margin: 0;
  padding: 15px 18px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink);
}

.tok-keyword { color: var(--tok-kw); font-weight: 600; }
.tok-string  { color: var(--tok-str); }
.tok-comment { color: var(--tok-cmt); font-style: italic; }
.tok-number  { color: var(--tok-num); }

/* Figures & Zoomable Images */
.md-prose .md-figure {
  margin: 1.6em 0;
  text-align: center;
}

.md-prose .md-figure img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: zoom-in;
  display: block;
  margin: 0 auto;
}

.md-prose .md-figure figcaption {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ink-muted);
}

/* Tables */
.md-prose .md-table-wrap {
  margin: 1.4em 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.md-prose .md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 480px;
}

.md-prose .md-table th,
.md-prose .md-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.md-prose .md-table th {
  background: var(--surface);
  color: var(--ink);
  font-weight: 650;
}

.md-prose .md-table tr:last-child td {
  border-bottom: none;
}

/* Blockquotes & Callouts */
.md-prose .md-quote {
  margin: 1.4em 0;
  padding: 10px 18px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 10px 10px 0;
  color: var(--ink-secondary);
}

.md-prose .md-callout {
  margin: 1.4em 0;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--accent-soft);
}

.md-prose .md-callout-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

.md-prose .md-callout-body {
  font-size: 14.5px;
  line-height: 1.68;
}

/* Lists & Task Lists */
.md-prose .md-list {
  margin: 0 0 1.3em;
  padding-left: 1.4em;
}

.md-prose .md-list li {
  margin-bottom: 0.42em;
}

.md-prose .md-task-item {
  list-style: none;
  margin-left: -1.2em;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.md-prose .md-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  font-size: 11px;
  color: var(--accent);
  flex-shrink: 0;
}

.md-prose .md-hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.2em 0;
}

/* Post Adjacent Nav */
.post-adj-nav {
  margin-top: 44px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.post-adj-card {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.15s;
}

.post-adj-card:hover {
  border-color: var(--accent);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: rgba(5, 8, 14, 0.9);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.lightbox img {
  max-width: min(1100px, 92vw);
  max-height: 80vh;
  border-radius: 10px;
  object-fit: contain;
}

.lightbox-caption {
  margin-top: 12px;
  font-size: 13px;
  color: #cbd5e1;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 16px;
}

/* Modals & Forms */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(5, 8, 14, 0.65);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  margin-bottom: 5px;
}

.field-input, .field-select, .field-textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
}

.field-input:focus, .field-select:focus, .field-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* ==========================================================================
   FULL-SCREEN ADMIN & MARKDOWN STUDIO
   ========================================================================== */

.studio-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1250;
  background: rgba(5, 8, 14, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.studio-shell {
  width: min(1360px, 100%);
  height: min(92vh, 920px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.studio-topbar {
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.studio-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

.studio-tab {
  padding: 6px 13px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
}

.studio-tab.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--border-strong);
}

.studio-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

/* Split-Pane Markdown Editor */
.editor-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
}

.editor-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border-strong);
  border-radius: 0 0 12px 12px;
  min-height: 440px;
  overflow: hidden;
}

.editor-textarea {
  width: 100%;
  height: 100%;
  min-height: 440px;
  padding: 16px;
  border: none;
  border-right: 1px solid var(--border);
  background: var(--code-bg);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.68;
  resize: vertical;
}

.editor-textarea:focus {
  outline: none;
}

.editor-preview {
  padding: 18px 22px;
  overflow-y: auto;
  max-height: 560px;
  background: var(--bg);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.media-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  display: flex;
  flex-direction: column;
}

.media-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  background: var(--code-bg);
}

.media-card-body {
  padding: 10px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.admin-table th, .admin-table td {
  padding: 10px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  font-size: 12px;
  color: var(--ink-muted);
}

/* Footer & Switcher */
.site-footer {
  margin-top: 64px;
  padding: 26px 0 36px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--ink-muted);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.edition-switcher {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 900;
  display: inline-flex;
  gap: 4px;
  padding: 5px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

.edition-pill {
  padding: 6px 11px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 550;
}

.edition-pill.is-active {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
}

.toast-stack {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1600;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  font-weight: 550;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
}

@media (max-width: 920px) {
  .editor-meta-grid {
    grid-template-columns: 1fr 1fr;
  }
  .editor-split {
    grid-template-columns: 1fr;
  }
  .editor-textarea {
    min-height: 280px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .post-adj-nav {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .md-prose {
    font-size: 15.5px;
    line-height: 1.76;
  }
  .editor-meta-grid {
    grid-template-columns: 1fr;
  }
  .studio-backdrop {
    padding: 0;
  }
  .studio-shell {
    height: 100vh;
    border-radius: 0;
  }
}
