/* ═══════════════════════════════════════════
   Design System — Personal Blog
   Base: 8px grid · Slate palette · Indigo accent
   Light + Dark mode via CSS variables
   ═══════════════════════════════════════════ */

/* ── Light Mode (default) ── */
:root {
  --color-primary:       #1e293b;
  --color-primary-light: #334155;
  --color-accent:        #6366f1;
  --color-accent-hover:  #4f46e5;

  --color-bg:            #f8fafc;
  --color-surface:       #ffffff;
  --color-surface-alt:   #f1f5f9;

  --color-text:          #1e293b;
  --color-text-secondary:#64748b;
  --color-text-muted:    #64748b;   /* WCAG AA 4.5:1 on #f8fafc */
  --color-text-inverse:  #ffffff;

  --color-border:        #e2e8f0;
  --color-border-light:  #f1f5f9;

  --color-success:       #10b981;
  --color-success-bg:    #ecfdf5;
  --color-error:         #ef4444;
  --color-error-bg:      #fef2f2;

  /* Shadows — dark/ambient for light mode */
  --shadow-rest:  0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-float: 0 4px 12px rgba(0, 0, 0, 0.06);

  /* Focus ring */
  --focus-ring: 0 0 0 3px rgba(99, 102, 241, 0.15);

  /* Image dimming (none in light) */
  --img-brightness: 1;

  /* ── Typography ── */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI",
               "Noto Sans SC", "PingFang SC", "Microsoft YaHei",
               "Hiragino Sans GB", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "JetBrains Mono",
               "Cascadia Code", monospace;

  --text-xs:    0.75rem;
  --text-sm:    0.8125rem;
  --text-base:  1rem;
  --text-lg:    1.125rem;
  --text-xl:    1.25rem;
  --text-2xl:   1.5rem;
  --text-3xl:   1.75rem;

  --leading-tight:  1.4;
  --leading-normal: 1.75;
  --leading-relaxed:1.85;

  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold:600;
  --weight-bold:   700;

  /* ── Spacing (8px grid) ── */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* ── Radius ── */
  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-full: 9999px;
}

/* ── Dark Mode (manual override) ── */
[data-theme="dark"] {
  --color-primary:       #e2e8f0;
  --color-primary-light: #cbd5e1;
  --color-accent:        #818cf8;
  --color-accent-hover:  #a5b4fc;

  --color-bg:            #0f172a;
  --color-surface:       #1e293b;
  --color-surface-alt:   #334155;

  --color-text:          #e2e8f0;
  --color-text-secondary:#94a3b8;
  --color-text-muted:    #64748b;
  --color-text-inverse:  #0f172a;

  --color-border:        #334155;
  --color-border-light:  #1e293b;

  --color-success:       #34d399;
  --color-success-bg:    #064e3b;
  --color-error:         #f87171;
  --color-error-bg:      #450a0a;

  /* Shadows become glow/border in dark mode */
  --shadow-rest:  0 0 0 1px rgba(255, 255, 255, 0.06);
  --shadow-float: 0 0 0 1px rgba(255, 255, 255, 0.1),
                  0 4px 20px rgba(0, 0, 0, 0.35);

  /* Focus ring — lighter in dark */
  --focus-ring: 0 0 0 3px rgba(129, 140, 248, 0.25);

  /* Dim images/videos */
  --img-brightness: 0.85;
}

/* ── System preference (only when no manual choice) ── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-primary:       #e2e8f0;
    --color-primary-light: #cbd5e1;
    --color-accent:        #818cf8;
    --color-accent-hover:  #a5b4fc;

    --color-bg:            #0f172a;
    --color-surface:       #1e293b;
    --color-surface-alt:   #334155;

    --color-text:          #e2e8f0;
    --color-text-secondary:#94a3b8;
    --color-text-muted:    #64748b;
    --color-text-inverse:  #0f172a;

    --color-border:        #334155;
    --color-border-light:  #1e293b;

    --color-success:       #34d399;
    --color-success-bg:    #064e3b;
    --color-error:         #f87171;
    --color-error-bg:      #450a0a;

    --shadow-rest:  0 0 0 1px rgba(255, 255, 255, 0.06);
    --shadow-float: 0 0 0 1px rgba(255, 255, 255, 0.1),
                    0 4px 20px rgba(0, 0, 0, 0.35);

    --focus-ring: 0 0 0 3px rgba(129, 140, 248, 0.25);

    --img-brightness: 0.85;
  }
}

/* ═══════════════════════════════════════════
   Reset & Base
   ═══════════════════════════════════════════ */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

html {
  font-size: 100%;
  -webkit-font-smoothing: antialiased;
  /* Smooth theme transition */
  transition: background-color 0.3s ease;
}

html { height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
body > main { flex: 1 0 auto; }

/* Images/video dim in dark mode */
img, video, iframe {
  filter: brightness(var(--img-brightness));
  transition: filter 0.3s ease;
}

a { color: var(--color-accent); text-decoration: none; transition: color 0.3s ease; }
a:hover { color: var(--color-accent-hover); }

/* ═══════════════════════════════════════════
   Layout
   ═══════════════════════════════════════════ */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-6) 0;
  margin-bottom: var(--space-8);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.site-header .wrap,
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.site-header .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.container {
  padding-bottom: var(--space-10);
}

.site-footer {
  flex-shrink: 0;
  text-align: center;
  padding: 2rem 1rem;
  border-top: 1px solid var(--color-border-light);
}
.site-footer p {
  margin: 0;
  line-height: 2;
}
.site-footer .copyright {
  font-size: 0.8125rem;
  font-weight: var(--weight-normal);
  color: var(--color-text-muted);
  letter-spacing: 0.015em;
}
.site-footer .icp {
  font-size: 0.75rem;
  font-weight: 300;
}
.site-footer .icp a {
  color: #6B7280;
  text-decoration: none;
  padding-bottom: 1px;
  border-bottom: 1px solid transparent;
  transition: color 0.3s ease, border-color 0.3s ease;
}
.site-footer .icp a:hover {
  color: var(--color-text-secondary);
  border-bottom-color: var(--color-text-muted);
}
[data-theme="dark"] .site-footer .icp a {
  color: #4B5563;
}
[data-theme="dark"] .site-footer .icp a:hover {
  color: #9CA3AF;
  border-bottom-color: #6B7280;
}
.site-footer p {
  margin: 0;
  line-height: 2;
}
.site-footer p:first-of-type {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  letter-spacing: 0.02em;
  font-weight: var(--weight-medium);
}
.site-footer p:last-of-type {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.site-footer a {
  color: var(--color-text-muted);
  text-decoration: none;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
}
.site-footer a:hover {
  color: var(--color-accent);
  background: var(--color-border-light);
}

/* ── Header ── */
.site-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-primary);
  letter-spacing: -0.01em;
}
.site-title a { color: inherit; }
.site-title a:hover { color: var(--color-primary-light); }

.site-nav a {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-left: var(--space-4);
  transition: color 0.15s;
}
.site-nav a:hover { color: var(--color-primary); }

/* ═══════════════════════════════════════════
   Article Card (list page)
   ═══════════════════════════════════════════ */
.article-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-rest);
  border: 1px solid var(--color-border-light);
  transition: box-shadow 0.2s, border-color 0.2s, background-color 0.3s ease;
}
.article-card:hover {
  box-shadow: var(--shadow-float);
  border-color: var(--color-border);
}

.article-card h2 {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-1);
}
.article-card h2 a { color: var(--color-primary); }
.article-card h2 a:hover { color: var(--color-accent); }

.article-card .meta {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.article-card .excerpt {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  line-height: var(--leading-normal);
}

/* ═══════════════════════════════════════════
   Article Full (single page)
   ═══════════════════════════════════════════ */
.article-full {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-8);
  box-shadow: var(--shadow-rest);
  border: 1px solid var(--color-border-light);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.article-full h1 {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  line-height: 1.5;
  color: var(--color-primary);
  margin-bottom: var(--space-1);
  letter-spacing: -0.015em;
}

.article-full .meta {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
  transition: border-color 0.3s ease;
}

.article-full .content {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--color-text);
}

.article-full .content p {
  margin-bottom: var(--space-4);
}

.article-full .content p:last-child {
  margin-bottom: 0;
}

.back-link {
  margin-top: var(--space-6);
  font-size: var(--text-sm);
}
.back-link a { color: var(--color-text-secondary); }
.back-link a:hover { color: var(--color-accent); }

/* ═══════════════════════════════════════════
   Pagination
   ═══════════════════════════════════════════ */
.pagination {
  text-align: center;
  margin-top: var(--space-8);
  display: flex;
  justify-content: center;
  gap: var(--space-1);
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  transition: all 0.15s;
}

.pagination a {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.pagination a:hover {
  background: var(--color-border-light);
  border-color: var(--color-border);
}

.pagination span {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-weight: var(--weight-medium);
}

/* ═══════════════════════════════════════════
   Empty State
   ═══════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: var(--space-16) 0;
  color: var(--color-text-muted);
}
.empty-state p {
  font-size: var(--text-base);
}

/* ═══════════════════════════════════════════
   Login Page
   ═══════════════════════════════════════════ */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: var(--space-4);
}

.login-box {
  background: var(--color-surface);
  padding: var(--space-10);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  width: 100%;
  max-width: 380px;
  transition: background-color 0.3s ease;
}

.login-box h1 {
  text-align: center;
  margin-bottom: var(--space-6);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-primary);
}

.login-box .error-msg {
  color: var(--color-error);
  text-align: center;
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
}

.login-box .back {
  text-align: center;
  margin-top: var(--space-4);
  font-size: var(--text-sm);
}
.login-box .back a { color: var(--color-text-muted); }
.login-box .back a:hover { color: var(--color-accent); }

/* ═══════════════════════════════════════════
   Form Elements
   ═══════════════════════════════════════════ */
.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.3s ease, color 0.3s ease;
  margin-bottom: var(--space-3);
}

.form-input::placeholder {
  color: var(--color-text-muted);
}

.form-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--focus-ring);
}

textarea.form-input {
  min-height: 240px;
  resize: vertical;
  line-height: var(--leading-normal);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-4);
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  font-weight: var(--weight-medium);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s, transform 0.15s;
  line-height: 1.5;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.btn-primary:hover { background: var(--color-primary-light); color: var(--color-text-inverse); }

.btn-danger  {
  background: var(--color-error);
  color: #fff;
}
.btn-danger:hover  { opacity: 0.9; color: #fff; }

.btn-ghost {
  background: var(--color-border-light);
  color: var(--color-text-secondary);
}
.btn-ghost:hover { background: var(--color-border); color: var(--color-text); }

/* ═══════════════════════════════════════════
   Theme Toggle Button
   ═══════════════════════════════════════════ */
.theme-toggle {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.theme-toggle:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* Sun/Moon icons */
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.3s ease;
  width: 18px; height: 18px;
}

/* Light mode: show moon, hide sun */
.theme-toggle .icon-moon {
  transform: rotate(0deg) scale(1);
  opacity: 1;
}
.theme-toggle .icon-sun {
  transform: rotate(90deg) scale(0);
  opacity: 0;
}

/* Dark mode: show sun, hide moon */
[data-theme="dark"] .theme-toggle .icon-moon,
:root:not([data-theme="light"]) .theme-toggle .icon-moon {
  transform: rotate(-90deg) scale(0);
  opacity: 0;
}
[data-theme="dark"] .theme-toggle .icon-sun,
:root:not([data-theme="light"]) .theme-toggle .icon-sun {
  transform: rotate(0deg) scale(1);
  opacity: 1;
}

/* Also handle system-preference dark (no data-theme set) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .theme-toggle .icon-moon {
    transform: rotate(-90deg) scale(0);
    opacity: 0;
  }
  :root:not([data-theme="light"]):not([data-theme="dark"]) .theme-toggle .icon-sun {
    transform: rotate(0deg) scale(1);
    opacity: 1;
  }
}

/* ── Theme toggle in site nav ── */
.site-nav .theme-toggle {
  margin-left: var(--space-4);
  vertical-align: middle;
}

/* ═══════════════════════════════════════════
   Scroll Progress Bar
   ═══════════════════════════════════════════ */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px;
  background: linear-gradient(90deg, var(--color-accent), #a78bfa);
  z-index: 9999; width: 0%;
  transition: width 0.1s linear;
  pointer-events: none;
}

/* ═══════════════════════════════════════════
/* ==================== Floating Action Bar ==================== */
.fab {
  position: fixed; bottom: 24px; right: 20px; z-index: 50;
  display: flex; gap: 2px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 3px;
  box-shadow: var(--shadow-float);
  opacity: 0; transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}
.fab.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.fab-btn {
  width: 40px; height: 40px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-secondary); text-decoration: none; cursor: pointer;
  border: none; background: transparent;
  transition: all 0.2s ease;
  position: relative;
}
.fab-btn:hover { background: var(--color-primary); color: #fff; }
.fab-btn:active { transform: scale(0.92); }
.fab-btn svg { width: 18px; height: 18px; }
.fab-btn::after {
  content: attr(aria-label);
  position: absolute; right: 52px; top: 50%; transform: translateY(-50%);
  background: var(--color-primary); color: var(--color-text-inverse);
  font-size: 0.75rem; padding: 3px 10px; border-radius: var(--radius-sm);
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity 0.2s ease;
}
.fab-btn:hover::after { opacity: 1; }

@media (max-width: 640px) {
  .fab { display: none; }
}

/* ═══════════════════════════════════════════
   Mobile Bottom Navigation
   ═══════════════════════════════════════════ */
.mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  justify-content: space-around;
  transition: background-color 0.3s ease;
}
.mobile-nav.visible { display: flex; }

.mobile-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--color-text-muted); text-decoration: none;
  font-size: 11px; padding: 4px 16px; border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav a:active { background: var(--color-border-light); }
.mobile-nav a.active { color: var(--color-accent); }
.mobile-nav a svg { width: 20px; height: 20px; }

.has-mobile-nav { padding-bottom: 64px; }

/* ═══════════════════════════════════════════
   Button Loading State
   ═══════════════════════════════════════════ */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
  opacity: 0.8;
}
.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.btn-ghost.btn-loading::after {
  border-color: rgba(0,0,0,0.1);
  border-top-color: var(--color-text);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════
   Form Validation
   ═══════════════════════════════════════════ */
.form-group { margin-bottom: var(--space-3); }

.form-input.is-invalid {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}
.form-input.is-valid {
  border-color: var(--color-success);
}

.form-error {
  display: none;
  color: var(--color-error);
  font-size: var(--text-sm);
  margin-top: -8px;
  margin-bottom: var(--space-3);
}
.form-hint {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-top: -8px;
  margin-bottom: var(--space-3);
}

/* ═══════════════════════════════════════════
   Skeleton Loading
   ═══════════════════════════════════════════ */
.skeleton {
  background: linear-gradient(90deg,
    var(--color-border-light) 25%,
    var(--color-surface) 50%,
    var(--color-border-light) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-wave 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-wave {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  padding: var(--space-6);
  margin-bottom: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
}

.skeleton-title {
  height: 24px; width: 60%; margin-bottom: 12px;
}
.skeleton-meta {
  height: 14px; width: 30%; margin-bottom: 12px;
}
.skeleton-line {
  height: 14px; margin-bottom: 8px;
}
.skeleton-line:last-child { width: 70%; }

/* ═══════════════════════════════════════════
   404 Page
   ═══════════════════════════════════════════ */
.error-page {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 70vh; text-align: center;
  padding: var(--space-4);
}
.error-page .error-code {
  font-size: 6rem; font-weight: var(--weight-bold);
  color: var(--color-border); line-height: 1;
  margin-bottom: var(--space-4);
}
.error-page h2 {
  font-size: var(--text-2xl); color: var(--color-primary);
  margin-bottom: var(--space-2);
}
.error-page p {
  color: var(--color-text-secondary); margin-bottom: var(--space-6);
  max-width: 400px; line-height: var(--leading-relaxed);
}
.error-page .btn { margin-top: var(--space-2); }

/* ═══════════════════════════════════════════
   Touch / Mobile Optimizations
   ═══════════════════════════════════════════ */
@media (max-width: 640px) {
  /* Larger touch targets */
  .site-nav a, .admin-header nav a {
    padding: var(--space-2) var(--space-3);
  }
  /* Prevent iOS zoom on input focus */
  .form-input { font-size: 16px !important; }

  /* Disable hover effects on touch */
  @media (hover: none) {
    .article-card:hover { box-shadow: var(--shadow-rest); border-color: var(--color-border-light); }
    .article-card:active { background: var(--color-border-light); }
  }
}

/* ── Tap highlight ── */
a, button, [role="button"] {
  -webkit-tap-highlight-color: rgba(99, 102, 241, 0.15);
}

/* ═══════════════════════════════════════════
   Accessibility: Skip Link
   ═══════════════════════════════════════════ */
.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: 10000;
  background: var(--color-primary); color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  text-decoration: none;
  transform: translateY(-120%);
  transition: transform 0.2s ease;
}
.skip-link:focus {
  transform: translateY(0);
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════
   Accessibility: Focus Visible
   ═══════════════════════════════════════════ */
/* Only show focus ring for keyboard users */
*:focus-visible {
  outline: 2.5px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Suppress focus ring for mouse/touch users */
*:focus:not(:focus-visible) {
  outline: none;
}

/* Override for elements that have their own focus styles */
.form-input:focus-visible {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--focus-ring);
}

.btn:focus-visible,
.theme-toggle:focus-visible,
.fab-btn:focus-visible {
  outline: 2.5px solid var(--color-accent);
  outline-offset: 2px;
}

/* Dark mode focus ring */
[data-theme="dark"] *:focus-visible {
  outline-color: #818cf8;
}

/* ═══════════════════════════════════════════
   Accessibility: Reduced Motion
   ═══════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ═══════════════════════════════════════════
   Utility
   ═══════════════════════════════════════════ */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); border: 0;
}

.post-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2rem;
  align-items: start;
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}
.post-sidebar { position: sticky; top: 1.5rem; }
.sidebar-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-rest);
  margin-bottom: 1rem;
}
.sidebar-card .card-title {
  font-size: var(--text-sm); font-weight: var(--weight-semibold);
  color: var(--color-text-secondary); text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 1rem;
  padding-bottom: 0.75rem; border-bottom: 2px solid var(--color-accent);
}
.sidebar-author { text-align: center; }
.sidebar-author .author-avatar {
  width: 72px; height: 72px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--color-border); margin-bottom: 0.75rem;
}
.sidebar-author .author-name {
  font-size: var(--text-lg); font-weight: var(--weight-semibold);
  color: var(--color-primary); margin-bottom: 0.25rem;
}
.sidebar-author .author-bio {
  font-size: var(--text-sm); color: var(--color-text-secondary); line-height: 1.6;
}
.sidebar-posts { list-style: none; }
.sidebar-posts li { margin-bottom: 0.5rem; }
.sidebar-posts a {
  font-size: var(--text-sm); color: var(--color-text); text-decoration: none;
  display: block; padding: 0.5rem 0; border-bottom: 1px solid var(--color-border-light);
  transition: color 0.2s; line-height: 1.5;
}
.sidebar-posts a:hover { color: var(--color-accent); }
.sidebar-posts .post-date { font-size: var(--text-xs); color: var(--color-text-muted); display: block; margin-top: 2px; }
.sidebar-back { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-sm); color: var(--color-accent); text-decoration: none; font-weight: var(--weight-medium); transition: gap 0.2s; }
.sidebar-back:hover { gap: 8px; }
@media (max-width: 768px) {
  .post-layout { grid-template-columns: 1fr; max-width: 720px; }
  .post-sidebar { position: static; order: -1; }
  .sidebar-author { display: none; }
}

/* ==================== Page Hero ==================== */
.page-hero {
  text-align: center;
  padding: 3rem 1rem 2rem;
  margin-bottom: 1.5rem;
}
.page-hero .page-hero-title {
  font-size: 2rem;
  font-weight: var(--weight-bold);
  color: var(--color-primary);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.page-hero .page-hero-desc {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  margin-bottom: 0.25rem;
}
.page-hero .page-hero-count {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.page-hero-divider {
  width: 50px; height: 3px;
  margin: 1rem auto 0;
  border-radius: 2px;
  background: var(--color-accent);
  opacity: 0.5;
}

@media (min-width: 641px) {
  .mobile-nav { display: none !important; }
  body.has-mobile-nav { padding-bottom: 0 !important; }
}


   ═══════════════════════════════════════════ */

/* ── Shared header vars ── */
.header-inner{max-width:56rem;margin:0 auto;padding:0 1.25rem;height:4rem;display:flex;align-items:center;justify-content:space-between}
.logo{font-family:var(--font-mono);font-size:var(--text-sm);font-weight:500;letter-spacing:-0.02em;text-decoration:none}
.logo-accent{color:var(--color-accent)}

/* ── Desktop nav ── */
.header-nav{display:none;align-items:center;gap:1.5rem;font-size:var(--text-sm)}
@media(min-width:768px){.header-nav{display:flex}}
.header-nav a{color:inherit;text-decoration:none;transition:color .15s;white-space:nowrap}
.header-nav a.active{color:var(--color-accent);font-weight:600}

/* ── Standard header (sub-pages) ── */
.site-header{background:var(--color-surface);border-bottom:1px solid var(--color-border-light)}
.site-header .logo{color:var(--color-primary)}
.site-header .header-nav a{color:var(--color-text-secondary)}
.site-header .header-nav a:hover{color:var(--color-primary)}
.site-header .header-nav a.active{color:var(--color-accent)}

/* ── Glass header (homepage hero) ── */
.nav-glass-fixed{position:fixed;top:0;left:0;right:0;z-index:50;transition:all .35s ease;background:transparent}
.nav-glass-fixed .logo{color:#fff}
.nav-glass-fixed .header-nav a{color:rgba(255,255,255,.72)}
.nav-glass-fixed .header-nav a:hover{color:#fff}
.nav-glass-fixed .header-nav a.active{color:#fff;font-weight:600}
.nav-glass-fixed .theme-toggle-btn{border-color:rgba(255,255,255,.25);color:rgba(255,255,255,.7)}
.nav-glass-fixed .theme-toggle-btn:hover{border-color:rgba(255,255,255,.5);color:#fff}
/* scrolled state */
.nav-glass-fixed.scrolled{background:rgba(255,255,255,.72);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);border-bottom:1px solid rgba(0,0,0,.04)}
.nav-glass-fixed.scrolled .logo{color:var(--color-primary)}
.nav-glass-fixed.scrolled .header-nav a{color:var(--color-text-secondary)}
.nav-glass-fixed.scrolled .header-nav a:hover{color:var(--color-primary)}
.nav-glass-fixed.scrolled .header-nav a.active{color:var(--color-accent)}
.nav-glass-fixed.scrolled .theme-toggle-btn{border-color:var(--color-border);color:var(--color-text-muted)}
.nav-glass-fixed.scrolled .theme-toggle-btn:hover{border-color:var(--color-accent);color:var(--color-accent)}
/* dark mode glass */
[data-theme="dark"] .nav-glass-fixed.scrolled{background:rgba(15,23,42,.78);border-bottom:1px solid rgba(255,255,255,.04)}
[data-theme="dark"] .nav-glass-fixed.scrolled .logo{color:var(--color-text)}
[data-theme="dark"] .nav-glass-fixed.scrolled .theme-toggle-btn{border-color:#334155;color:#94a3b8}

/* ── Hamburger ── */
.hamburger{display:flex;flex-direction:column;justify-content:center;gap:5px;width:36px;height:36px;background:none;border:none;cursor:pointer;padding:6px;z-index:60}
.hamburger span{display:block;width:100%;height:2px;background:currentColor;border-radius:2px;transition:all .3s var(--ease-out-expo);transform-origin:center}
.hamburger.open span:nth-child(1){transform:translateY(7px) rotate(45deg)}
.hamburger.open span:nth-child(2){opacity:0;transform:scaleX(0)}
.hamburger.open span:nth-child(3){transform:translateY(-7px) rotate(-45deg)}
.nav-glass-fixed .hamburger{color:#fff}
.nav-glass-fixed.scrolled .hamburger,.site-header .hamburger{color:var(--color-primary)}
@media(min-width:768px){.hamburger{display:none}}

/* ── Mobile drawer ── */
.mobile-drawer{position:fixed;top:0;right:0;width:280px;height:100vh;z-index:55;background:var(--color-surface);padding:5rem 1.5rem 2rem;transform:translateX(100%);transition:transform .35s var(--ease-out-expo);overflow-y:auto;box-shadow:-8px 0 30px rgba(0,0,0,.08)}
.mobile-drawer.open{transform:translateX(0)}
.mobile-drawer a{display:block;padding:12px 0;font-size:var(--text-lg);font-weight:500;color:var(--color-text);text-decoration:none;border-bottom:1px solid var(--color-border-light);transition:color .15s}
.mobile-drawer a:hover,.mobile-drawer a.active{color:var(--color-accent)}
.mobile-drawer-theme{display:flex;align-items:center;justify-content:space-between;padding:16px 0;font-size:var(--text-sm);color:var(--color-text-secondary)}
.mobile-overlay{position:fixed;inset:0;background:rgba(0,0,0,.3);z-index:50;opacity:0;pointer-events:none;transition:opacity .3s ease}
.mobile-overlay.open{opacity:1;pointer-events:auto}

[data-theme="dark"] .nav-dropdown-menu-inner a:hover{background:var(--color-surface-alt);color:var(--color-accent)}

/* ── Smooth page transitions ── */
@keyframes page-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
main{animation:page-in .35s var(--ease-out-expo) both}
/* ═══════════════════════════════════════════
   Desktop Enhancements (≥768px only)
   ═══════════════════════════════════════════ */
@media (min-width: 768px) {

  /* ── Hero: split layout ── */
  .glass-bg {
    flex-direction: row;
    gap: 3rem;
    padding: 0 2rem;
  }
  .glass-card {
    max-width: 480px;
    margin: 0;
    flex-shrink: 0;
  }

  /* ── Hero: right-side code terminal ── */
  .hero-terminal {
    display: flex !important;
    flex-direction: column;
    width: 380px;
    flex-shrink: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,.15);
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.8;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
    animation: card-enter 0.8s .15s cubic-bezier(.16,1,.3,1) both;
  }
  .hero-terminal-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(255,255,255,.06);
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  .hero-terminal-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
  }
  .hero-terminal-dot.r { background: #ff5f57; }
  .hero-terminal-dot.y { background: #febc2e; }
  .hero-terminal-dot.g { background: #28c840; }
  .hero-terminal-title {
    flex: 1;
    text-align: center;
    color: rgba(255,255,255,.5);
    font-size: 12px;
  }
  .hero-terminal-body {
    padding: 20px 22px;
    color: rgba(255,255,255,.85);
  }
  .hero-terminal-body .prompt { color: #50fa7b; }
  .hero-terminal-body .cmd   { color: #f8f8f2; }
  .hero-terminal-body .key   { color: #ff79c6; }
  .hero-terminal-body .val   { color: #f1fa8c; }
  .hero-terminal-body .comment { color: #6272a4; }
  .hero-terminal-body .cursor::after {
    content: '▊';
    color: #f8f8f2;
    animation: blink 1s step-end infinite;
  }

  /* ── Stats row ── */
  .stats-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    max-width: 980px;
    margin: -40px auto 0;
    padding: 0 1.25rem;
    position: relative;
    z-index: 2;
  }
  .stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    padding: 1.5rem 1rem;
    text-align: center;
    transition: all .3s var(--ease-out-expo);
  }
  .stat-card:first-child { border-radius: var(--radius-lg) 0 0 var(--radius-lg); }
  .stat-card:last-child  { border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
  .stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-float);
    border-color: var(--color-accent);
  }
  .stat-num {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-accent);
    font-family: var(--font-mono);
    line-height: 1.2;
  }
  .stat-icon {
    color: var(--color-accent);
    margin-bottom: 6px;
    display: flex;
    justify-content: center;
    transition: transform .3s var(--ease-out-expo);
  }
  .stat-icon svg {
    width: 24px;
    height: 24px;
  }
  .stat-card:hover .stat-icon {
    transform: scale(1.15);
  }

  .stat-label {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: 4px;
  }

  /* ── Writing section: gradient top ── */
  #writing {
    background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-bg) 100%);
    padding-top: 7rem !important;
  }
  #writing .code-comment {
    font-size: 14px;
    letter-spacing: 0.05em;
  }

  /* ── Article cards: accent top bar ── */
  #writing .card-lift {
    position: relative;
    overflow: hidden;
  }
  #writing .card-lift::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-accent), #a78bfa, #67e8f9);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .4s var(--ease-out-expo);
  }
  #writing .card-lift:hover::before {
    transform: scaleX(1);
  }

  /* ── Footer: multi-column ── */
  .site-footer {
    border-top: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--color-accent), #a78bfa, #67e8f9) 1;
  }
  .site-footer .footer-inner {
    max-width: 56rem;
    margin: 0 auto;
    padding: 2.5rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .site-footer .footer-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
  }
  .site-footer .footer-links {
    display: flex;
    gap: 1.5rem;
    font-size: var(--text-sm);
  }
  .site-footer .footer-links a {
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color .15s;
  }
  .site-footer .footer-links a:hover {
    color: var(--color-accent);
  }
  .site-footer .footer-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
  }
  .site-footer .status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px rgba(16,185,129,.4);
  }

  /* ── Posts page hero ── */
  .posts-hero {
    background: linear-gradient(180deg, color-mix(in srgb, var(--color-accent) 5%, transparent) 0%, transparent 100%);
    padding-top: 6rem !important;
    padding-bottom: 3rem !important;
  }
  .posts-hero h1 {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  [data-theme="dark"] .posts-hero h1 {
    background: linear-gradient(135deg, #e2e8f0 0%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  /* ── Post cards: image placeholder ── */
  .post-card {
    display: flex;
    flex-direction: column;
  }
  .post-card .card-visual {
    height: 140px;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    background: linear-gradient(135deg, color-mix(in srgb, var(--color-accent) 10%, var(--color-surface)) 0%, color-mix(in srgb, #a78bfa 8%, var(--color-surface)) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    opacity: .6;
    transition: opacity .3s;
  }
  .post-card:hover .card-visual {
    opacity: .9;
  }

  /* ── Tool pages: hero gradient ── */
  .tool-hero {
    background: linear-gradient(180deg, color-mix(in srgb, var(--color-accent) 4%, transparent) 0%, transparent 100%);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
  }

  /* ── Floating particles on hero ── */
  .hero-particles {
    display: block;
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
  }
  .hero-particle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    animation: particle-float linear infinite;
  }
  @keyframes particle-float {
    0%   { transform: translateY(100vh) scale(0); opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { transform: translateY(-10vh) scale(1); opacity: 0; }
  }

  /* ── Glass card: subtle border glow on hover ── */
  .glass-card {
    transition: transform .4s var(--ease-out-expo), box-shadow .4s var(--ease-out-expo);
  }
  .glass-card:hover {
    transform: translateY(-4px);
    box-shadow:
      0 12px 40px rgba(0,0,0,.15),
      0 0 0 1px rgba(255,255,255,.25),
      inset 0 1px 0 rgba(255,255,255,.2);
  }

  /* ── Scroll indicator: hidden on desktop ── */
  .glass-scroll { display: none; }

  /* ── Nav logo: bigger on desktop ── */
  .logo { font-size: var(--text-base) !important; }

} /* end @media min-width: 768px */

/* ═══════════════════════════════════════════
   Larger desktop tweaks (≥1024px)
   ═══════════════════════════════════════════ */
@media (min-width: 1024px) {
  .glass-card {
    max-width: 500px;
    padding: 56px 48px 48px;
  }
  .hero-terminal {
    width: 420px;
  }
  .glass-avatar {
    width: 120px; height: 120px;
  }
  .glass-name {
    font-size: 2rem;
  }
}

/* ═══════════════════════════════════════════
   Click-to-toggle dropdown (replaces hover)
   ═══════════════════════════════════════════ */

/* Reset old hover rules — only show when .open */
.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  padding-top: 8px;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s 0.2s;
}
.nav-dropdown.open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s 0s;
}

/* Trigger as button */
.nav-dropdown-trigger {
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
}
.nav-dropdown-trigger .arrow {
  display: inline-block;
  transition: transform 0.2s ease;
  font-size: 0.7em;
  opacity: 0.5;
}
.nav-dropdown.open .nav-dropdown-trigger .arrow {
  transform: rotate(180deg);
}

/* Menu inner */
.nav-dropdown-menu-inner {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.04);
  padding: 6px;
  min-width: 170px;
  white-space: nowrap;
  overflow: hidden;
}
.nav-dropdown-heading {
  display: block;
  padding: 6px 14px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  opacity: 0.6;
}
.nav-dropdown-menu-inner a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: var(--text-sm);
  color: var(--color-text);
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.15s;
}
.nav-dropdown-menu-inner a:hover {
  background: var(--color-surface-alt);
  color: var(--color-accent);
}

/* Tools overlay (transparent, catches clicks) */
.tools-overlay {
  position: fixed;
  inset: 0;
  z-index: 99;
  pointer-events: none;
}
.tools-overlay.open {
  pointer-events: auto;
}

/* Dark mode */
[data-theme="dark"] .nav-dropdown-menu-inner {
  background: var(--color-surface);
  border-color: var(--color-border);
}
[data-theme="dark"] .nav-dropdown-menu-inner a {
  color: var(--color-text);
}
[data-theme="dark"] .nav-dropdown-menu-inner a:hover {
  background: var(--color-surface-alt);
  color: var(--color-accent);
}

/* Standard header trigger color */
.site-header .nav-dropdown-trigger {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-left: var(--space-4);
  transition: color 0.15s;
}
.site-header .nav-dropdown.open .nav-dropdown-trigger,
.site-header .nav-dropdown-trigger:hover {
  color: var(--color-primary);
}

/* Glass header trigger color */
.nav-glass-fixed .nav-dropdown-trigger { color: rgba(255,255,255,.72); }
.nav-glass-fixed .nav-dropdown.open .nav-dropdown-trigger,
.nav-glass-fixed .nav-dropdown-trigger:hover { color: #fff; }
.nav-glass-fixed.scrolled .nav-dropdown-trigger { color: var(--color-text-secondary); }
.nav-glass-fixed.scrolled .nav-dropdown.open .nav-dropdown-trigger,
.nav-glass-fixed.scrolled .nav-dropdown-trigger:hover { color: var(--color-primary); }

/* Mobile drawer section label */
.mobile-drawer-section {
  display: block;
  padding: 20px 0 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  opacity: 0.5;
}

/* Make dropdown trigger match nav links exactly */
.header-nav .nav-dropdown-trigger {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  line-height: inherit;
}

/* ═══════════════════════════════════════════
   FAB — Teal arc menu (bottom-right)
   ═══════════════════════════════════════════ */
.fab-container{position:fixed;bottom:32px;right:32px;z-index:200;display:flex;align-items:center;justify-content:center}
.fab-main{width:56px;height:56px;border-radius:50%;background:#00796B;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 6px 20px rgba(0,121,107,.4),0 2px 8px rgba(0,0,0,.15);transition:transform .3s var(--ease-out-expo),box-shadow .3s ease,background .3s ease;position:relative;z-index:2;color:#fff}
.fab-main:hover{background:#00897B;box-shadow:0 8px 28px rgba(0,121,107,.5),0 4px 12px rgba(0,0,0,.2);transform:scale(1.06)}
.fab-main:active{transform:scale(.94)}
.fab-main svg{width:24px;height:24px;transition:transform .35s var(--ease-out-expo),opacity .25s ease}
.fab-main .icon-plus{position:absolute}
.fab-main .icon-close{position:absolute;opacity:0;transform:rotate(-90deg) scale(.5)}
.fab-main.open .icon-plus{opacity:0;transform:rotate(90deg) scale(.5)}
.fab-main.open .icon-close{opacity:1;transform:rotate(0deg) scale(1)}
.fab-main.open{background:#00695C}

/* Arc items */
.fab-item{position:absolute;width:44px;height:44px;border-radius:50%;background:#00796B;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;color:#fff;box-shadow:0 4px 14px rgba(0,121,107,.35);transition:all .35s var(--ease-out-expo);opacity:0;transform:translate(0,0) scale(.4);pointer-events:none;text-decoration:none}
.fab-item:hover{background:#00897B;transform:translate(var(--tx),var(--ty)) scale(1.12) !important;box-shadow:0 6px 20px rgba(0,121,107,.5)}
.fab-container.open .fab-item{opacity:1;pointer-events:auto}

/* Arc positions — fan to upper-left (90° spread) */
.fab-container.open .fab-item:nth-child(2){transform:translate(-80px,-100px) scale(1);transition-delay:.03s}
.fab-container.open .fab-item:nth-child(3){transform:translate(-120px,-55px) scale(1);transition-delay:.08s}
.fab-container.open .fab-item:nth-child(4){transform:translate(-120px,0px) scale(1);transition-delay:.13s}
.fab-container.open .fab-item:nth-child(5){transform:translate(-80px,50px) scale(1);transition-delay:.18s}

.fab-item svg{width:20px;height:20px}

/* Mobile: slightly tighter arc */
@media(max-width:640px){
  .fab-container{bottom:80px;right:20px}
  .fab-container.open .fab-item:nth-child(2){transform:translate(-65px,-85px) scale(1)}
  .fab-container.open .fab-item:nth-child(3){transform:translate(-100px,-42px) scale(1)}
  .fab-container.open .fab-item:nth-child(4){transform:translate(-100px,0px) scale(1)}
  .fab-container.open .fab-item:nth-child(5){transform:translate(-65px,42px) scale(1)}
}

/* Backdrop */
.fab-backdrop{position:fixed;inset:0;z-index:199;background:rgba(0,0,0,.25);opacity:0;pointer-events:none;transition:opacity .3s ease}
.fab-backdrop.open{opacity:1;pointer-events:auto}/* ═══════════════════════════════════════════
   Nav polish — desktop only (≥768px)
   ═══════════════════════════════════════════ */
@media (min-width: 768px) {

  /* ── Taller, airier header ── */
  .header-inner {
    height: 4.5rem;
  }

  /* ── Logo: refined ── */
  .logo {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    transition: opacity 0.2s;
  }
  .logo:hover { opacity: 0.8; }

  /* ── Nav links: underline animation ── */
  .header-nav {
    gap: 2rem;
    font-size: 0.9rem;
  }
  .header-nav a {
    position: relative;
    padding: 0.35rem 0;
    font-weight: 480;
  }
  .header-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--color-accent);
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .header-nav a:hover::after,
  .header-nav a.active::after {
    transform: scaleX(1);
  }

  /* Active link: subtle text lift */
  .header-nav a.active {
    font-weight: 600;
    letter-spacing: 0.01em;
  }

  /* ── Standard header: glass + shadow ── */
  .site-header {
    padding: 0 !important;        /* override old padding */
    margin-bottom: 0 !important;  /* override old margin */
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(14px) saturate(1.2);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
    position: sticky;
    top: 0;
    z-index: 40;
  }
  [data-theme="dark"] .site-header {
    background: rgba(15, 23, 42, 0.82);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  }

  /* ── Glass header: bolder on desktop ── */
  .nav-glass-fixed {
    height: 4.5rem;
  }
  .nav-glass-fixed .header-nav a {
    font-weight: 480;
  }

  /* Glass header scrolled: refined shadow */
  .nav-glass-fixed.scrolled {
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  }
  [data-theme="dark"] .nav-glass-fixed.scrolled {
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
  }

  /* Glass header active: white underline */
  .nav-glass-fixed .header-nav a::after {
    background: rgba(255, 255, 255, 0.9);
  }
  .nav-glass-fixed.scrolled .header-nav a::after {
    background: var(--color-accent);
  }

  /* ── Theme toggle: refined ── */
  .theme-toggle-btn {
    width: 38px;
    height: 38px;
    margin-left: 0.25rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .theme-toggle-btn:hover {
    transform: rotate(15deg);
  }

  /* ── Tools dropdown trigger: underline too ── */
  .nav-dropdown-trigger {
    position: relative;
    padding: 0.35rem 0;
  }
  .nav-dropdown-trigger::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--color-accent);
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .nav-dropdown.open .nav-dropdown-trigger::after,
  .nav-dropdown-trigger:hover::after {
    transform: scaleX(1);
  }
  /* Glass header dropdown underline */
  .nav-glass-fixed .nav-dropdown-trigger::after {
    background: rgba(255, 255, 255, 0.9);
  }
  .nav-glass-fixed.scrolled .nav-dropdown-trigger::after {
    background: var(--color-accent);
  }

  /* ── Dropdown menu: refined card ── */
  .nav-dropdown-menu-inner {
    border-radius: 14px;
    padding: 8px;
    min-width: 180px;
  }
  .nav-dropdown-menu-inner a {
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
  }
}
/* ═══════════════════════════════════════════
   V2 Enhancements — Stats · Cards · Footer
   ═══════════════════════════════════════════ */

/* ── Section Bridge: gradient fade between hero and content ── */
.section-bridge {
  position: relative;
  height: 80px;
  margin-top: -1px;
  background: linear-gradient(to bottom, #667eea 0%, #f8fafc 100%);
  pointer-events: none;
  z-index: 0;
}
[data-theme="dark"] .section-bridge {
  background: linear-gradient(to bottom, #1a1040 0%, #0f172a 100%);
}

/* ── Stats Strip v2 ── */
.stats-strip {
  max-width: 960px;
  margin: -20px auto 0;
  padding: 0 var(--space-4);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  position: relative;
  z-index: 2;
}
.stat-card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-4);
  text-align: center;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99,102,241,0.04) 0%, transparent 50%, rgba(139,92,246,0.04) 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.stat-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.25);
}
.stat-card:hover::before { opacity: 1; }
.stat-icon {
  width: 48px; height: 48px;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(139,92,246,0.1));
  display: flex; align-items: center; justify-content: center;
  color: var(--color-accent);
  transition: all 0.3s ease;
}
.stat-card:hover .stat-icon {
  background: linear-gradient(135deg, var(--color-accent), #8b5cf6);
  color: #fff;
  transform: scale(1.1);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}
.stat-num {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
  margin-bottom: var(--space-1);
  transition: color 0.3s ease;
}
.stat-card:hover .stat-num { color: var(--color-accent); }
.stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}
[data-theme="dark"] .stat-card:hover {
  box-shadow: 0 12px 40px rgba(129, 140, 248, 0.15);
  border-color: rgba(129, 140, 248, 0.3);
}

/* ── Article Cards v2 ── */
.card-lift {
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}
.card-lift::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--color-accent), #8b5cf6, var(--color-accent));
  background-size: 200% 200%;
  opacity: 0;
  z-index: -1;
  transition: opacity 0.4s ease;
}
.card-lift:hover::after { opacity: 0.25; }
.card-lift:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 48px rgba(99, 102, 241, 0.1);
}
.card-lift .card-visual {
  font-size: 2rem;
  margin-bottom: var(--space-3);
  transition: transform 0.3s ease;
  display: inline-block;
}
.card-lift:hover .card-visual {
  transform: scale(1.15) rotate(-6deg);
}

/* ── Post card (posts listing) ── */
.post-card {
  overflow: hidden;
}
.post-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-accent), #8b5cf6);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.post-card:hover::before { opacity: 1; }

/* ── Section Headers ── */
.section-header-accent {
  position: relative;
  display: inline-block;
}
.section-header-accent::after {
  content: '';
  position: absolute;
  bottom: -6px; left: 0;
  width: 48px; height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--color-accent), #8b5cf6);
}

/* ── Footer v2 ── */
.site-footer {
  background: var(--color-surface);
  border-top: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--color-accent), #8b5cf6, rgba(99,102,241,0.15)) 1;
  padding: var(--space-12) var(--space-4) var(--space-6);
  margin-top: var(--space-16);
}
.site-footer .footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-8);
}
.site-footer .footer-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.site-footer .footer-brand {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.02em;
}
.site-footer .footer-brand span { font-weight: 300; color: var(--color-text-muted); }
.site-footer .footer-tagline {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: 280px;
  line-height: 1.6;
}
.site-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
}
.site-footer .footer-col { min-width: 100px; }
.site-footer .footer-col h5 {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  font-weight: 600;
}
.site-footer .footer-col a {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  padding: var(--space-1) 0;
  transition: color 0.2s ease, transform 0.2s ease;
}
.site-footer .footer-col a:hover {
  color: var(--color-accent);
  transform: translateX(4px);
}
.site-footer .footer-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  background: var(--color-surface-alt);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
}
.site-footer .status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(1.3); }
}
.site-footer .icp {
  max-width: 960px;
  margin: var(--space-6) auto 0;
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-light);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: center;
}
.site-footer .icp a { color: var(--color-text-muted); }
.site-footer .icp a:hover { color: var(--color-accent); }

[data-theme="dark"] .site-footer {
  border-image: linear-gradient(90deg, var(--color-accent), #a78bfa, rgba(129,140,248,0.1)) 1;
}

/* ── Scroll-to-top ── */
.scroll-top-btn {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-float);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 40;
  color: var(--color-text-muted);
}
.scroll-top-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.scroll-top-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15);
}

/* ── Article page v2 ── */
.article-header {
  position: relative;
  padding-bottom: var(--space-8);
  margin-bottom: var(--space-10);
}
.article-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 64px; height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--color-accent), #8b5cf6);
}
.article-body h2 {
  position: relative;
  padding-left: var(--space-4);
}
.article-body h2::before {
  content: '';
  position: absolute;
  left: 0; top: 0.2em; bottom: 0.2em;
  width: 3px;
  border-radius: 2px;
  background: var(--color-accent);
}

/* ── Fade-up animation ── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.reveal.visible {
  animation: fade-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .stats-strip { grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
  .stat-card { padding: var(--space-6) var(--space-3); }
  .stat-icon { width: 40px; height: 40px; }
  .site-footer .footer-inner { flex-direction: column; gap: var(--space-6); }
  .site-footer .footer-links { gap: var(--space-6); }
  .site-footer .footer-status { align-self: flex-start; }
  .scroll-top-btn { bottom: 80px; }
  .section-bridge { height: 48px; }
}
