html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  background: #080808;
  color: #f5f1ea;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.navbar,
.footer {
  background: #111 !important;
  border-color: #2d261d !important;
}

.navbar-brand,
.nav-link,
.footer,
.footer a {
  color: #f5f1ea !important;
}

.hero-lab {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 2rem;
  min-height: 68vh;
  align-items: center;
}

.hero-copy h1 {
  max-width: 820px;
  font-size: clamp(2.5rem, 7vw, 5.8rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
}

.eyebrow {
  color: #ff9f1a;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero-copy .lead {
  max-width: 720px;
  color: #d7cfc4;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.hero-lines {
  display: grid;
  gap: 1rem;
}

.hero-lines div,
.cp-login-card,
.admin-stat,
.admin-panel-header {
  border: 1px solid #312719;
  background: linear-gradient(135deg, #14110d, #0d0d0d);
  border-radius: 1rem;
  padding: 1.25rem;
}

.hero-lines span {
  color: #ff9f1a;
  font-size: 0.85rem;
}

.hero-lines strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.35rem;
}

.hero-lines p,
.cp-login-card p,
.admin-panel-header p,
.admin-stat span {
  color: #c7b9a8;
}

.cp-login {
  display: grid;
  min-height: 62vh;
  place-items: center;
}

.cp-login-card {
  width: min(100%, 460px);
}

.admin-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  margin: 0;
}

.admin-sidebar {
  border-right: 1px solid #312719;
  background: #0d0d0d;
  padding: 1.25rem;
}

.admin-brand {
  display: block;
  margin-bottom: 2rem;
  color: #ff9f1a;
  font-size: 1.35rem;
  font-weight: 800;
  text-decoration: none;
}

.admin-sidebar nav {
  display: grid;
  gap: 0.35rem;
}

.admin-sidebar a,
.admin-sidebar span,
.admin-topbar a {
  color: #f5f1ea;
  text-decoration: none;
}

.admin-brand-main {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
  color: #ff9f1a;
}

.admin-brand-sub {
  display: block;
  font-size: 0.7rem;
  color: #7b7167;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-section-label {
  font-size: 0.68rem;
  color: #5c544d;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.9rem 0.85rem 0.3rem;
}

.admin-sidebar a {
  border-radius: 0.65rem;
  padding: 0.65rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
  transition: background 0.15s;
}

.admin-sidebar a:hover {
  background: #1e1a14;
  color: #f5f1ea;
}

.admin-sidebar a.active {
  background: #2a1f0e;
  color: #ff9f1a;
}

.admin-sidebar-footer {
  margin-top: auto;
  border-top: 1px solid #312719;
  padding-top: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.admin-user-name {
  font-size: 0.82rem;
  color: #c7b9a8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  font-size: 0.78rem;
  color: #7b7167 !important;
  white-space: nowrap;
  padding: 0.3rem 0.6rem;
  border: 1px solid #312719;
  border-radius: 0.4rem;
}

.btn-logout:hover {
  color: #f5f1ea !important;
  border-color: #5c4a2a;
}

.admin-main {
  padding: 1.25rem;
  overflow: auto;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #1e1a14;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: #f5f1ea;
}

.topbar-site-link {
  font-size: 0.8rem;
  color: #7b7167 !important;
}

.topbar-site-link:hover {
  color: #ff9f1a !important;
}

.admin-panel-header {
  margin-bottom: 1.25rem;
}

.admin-panel-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0.15rem 0 0;
}

.admin-stat {
  border: 1px solid #312719;
  background: linear-gradient(135deg, #14110d, #0d0d0d);
  border-radius: 1rem;
  padding: 1.25rem;
}

.admin-stat strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.1rem;
}

/* 表格通用 */
.table-dark {
  --bs-table-bg: #0d0d0d;
  --bs-table-hover-bg: #1a150e;
  font-size: 0.88rem;
}

.table th {
  color: #7b7167;
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-color: #1e1a14 !important;
}

.table td {
  border-color: #1a1510 !important;
  vertical-align: middle;
}

/* 表單 */
.form-control,
.form-select,
.form-check-input {
  background-color: #111 !important;
  border-color: #312719 !important;
  color: #f5f1ea !important;
  -webkit-text-fill-color: #f5f1ea !important;
  caret-color: #ff9f1a;
}

.form-control::placeholder,
.form-select::placeholder,
textarea.form-control::placeholder {
  color: #7b7167 !important;
  -webkit-text-fill-color: #7b7167 !important;
}

.form-control:focus,
.form-select:focus {
  border-color: #ff9f1a !important;
  box-shadow: 0 0 0 0.15rem rgba(255,159,26,.2) !important;
}

.form-label {
  color: #c7b9a8;
  font-size: 0.85rem;
}

textarea.form-control {
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  line-height: 1.6;
}

@media (max-width: 800px) {
  .hero-lab,
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    border-right: 0;
    border-bottom: 1px solid #312719;
  }
}

/* ═══════════════════════════════════════════
   FRONTEND PUBLIC PAGES
   ═══════════════════════════════════════════ */

/* ── Site Header ─────────────────────────── */
.site-header {
  background: #0d0d0d;
  border-bottom: 1px solid #1e1a14;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 1.5rem;
}

.site-brand {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ff9f1a !important;
  text-decoration: none;
  white-space: nowrap;
}

.site-brand span {
  font-weight: 400;
  color: #7b7167;
  font-size: 0.85rem;
}

.site-nav {
  display: flex;
  gap: 0.25rem;
}

.site-nav a {
  color: #c7b9a8;
  text-decoration: none;
  font-size: 0.88rem;
  padding: 0.35rem 0.75rem;
  border-radius: 0.5rem;
  transition: background 0.15s, color 0.15s;
}

.site-nav a:hover,
.site-nav a.active {
  background: #1e1a14;
  color: #ff9f1a;
}

/* ── Site Footer ─────────────────────────── */
.site-footer {
  margin-top: 5rem;
  border-top: 1px solid #1e1a14;
  padding: 2.5rem 0 3rem;
}

.site-footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.footer-brand {
  font-weight: 700;
  color: #ff9f1a;
  font-size: 1rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  justify-content: center;
}

.footer-nav a {
  color: #7b7167;
  text-decoration: none;
  font-size: 0.83rem;
  transition: color 0.15s;
}

.footer-nav a:hover {
  color: #ff9f1a;
}

.footer-copy {
  color: #3d3630;
  font-size: 0.78rem;
  margin: 0;
}

/* ── Home Page ───────────────────────────── */
.home-hero {
  padding: 5rem 0 3rem;
}

.home-title {
  font-size: clamp(2.2rem, 6vw, 4.5rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  margin: 0.5rem 0 1rem;
}

.home-lead {
  color: #c7b9a8;
  font-size: 1.1rem;
  max-width: 640px;
  margin-bottom: 2rem;
}

.home-lines {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.home-line {
  border: 1px solid #2a1f0e;
  background: linear-gradient(135deg, #14110d, #0d0d0d);
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
}

.home-line span {
  color: #ff9f1a;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.home-line strong {
  display: block;
  margin: 0.3rem 0 0.25rem;
  font-size: 1.15rem;
}

.home-line strong a {
  color: #f5f1ea;
  text-decoration: none;
}

.home-line strong a:hover {
  color: #ff9f1a;
}

.home-line p {
  color: #7b7167;
  font-size: 0.82rem;
  margin: 0;
}

.home-empty {
  color: #5c544d;
  margin-top: 2rem;
}

.home-content {
  padding-bottom: 3rem;
}

.home-section {
  margin-bottom: 4rem;
}

.home-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.45rem;
  font-weight: 800;
  margin: 0.2rem 0 0.4rem;
}

.section-desc {
  color: #7b7167;
  font-size: 0.88rem;
  margin: 0;
  max-width: 480px;
}

.section-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.see-all,
.see-search {
  font-size: 0.83rem;
  text-decoration: none;
  padding: 0.35rem 0.85rem;
  border-radius: 0.5rem;
  border: 1px solid #312719;
  color: #c7b9a8;
  transition: background 0.15s, color 0.15s;
}

.see-all:hover,
.see-search:hover {
  background: #1e1a14;
  color: #ff9f1a;
  border-color: #5c4a2a;
}

/* ── Article Grid & Cards ────────────────── */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.article-card {
  border: 1px solid #1e1a14;
  border-radius: 1rem;
  overflow: hidden;
  background: #0d0d0d;
  transition: border-color 0.15s, transform 0.15s;
}

.article-card:hover {
  border-color: #5c4a2a;
  transform: translateY(-2px);
}

.card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

.card-cover {
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #111;
  flex-shrink: 0;
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.article-card:hover .card-cover img {
  transform: scale(1.03);
}

.card-cover--empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #14110d, #0d0d0d);
}

.card-type-bg {
  font-size: 3rem;
  font-weight: 900;
  color: #2a1f0e;
  user-select: none;
}

.card-body {
  padding: 1.1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  font-size: 0.75rem;
}

.card-type {
  background: #1e1a14;
  color: #ff9f1a;
  padding: 0.15rem 0.55rem;
  border-radius: 0.35rem;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}

.card-type--blog     { background: #1a1209; color: #ff9f1a; }
.card-type--viewpoint{ background: #0e1520; color: #5ba4f7; }
.card-type--gitrepos { background: #0e1a0e; color: #4caf50; }

.card-meta time {
  color: #5c544d;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 0.55rem;
  color: #f5f1ea;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-summary {
  font-size: 0.83rem;
  color: #7b7167;
  line-height: 1.55;
  margin: 0 0 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: auto;
}

.tag {
  font-size: 0.72rem;
  background: #1a1510;
  color: #7b7167;
  border: 1px solid #2a2218;
  padding: 0.15rem 0.5rem;
  border-radius: 0.3rem;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}

a.tag:hover {
  color: #ff9f1a;
  border-color: #5c4a2a;
}

/* ── List Page ───────────────────────────── */
.list-page {
  padding-top: 3rem;
  padding-bottom: 4rem;
}

.list-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #1e1a14;
}

.list-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 900;
  margin: 0.3rem 0 0.5rem;
  letter-spacing: -0.03em;
}

.list-desc {
  color: #7b7167;
  font-size: 0.9rem;
  margin: 0;
  max-width: 560px;
}

.no-articles {
  color: #5c544d;
  grid-column: 1/-1;
  text-align: center;
  padding: 3rem 0;
}

/* ── Search Page ─────────────────────────── */
.search-page {
  padding-top: 3rem;
  padding-bottom: 4rem;
}

.search-bar input {
  background: #111 !important;
  border-color: #312719 !important;
  color: #f5f1ea !important;
  caret-color: #ff9f1a;
}

.search-bar input:focus {
  border-color: #ff9f1a !important;
  box-shadow: 0 0 0 0.15rem rgba(255,159,26,.15) !important;
}

.search-filters {
  font-size: 0.85rem;
  color: #c7b9a8;
}

.filter-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

.filter-label input[type="checkbox"] {
  accent-color: #ff9f1a;
  width: 15px;
  height: 15px;
}

/* ── Article Detail Page ─────────────────── */
.article-page {
  padding-top: 2.5rem;
  padding-bottom: 5rem;
}

.article-header {
  max-width: 800px;
  margin: 0 auto 2.5rem;
}

.article-header .eyebrow {
  margin-bottom: 0.75rem;
}

.article-title {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 1.25rem;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  font-size: 0.82rem;
  color: #7b7167;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #1e1a14;
}

.article-meta .tag {
  font-size: 0.75rem;
}

.article-cover {
  max-width: 860px;
  margin: 0 auto 2.5rem;
  border-radius: 1rem;
  overflow: hidden;
}

.article-cover img {
  width: 100%;
  display: block;
}

.article-body {
  max-width: 720px;
  margin: 0 auto;
  font-size: 1.02rem;
  line-height: 1.85;
  color: #e8e0d4;
}

.article-body h2 {
  font-size: 1.55rem;
  font-weight: 800;
  margin: 2.5rem 0 0.9rem;
  letter-spacing: -0.02em;
  color: #f5f1ea;
}

.article-body h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 2rem 0 0.7rem;
  color: #f5f1ea;
}

.article-body h4 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
  color: #d7cfc4;
}

.article-body p {
  margin-bottom: 1.3rem;
}

.article-body a {
  color: #ff9f1a;
  text-decoration: underline;
  text-decoration-color: rgba(255,159,26,.35);
  text-underline-offset: 3px;
}

.article-body a:hover {
  text-decoration-color: #ff9f1a;
}

.article-body ul,
.article-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1.3rem;
}

.article-body li {
  margin-bottom: 0.4rem;
}

.article-body blockquote {
  border-left: 3px solid #ff9f1a;
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  background: #110e09;
  border-radius: 0 0.5rem 0.5rem 0;
  color: #c7b9a8;
}

.article-body pre {
  background: #0d0d0d;
  border: 1px solid #1e1a14;
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.65;
  margin-bottom: 1.5rem;
}

.article-body code {
  font-family: 'Courier New', monospace;
  font-size: 0.88em;
  color: #f5c77e;
}

.article-body pre code {
  color: #d7cfc4;
}

.article-body img {
  max-width: 100%;
  border-radius: 0.75rem;
  margin: 1.5rem 0;
}

.article-body hr {
  border-color: #1e1a14;
  margin: 2.5rem 0;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
}

.article-body th,
.article-body td {
  border: 1px solid #1e1a14;
  padding: 0.6rem 0.9rem;
  text-align: left;
}

.article-body th {
  background: #111;
  color: #7b7167;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.article-body > #ai-viewpoint,
.article-body > h2#ai-viewpoint {
  font-size: 1.18rem;
  font-weight: 700;
  margin-top: 2.1rem;
  margin-bottom: 0.75rem;
  color: #d9cec1;
}

.article-body > h2#ai-viewpoint + p {
  font-size: 0.95rem;
  line-height: 1.78;
  color: #d3c7b8;
}

/* AI Summary box */
.ai-summary {
  background: linear-gradient(135deg, #14110d, #0d0d0d);
  border: 1px solid #2a1f0e;
  border-radius: 1rem;
  padding: 1.5rem 1.75rem;
  margin: 0 auto 2rem;
  max-width: 720px;
}

.ai-summary-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ff9f1a;
  margin-bottom: 0.5rem;
}

.ai-summary p {
  color: #c7b9a8;
  font-size: 0.92rem;
  line-height: 1.7;
  margin: 0;
}

.ai-keypoints {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}

.ai-keypoints li {
  position: relative;
  padding-left: 1.25rem;
  color: #c7b9a8;
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 0.35rem;
}

.ai-keypoints li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: #ff9f1a;
}

/* Related articles */
.related-articles {
  max-width: 720px;
  margin: 3rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid #1e1a14;
}

.related-articles h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #c7b9a8;
}

.related-list {
  display: grid;
  gap: 0.75rem;
}

.related-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid #1e1a14;
  border-radius: 0.65rem;
  text-decoration: none;
  color: #c7b9a8;
  font-size: 0.88rem;
  transition: background 0.15s, border-color 0.15s;
}

.related-item:hover {
  background: #14110d;
  border-color: #5c4a2a;
  color: #f5f1ea;
}

.related-item time {
  color: #3d3630;
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 768px) {
  .site-header-inner {
    gap: 0.75rem;
  }

  .site-nav a {
    padding: 0.3rem 0.5rem;
    font-size: 0.82rem;
  }

  .home-hero {
    padding: 3rem 0 2rem;
  }

  .article-grid {
    grid-template-columns: 1fr;
  }

  .home-section-header,
  .list-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .article-body {
    font-size: 0.96rem;
  }
}
