:root {
  --ai-cyan: #22d3ee;
  --ai-blue: #3b82f6;
  --ai-violet: #8b5cf6;
  --ai-ink: #edf5fc;
  --ai-panel: rgba(255, 255, 255, 0.82);
  --ai-line: rgba(8, 145, 178, 0.2);
  --ai-grid-line: rgba(8, 145, 178, 0.07);
  --ai-card-bg: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(235, 245, 255, 0.94));
  --ai-tag-bg: rgba(245, 250, 255, 0.9);
  --ai-status-bg: rgba(244, 250, 255, 0.86);
  --ai-status-text: rgba(15, 71, 91, 0.76);
  --ai-sidebar-bg: rgba(244, 248, 255, 0.9);
  --ai-surface: rgba(255, 255, 255, 0.78);
  --ai-surface-strong: rgba(255, 255, 255, 0.94);
  --ai-surface-muted: rgba(238, 247, 255, 0.72);
  --ai-divider: rgba(8, 145, 178, 0.12);
  --ai-shadow-soft: 0 10px 30px rgba(30, 64, 175, 0.07), 0 1px 2px rgba(15, 23, 42, 0.04);
  --ai-shadow-card: 0 16px 42px rgba(30, 64, 175, 0.09), 0 2px 6px rgba(15, 23, 42, 0.04);
  --ai-shadow-hover: 0 20px 48px rgba(30, 64, 175, 0.13), 0 0 28px rgba(34, 211, 238, 0.08);
  --ai-page-bg:
    radial-gradient(circle at 18% -10%, rgba(34, 211, 238, 0.12), transparent 30rem),
    radial-gradient(circle at 88% 18%, rgba(139, 92, 246, 0.09), transparent 28rem),
    #edf5fc;
}

html[data-theme='dark'],
html.dark {
  --ai-ink: #050914;
  --ai-panel: rgba(8, 16, 32, 0.82);
  --ai-line: rgba(103, 232, 249, 0.18);
  --ai-grid-line: rgba(56, 189, 248, 0.045);
  --ai-card-bg: linear-gradient(145deg, rgba(12, 24, 48, 0.88), rgba(6, 13, 28, 0.9));
  --ai-tag-bg: rgba(7, 16, 34, 0.8);
  --ai-status-bg: rgba(4, 10, 22, 0.76);
  --ai-status-text: rgba(207, 250, 254, 0.68);
  --ai-sidebar-bg: rgba(6, 12, 24, 0.82);
  --ai-surface: rgba(8, 16, 32, 0.76);
  --ai-surface-strong: rgba(12, 24, 48, 0.9);
  --ai-surface-muted: rgba(13, 25, 48, 0.7);
  --ai-divider: rgba(103, 232, 249, 0.12);
  --ai-shadow-soft: 0 14px 36px rgba(0, 0, 0, 0.2);
  --ai-shadow-card: 0 18px 50px rgba(0, 0, 0, 0.24);
  --ai-shadow-hover: 0 20px 60px rgba(0, 0, 0, 0.32), 0 0 32px rgba(34, 211, 238, 0.08);
  --ai-page-bg:
    radial-gradient(circle at 18% -10%, rgba(34, 211, 238, 0.13), transparent 30rem),
    radial-gradient(circle at 88% 18%, rgba(139, 92, 246, 0.13), transparent 28rem),
    #050914;
  --bg: #050914;
  --card: rgba(8, 16, 32, 0.88);
  --block: rgba(13, 25, 48, 0.78);
  --text: #e8f2ff;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    --ai-ink: #050914;
    --ai-panel: rgba(8, 16, 32, 0.82);
    --ai-line: rgba(103, 232, 249, 0.18);
    --ai-grid-line: rgba(56, 189, 248, 0.045);
    --ai-card-bg: linear-gradient(145deg, rgba(12, 24, 48, 0.88), rgba(6, 13, 28, 0.9));
    --ai-tag-bg: rgba(7, 16, 34, 0.8);
    --ai-status-bg: rgba(4, 10, 22, 0.76);
    --ai-status-text: rgba(207, 250, 254, 0.68);
    --ai-sidebar-bg: rgba(6, 12, 24, 0.82);
    --ai-surface: rgba(8, 16, 32, 0.76);
    --ai-surface-strong: rgba(12, 24, 48, 0.9);
    --ai-surface-muted: rgba(13, 25, 48, 0.7);
    --ai-divider: rgba(103, 232, 249, 0.12);
    --ai-shadow-soft: 0 14px 36px rgba(0, 0, 0, 0.2);
    --ai-shadow-card: 0 18px 50px rgba(0, 0, 0, 0.24);
    --ai-shadow-hover: 0 20px 60px rgba(0, 0, 0, 0.32), 0 0 32px rgba(34, 211, 238, 0.08);
    --ai-page-bg:
      radial-gradient(circle at 18% -10%, rgba(34, 211, 238, 0.13), transparent 30rem),
      radial-gradient(circle at 88% 18%, rgba(139, 92, 246, 0.13), transparent 28rem),
      #050914;
  }
}

body {
  background: var(--ai-page-bg) !important;
}

.ai-skip-link {
  position: fixed;
  top: 10px;
  left: 50%;
  z-index: 1000;
  padding: 10px 16px;
  border: 1px solid var(--ai-cyan);
  border-radius: 999px;
  color: #fff;
  background: #071225;
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.28);
  transform: translate(-50%, -160%);
  transition: transform 160ms ease;
}

.ai-skip-link:focus {
  transform: translate(-50%, 0);
}

.ai-ambient {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.ai-ambient__grid {
  position: absolute;
  inset: 0;
  opacity: 0.24;
  background-image:
    linear-gradient(var(--ai-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--ai-grid-line) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

.ai-ambient__orb {
  position: absolute;
  width: 34rem;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.12;
}

.ai-ambient__orb--cyan {
  top: -16rem;
  left: 12%;
  background: var(--ai-cyan);
}

.ai-ambient__orb--violet {
  right: -16rem;
  top: 24%;
  background: var(--ai-violet);
}

.ai-signal-line {
  position: fixed;
  inset: 0 0 auto;
  z-index: 999;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ai-cyan), var(--ai-violet), transparent);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.65);
  pointer-events: none;
}

.ai-theme-toggle {
  position: fixed;
  right: 18px;
  bottom: 56px;
  z-index: 91;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid var(--ai-line);
  border-radius: 999px;
  color: var(--ai-status-text);
  background: var(--ai-status-bg);
  backdrop-filter: blur(16px);
  font: 700 9px/1 "JetBrains Mono", monospace;
  letter-spacing: 0.11em;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
  cursor: pointer;
}

.ai-theme-toggle:hover,
.ai-theme-toggle:focus-visible {
  color: var(--ai-cyan);
  border-color: rgba(34, 211, 238, 0.48);
  outline: none;
}

.ai-theme-toggle svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.ai-system-status {
  position: fixed;
  right: 18px;
  bottom: 16px;
  z-index: 90;
  display: flex;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--ai-line);
  border-radius: 999px;
  color: var(--ai-status-text);
  background: var(--ai-status-bg);
  backdrop-filter: blur(16px);
  font: 600 9px/1.2 "JetBrains Mono", monospace;
  letter-spacing: 0.11em;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}

.ai-system-status span {
  white-space: nowrap;
}

.ai-system-status i {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 10px #34d399;
  animation: ai-pulse 2.4s ease-in-out infinite;
}

.l_left .sidebg {
  background-color: var(--ai-sidebar-bg) !important;
}

@keyframes ai-pulse {
  50% { opacity: 0.42; transform: scale(0.76); }
}

.post-list .post-card {
  border: 1px solid var(--ai-line);
  box-shadow: var(--ai-shadow-card);
}

.l_left .logo-wrap {
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--ai-line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(34, 211, 238, 0.07), transparent 48%),
    var(--ai-surface-strong);
  box-shadow: var(--ai-shadow-soft);
}

.l_left .logo-wrap a.avatar {
  width: 44px;
  height: 44px;
  margin-right: 0.75rem;
}

.l_left .logo-wrap a.title {
  min-width: 0;
}

.l_left .logo-wrap a.title .main {
  letter-spacing: -0.035em;
}

.l_left .logo-wrap a.title .sub {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.055em;
}

.l_left .widgets .widget-wrapper {
  border: 0;
  box-shadow: none;
}

.l_left .widgets .widget-wrapper.recent {
  overflow: hidden;
  padding: 10px 8px 8px;
  border: 1px solid var(--ai-line);
  border-radius: 16px;
  background: var(--ai-surface);
  box-shadow: var(--ai-shadow-soft);
}

.l_left .widget-wrapper.recent .widget-header {
  padding: 0 10px 4px;
}

.l_left .widget-wrapper.recent .widget-header > span {
  color: var(--ai-status-text);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0.7;
}

.l_left .widget-wrapper.recent .widget-body {
  display: grid;
  gap: 4px;
}

.l_left .widget-wrapper.recent .widget-body a {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.l_left .widget-wrapper.recent .widget-body a + a {
  margin-top: 0;
}

.l_left .widget-wrapper.recent .widget-body a:hover,
.l_left .widget-wrapper.recent .widget-body a:focus-visible {
  color: var(--text);
  border-color: var(--ai-divider);
  background: var(--ai-surface-muted);
  outline: none;
}

article.md-text {
  border: 0;
  box-shadow: none;
}

.post-list .post-card {
  position: relative;
  overflow: hidden;
  background: var(--ai-card-bg);
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.post-list .post-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: linear-gradient(var(--ai-cyan), var(--ai-violet));
  opacity: 0;
  transition: opacity 180ms ease;
}

.post-list .post-card:hover {
  border-color: rgba(34, 211, 238, 0.32);
  transform: translateY(-2px);
  box-shadow: var(--ai-shadow-hover);
}

.post-list .post-card:hover::before {
  opacity: 1;
}

.post-list .post-card h2,
.post-list .post-card .post-title {
  letter-spacing: -0.025em;
}

.post-list .post-card .post-title::after {
  content: '  // VERIFIED SIGNAL';
  color: rgba(34, 211, 238, 0.55);
  font: 600 9px/1 "JetBrains Mono", monospace;
  letter-spacing: 0.08em;
  vertical-align: middle;
}

/* One cover hierarchy everywhere: centered one-line headline, bottom caption. */
.post-list .post-card.post.photo .cover,
.pin-slider .pin-slide.post-slide {
  isolation: isolate;
}

/* Desktop keeps the preferred neural-core art; mobile uses the H5-safe cover. */
@media (min-width: 721px) {
  .post-list .post-card.post.photo .cover,
  .pin-slider .pin-slide.post-slide {
    background-image: url('/assets/images/ai-intel-neural-core.jpg');
    background-position: center;
    background-size: cover;
  }

  .post-list .post-card.post.photo .cover {
    --cover-url: url('/assets/images/ai-intel-neural-core.jpg') !important;
  }

  .pin-slider .pin-slide.post-slide {
    --pin-cover-url: url('/assets/images/ai-intel-neural-core.jpg') !important;
  }

  .post-list .post-card.post.photo .cover > img,
  .pin-slider .pin-slide.post-slide > .pin-slide-bg {
    opacity: 0;
  }
}

.post-list .post-card.post.photo .cover::after,
.pin-slider .pin-slide.post-slide::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(to bottom, rgba(2, 8, 23, 0.2), rgba(2, 8, 23, 0.05) 37%, rgba(2, 8, 23, 0.22) 58%, rgba(2, 8, 23, 0.9) 100%),
    linear-gradient(to right, rgba(2, 8, 23, 0.24), transparent 24%, transparent 76%, rgba(2, 8, 23, 0.24));
  pointer-events: none;
}

.post-list .post-card.post.photo .cover .cover-info,
.pin-slider .pin-slide.post-slide .pin-slide-text {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr);
  box-sizing: border-box;
  width: 100%;
  padding: clamp(0.85rem, 2.4vw, 1.35rem) clamp(1rem, 3.6vw, 2rem);
  background: none;
  line-height: 1.35;
}

.post-list .post-card.post.photo .cover .cover-info .headline,
.pin-slider .pin-slide.post-slide .pin-slide-headline {
  grid-row: 2;
  align-self: center;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #f8fbff;
  font-size: clamp(1.45rem, 3.6vw, 2.35rem);
  font-weight: 750;
  line-height: 1.18;
  letter-spacing: -0.035em;
  text-align: center;
  text-overflow: ellipsis;
  text-shadow: 0 3px 20px rgba(0, 0, 0, 0.82);
  white-space: nowrap;
}

.post-list .post-card.post.photo .cover .cover-info .caption,
.pin-slider .pin-slide.post-slide .pin-slide-caption {
  display: -webkit-box;
  grid-row: 3;
  align-self: end;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: rgba(248, 251, 255, 0.9);
  font-size: clamp(0.78rem, 1.65vw, 0.95rem);
  font-weight: 430;
  line-height: 1.5;
  letter-spacing: 0;
  text-align: left;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
  overflow-wrap: anywhere;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.post-list .post-card.post.photo .cover .cover-info div + div,
.pin-slider .pin-slide.post-slide .pin-slide-headline + .pin-slide-caption {
  margin-top: 0;
}

.tag-plugin.note,
.tag-plugin.box,
figure.highlight {
  border-color: var(--ai-line) !important;
  background: var(--ai-tag-bg) !important;
}

.article-footer {
  border-color: var(--ai-line);
  background: var(--ai-surface);
  box-shadow: var(--ai-shadow-soft);
}

.article-footer section + section {
  border-top-color: var(--ai-divider);
}

.article-footer .social-wrap a.social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--ai-divider);
  border-radius: 10px;
  background: var(--ai-surface-muted);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.article-footer .social-wrap a.social:hover,
.article-footer .social-wrap a.social:focus-visible {
  border-color: rgba(34, 211, 238, 0.38);
  background: var(--ai-surface-strong);
  outline: none;
  transform: translateY(-1px);
}

.related-wrap {
  border: 0;
  box-shadow: none;
}

.related-wrap#read-next {
  margin: 2rem 0 3rem;
}

.related-wrap#read-next .body {
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 12px;
}

.related-wrap#read-next .body .item {
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid var(--ai-line);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(34, 211, 238, 0.055), transparent 52%),
    var(--ai-surface);
  box-shadow: var(--ai-shadow-soft);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.related-wrap#read-next .body .item:empty {
  display: none;
}

.related-wrap#read-next .body .item:hover {
  border-color: rgba(34, 211, 238, 0.3);
  box-shadow: var(--ai-shadow-card);
  transform: translateY(-2px);
}

.related-wrap#read-next .body .note {
  margin-bottom: 0.5rem;
  color: var(--ai-status-text);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.related-wrap#read-next .body a {
  display: inline-block;
  max-width: 100%;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.45;
}

.related-wrap#read-next .body #next {
  text-align: left;
}

.md-text h2::before,
.md-text h3::before {
  color: var(--ai-cyan) !important;
  text-shadow: 0 0 14px rgba(34, 211, 238, 0.34);
}

.md-text a:not([class]) {
  text-decoration-color: rgba(34, 211, 238, 0.32);
  text-underline-offset: 0.2em;
}

.search-wrapper,
.search-input {
  border-color: rgba(103, 232, 249, 0.18) !important;
}

::selection {
  color: white;
  background: rgba(59, 130, 246, 0.62);
}

@media (max-width: 720px) {
  .l_left .logo-wrap {
    padding: 8px 10px;
    border-radius: 15px;
  }

  .article-footer {
    margin-right: 0.5rem;
    margin-left: 0.5rem;
  }

  .related-wrap#read-next {
    padding: 0 0.5rem;
  }

  .ai-theme-toggle {
    position: absolute;
    top: 62px;
    right: 12px;
    bottom: auto;
    left: auto;
  }

  .ai-system-status {
    display: none;
  }

  .post-list .post-card.post.photo .cover .cover-info,
  .pin-slider .pin-slide.post-slide .pin-slide-text {
    padding: 0.7rem 0.85rem;
  }

  .post-list .post-card.post.photo .cover .cover-info .headline,
  .pin-slider .pin-slide.post-slide .pin-slide-headline {
    font-size: clamp(1.05rem, 5.5vw, 1.45rem);
  }

  .post-list .post-card.post.photo .cover .cover-info .caption,
  .pin-slider .pin-slide.post-slide .pin-slide-caption {
    font-size: clamp(0.7rem, 3.35vw, 0.82rem);
    line-height: 1.38;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-system-status i {
    animation: none;
  }

  .post-list .post-card {
    transition: none;
  }
}
