:root {
  --bg: #0f1020;
  --panel: #1a1c33;
  --panel-soft: #242848;
  --text: #eef0ff;
  --muted: #b7b9d3;
  --accent: #9dff6a;
  --accent-2: #7ad7ff;
  --border: #3a3f67;
  --max-width: 1080px;
}

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

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, #24254a 0%, transparent 35%),
    radial-gradient(circle at 90% 20%, #1a3a52 0%, transparent 35%),
    var(--bg);
  font-family: Inter, "Segoe UI", Roboto, sans-serif;
  line-height: 1.65;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

a:hover {
  color: var(--accent);
}

.container {
  width: min(100% - 2rem, var(--max-width));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(15, 16, 32, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.9rem 0;
}

.brand {
  display: grid;
  gap: 0.1rem;
}

.brand-title {
  font-size: 1.1rem;
  color: var(--text);
  font-weight: 750;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.85rem;
}

.main-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.content {
  padding: 2rem 0 3rem;
}

.hero {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2.4rem;
  align-items: stretch;
}

.panel {
  position: relative;
  background:
    linear-gradient(180deg, var(--panel-soft), var(--panel)),
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(255, 255, 255, 0.015) 2px 3px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.4rem 1.4rem 1.25rem;
  box-shadow:
    0 0 0 1px rgba(122, 215, 255, 0.06) inset,
    0 14px 30px rgba(6, 10, 28, 0.45);
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.panel::before {
  top: -3px;
  left: -3px;
  border-top: 3px solid var(--accent);
  border-left: 3px solid var(--accent);
  border-top-left-radius: 4px;
}

.panel::after {
  bottom: -3px;
  right: -3px;
  border-bottom: 3px solid var(--accent-2);
  border-right: 3px solid var(--accent-2);
  border-bottom-right-radius: 4px;
}

.hero-copy,
.character-sheet {
  display: flex;
  flex-direction: column;
}

.hero-kicker {
  margin: 0 0 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--accent);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.hero h1 {
  margin: 0.15rem 0 0.85rem;
  line-height: 1.05;
  font-size: clamp(2rem, 6vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  background: linear-gradient(90deg, var(--text) 0%, var(--accent-2) 60%, var(--accent) 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}

.hero-sub {
  margin: 0;
  color: #d6d8f0;
  font-size: 1.02rem;
  line-height: 1.65;
  max-width: 56ch;
}

.hero-cursor {
  display: inline-block;
  margin-left: 4px;
  color: var(--accent);
  animation: cursor-blink 1.05s steps(2, start) infinite;
}

@keyframes cursor-blink {
  to { visibility: hidden; }
}

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

.character-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 0.85rem;
}

.character-sheet-header h2 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.character-sheet-header h2::before {
  content: "▣ ";
  color: var(--accent);
  margin-right: 4px;
}

.character-slot {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent-2);
  background: rgba(122, 215, 255, 0.08);
}

.character-stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.character-stats li {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 0.7rem;
  align-items: center;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid transparent;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.character-stats li:hover {
  border-color: rgba(122, 215, 255, 0.3);
  background: rgba(122, 215, 255, 0.06);
  transform: translateX(2px);
}

.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #1a1f44;
  border: 1px solid var(--border);
  font-size: 1rem;
  line-height: 1;
  color: var(--accent-2);
}

.stat-icon svg {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
}

.stat-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-label {
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.stat-value {
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 600;
  line-height: 1.25;
}

.character-bar {
  margin-top: auto;
  padding-top: 1rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: center;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.character-bar-track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: #11142a;
  border: 1px solid var(--border);
  overflow: hidden;
}

.character-bar-fill {
  position: absolute;
  inset: 0;
  width: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 12px rgba(157, 255, 106, 0.45);
  animation: bar-shimmer 2.4s ease-in-out infinite;
}

@keyframes bar-shimmer {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.25); }
}

.character-bar-value {
  color: var(--accent);
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.15rem;
  border-radius: 10px;
  border: 1px solid #4a527e;
  color: var(--text);
  background:
    linear-gradient(180deg, #353a66 0%, #232752 60%, #1a1d44 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 -1px 0 rgba(0, 0, 0, 0.35) inset,
    0 6px 14px rgba(6, 10, 28, 0.45);
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 200ms ease,
    background 200ms ease;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(120deg, transparent, rgba(122, 215, 255, 0.18), transparent 70%);
  transition: opacity 220ms ease;
}

.btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent-2);
  color: #ffffff;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.12) inset,
    0 -1px 0 rgba(0, 0, 0, 0.4) inset,
    0 10px 22px rgba(6, 10, 28, 0.6),
    0 0 18px rgba(122, 215, 255, 0.28);
}

.btn:hover::after {
  opacity: 1;
}

.btn:active {
  transform: translateY(0);
  box-shadow:
    0 0 0 rgba(255, 255, 255, 0.06) inset,
    0 -1px 0 rgba(0, 0, 0, 0.45) inset,
    0 4px 10px rgba(6, 10, 28, 0.5);
}

.btn:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow:
    0 0 0 2px rgba(157, 255, 106, 0.35),
    0 6px 14px rgba(6, 10, 28, 0.45);
}

.btn-primary {
  border-color: #74d955;
  color: #f4ffe9;
  background:
    linear-gradient(180deg, #2f6d3a 0%, #1f5028 55%, #173d1f 100%);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.btn-primary:hover {
  border-color: var(--accent);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 -1px 0 rgba(0, 0, 0, 0.45) inset,
    0 12px 24px rgba(6, 10, 28, 0.6),
    0 0 22px rgba(157, 255, 106, 0.4);
}

.hero-panel h2 {
  margin-top: 0;
  font-size: 1rem;
}

.hero-panel ul {
  padding-left: 1.1rem;
  margin: 0;
}

.section-block h1,
.section-block h2 {
  margin-top: 0;
}

.not-found .not-found-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.25rem 0 0;
  align-items: center;
}

.not-found-latest {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--border);
}

.not-found-latest h2 {
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  margin-bottom: 0.75rem;
}

.not-found-post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.not-found-post-list a {
  font-weight: 600;
}

.not-found-post-date {
  color: var(--muted);
  font-size: 0.85rem;
  margin-left: 0.35rem;
}

.panel-loose {
  padding: 1.4rem 1.4rem 1.6rem;
  margin-bottom: 2.4rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding-bottom: 0.8rem;
  margin-bottom: 1.2rem;
  border-bottom: 1px dashed var(--border);
}

.section-header h1,
.section-header h2 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
}

.section-header h1::before,
.section-header h2::before {
  content: "▣ ";
  color: var(--accent);
  margin-right: 4px;
}

.section-slot {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent-2);
  background: rgba(122, 215, 255, 0.08);
}

.post-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.post-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  overflow: hidden;
  transition:
    transform 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease,
    background 220ms ease;
}

.post-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(122, 215, 255, 0.07) 45%,
    rgba(157, 255, 106, 0.08) 55%,
    transparent 100%
  );
  opacity: 0;
  transition: opacity 260ms ease;
}

.post-card::before {
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: radial-gradient(circle at 35% 35%, #d9ffe8 0%, #76f0ba 50%, #2ec291 100%);
  box-shadow:
    0 0 0 2px rgba(16, 22, 42, 0.8),
    0 0 8px rgba(46, 194, 145, 0.25);
  opacity: 0.4;
  transform: scale(0.9);
  transition: opacity 220ms ease, transform 220ms ease;
  z-index: 2;
}

.post-card:hover,
.post-card:focus-within {
  transform: translateY(-4px);
  border-color: #5a8aa4;
  box-shadow:
    0 12px 24px rgba(6, 10, 28, 0.45),
    0 0 0 1px rgba(122, 215, 255, 0.2);
  background: #202547;
}

.post-card:hover::after,
.post-card:focus-within::after {
  opacity: 1;
}

.post-card:hover::before,
.post-card:focus-within::before {
  opacity: 1;
  transform: scale(1.05);
  animation: mana-pulse 1.2s ease-in-out infinite;
}

.post-card-link {
  color: inherit;
}

.post-card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.post-card-body {
  position: relative;
  z-index: 2;
}

.post-card .post-card-body::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  background:
    linear-gradient(90deg, transparent 0, transparent calc(100% - 2px), rgba(157, 255, 106, 0.35) calc(100% - 2px), rgba(157, 255, 106, 0.35) 100%),
    linear-gradient(180deg, transparent 0, transparent calc(100% - 2px), rgba(122, 215, 255, 0.28) calc(100% - 2px), rgba(122, 215, 255, 0.28) 100%);
  transition: opacity 220ms ease;
}

.post-card:hover .post-card-body::after,
.post-card:focus-within .post-card-body::after {
  opacity: 1;
}

.post-thumb-wrap {
  display: block;
  margin: -1rem -1rem 0.85rem;
}

.post-thumb-fallback {
  display: block;
  margin: -1rem -1rem 0.85rem;
  height: 120px;
  background:
    linear-gradient(140deg, #1a2a44 0%, #1e2f4a 35%, #152238 100%),
    radial-gradient(ellipse 90% 60% at 20% 25%, rgba(122, 215, 255, 0.16), transparent 55%),
    radial-gradient(ellipse 70% 50% at 85% 75%, rgba(157, 255, 106, 0.1), transparent 50%);
  border-bottom: 1px solid var(--border);
  border-radius: 12px 12px 0 0;
}

.post-thumb {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  border-radius: 12px 12px 0 0;
  border-bottom: 1px solid var(--border);
  transition: transform 280ms ease, filter 280ms ease;
}

.post-card:hover .post-thumb,
.post-card:focus-within .post-thumb {
  transform: scale(1.04);
  filter: saturate(1.08) contrast(1.04);
}

.post-card h2,
.post-card h3 {
  margin: 0.4rem 0;
  line-height: 1.25;
}

.post-meta {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tags a {
  background: #2a3457;
  border: 1px solid var(--border);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
}

.post-single {
  max-width: none;
  width: 100%;
}

.post-grid.one-column {
  grid-template-columns: 1fr;
  max-width: none;
}

.post-grid.one-column .post-card.has-thumb,
.post-grid.one-column .post-card.no-thumb {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 0;
  align-items: start;
  padding: 0;
  overflow: hidden;
}

.post-grid.one-column .post-thumb-link {
  margin: 0;
  height: 100%;
}

.post-grid.one-column .post-thumb-wrap {
  margin: 0;
  height: 100%;
  position: relative;
}

.post-grid.one-column .post-thumb-wrap::after {
  content: "";
  position: absolute;
  top: 10%;
  right: 0;
  width: 1px;
  height: 80%;
  background: linear-gradient(180deg, rgba(122, 215, 255, 0.25), rgba(157, 255, 106, 0.6), rgba(122, 215, 255, 0.25));
  transform: scaleY(0);
  transform-origin: top;
  will-change: transform;
  z-index: 2;
}

.post-grid.one-column .post-thumb {
  height: 130px;
  min-height: 100%;
  border-radius: 0;
  border: 0;
}

.post-grid.one-column .post-card.no-thumb .post-thumb-fallback {
  margin: 0;
  width: 100%;
  min-height: 130px;
  height: 100%;
  border-radius: 0;
  border: 0;
  border-bottom: 0;
}

.post-grid.one-column .post-card-body {
  padding: 1rem;
}

.post-card .tags,
.post-card .tags a {
  position: relative;
  z-index: 3;
}

.post-grid.one-column .post-card.has-thumb:hover .post-thumb-wrap::after,
.post-grid.one-column .post-card.has-thumb:focus-within .post-thumb-wrap::after {
  animation: divider-draw-y 900ms steps(10, end) forwards;
}

@keyframes mana-pulse {
  0% {
    box-shadow:
      0 0 0 2px rgba(16, 22, 42, 0.8),
      0 0 8px rgba(46, 194, 145, 0.25);
    filter: saturate(1);
  }
  50% {
    box-shadow:
      0 0 0 2px rgba(16, 22, 42, 0.95),
      0 0 14px rgba(122, 215, 255, 0.55),
      0 0 24px rgba(157, 255, 106, 0.35);
    filter: saturate(1.2);
  }
  100% {
    box-shadow:
      0 0 0 2px rgba(16, 22, 42, 0.8),
      0 0 8px rgba(46, 194, 145, 0.25);
    filter: saturate(1);
  }
}

@keyframes divider-draw-y {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

@keyframes divider-draw-x {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

.post-card-body > :first-child {
  margin-top: 0;
}

.post-header {
  margin-bottom: 1.6rem;
}

.post-header .post-title {
  margin: 0.2rem 0 0.6rem;
  line-height: 1.18;
  font-size: clamp(1.6rem, 3.2vw, 2.1rem);
}

.post-description {
  color: var(--muted);
  margin: 0 0 0.8rem;
}

.toc {
  margin-bottom: 1.6rem;
}

.toc nav ul {
  margin: 0;
  padding-left: 1.1rem;
}

.toc nav li {
  margin: 0.15rem 0;
}

.toc nav a {
  color: var(--text);
}

.toc nav a:hover {
  color: var(--accent);
}

.prose blockquote {
  position: relative;
  margin: 1.6rem 0;
  padding: 0.9rem 1.1rem 0.9rem 2.4rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(157, 255, 106, 0.06), rgba(122, 215, 255, 0.04)),
    var(--panel);
  color: #e9ebff;
  box-shadow:
    0 0 0 1px rgba(122, 215, 255, 0.08) inset,
    0 8px 18px rgba(6, 10, 28, 0.4);
}

.prose blockquote::before {
  content: "✦";
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  color: var(--accent);
  font-size: 1rem;
  line-height: 1;
}

.prose blockquote::after {
  content: "";
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 12px;
  height: 12px;
  border-bottom: 3px solid var(--accent-2);
  border-right: 3px solid var(--accent-2);
  border-bottom-right-radius: 4px;
  pointer-events: none;
}

.prose blockquote p {
  margin: 0;
}

.prose blockquote p + p {
  margin-top: 0.6rem;
}

.prose p,
.prose li {
  color: #f3f4ff;
}

.prose p:has(> img:only-child) {
  position: relative;
  margin: 1.8rem auto;
  padding: 10px;
  max-width: 100%;
  background:
    linear-gradient(180deg, rgba(122, 215, 255, 0.08), rgba(157, 255, 106, 0.05)),
    #0c0e1c;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow:
    0 0 0 1px rgba(122, 215, 255, 0.12) inset,
    0 12px 28px rgba(6, 10, 28, 0.55);
  transition: box-shadow 220ms ease, transform 220ms ease, border-color 220ms ease;
}

.prose p:has(> img:only-child)::before,
.prose p:has(> img:only-child)::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.prose p:has(> img:only-child)::before {
  top: -3px;
  left: -3px;
  border-top: 3px solid var(--accent);
  border-left: 3px solid var(--accent);
  border-top-left-radius: 4px;
}

.prose p:has(> img:only-child)::after {
  bottom: -3px;
  right: -3px;
  border-bottom: 3px solid var(--accent-2);
  border-right: 3px solid var(--accent-2);
  border-bottom-right-radius: 4px;
}

.prose p:has(> img:only-child):hover {
  border-color: rgba(122, 215, 255, 0.45);
  box-shadow:
    0 0 0 1px rgba(122, 215, 255, 0.25) inset,
    0 18px 36px rgba(6, 10, 28, 0.7),
    0 0 24px rgba(122, 215, 255, 0.18);
  transform: translateY(-2px);
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
  background: #0c0e1c;
  cursor: zoom-in;
}

.gallery {
  display: grid;
  gap: 1rem;
  margin: 1.6rem 0;
  grid-template-columns: repeat(var(--gallery-cols, 3), minmax(0, 1fr));
}

.gallery[data-count="1"] { --gallery-cols: 1; }
.gallery[data-count="2"] { --gallery-cols: 2; }
.gallery[data-count="3"] { --gallery-cols: 3; }
.gallery[data-count="4"] { --gallery-cols: 2; }

.gallery-item {
  position: relative;
  margin: 0;
  padding: 8px;
  background:
    linear-gradient(180deg, rgba(122, 215, 255, 0.08), rgba(157, 255, 106, 0.05)),
    #0c0e1c;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow:
    0 0 0 1px rgba(122, 215, 255, 0.12) inset,
    0 8px 18px rgba(6, 10, 28, 0.45);
  transition: box-shadow 220ms ease, transform 220ms ease, border-color 220ms ease;
}

.gallery-item::before,
.gallery-item::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  pointer-events: none;
}

.gallery-item::before {
  top: -3px;
  left: -3px;
  border-top: 3px solid var(--accent);
  border-left: 3px solid var(--accent);
  border-top-left-radius: 4px;
}

.gallery-item::after {
  bottom: -3px;
  right: -3px;
  border-bottom: 3px solid var(--accent-2);
  border-right: 3px solid var(--accent-2);
  border-bottom-right-radius: 4px;
}

.gallery-item:hover {
  border-color: rgba(122, 215, 255, 0.45);
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px rgba(122, 215, 255, 0.25) inset,
    0 14px 26px rgba(6, 10, 28, 0.6),
    0 0 18px rgba(122, 215, 255, 0.18);
}

.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  cursor: zoom-in;
  background: #0c0e1c;
}

.gallery-item figcaption {
  margin-top: 0.55rem;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.02em;
}

@media (max-width: 720px) {
  .gallery,
  .gallery[data-count="2"],
  .gallery[data-count="3"],
  .gallery[data-count="4"] {
    --gallery-cols: 1;
  }
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 22, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 2rem;
  opacity: 0;
  transition: opacity 180ms ease;
  cursor: zoom-out;
}

.lightbox.is-open {
  opacity: 1;
}

.lightbox img {
  max-width: min(96vw, 1400px);
  max-height: 92vh;
  border-radius: 10px;
  border: 1px solid rgba(122, 215, 255, 0.4);
  box-shadow:
    0 0 0 1px rgba(157, 255, 106, 0.25) inset,
    0 30px 60px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(122, 215, 255, 0.25);
  transform: scale(0.96);
  transition: transform 220ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.lightbox.is-open img {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  background: rgba(20, 24, 50, 0.85);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}

.lightbox-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.prose h2,
.prose h3,
.prose h4 {
  margin-top: 2.2rem;
  margin-bottom: 0.9rem;
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.prose h2 {
  position: relative;
  font-size: clamp(1.4rem, 2.4vw, 1.75rem);
  padding: 0.35rem 0 0.4rem 0.9rem;
  border-left: 4px solid var(--accent);
  background: linear-gradient(90deg, rgba(157, 255, 106, 0.08), transparent 60%);
  border-radius: 0 6px 6px 0;
}

.prose h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: -3px;
  width: 4px;
  height: 6px;
  background: var(--accent-2);
  box-shadow: 0 0 8px rgba(122, 215, 255, 0.6);
}

.prose h3 {
  font-size: clamp(1.1rem, 1.8vw, 1.3rem);
  padding-left: 0.7rem;
  border-left: 3px solid var(--accent-2);
  color: var(--text);
}

.prose h4 {
  font-size: 1.05rem;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.prose pre {
  overflow: auto;
  background: #11142a;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
}

.prose code {
  background: #252a4b;
  border-radius: 4px;
  padding: 0.08rem 0.3rem;
  font-size: 0.92em;
}

.code-block {
  margin: 1.4rem 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #11142a;
  box-shadow: 0 6px 18px rgba(6, 10, 28, 0.35);
}

.code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.85rem;
  background: linear-gradient(180deg, #1d2147, #161938);
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.code-lang {
  color: var(--accent);
  font-weight: 600;
}

.code-lang::before {
  content: "▸ ";
  color: var(--accent-2);
}

.code-title {
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.78rem;
}

.code-block-body {
  overflow: auto;
  font-size: 0.92rem;
  line-height: 1.55;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.code-block-body::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

.code-block-body::-webkit-scrollbar-track {
  background: transparent;
}

.code-block-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.code-block-body::-webkit-scrollbar-thumb:hover {
  background: #5a6184;
}

.code-block-body .highlight,
.code-block-body pre {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  padding: 0;
}

.code-block-body pre {
  padding: 0.7rem 0;
}

.code-block-body .chroma {
  background: transparent !important;
}

.code-block-body table.lntable {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}

.code-block-body table.lntable td {
  padding: 0;
  vertical-align: top;
  border: 0;
}

.code-block-body table.lntable td:first-child {
  width: 1%;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.03);
  border-right: 1px solid var(--border);
}

.code-block-body .lntd:last-child {
  width: 100%;
  overflow-x: auto;
}

.code-block-body .lnt,
.code-block-body .ln {
  display: block;
  padding: 0 0.85rem;
  color: #5a6184;
  user-select: none;
  text-align: right;
  min-width: 2.4rem;
}

.code-block-body .lntd pre {
  padding: 0.7rem 0.9rem;
}

.code-block-body .lntd:first-child pre {
  padding-left: 0;
  padding-right: 0;
}

/* Chroma + lineNos: one <pre><code> contains every span.line — code must be block so lines stack */
.code-block-body .lntd:last-child pre > code,
.prose pre.chroma > code {
  display: block;
  width: 100%;
}

.code-block-body .chroma .line,
.prose pre .chroma .line {
  white-space: pre;
}

.code-block-body .chroma .line:hover {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
}

.code-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
  flex-shrink: 0;
  margin-left: auto;
}

.code-copy-btn svg {
  width: 14px;
  height: 14px;
}

.code-copy-btn:hover {
  color: var(--accent-2);
  border-color: var(--border);
  background: rgba(122, 215, 255, 0.08);
}

.code-copy-btn.is-copied {
  color: var(--accent);
  border-color: rgba(157, 255, 106, 0.4);
  background: rgba(157, 255, 106, 0.08);
}

.terms-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.term-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  background: linear-gradient(180deg, #2a2f5a, #1f2347);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 200ms ease, color 180ms ease;
}

.term-chip:hover {
  border-color: var(--accent-2);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(6, 10, 28, 0.5), 0 0 14px rgba(122, 215, 255, 0.25);
}

.term-chip span {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 0.45rem;
  font-size: 0.75rem;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.page-intro {
  color: var(--muted);
  margin: 0 0 1rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.footer-inner {
  padding: 1.25rem 0 2.2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.yt-embed {
  position: relative;
  margin: 1.5rem 0;
  aspect-ratio: 16 / 9;
  width: 100%;
  background:
    radial-gradient(circle at 30% 30%, rgba(122, 215, 255, 0.18) 0%, transparent 55%),
    radial-gradient(circle at 70% 70%, rgba(157, 255, 106, 0.12) 0%, transparent 55%),
    var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  isolation: isolate;
  transition:
    border-color 320ms ease,
    box-shadow 320ms ease;
}

.yt-embed::before {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 30% 30%, rgba(122, 215, 255, 0.22) 0%, transparent 55%),
    radial-gradient(circle at 70% 70%, rgba(157, 255, 106, 0.18) 0%, transparent 55%);
  opacity: 0;
  transform: scale(1.02);
  transition:
    opacity 420ms ease,
    transform 600ms ease;
  pointer-events: none;
  z-index: 0;
}

.yt-embed:hover,
.yt-embed:focus-within {
  border-color: var(--accent-2);
  box-shadow: 0 12px 36px -16px rgba(122, 215, 255, 0.45);
}

.yt-embed:hover::before,
.yt-embed:focus-within::before {
  opacity: 1;
  transform: scale(1);
}

.yt-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  position: relative;
  z-index: 1;
}

.yt-embed__btn {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 1.2rem;
  background: transparent;
  color: var(--text);
  border: 0;
  cursor: pointer;
  text-align: center;
  font: inherit;
  z-index: 2;
  transition: background-color 320ms ease;
}

.yt-embed__btn:hover,
.yt-embed__btn:focus-visible {
  background: rgba(255, 255, 255, 0.04);
  outline: none;
}

.yt-embed__play {
  position: relative;
  width: 64px;
  height: 64px;
  padding-left: 6px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--bg);
  background: var(--accent);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  transition:
    transform 320ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 320ms ease;
}

.yt-embed__play::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  transform: scale(0.85);
  transition:
    opacity 360ms ease,
    transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.yt-embed__btn:hover .yt-embed__play,
.yt-embed__btn:focus-visible .yt-embed__play {
  transform: scale(1.08);
  box-shadow: 0 10px 28px rgba(157, 255, 106, 0.35);
}

.yt-embed__btn:hover .yt-embed__play::after,
.yt-embed__btn:focus-visible .yt-embed__play::after {
  opacity: 0.7;
  transform: scale(1.1);
  animation: yt-pulse 2.4s ease-out infinite;
}

@keyframes yt-pulse {
  0% {
    opacity: 0.7;
    transform: scale(1);
  }
  70% {
    opacity: 0;
    transform: scale(1.45);
  }
  100% {
    opacity: 0;
    transform: scale(1.45);
  }
}

.yt-embed__label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 46ch;
  transform: translateY(4px);
  opacity: 0.92;
  transition:
    transform 360ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 360ms ease;
}

.yt-embed__btn:hover .yt-embed__label,
.yt-embed__btn:focus-visible .yt-embed__label {
  transform: translateY(0);
  opacity: 1;
}

.yt-embed__title {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.yt-embed__hint {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

@media (prefers-reduced-motion: reduce) {
  .yt-embed,
  .yt-embed::before,
  .yt-embed__btn,
  .yt-embed__play,
  .yt-embed__play::after,
  .yt-embed__label {
    transition: none;
    animation: none;
  }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .post-grid.one-column .post-card.has-thumb,
  .post-grid.one-column .post-card.no-thumb {
    grid-template-columns: 1fr;
  }

  .post-grid.one-column .post-thumb {
    width: 100%;
    height: 180px;
    min-height: 180px;
  }

  .post-grid.one-column .post-card.no-thumb .post-thumb-fallback {
    min-height: 120px;
    height: 120px;
  }

  .post-grid.one-column .post-thumb-wrap::after {
    top: auto;
    bottom: 0;
    right: auto;
    left: 10%;
    width: 80%;
    height: 1px;
    transform: scaleX(0);
    transform-origin: left;
  }

  .post-grid.one-column .post-card.has-thumb:hover .post-thumb-wrap::after,
  .post-grid.one-column .post-card.has-thumb:focus-within .post-thumb-wrap::after {
    animation: divider-draw-x 900ms steps(10, end) forwards;
  }
}
