/* =====================================================
   WYX LAB - Intro Animation & Particle Effects
   Bright & Clean Edition (AnZhiYu-inspired)
   ===================================================== */

/* ---------- Intro Overlay ---------- */
#wyx-intro {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  background: linear-gradient(160deg, #dcefff 0%, #f2f9ff 45%, #ffffff 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Split-curtain dismiss: two halves slide apart */
#wyx-intro .intro-curtain-l,
#wyx-intro .intro-curtain-r {
  position: absolute;
  top: 0; bottom: 0;
  width: 50%;
  background: linear-gradient(160deg, #dcefff 0%, #ffffff 100%);
  z-index: 10;
  transition: transform 0.9s cubic-bezier(0.76, 0, 0.24, 1);
  pointer-events: none;
}
#wyx-intro .intro-curtain-l { left: 0; }
#wyx-intro .intro-curtain-r { right: 0; }

#wyx-intro.reveal .intro-curtain-l { transform: translateX(-100%); }
#wyx-intro.reveal .intro-curtain-r { transform: translateX(100%); }

#wyx-intro.gone {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease 0.85s;
}

/* keep content above curtain during reveal */
#wyx-intro .intro-content,
#wyx-intro .intro-hex-ring,
#wyx-intro .intro-corner,
#wyx-intro #intro-canvas {
  z-index: 5;
}
/* fade out content just before curtain opens */
#wyx-intro.reveal .intro-content {
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* ---------- Grid background (dimmed) ---------- */
#wyx-intro::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(73, 177, 245, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(73, 177, 245, 0.05) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: grid-scroll 6s linear infinite;
}

@keyframes grid-scroll {
  0%   { background-position: 0 0; }
  100% { background-position: 50px 50px; }
}

/* ---------- Scan line (dimmed) ---------- */
#wyx-intro::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #49b1f5, #8ec9ff, transparent);
  animation: scan 3s ease-in-out infinite;
  opacity: 0.25;
}

@keyframes scan {
  0%   { top: -2px; opacity: 0; }
  10%  { opacity: 0.25; }
  90%  { opacity: 0.25; }
  100% { top: 100%; opacity: 0; }
}

/* ---------- Particle canvas (intro) ---------- */
#intro-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* ---------- Content wrapper ---------- */
.intro-content {
  position: relative;
  z-index: 2;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

/* ---------- Logo / title ---------- */
.intro-logo {
  font-size: clamp(2.4rem, 8vw, 5rem);
  font-weight: 800;
  font-family: 'Segoe UI', 'PingFang SC', sans-serif;
  letter-spacing: 0.18em;
  color: #1c3d5a;
  position: relative;
}

.intro-logo .logo-text {
  display: inline-block;
  opacity: 0;
  transform: translateY(30px);
  animation: logo-rise 0.7s cubic-bezier(.22,1,.36,1) forwards;
}

.intro-logo .logo-text:nth-child(1) { animation-delay: 0.3s; }
.intro-logo .logo-text:nth-child(2) { animation-delay: 0.5s; color: #49b1f5; }
.intro-logo .logo-text:nth-child(3) { animation-delay: 0.7s; }

@keyframes logo-rise {
  to { opacity: 1; transform: translateY(0); }
}

.intro-logo-glow {
  position: absolute;
  inset: -20px;
  background: radial-gradient(ellipse at center, rgba(73, 177, 245, 0.12) 0%, transparent 70%);
  animation: pulse-glow 2.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50%       { opacity: 0.5;   transform: scale(1.05); }
}

/* ---------- Subtitle / typewriter ---------- */
.intro-subtitle {
  font-size: clamp(0.85rem, 2.5vw, 1.1rem);
  color: #7fa8cc;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-family: 'Segoe UI', 'PingFang SC', sans-serif;
  opacity: 0;
  animation: fade-in 0.6s ease forwards 1.2s;
}

.intro-subtitle .cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: #49b1f5;
  margin-left: 3px;
  vertical-align: middle;
  animation: blink 0.8s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

@keyframes fade-in {
  to { opacity: 1; }
}

/* ---------- Progress bar ---------- */
.intro-progress-wrap {
  width: clamp(220px, 40vw, 360px);
  opacity: 0;
  animation: fade-in 0.5s ease forwards 1.4s;
}

.intro-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #9fbcd6;
  font-family: 'Consolas', 'Courier New', monospace;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.intro-progress-track {
  width: 100%;
  height: 3px;
  background: rgba(73, 177, 245, 0.15);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.intro-progress-track::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #2f8fe0, #49b1f5, #8ec9ff);
  border-radius: 4px;
  transform: scaleX(0);
  transform-origin: left;
  animation: progress-fill 2.2s cubic-bezier(.4,0,.2,1) forwards 1.5s;
}

@keyframes progress-fill {
  to { transform: scaleX(1); }
}

/* ---------- Hex decorations ---------- */
.intro-hex-ring {
  position: absolute;
  border: 1px solid rgba(73, 177, 245, 0.15);
  border-radius: 50%;
  animation: spin-ring linear infinite;
}

.intro-ring-1 {
  width: 340px; height: 340px;
  top: 50%; left: 50%;
  margin: -170px 0 0 -170px;
  animation-duration: 12s;
}
.intro-ring-2 {
  width: 480px; height: 480px;
  top: 50%; left: 50%;
  margin: -240px 0 0 -240px;
  animation-duration: 20s;
  animation-direction: reverse;
  border-color: rgba(143, 201, 255, 0.18);
}
.intro-ring-3 {
  width: 620px; height: 620px;
  top: 50%; left: 50%;
  margin: -310px 0 0 -310px;
  animation-duration: 30s;
  border-color: rgba(73, 177, 245, 0.1);
}

.intro-hex-ring::after {
  content: '';
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #49b1f5;
  top: -3px; left: 50%;
  margin-left: -3px;
  box-shadow: 0 0 6px rgba(73, 177, 245, 0.5);
}

@keyframes spin-ring {
  to { transform: rotate(360deg); }
}

/* ---------- Corner decorations ---------- */
.intro-corner {
  position: absolute;
  width: 60px; height: 60px;
  opacity: 0.45;
}
.intro-corner::before,
.intro-corner::after {
  content: '';
  position: absolute;
  background: #49b1f5;
}
.intro-corner::before { width: 2px; height: 100%; }
.intro-corner::after  { width: 100%; height: 2px; }

.intro-corner-tl { top: 30px; left: 30px; }
.intro-corner-tr { top: 30px; right: 30px; transform: scaleX(-1); }
.intro-corner-bl { bottom: 30px; left: 30px; transform: scaleY(-1); }
.intro-corner-br { bottom: 30px; right: 30px; transform: scale(-1); }

/* =====================================================
   Global Particle Canvas
   ===================================================== */
#particle-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

/* Low-contrast falling particles: decorative only, never block interaction. */
#falling-particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

#falling-particles i {
  position: absolute;
  top: -24px;
  display: block;
  border-radius: 50%;
  background: #76bff0;
  box-shadow: 0 0 8px rgba(118, 191, 240, 0.16);
  animation-name: particle-fall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes particle-fall {
  from {
    transform: translate3d(0, -24px, 0);
  }
  to {
    transform: translate3d(10vw, 105vh, 0);
  }
}

/* ensure main content sits above particles */
#web-main,
#page,
.content-inner,
header,
footer,
#aside-content {
  position: relative;
  z-index: 1;
}

/* =====================================================
   Avatar Glow Effects (Static - No Animation)
   ===================================================== */

#aside-content .card-info-avatar,
.card-info-avatar {
  position: relative;
}

/* Static subtle border, no animation */
#aside-content .card-info-avatar img,
.card-info-avatar img {
  border-radius: 50% !important;
  box-shadow:
    0 0 0 2px rgba(73, 177, 245, 0.35),
    0 0 8px rgba(73, 177, 245, 0.2);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

#aside-content .card-info-avatar img:hover,
.card-info-avatar img:hover {
  transform: scale(1.04);
  box-shadow:
    0 0 0 2px rgba(73, 177, 245, 0.55),
    0 0 12px rgba(73, 177, 245, 0.35);
}

/* Butterfly rotates avatar images on hover by default. Keep them stationary. */
#aside-content .avatar-img img:hover,
#sidebar .avatar-img img:hover {
  transform: none !important;
}

/* Remove rotating arcs - no pseudo-element animation */
#aside-content .card-info-avatar::before,
.card-info-avatar::before {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1px solid rgba(73, 177, 245, 0.25);
  pointer-events: none;
  z-index: 2;
}

#aside-content .card-info-avatar::after,
.card-info-avatar::after {
  content: '';
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 0.5px solid rgba(143, 201, 255, 0.2);
  pointer-events: none;
  z-index: 2;
}

/* =====================================================
   Deep-space animated cover
   ===================================================== */

#page-header:not(.not-top-img) #nav .site-name,
#page-header:not(.not-top-img) #nav a,
#page-header:not(.not-top-img) #nav span.site-page,
#page-header:not(.not-top-img) .nav-page-title,
#page-header:not(.not-top-img) #site-title,
#page-header:not(.not-top-img).post-bg .post-title {
  color: #f7f9ff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.72);
}

#page-header:not(.not-top-img) #site-subtitle,
#page-header:not(.not-top-img) #scroll-down .scroll-down-effects,
#page-header:not(.not-top-img).post-bg #post-meta,
#page-header:not(.not-top-img).post-bg #post-meta a,
#page-header:not(.not-top-img).post-bg #post-meta i,
#page-header:not(.not-top-img).post-bg #post-meta time,
#page-header:not(.not-top-img).post-bg #post-meta span {
  color: rgba(239, 244, 255, 0.88);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
}

/*
 * Let cover artwork dissolve into the page surface instead of ending on a
 * hard horizontal seam. The final part of the fade extends past the header,
 * so slight differences between the cover edge and the page background are
 * blended rather than exposed.
 */
#page-header:not(.not-top-img) {
  --cover-fade-depth: 56px;
  --cover-fade-start: 80%;
  --cover-fade-solid: #f6f8fb;
  --cover-fade-clear: rgba(246, 248, 251, 0);
  --cover-art-overlay: radial-gradient(circle at 52% 48%, rgba(4, 8, 17, 0.46), rgba(4, 8, 17, 0.16) 48%, rgba(2, 6, 13, 0.34));
  background-color: #080d16;
  background-position: center;
}

#page-header .deep-space-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.8s ease;
}

#page-header .deep-space-cover.is-ready {
  opacity: 1;
}

#page-header.full_page {
  --cover-fade-start: 88%;
}

#page-header.post-bg {
  --cover-fade-start: 78%;
}

#page-header:not(.not-top-img)::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: calc(-1 * var(--cover-fade-depth));
  left: 0;
  background:
    linear-gradient(
      to bottom,
      transparent 0,
      transparent var(--cover-fade-start),
      var(--cover-fade-solid) calc(100% - var(--cover-fade-depth)),
      var(--cover-fade-clear) 100%
    ),
    var(--cover-art-overlay) top / 100% calc(100% - var(--cover-fade-depth)) no-repeat;
  pointer-events: none;
  z-index: 2;
}

/* Keep cover copy above the blend layer, including metadata near the bottom. */
#page-header #site-info,
#page-header #post-info,
#page-header #page-site-info,
#page-header #scroll-down {
  z-index: 3;
}

/* Subtle bottom edge glow */
#page-header:not(.not-top-img)::before {
  content: '';
  position: absolute;
  top: auto;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(178, 145, 184, 0.58), rgba(231, 166, 153, 0.48), transparent);
  background-color: transparent;
  z-index: 3;
  animation: banner-scan 6s ease-in-out infinite;
  opacity: 0;
}

/* =====================================================
   Home post cards & search dialog
   ===================================================== */

/* Keep every homepage article visually distinct, including cards without covers. */
#recent-posts .recent-post-item {
  border: 1px solid rgba(73, 177, 245, 0.22);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(28, 61, 90, 0.08);
  cursor: pointer;
}

#recent-posts .recent-post-item:focus-visible {
  outline: 3px solid rgba(73, 177, 245, 0.45);
  outline-offset: 3px;
}

#recent-posts .recent-post-item:hover {
  border-color: rgba(73, 177, 245, 0.55);
  box-shadow: 0 14px 32px rgba(28, 61, 90, 0.14);
}

/* =====================================================
   Refined visual system — quiet, spacious, and focused
   ===================================================== */

body {
  background:
    radial-gradient(circle at 12% 8%, rgba(132, 116, 158, 0.1), transparent 32%),
    radial-gradient(circle at 88% 20%, rgba(190, 125, 119, 0.08), transparent 34%),
    #f6f8fb;
}

/* Keep the background texture present without competing with reading. */
#particle-canvas {
  opacity: 0.16;
}

/* A restrained navigation surface makes the page feel lighter. */
#page-header #nav,
#page-header.nav-fixed #nav {
  z-index: 200;
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid rgba(28, 61, 90, 0.08);
  box-shadow: 0 4px 18px rgba(28, 61, 90, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

#page-header:not(.not-top-img) #nav,
#page-header:not(.not-top-img).nav-fixed #nav {
  background: rgba(7, 12, 22, 0.66);
  border-bottom-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16);
}

/* The header is a higher stacking context than content cards and side widgets. */
#page-header {
  z-index: 300;
}

#page-header #nav .site-name {
  letter-spacing: 0.04em;
  font-weight: 700;
}

#page-header #nav a,
#page-header #nav span.site-page {
  font-size: 0.94rem;
}

#page-header #nav .nav-quick-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  margin: 0 0 0 14px;
  padding: 0 0 6px;
  height: 26px;
  border: 0;
  background: transparent;
  color: var(--font-color);
  font-family: inherit;
  font-size: 0.94rem;
  line-height: 20px;
  top: -1px;
  vertical-align: baseline;
  cursor: pointer;
}

#page-header:not(.not-top-img) #nav .nav-quick-action {
  color: #f7f9ff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.72);
}

#page-header #nav .nav-quick-action:hover,
#page-header #nav .nav-quick-action:focus-visible {
  color: var(--theme-color);
}

#page-header #nav .nav-quick-action:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 6px;
}

#page-header #site-title {
  letter-spacing: 0.09em;
  font-weight: 750;
}

#page-header #site-subtitle {
  margin-top: 0.45rem;
  font-size: 1rem;
  letter-spacing: 0.08em;
}

/* Article navigation borrows the violet and coral glow from the deep-space cover. */
#pagination.pagination-post {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  overflow: visible;
  margin-top: 44px;
  border-radius: 0;
}

#pagination.pagination-post .pagination-related {
  isolation: isolate;
  min-width: 0;
  height: 136px;
  border: 1px solid rgba(178, 145, 184, 0.34);
  border-radius: 18px;
  background:
    radial-gradient(circle at 18% 18%, rgba(178, 145, 184, 0.34), transparent 42%),
    linear-gradient(135deg, #12101d 0%, #211828 54%, #3a2029 100%);
  box-shadow: 0 14px 34px rgba(37, 25, 48, 0.16);
  transition: transform 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease;
}

#pagination.pagination-post .pagination-related.full-width {
  grid-column: 1 / -1;
}

#pagination.pagination-post .pagination-related::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  background: linear-gradient(115deg, rgba(10, 11, 20, 0.32), rgba(31, 20, 40, 0.58) 54%, rgba(99, 51, 58, 0.46));
  content: '';
  transition: opacity 0.28s ease;
}

#pagination.pagination-post .pagination-related .cover {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.42;
  filter: saturate(0.76) contrast(1.04);
}

#pagination.pagination-post .pagination-related .info {
  position: relative;
  z-index: 2;
  height: 100%;
}

#pagination.pagination-post .pagination-related .info-1,
#pagination.pagination-post .pagination-related .info-2 {
  padding: 24px 58px;
}

#pagination.pagination-post .pagination-related .info-item-1 {
  color: rgba(232, 218, 235, 0.8);
  letter-spacing: 0.12em;
  font-size: 0.78rem;
}

#pagination.pagination-post .pagination-related .info-item-2 {
  margin-top: 8px;
  color: #fff8f5;
  font-weight: 650;
  line-height: 1.55;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.34);
}

/* Keep article names readable at all times; the original theme swaps them for excerpts on hover. */
#pagination.pagination-post .pagination-related .info-1,
#pagination.pagination-post .pagination-related:not(.no-desc):hover .info-1,
#pagination.pagination-post .pagination-related:not(.no-desc):focus-visible .info-1 {
  opacity: 1;
  transform: translate(0, -50%);
}

#pagination.pagination-post .pagination-related .info-1 .info-item-2 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  text-wrap: balance;
}

#pagination.pagination-post .pagination-related .info-2 {
  display: none;
}

#pagination.pagination-post .pagination-direction-icon {
  position: absolute;
  top: 50%;
  left: 18px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 235, 228, 0.24);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #f0b8ac;
  transform: translateY(-50%);
  transition: transform 0.28s ease, background-color 0.28s ease, color 0.28s ease;
}

#pagination.pagination-post .next-post .pagination-direction-icon {
  right: 18px;
  left: auto;
}

#pagination.pagination-post .pagination-related:hover,
#pagination.pagination-post .pagination-related:focus-visible {
  border-color: rgba(231, 166, 153, 0.72);
  box-shadow: 0 18px 40px rgba(73, 39, 56, 0.24);
  transform: translateY(-4px);
}

#pagination.pagination-post .pagination-related:hover::after,
#pagination.pagination-post .pagination-related:focus-visible::after {
  opacity: 0.82;
}

#pagination.pagination-post .prev-post:hover .pagination-direction-icon,
#pagination.pagination-post .prev-post:focus-visible .pagination-direction-icon {
  background: rgba(231, 166, 153, 0.18);
  color: #ffe3da;
  transform: translate(-3px, -50%);
}

#pagination.pagination-post .next-post:hover .pagination-direction-icon,
#pagination.pagination-post .next-post:focus-visible .pagination-direction-icon {
  background: rgba(231, 166, 153, 0.18);
  color: #ffe3da;
  transform: translate(3px, -50%);
}

#pagination.pagination-post .pagination-related:focus-visible {
  outline: 3px solid rgba(231, 166, 153, 0.36);
  outline-offset: 3px;
}

/* Match the footer and its framework/theme credits to the cover palette. */
#footer {
  border-top: 1px solid rgba(178, 145, 184, 0.3);
  background:
    radial-gradient(circle at 16% 0%, rgba(135, 99, 154, 0.24), transparent 38%),
    radial-gradient(circle at 86% 16%, rgba(181, 95, 87, 0.18), transparent 34%),
    linear-gradient(135deg, #0b0d16 0%, #171321 52%, #25151c 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#footer > *,
#footer a,
#footer .framework-info,
#footer .footer-copyright {
  color: rgba(235, 226, 237, 0.84);
}

#footer .framework-info a {
  color: #d8b8d7;
  text-decoration-color: rgba(216, 184, 215, 0.36);
  text-underline-offset: 3px;
}

#footer a:hover,
#footer .framework-info a:hover {
  color: #f0b8ac;
}

#footer .footer-separator {
  color: rgba(231, 166, 153, 0.5);
}

/* Align cards around one soft border, modest shadow, and generous spacing. */
#recent-posts .recent-post-item,
#aside-content .card-widget,
#page .page,
#post {
  border: 1px solid rgba(28, 61, 90, 0.09);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(28, 61, 90, 0.06);
  transition:
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    transform 0.25s ease;
}

#recent-posts .recent-post-item {
  margin-bottom: 24px;
}

#recent-posts .recent-post-item:hover,
#aside-content .card-widget:hover {
  box-shadow: 0 14px 30px rgba(28, 61, 90, 0.1);
  transform: translateY(-3px);
}

#recent-posts .recent-post-item:hover,
#aside-content .card-widget:hover,
#page .page:hover,
#post:hover {
  border-color: rgba(73, 177, 245, 0.72);
  box-shadow:
    0 0 0 1px rgba(73, 177, 245, 0.18),
    0 14px 32px rgba(28, 61, 90, 0.12);
}

#recent-posts .recent-post-item .article-title {
  font-weight: 650;
  letter-spacing: 0.01em;
}

#recent-posts .recent-post-item .article-meta-wrap,
#recent-posts .recent-post-item .content {
  line-height: 1.8;
}

#aside-content .card-widget {
  margin-bottom: 18px;
}

#aside-content .item-headline {
  font-weight: 650;
  letter-spacing: 0.02em;
}

#aside-content #card-info-btn {
  border-radius: 10px;
  box-shadow: none;
}

/* Leave a clear buffer for the fixed navigation above sticky widgets. */
@media screen and (min-width: 900px) {
  #aside-content .sticky_layout,
  #page-header.nav-visible:not(.fixed) + .layout > #aside-content .sticky_layout,
  #page-header.fixed + .layout > #aside-content .sticky_layout {
    top: 82px;
  }
}

/* Maintain contrast when the built-in dark theme is enabled. */
html[data-theme='dark'],
html[data-theme='dark'] body {
  background: #090a0d !important;
}

html[data-theme='dark'] {
  --global-bg: #090a0d;
  --card-bg: #15171c;
  --sidebar-bg: #15171c;
  --sidebar-menu-bg: #1b1e24;
  --search-bg: #15171c;
  --blockquote-bg: #1c1f25;
  --tab-button-bg: #1d2026;
  --tab-button-active-bg: #15171c;
}

html[data-theme='dark'] #web_bg {
  background: #090a0d !important;
}

html[data-theme='dark'] #web_bg::before {
  background: transparent !important;
}

html[data-theme='dark'] #page-header:not(.not-top-img),
html[data-darkreader-scheme='dark'] #page-header:not(.not-top-img),
#page-header[data-cover-theme='dark']:not(.not-top-img) {
  --cover-fade-solid: #090a0d;
  --cover-fade-clear: rgba(9, 10, 13, 0);
  --cover-art-overlay: radial-gradient(circle at 52% 48%, rgba(2, 6, 13, 0.5), rgba(2, 6, 13, 0.2) 48%, rgba(1, 4, 9, 0.38));
}

/* Dark surfaces can carry a longer dissolve without washing out the artwork. */
#page-header[data-cover-theme='dark'].full_page {
  --cover-fade-start: 76%;
}

#page-header[data-cover-theme='dark'].post-bg {
  --cover-fade-start: 56%;
}

/* Keep the same artwork in both modes; only the page-edge blend changes. */
html[data-theme='dark'] #page-header {
  background-color: #07131f;
  background-blend-mode: normal;
}

/* Script-resolved visual mode also covers browser-enforced dark rendering. */
#page-header[data-cover-theme='dark'] {
  background-color: #07131f;
  background-blend-mode: normal;
}

#page-header[data-cover-theme='dark'] #site-title,
#page-header[data-cover-theme='dark'].post-bg .post-title {
  color: #f3f8fc;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.34);
}

html[data-theme='dark'] #page-header #site-info,
html[data-theme='dark'] #page-header #post-info,
html[data-theme='dark'] #page-header #page-site-info,
html[data-theme='dark'] #page-header #scroll-down {
  z-index: 3;
}

[data-theme='dark'] #page-header #site-title,
[data-theme='dark'] #page-header.post-bg .post-title {
  color: #f3f8fc;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.34);
}

[data-theme='dark'] #page-header #site-subtitle,
[data-theme='dark'] #page-header.post-bg #post-meta,
[data-theme='dark'] #page-header.post-bg #post-meta a,
[data-theme='dark'] #page-header.post-bg #post-meta i,
[data-theme='dark'] #page-header.post-bg #post-meta time,
[data-theme='dark'] #page-header.post-bg #post-meta span {
  color: rgba(222, 239, 252, 0.82);
}

[data-theme='dark'] #page-header #nav,
[data-theme='dark'] #page-header.nav-fixed #nav {
  background: rgba(18, 18, 18, 0.82);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme='dark'] #page-header #nav .site-name,
[data-theme='dark'] #page-header #nav a,
[data-theme='dark'] #page-header #nav span.site-page,
[data-theme='dark'] #page-header .nav-page-title {
  color: rgba(239, 247, 255, 0.9);
}

[data-theme='dark'] #recent-posts .recent-post-item,
[data-theme='dark'] #aside-content .card-widget,
[data-theme='dark'] #page .page,
[data-theme='dark'] #post {
  border-color: rgba(255, 255, 255, 0.11);
  background: #15171c;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.32);
}

[data-theme='dark'] #recent-posts .recent-post-item:hover,
[data-theme='dark'] #aside-content .card-widget:hover,
[data-theme='dark'] #page .page:hover,
[data-theme='dark'] #post:hover {
  border-color: rgba(105, 190, 246, 0.78);
  box-shadow:
    0 0 0 1px rgba(105, 190, 246, 0.2),
    0 12px 30px rgba(23, 116, 177, 0.16);
}

/* =====================================================
   Search Dialog - quiet, spacious and consistent
   ===================================================== */
#local-search .search-dialog {
  top: max(72px, 8vh);
  left: 50%;
  translate: -50% 0;
  margin-left: 0;
  padding: 0;
  width: min(720px, calc(100vw - 40px));
  max-height: min(760px, 84vh);
  overflow: hidden;
  border: 1px solid rgba(73, 177, 245, 0.24);
  border-radius: 22px !important;
  background: rgba(249, 252, 255, 0.96);
  box-shadow:
    0 28px 80px rgba(24, 55, 82, 0.24),
    0 4px 18px rgba(45, 98, 136, 0.1);
  backdrop-filter: blur(18px) saturate(120%);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
}

#local-search .search-dialog .search-nav {
  position: relative;
  margin: 0;
  padding: 22px 24px 18px;
  border-bottom: 1px solid rgba(73, 177, 245, 0.13);
  color: #20384d;
  font-size: 1rem;
  line-height: 1.2;
}

#local-search .search-dialog .search-dialog-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

#local-search .search-dialog .search-dialog-title::before {
  width: 5px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #49b1f5, #3288c8);
  box-shadow: 0 0 10px rgba(73, 177, 245, 0.28);
  content: '';
}

#local-search .search-dialog .search-close-button {
  flex: 0 0 36px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: rgba(73, 177, 245, 0.08);
  color: #60778b;
  text-align: center;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

#local-search .search-dialog .search-close-button:hover {
  border-color: rgba(73, 177, 245, 0.22);
  background: rgba(73, 177, 245, 0.15);
  color: #2784c4;
}

#local-search .search-dialog .local-search-input {
  position: relative;
  margin: 0;
  padding: 18px 24px 14px;
}

#local-search .search-dialog .local-search-input input {
  min-height: 50px;
  padding: 11px 18px;
  border: 1px solid rgba(73, 177, 245, 0.3);
  border-radius: 14px;
  background: rgba(238, 247, 253, 0.78);
  color: #24384b;
  box-shadow: inset 0 1px 2px rgba(28, 61, 90, 0.04);
  font-size: 0.98rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

#local-search .search-dialog .local-search-input input::placeholder {
  color: #8295a6;
}

#local-search .search-dialog .local-search-input input:focus {
  border-color: #49b1f5;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(73, 177, 245, 0.13);
}

#local-search .search-dialog > hr {
  display: none;
}

#local-search #local-search-stats > hr {
  display: none;
}

#local-search #loading-database,
#local-search .search-loading {
  margin: 8px 24px 22px;
  padding: 26px 20px;
  border: 1px dashed rgba(73, 177, 245, 0.24);
  border-radius: 14px;
  color: #708699;
  background: rgba(73, 177, 245, 0.035);
}

#local-search .search-dialog .search-result-list {
  margin: 0;
  padding: 4px 24px 14px;
  max-height: min(52vh, 450px);
  scrollbar-width: thin;
  scrollbar-color: rgba(73, 177, 245, 0.38) transparent;
}

#local-search .search-dialog .local-search-hit-item {
  align-items: center;
  margin: 8px 0;
  padding: 14px 16px;
  border: 1px solid rgba(73, 177, 245, 0.13);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  line-height: 1.65;
  box-shadow: 0 3px 12px rgba(45, 98, 136, 0.045);
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

#local-search .search-dialog .local-search-hit-item:hover {
  border-color: rgba(73, 177, 245, 0.35);
  background: #fff;
  box-shadow: 0 8px 22px rgba(45, 98, 136, 0.1);
  transform: translateY(-2px);
}

#local-search .search-dialog .local-search-hit-item[value]::before {
  margin: 0 12px 0 0;
  min-width: 28px;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: rgba(73, 177, 245, 0.11);
  color: #3288c8;
  content: attr(value);
  font-size: 0.78rem;
  font-style: normal;
}

#local-search .search-dialog .local-search-hit-item a {
  color: #30475b;
}

#local-search .search-dialog .search-result-title {
  display: inline-block;
  margin-bottom: 4px;
  color: #20384d;
  font-size: 1rem;
  font-weight: 700;
}

#local-search .search-dialog .search-result {
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  color: #687d8f;
  font-size: 0.86rem;
  line-height: 1.65;
  word-break: break-word;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

#local-search .search-keyword {
  padding: 0 2px;
  border-radius: 4px;
  background: rgba(73, 177, 245, 0.13);
  color: #1679b9;
}

#local-search #local-search-stats {
  padding: 0 24px 16px;
}

#local-search #local-search-stats .search-result-stats {
  margin: 2px 0 0;
  color: #8093a3;
  font-size: 0.82rem;
}

#search-mask {
  background: rgba(8, 20, 31, 0.58);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

html[data-theme='dark'] #local-search .search-dialog {
  border-color: rgba(105, 190, 246, 0.2);
  background: rgba(12, 24, 36, 0.96);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
}

html[data-theme='dark'] #local-search .search-dialog .search-nav {
  border-bottom-color: rgba(255, 255, 255, 0.08);
  color: #e7f2fb;
}

html[data-theme='dark'] #local-search .search-dialog .search-close-button {
  background: rgba(105, 190, 246, 0.08);
  color: #9db1c3;
}

html[data-theme='dark'] #local-search .search-dialog .local-search-input input {
  border-color: rgba(105, 190, 246, 0.22);
  background: rgba(4, 14, 24, 0.62);
  color: #e4eef6;
}

html[data-theme='dark'] #local-search .search-dialog .local-search-input input:focus {
  border-color: rgba(105, 190, 246, 0.72);
  background: rgba(5, 17, 28, 0.9);
}

html[data-theme='dark'] #local-search .search-dialog .local-search-hit-item {
  border-color: rgba(105, 190, 246, 0.12);
  background: rgba(19, 37, 53, 0.76);
  box-shadow: none;
}

html[data-theme='dark'] #local-search .search-dialog .local-search-hit-item:hover {
  border-color: rgba(105, 190, 246, 0.32);
  background: rgba(25, 48, 68, 0.92);
}

html[data-theme='dark'] #local-search .search-dialog .search-result-title,
html[data-theme='dark'] #local-search .search-dialog .local-search-hit-item a {
  color: #e3eef7;
}

html[data-theme='dark'] #local-search .search-dialog .search-result {
  color: #9aafc0;
}

html[data-theme='dark'] #local-search #loading-database,
html[data-theme='dark'] #local-search .search-loading {
  border-color: rgba(105, 190, 246, 0.18);
  background: rgba(105, 190, 246, 0.035);
  color: #9aafc0;
}

@media screen and (max-width: 768px) {
  #page-header:not(.not-top-img) {
    --cover-fade-depth: 40px;
    background-position: 54% center;
  }

  #page-header.post-bg {
    --cover-fade-start: 72%;
  }

  #page-header[data-cover-theme='dark'].post-bg {
    --cover-fade-start: 50%;
  }

  #recent-posts .recent-post-item {
    border-radius: 12px;
  }

  #particle-canvas {
    opacity: 0.1;
  }

  #falling-particles i {
    opacity: 0.22 !important;
  }

  #recent-posts .recent-post-item,
  #aside-content .card-widget,
  #page .page,
  #post {
    border-radius: 12px;
  }

  #local-search .search-dialog {
    top: 0;
    left: 0;
    translate: none;
    width: 100%;
    height: var(--search-height, 100svh);
    max-height: none;
    border: 0;
    border-radius: 0 !important;
  }

  #local-search .search-dialog .search-nav {
    padding: 18px 20px 16px;
  }

  #local-search .search-dialog .local-search-input {
    padding: 16px 20px 12px;
  }

  #local-search .search-dialog .search-result-list {
    padding: 2px 20px 18px;
    max-height: calc(var(--search-height, 100svh) - 185px) !important;
  }

  #local-search .search-dialog .local-search-hit-item {
    padding: 13px 14px;
  }

  #local-search #local-search-stats {
    padding-right: 20px;
    padding-left: 20px;
  }
}

@keyframes banner-scan {
  0%   { opacity: 0; transform: scaleX(0.2); }
  20%  { opacity: 0.4; transform: scaleX(1); }
  80%  { opacity: 0.4; }
  100% { opacity: 0; transform: scaleX(0.2); }
}

/* =====================================================
   Mobile Optimizations (max-width 768px)
   ===================================================== */
@media screen and (max-width: 768px) {
  /* Avoid background-attachment: fixed jank on Android / iOS */
  #page-header {
    background-attachment: scroll !important;
  }

  /* URL-bar aware banner height (falls back to 100vh) */
  #page-header.full_page {
    height: 100vh;
    height: 100svh;
  }

  #pagination.pagination-post {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 34px;
  }

  #pagination.pagination-post .pagination-related {
    height: 122px;
    border-radius: 15px;
  }

  #pagination.pagination-post .pagination-related .info-1,
  #pagination.pagination-post .pagination-related .info-2 {
    padding: 20px 54px;
  }

  /* Slightly smaller site title on small screens */
  #site-info #site-title,
  #page-site-info #site-title {
    font-size: 1.55em;
  }

  /* Solid nav bar: backdrop-filter can glitch over the fixed canvas on iOS */
  #page-header #nav,
  #page-header.nav-fixed #nav {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(255, 255, 255, 0.94);
  }

  /* Intro: shrink decorations so nothing clips on narrow screens */
  .intro-ring-1 {
    width: 240px; height: 240px;
    margin: -120px 0 0 -120px;
  }
  .intro-ring-2 {
    width: 340px; height: 340px;
    margin: -170px 0 0 -170px;
  }
  .intro-ring-3 {
    width: 440px; height: 440px;
    margin: -220px 0 0 -220px;
  }

  .intro-logo {
    letter-spacing: 0.1em;
  }

  .intro-content {
    gap: 16px;
  }

  .intro-corner {
    width: 40px; height: 40px;
  }
  .intro-corner-tl { top: 20px; left: 20px; }
  .intro-corner-tr { top: 20px; right: 20px; }
  .intro-corner-bl { bottom: 20px; left: 20px; }
  .intro-corner-br { bottom: 20px; right: 20px; }
}
