:root {
  --brand: #0b7285;
  --brand-dark: #0a4f5c;
  --ink: #1a1f2b;
  --bg: #f8fafc;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-border: rgba(11, 114, 133, 0.1);
}

:root[data-theme='dark'] {
  --brand: #3db8cd;
  --brand-dark: #2b95a9;
  --ink: #e2e8f0;
  --bg: #0b1220;
  --surface: rgba(17, 25, 40, 0.9);
  --surface-border: rgba(148, 163, 184, 0.25);
}

body {
  position: relative;
  font-family: Manrope, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 10%, rgba(13, 148, 136, 0.17) 0%, transparent 35%),
    radial-gradient(circle at 10% 90%, rgba(59, 130, 246, 0.16) 0%, transparent 28%),
    var(--bg);
}

.site-background-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

h1, h2, h3, h4, .navbar-brand {
  font-family: Fraunces, serif;
}

.navbar,
.alert,
.list-group-item {
  background-color: var(--surface) !important;
  color: var(--ink);
}

.hero-card,
.content-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 1rem;
  box-shadow: 0 14px 40px rgba(2, 27, 45, 0.15);
}

.hero-card { padding: 2rem; }
.content-card { padding: 1.25rem; }

.btn-brand {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn-brand:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

.markdown { line-height: 1.7; }
.markdown img { max-width: 100%; border-radius: 0.75rem; }
.markdown pre {
  background: #0f172a;
  color: #e5e7eb;
  padding: 1rem;
  border-radius: 0.75rem;
  overflow-x: auto;
}

.item-link { text-decoration: none; color: inherit; }
.item-link:hover .content-card { transform: translateY(-2px); transition: transform 0.2s ease; }

.muted-label {
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

.card-cover {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}

.detail-cover {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  display: block;
}

.thumb-mini {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 0.35rem;
  border: 1px solid var(--surface-border);
}

:root[data-theme='dark'] .text-secondary {
  color: #94a3b8 !important;
}

:root[data-theme='dark'] .navbar .navbar-brand,
:root[data-theme='dark'] .navbar .nav-link {
  color: #ffffff !important;
}

:root[data-theme='dark'] .navbar .nav-link:hover,
:root[data-theme='dark'] .navbar .nav-link:focus,
:root[data-theme='dark'] .navbar .navbar-brand:hover,
:root[data-theme='dark'] .navbar .navbar-brand:focus {
  color: #e2e8f0 !important;
}

.intro-hero {
  position: relative;
  overflow: hidden;
  padding: 2rem;
  border: 1px solid var(--surface-border);
  border-radius: 1.25rem;
  background: linear-gradient(135deg, rgba(11, 114, 133, 0.13), rgba(59, 130, 246, 0.08));
  animation: introFade 700ms ease-out;
}

.intro-content {
  z-index: 2;
}

.intro-title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.intro-glow {
  position: absolute;
  border-radius: 999px;
  filter: blur(25px);
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
}

.intro-glow-a {
  width: 220px;
  height: 220px;
  top: -60px;
  right: 12%;
  background: rgba(56, 189, 248, 0.4);
}

.intro-glow-b {
  width: 180px;
  height: 180px;
  bottom: -70px;
  left: 8%;
  background: rgba(45, 212, 191, 0.35);
}

.intro-metrics {
  display: grid;
  gap: 1rem;
}

.metric-value {
  margin: 0;
  font-family: Fraunces, serif;
  font-size: clamp(1.6rem, 3.8vw, 2.4rem);
}

.profile-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.profile-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 36px rgba(2, 27, 45, 0.18);
}

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

@media (max-width: 768px) {
  .intro-hero {
    padding: 1.25rem;
    border-radius: 1rem;
  }

  .intro-title {
    font-size: clamp(1.75rem, 8vw, 2.25rem);
    line-height: 1.1;
  }

  .intro-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
    text-align: center;
  }

  .metric-value {
    font-size: clamp(1.2rem, 6vw, 1.6rem);
  }

  .profile-card .btn {
    flex: 1 1 auto;
  }
}

.tag-editor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem;
  border: 1px solid var(--surface-border);
  border-radius: 0.5rem;
  background: var(--surface);
}

.tag-editor-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag-editor-input {
  flex: 1 1 140px;
  min-width: 120px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
}

.tag-chip {
  border: 1px solid var(--surface-border);
  background: rgba(11, 114, 133, 0.12);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

:root[data-theme='dark'] .tag-chip {
  background: rgba(61, 184, 205, 0.18);
}

.tag-pill {
  display: inline-block;
  margin: 0 0.35rem 0.35rem 0;
  padding: 0.12rem 0.52rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.tag-palette-0 { background: #ffe3e3; color: #9b2226; border-color: #fecaca; }
.tag-palette-1 { background: #fff3bf; color: #8d6e00; border-color: #fde68a; }
.tag-palette-2 { background: #dcfce7; color: #166534; border-color: #86efac; }
.tag-palette-3 { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.tag-palette-4 { background: #ede9fe; color: #5b21b6; border-color: #c4b5fd; }
.tag-palette-5 { background: #fce7f3; color: #9d174d; border-color: #f9a8d4; }
.tag-palette-6 { background: #e0f2fe; color: #0369a1; border-color: #7dd3fc; }
.tag-palette-7 { background: #ffedd5; color: #9a3412; border-color: #fdba74; }

:root[data-theme='dark'] .tag-palette-0 { background: rgba(185, 28, 28, 0.30); color: #fecaca; border-color: rgba(248, 113, 113, 0.45); }
:root[data-theme='dark'] .tag-palette-1 { background: rgba(161, 98, 7, 0.30); color: #fde68a; border-color: rgba(250, 204, 21, 0.45); }
:root[data-theme='dark'] .tag-palette-2 { background: rgba(21, 128, 61, 0.30); color: #bbf7d0; border-color: rgba(74, 222, 128, 0.45); }
:root[data-theme='dark'] .tag-palette-3 { background: rgba(29, 78, 216, 0.30); color: #bfdbfe; border-color: rgba(96, 165, 250, 0.45); }
:root[data-theme='dark'] .tag-palette-4 { background: rgba(91, 33, 182, 0.30); color: #ddd6fe; border-color: rgba(167, 139, 250, 0.45); }
:root[data-theme='dark'] .tag-palette-5 { background: rgba(157, 23, 77, 0.30); color: #fbcfe8; border-color: rgba(244, 114, 182, 0.45); }
:root[data-theme='dark'] .tag-palette-6 { background: rgba(3, 105, 161, 0.30); color: #bae6fd; border-color: rgba(56, 189, 248, 0.45); }
:root[data-theme='dark'] .tag-palette-7 { background: rgba(154, 52, 18, 0.30); color: #fed7aa; border-color: rgba(251, 146, 60, 0.45); }

.stats-table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--ink);
  --bs-table-border-color: var(--surface-border);
  margin-bottom: 0;
}

.stats-table thead th {
  color: #475569;
  border-bottom-width: 1px;
}

:root[data-theme='dark'] .stats-table thead th {
  color: #cbd5e1;
}

.stats-chart-wrap {
  position: relative;
  min-height: 280px;
}

.form-control,
.form-select,
.form-control:focus,
.form-select:focus {
  background-color: var(--surface);
  color: var(--ink);
  border-color: var(--surface-border);
}

.form-control::placeholder {
  color: #64748b;
  opacity: 1;
}

:root[data-theme='dark'] .form-control::placeholder {
  color: #94a3b8;
}

.form-text {
  color: #64748b;
}

:root[data-theme='dark'] .form-text {
  color: #94a3b8;
}

.preview-panel {
  border: 1px solid var(--surface-border);
  border-radius: 0.75rem;
  background: var(--surface);
  color: var(--ink);
}
