/* ============================================================
   JINER Blog — Homepage Refinement (home-redesign.css)
   Merged from the hero / sections / system design reviews.
   Scope: homepage elements only. Dark-mode overrides are
   consolidated under the trailing "Dark mode" section.
   ============================================================ */

/* ---------- Nav ---------- */
/* Hero nav floats over the gradient instead of a detached milky band */
.nav-main.nav-hero:not(.nav-scrolled) .nav-glass {
  background: rgba(255, 255, 255, 0.55);
  border-bottom-color: rgba(255, 255, 255, 0.18);
  box-shadow: none;
}
/* box-shadow is gated on :not(.nav-scrolled) so the shared nav.css
   stronger band + shadow still return once the user scrolls off. */

/* ---------- Hero ---------- */
/* Animated gradient locked into the indigo->violet identity ramp */
section.glass-bg {
  background: linear-gradient(-45deg, #6366f1, #8b5cf6, #7c3aed, #4f46e5);
  background-size: 400% 400%;
  /* clear the fixed nav + reserve floor space for the scroll hint */
  padding: calc(var(--nav-height, 60px) + 16px) 24px 64px;
}
@media (max-width: 640px) {
  section.glass-bg { padding: calc(var(--nav-height, 60px) + 12px) 16px 56px; }
}

/* Card: top-lit gradient + corner sheen reads as frosted glass */
.glass-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.07));
  border-color: rgba(255, 255, 255, 0.24);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.20);
}
.glass-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.22), transparent 42%);
  pointer-events: none;
}

/* Avatar: violet-tinted ring + halo makes it a brand focal point */
.glass-avatar {
  border: 3px solid rgba(255, 255, 255, 0.92);
  box-shadow:
    0 0 0 4px rgba(139, 92, 246, 0.28),
    0 12px 32px rgba(0, 0, 0, 0.20),
    0 0 44px rgba(139, 92, 246, 0.35);
}

/* Typography ladder: name always leads the page (higher specificity
   than the embedded rule and its 640px override) */
.glass-card .glass-name {
  font-size: clamp(1.8rem, 5.5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin-bottom: 8px;
}
.glass-bg .glass-name-sub {
  font-size: 0.875rem;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.74);
  margin-bottom: 24px;
}
.glass-bg .glass-bio {
  font-size: 0.975rem;
  color: rgba(255, 255, 255, 0.86);
  margin-bottom: 28px;
}
.glass-bg .glass-actions { gap: 12px; margin-bottom: 28px; }

/* Divider: cyan removed, thinned to a 2px violet shimmer */
.glass-divider {
  width: 72px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #a78bfa 18%, #8b5cf6 50%, #a78bfa 82%, transparent);
  background-size: 200% 100%;
}

/* Buttons: one unmistakable primary (brand ramp + violet glow),
   secondary demotes to a frosted ghost; no more white-rect inversion */
.glass-bg .glass-actions .glass-btn {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.30);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.glass-bg .glass-actions .glass-btn:hover {
  background: rgba(255, 255, 255, 0.26);
  border-color: rgba(255, 255, 255, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}
.glass-bg .glass-actions .glass-btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.glass-bg .glass-actions .glass-btn-primary:hover {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(99, 102, 241, 0.45);
}
/* Pill geometry unifies the CTAs with the tag / nav chip language */
.glass-bg .glass-actions .glass-btn,
.glass-bg .glass-actions .glass-btn-primary {
  padding: 11px 22px;
  border-radius: 999px;
  letter-spacing: 0.01em;
}
.glass-bg .glass-actions .glass-btn { font-weight: 500; }
.glass-bg .glass-actions .glass-btn-primary { font-weight: 600; }

/* Tags: deliberate chips with surface feedback on hover */
.glass-tag {
  padding: 6px 14px;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}
.glass-tag:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.32);
}

/* Terminal skill chips: same pill geometry as the card tags */
.hero-terminal-body .key { border-radius: 999px; }

/* Keyboard focus ring must read on the saturated gradient */
.glass-bg :focus-visible {
  outline-color: rgba(255, 255, 255, 0.9);
  outline-offset: 3px;
}

/* ---------- System ---------- */
/* All interactive motion shares the brand easing curve */
.glass-tag,
.hero-terminal-body .key {
  transition: transform .2s var(--ease), border-color .2s var(--ease),
              background-color .2s var(--ease), color .2s var(--ease);
}

/* ---------- Stats ---------- */
/* Align the strip with the max-w-4xl content column (one continuous column) */
.stats-strip {
  max-width: 56rem;
  gap: 20px;
  margin: 44px auto 0;
}
.section-bridge { max-width: 56rem; }

/* Stagger must only gate the entrance; interaction responds instantly */
.stats-strip .stat-card:hover,
.stats-strip .stat-card:focus-visible {
  transition-delay: 0s !important;
}

/* Cards: radius-xl surface with glass top-sheen + accent hairline on hover */
.stat-card {
  position: relative;
  gap: 10px;
  padding: 28px 20px;
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--color-accent), #8b5cf6);
  opacity: 0;
  transition: opacity .25s var(--ease);
  pointer-events: none;
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-accent);
}
.stat-card:hover::before { opacity: 1; }

/* Icon tile: raised glyph, not a flat chip */
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--color-accent-soft), rgba(139, 92, 246, 0.05));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

/* Numerals on a constant grid; CJK/latin values sit evenly at 700 */
.stat-num {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-label { letter-spacing: .04em; }

/* ---------- Content (#writing) ---------- */
/* Soft surface fade smooths the hero -> content transition */
#writing {
  background: linear-gradient(180deg, var(--color-surface-alt), var(--color-surface) 160px);
}

/* Gradient headline echoes the nav logo */
#writing h2 {
  background: linear-gradient(120deg, var(--color-text), var(--color-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* Crisp entrance: shorter travel + one easing curve + cascade stagger */
#writing .reveal {
  transform: translateY(16px);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
#writing .reveal.visible { transform: none; }
#writing .grid > .reveal:nth-child(2) { transition-delay: 80ms; }
#writing .grid > .reveal:nth-child(3) { transition-delay: 160ms; }
#writing .grid > .reveal:nth-child(4) { transition-delay: 240ms; }
#writing .grid > .reveal:nth-child(5) { transition-delay: 320ms; }

/* Empty state: a designed, accent-tinted 'waiting for content' card */
#writing .grid > .reveal.col-span-full {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 72px 24px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, var(--color-accent-soft), transparent 70%);
  color: var(--color-text-muted);
}
#writing .grid > .reveal.col-span-full::before {
  content: "\270E";
  margin-bottom: 16px;
  font-size: 2.5rem;
  line-height: 1;
  color: var(--color-accent);
  opacity: .55;
}
#writing .grid > .reveal.col-span-full p:first-child {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-secondary);
}
#writing .grid > .reveal.col-span-full a {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-accent);
  background: var(--color-accent-soft);
  text-decoration: none;
  transition: background-color .2s ease, transform .2s var(--ease);
}
#writing .grid > .reveal.col-span-full a:hover {
  background: rgba(109, 40, 217, 0.16);
  transform: translateY(-1px);
}

/* Primary CTA: literal brand ramp (white text stays readable in dark,
   supersedes the bg-ink/near-white dark contrast bug) */
#writing .btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border-radius: 999px;
  padding: 12px 28px;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
#writing .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.3);
}
#writing .btn-primary svg { transition: transform .2s var(--ease); }
#writing .btn-primary:hover svg { transform: translateX(3px); }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: clamp(3rem, 6vw, 4.5rem);
  border-top: 1px solid var(--color-border-light);
  box-shadow: inset 0 1px 0 var(--color-accent-soft);
}
.footer-inner { padding: 4rem 20px 2.5rem; }
.footer-links { gap: 8px 20px; }
.footer-links a {
  padding: 6px 12px;
  margin: -6px -12px;
  border-radius: 999px;
  transition: color .2s ease, background-color .2s ease;
}
.footer-links a:hover {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

/* ---------- Dark mode ---------- */
[data-theme="dark"] .nav-main.nav-hero:not(.nav-scrolled) .nav-glass {
  background: rgba(15, 13, 26, 0.45);
  border-bottom-color: rgba(167, 139, 250, 0.14);
}

[data-theme="dark"] section.glass-bg {
  background: linear-gradient(-45deg, #1e1b4b, #2e1065, #271a5c, #0d0830);
  background-size: 400% 400%;
}

[data-theme="dark"] .glass-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  border-color: rgba(167, 139, 250, 0.22);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .glass-card::before { background: linear-gradient(165deg, rgba(167, 139, 250, 0.14), transparent 42%); }

[data-theme="dark"] .glass-card .glass-name {
  color: transparent;
  background: linear-gradient(120deg, #fff, #a78bfa 60%, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
}
[data-theme="dark"] .glass-bg .glass-name-sub { color: rgba(255, 255, 255, 0.5); }

[data-theme="dark"] .glass-avatar {
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow:
    0 0 0 4px rgba(167, 139, 250, 0.14),
    0 0 28px rgba(167, 139, 250, 0.22);
}

[data-theme="dark"] .glass-divider {
  background: linear-gradient(90deg, #8b5cf6, #a78bfa);
  background-size: 200% 100%;
}

[data-theme="dark"] .glass-bg .glass-actions .glass-btn {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.16);
}
[data-theme="dark"] .glass-bg .glass-actions .glass-btn:hover { background: rgba(255, 255, 255, 0.17); }
[data-theme="dark"] .glass-bg .glass-actions .glass-btn-primary {
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

[data-theme="dark"] .glass-tag { background: rgba(255, 255, 255, 0.05); border-color: rgba(167, 139, 250, 0.18); }
[data-theme="dark"] .glass-tag:hover { background: rgba(167, 139, 250, 0.12); border-color: rgba(167, 139, 250, 0.32); }

/* Terminal keeps its 'device' silhouette against the dark backdrop */
[data-theme="dark"] .hero-terminal {
  border-color: rgba(167, 139, 250, 0.38);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(167, 139, 250, 0.08),
    0 0 40px rgba(124, 58, 237, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .stat-card {
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .site-footer { background: var(--color-bg); }
[data-theme="dark"] .site-footer .footer-bottom { border-top-color: rgba(230, 227, 242, 0.06); }
