/* =========================================================
   Md. Habib Hasan Himel — Portfolio
   Plant Breeding · Sustainable Agriculture
   Elegant · Responsive · Feature-rich
   ========================================================= */

:root {
  --bg: #07120c;
  --bg-elevated: #0c1a12;
  --surface: #12201a;
  --surface-2: #1a2e24;
  --surface-3: #243d30;
  --text: #f0f7f3;
  --text-soft: #d8ebe0;
  --muted: #8fb5a0;
  --muted-2: #6a8f7a;
  --accent: #34d399;
  --accent-light: #6ee7b7;
  --accent-dark: #10b981;
  --accent-glow: rgba(52, 211, 153, 0.16);
  --gold: #f59e0b;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --radius: 12px;
  --radius-sm: 9px;
  --radius-xs: 6px;
  --shadow-sm: 0 1px 6px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 18px -8px rgba(0, 0, 0, 0.16);
  --shadow-lg: 0 10px 28px -10px rgba(0, 0, 0, 0.2);
  --nav-h: 72px;
  --notice-h: 0px;
  --blur: 10px;
  --glass: color-mix(in srgb, var(--surface) 42%, transparent);
  --glass-strong: color-mix(in srgb, var(--bg-elevated) 72%, transparent);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --container: 1180px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Inter", "Noto Sans Bengali", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html:not(.dark) {
  --bg: #f4f9f6;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef6f1;
  --surface-3: #e0ede6;
  --text: #0c1a12;
  --text-soft: #1a2e24;
  --muted: #4a6b58;
  --muted-2: #6a8f7a;
  --accent: #059669;
  --accent-light: #10b981;
  --accent-dark: #047857;
  --accent-glow: rgba(5, 150, 105, 0.12);
  --border: rgba(12, 40, 26, 0.16);
  --border-strong: rgba(12, 40, 26, 0.26);
  --shadow-sm: 0 1px 6px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 18px -8px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 28px -10px rgba(0, 0, 0, 0.06);
  --glass-border: rgba(12, 40, 26, 0.18);
  --glass: color-mix(in srgb, var(--surface) 48%, transparent);
  --glass-strong: color-mix(in srgb, var(--surface) 74%, transparent);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 0 0 1px rgba(12, 26, 18, 0.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--notice-h) + var(--nav-h) + 12px); }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-x: clip;
  min-width: 0;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
::selection { background: rgba(52, 211, 153, 0.28); color: var(--text); }

@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; }
}

/* Scroll progress */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: linear-gradient(90deg, var(--accent-light), var(--accent), var(--accent-dark));
  z-index: 100; pointer-events: none;
}

/* Typography helpers */
.accent-text {
  background: linear-gradient(135deg, var(--accent-light), var(--accent) 50%, var(--accent-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.7rem 1.35rem; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 600; letter-spacing: -0.01em;
  border: none; cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), filter 0.2s, background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-light), var(--accent) 40%, var(--accent-dark));
  color: #04140c;
  box-shadow: 0 4px 16px rgba(52, 211, 153, 0.18);
}
.btn-primary:hover {
  filter: brightness(1.08); transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(52, 211, 153, 0.22);
}
.btn-ghost {
  background: transparent; border: 1px solid var(--border-strong); color: var(--text);
}
.btn-ghost:hover {
  border-color: var(--accent); color: var(--accent); background: var(--accent-glow);
}
.icon-btn {
  width: 42px; height: 42px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s var(--ease); flex-shrink: 0;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.icon-btn svg { width: 18px; height: 18px; }

/* NAV — floating frosted-glass bar */

/* =========================================================
   Site notice bar (rarely used — controlled by data/notice.json)
   ========================================================= */
#site-notice {
  position: fixed; top: 0; left: 0; right: 0; z-index: 55;
  height: var(--notice-h);
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent-dark) 88%, #000);
  color: #ecfdf5;
  font-size: 0.875rem;
  line-height: 1.35;
  padding: 0 2.5rem 0 1rem;
  box-shadow: 0 1px 0 rgba(0,0,0,0.12);
  transform: translateY(-100%);
  transition: transform 0.28s var(--ease);
  overflow: hidden;
}
#site-notice.is-visible { transform: translateY(0); }
#site-notice .notice-inner {
  display: flex; align-items: center; gap: 0.65rem; max-width: var(--container);
  width: 100%; justify-content: center; flex-wrap: wrap;
}
#site-notice .notice-msg { text-align: center; }
#site-notice .notice-link {
  color: #fff; font-weight: 600; text-decoration: underline;
  text-underline-offset: 2px; white-space: nowrap;
}
#site-notice .notice-link:hover { opacity: 0.9; }
#site-notice .notice-close {
  position: absolute; right: 0.65rem; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; color: inherit; cursor: pointer;
  width: 1.75rem; height: 1.75rem; border-radius: 999px;
  display: grid; place-items: center; opacity: 0.75; font-size: 1.1rem; line-height: 1;
}
#site-notice .notice-close:hover { opacity: 1; background: rgba(255,255,255,0.12); }
html.dark #site-notice {
  background: color-mix(in srgb, var(--accent) 22%, var(--bg-elevated));
  color: var(--text-soft);
  border-bottom: 1px solid var(--border);
}
@media (max-width: 640px) {
  #site-notice { font-size: 0.8125rem; padding-right: 2.25rem; }
  #site-notice .notice-inner { gap: 0.4rem; }
}

.nav {
  position: fixed; top: var(--notice-h); left: 0; right: 0; z-index: 50; height: var(--nav-h);
  display: flex; align-items: center; padding: 0 0.75rem; pointer-events: none;
}
.nav-inner {
  pointer-events: auto;
  max-width: var(--container); margin: 0 auto; width: 100%; height: 54px;
  padding: 0 0.65rem 0 0.75rem; border-radius: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--glass); border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--blur)) saturate(1.6); -webkit-backdrop-filter: blur(var(--blur)) saturate(1.6);
  box-shadow: var(--shadow-sm), var(--glass-hi);
  transition: background 0.35s, box-shadow 0.35s, transform 0.35s var(--ease);
}
.nav.scrolled .nav-inner { background: var(--glass-strong); box-shadow: 0 8px 24px -10px rgba(0, 0, 0, 0.18), var(--glass-hi); }
.logo { display: flex; align-items: center; gap: 0.75rem; color: var(--text); flex-shrink: 0; }
.logo-mark {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(145deg, var(--accent-light), var(--accent-dark));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 14px rgba(52, 211, 153, 0.2);
  transition: transform 0.35s var(--ease), box-shadow 0.35s;
}
.logo:hover .logo-mark { transform: rotate(-8deg) scale(1.06); box-shadow: 0 5px 18px rgba(52, 211, 153, 0.28); }
.logo-mark svg { width: 24px; height: 24px; color: #04140c; }
.logo-mark.footer-mark { width: 30px; height: 30px; border-radius: 9px; }
.logo-mark.footer-mark svg { width: 18px; height: 18px; }
.logo-text { display: flex; flex-direction: column; gap: 0.1rem; }
.logo-text strong {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.95rem; font-weight: 650; letter-spacing: -0.025em; line-height: 1.2;
}
.logo-text .name-icon { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; }
.logo-text span { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 500; }

.nav-links {
  display: none; align-items: center; gap: 0.2rem;
  padding: 0.25rem; border-radius: 999px;
  background: color-mix(in srgb, var(--surface-2) 45%, transparent);
  border: 1px solid var(--border);
}
@media (min-width: 1080px) { .nav-links { display: flex; } #mobile-btn { display: none !important; } }
.nav-links a {
  font-size: 0.78rem; font-weight: 550; color: var(--muted);
  padding: 0.5rem 0.8rem; border-radius: 999px;
  transition: color 0.22s, background 0.22s, box-shadow 0.22s;
}
.nav-links a:hover { color: var(--text); background: color-mix(in srgb, var(--surface-2) 80%, transparent); }
.nav-links a.active {
  color: #04140c; background: linear-gradient(135deg, var(--accent-light), var(--accent));
  box-shadow: 0 2px 12px rgba(52, 211, 153, 0.3); font-weight: 600;
}
.nav-actions { display: flex; align-items: center; gap: 0.45rem; }
.nav-links-divider { width: 1px; align-self: stretch; margin: 0.35rem 0.15rem; background: var(--border); }

/* Floating panels: compact menu window + notices popup */
.pop-scrim { position: fixed; inset: 0; z-index: 65; background: transparent; }
.menu-window {
  position: fixed; z-index: 70;
  top: calc(var(--notice-h) + var(--nav-h) - 6px); right: max(0.75rem, env(safe-area-inset-right, 0px));
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--blur)) saturate(1.5); -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5);
  box-shadow: var(--shadow-sm), var(--glass-hi);
  border-radius: 12px; transform-origin: top right;
  opacity: 0; visibility: hidden; transform: translateY(-6px) scale(0.96);
  transition: opacity 0.18s ease, transform 0.22s var(--ease), visibility 0.18s;
}
.menu-window.open { opacity: 1; visibility: visible; transform: none; }
.menu-window {
  width: max-content; min-width: 9.5rem; max-width: min(180px, calc(100vw - 1.75rem));
  padding: 0.3rem;
  max-height: calc(100svh - var(--nav-h) - 1rem); overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 0.02rem;
  border-radius: 12px;
}
.menu-head { display: none; }
.menu-window a {
  display: flex; align-items: center; gap: 0.55rem; padding: 0.4rem 0.55rem; border-radius: 8px;
  color: var(--text); font-size: 0.84rem; font-weight: 500; transition: background 0.15s ease;
  white-space: nowrap;
}
.menu-ic { width: 17px; height: 17px; flex-shrink: 0; color: var(--muted); transition: color 0.15s ease; }
.menu-window a:hover { background: color-mix(in srgb, var(--surface-2) 65%, transparent); }
.menu-window a.active { color: var(--accent); }
.menu-window a.active .menu-ic { color: var(--accent); }
.menu-divider { display: block; height: 1px; margin: 0.5rem 0.6rem; background: var(--border); }
.menu-btn .ic-close { display: none; }
.menu-btn.is-open .ic-close { display: block; }
.menu-btn.is-open .ic-burger { display: none; }
.menu-btn.is-open { color: var(--accent); border-color: var(--accent); background: var(--accent-glow); }


/* HERO */
.hero {
  min-height: 100svh;
  padding: calc(var(--notice-h) + var(--nav-h) + 2.25rem) 1.25rem 3rem;
  display: flex; align-items: center; position: relative; overflow: hidden;
}
.hero-orb { position: absolute; border-radius: 50%; pointer-events: none; z-index: 0; filter: blur(10px); }
.hero-orb-a {
  top: -12%; right: -10%; width: min(52vw, 640px); aspect-ratio: 1;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 68%);
}
.hero-orb-b {
  bottom: -18%; left: -12%; width: min(44vw, 520px); aspect-ratio: 1;
  background: radial-gradient(circle, color-mix(in srgb, var(--gold) 9%, transparent) 0%, transparent 70%);
}
.hero-inner { max-width: var(--container); margin: 0 auto; width: 100%; position: relative; z-index: 1; }
.hero-grid { display: grid; gap: 2.25rem; align-items: center; }
@media (min-width: 960px) {
  .hero-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 3.5rem; }
}
.hero-copy { min-width: 0; }
.nowrap { white-space: nowrap; }
@media (max-width: 420px) { .nowrap { white-space: normal; } }
.hero-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.95rem; border-radius: 999px;
  border: 1px solid rgba(52, 211, 153, 0.3); background: rgba(52, 211, 153, 0.08);
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 1.25rem;
}
.hero-badge .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5);
  animation: pulse-ring 2s ease-out infinite;
}
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}
.hero h1 {
  font-size: clamp(2rem, 4.6vw, 3.55rem); font-weight: 750; line-height: 1.1;
  letter-spacing: -0.035em; margin-bottom: 1.15rem; text-wrap: balance;
}
.hero .lead {
  color: var(--muted); font-size: clamp(0.98rem, 1.5vw, 1.08rem); max-width: 34rem;
  margin-bottom: 1.75rem; line-height: 1.7;
}
.hero-ctas { display: flex; flex-wrap: nowrap; gap: 0.6rem; margin-bottom: 1.75rem; }
.hero-ctas .btn-ghost { opacity: 0.72; }
.hero-ctas .btn-ghost:hover { opacity: 1; }
@media (max-width: 420px) { .hero-ctas .btn { padding: 0.7rem 0.8rem; font-size: 0.82rem; gap: 0.35rem; } }
.hero-meta { margin: 0 0 1.35rem; font-size: 0.85rem; font-weight: 500; color: var(--muted); line-height: 1.5; }
.hero-meta span { margin: 0 0.35rem; color: var(--accent); }
/* Reel + live widget rail */
.hero-media { display: flex; align-items: center; gap: 0.85rem; min-width: 0; }
.hero-media .hero-video-card { flex: 1; min-width: 0; max-width: 400px; margin: 0 auto; }
@media (max-width: 359px) {
  .hero-media { flex-direction: column; }
}
@media (max-width: 959px) {
  .hero-media .hero-video-card,
  .hero-video-card { max-width: 100%; margin: 0; }
}
@media (max-width: 639px) {
  .hero { padding: calc(var(--notice-h) + var(--nav-h) + 0.85rem) 1rem 1.75rem; align-items: flex-start; }
  .hero h1 { font-size: clamp(1.65rem, 7.5vw, 2.1rem); letter-spacing: -0.03em; }
  .hero .lead { font-size: 0.95rem; margin-bottom: 1.25rem; }
  .hero-ctas { margin-bottom: 1.15rem; }
  .hero-ctas .btn { flex: 1 1 auto; justify-content: center; min-height: 44px; }
  .hero-badge { font-size: 0.62rem; padding: 0.35rem 0.75rem; margin-bottom: 0.9rem; }
  .hero-meta { font-size: 0.78rem; margin-bottom: 1rem; }
  .hero-grid { gap: 1.5rem; }
}

/* Hero intro video — video frame + separate caption frame */
.hero-video-card {
  position: relative; border-radius: 0; overflow: visible;
  border: none !important; background: transparent !important;
  box-shadow: none !important; backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  width: 100%; max-width: 400px; margin-left: auto;
  display: flex; flex-direction: column; gap: 0.4rem;
  transition: transform 0.35s var(--ease);
}
.hero-video-card:hover {
  transform: translateY(-2px);
}
.hero-video-header { display: none; }
.hero-video-wrap {
  position: relative; aspect-ratio: 16/9; background: #000;
  border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.25s;
}
.hero-video-card:hover .hero-video-wrap {
  border-color: rgba(52, 211, 153, 0.35);
}
.hero-video-wrap video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.hero-video-footer {
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.hero-video-footer strong { font-size: 0.84rem; display: block; font-weight: 600; }
.hero-video-footer span { font-size: 0.72rem; color: var(--muted); display: block; }

/* About photo — thin ring, tap to expand */
.about-photo-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 0;
}
.avatar-frame {
  width: clamp(150px, 20vw, 196px); aspect-ratio: 1; border-radius: 50%;
  padding: 2px; position: relative; cursor: pointer;
  background: linear-gradient(145deg, var(--accent-light), var(--accent-dark));
  box-shadow: none; border: 0;
  display: block;
}
.avatar-frame img {
  width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; object-position: 50% 22%;
  border-radius: 50%; display: block; border: 2px solid var(--bg); background: #fff;
}
.avatar-frame:hover { opacity: 0.92; }
.avatar-caption { display: none; }

/* Photo lightbox */
.photo-lb {
  position: fixed; inset: 0; z-index: 240;
  background: rgba(0,0,0,0.88); backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem; opacity: 0; visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}
.photo-lb.open { opacity: 1; visibility: visible; }
.photo-lb img {
  max-width: min(420px, 92vw); max-height: 88svh;
  border-radius: 8px; border: 1px solid rgba(255,255,255,0.12);
  object-fit: contain; background: #111;
}
.photo-lb-close {
  position: absolute; top: 1rem; right: 1rem;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2); background: rgba(0,0,0,0.45);
  color: #fff; font-size: 1.4rem; line-height: 1; cursor: pointer;
}

/* Note image lightbox */
.gallery-lb {
  position: fixed; inset: 0; z-index: 240;
  background: rgba(0,0,0,0.92); backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  padding: 1.25rem; opacity: 0; visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
  touch-action: pan-y;
}
.gallery-lb.open { opacity: 1; visibility: visible; }
.gallery-lb img { max-width: min(900px, 92vw); max-height: 86svh; border-radius: 8px; object-fit: contain; background: #111; }
.gallery-lb-close, .gallery-lb-nav {
  position: absolute; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2); background: rgba(0,0,0,0.45);
  color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.gallery-lb-close { top: 1rem; right: 1rem; font-size: 1.4rem; line-height: 1; }
.gallery-lb-nav { top: 50%; transform: translateY(-50%); }
.gallery-lb-prev { left: 0.75rem; }
.gallery-lb-next { right: 0.75rem; }
.gallery-lb-nav:hover, .gallery-lb-close:hover { background: rgba(0,0,0,0.7); }
.gallery-lb-count {
  position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%);
  font-size: 0.78rem; font-weight: 600; color: #fff; background: rgba(0,0,0,0.5);
  padding: 0.25rem 0.7rem; border-radius: 999px;
}
@media (max-width: 639px) {
  .gallery-lb-prev { left: 0.35rem; } .gallery-lb-next { right: 0.35rem; }
}

/* Reader cover / gallery — tappable for the lightbox */
.reader-cover img { cursor: zoom-in; }

.reader-location { font-size: 0.85rem; color: var(--muted); margin: -0.5rem 0 1rem; }

.blog-count { font-size: 0.8rem; font-weight: 600; color: var(--accent); margin: 0.5rem 0 0; }
.about-bio-block h3 {
  font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 0.35rem;
}
.about-bio-block .role {
  color: var(--accent); font-size: 0.9rem; font-weight: 550; margin-bottom: 1.15rem;
}
.about-bio-block p {
  color: var(--muted); font-size: 0.95rem; line-height: 1.7; margin-bottom: 0.9rem;
}
.about-actions {
  display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 1.5rem;
}
.bio-grid {
  display: grid; gap: 2.5rem; align-items: center; margin-top: 2.5rem;
}
@media (min-width: 900px) {
  .bio-grid { grid-template-columns: 260px minmax(0, 1fr); gap: 3.5rem; align-items: start; }
  .about-photo-wrap { position: sticky; top: calc(var(--notice-h) + var(--nav-h) + 1rem); }
}
@media (max-width: 899px) {
  /* Photo and name stack in one column here — center the name/role under the photo, keep the paragraphs left-aligned for readability */
  .about-bio-block h3, .about-bio-block .role { text-align: center; }
}

/* Skill marquee */
.skill-bar {
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  padding: 0.95rem 0; overflow: hidden;
}
.skill-track { display: flex; width: max-content; animation: marquee 32s linear infinite; }
.skill-track:hover { animation-play-state: paused; }
.skill-item {
  display: flex; align-items: center; gap: 0.5rem; padding: 0 1.75rem;
  font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); font-weight: 500; white-space: nowrap;
}
.skill-item::after { content: "·"; margin-left: 1.75rem; opacity: 0.4; }
@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Sections — match content width, tighter vertical rhythm */
section { padding: 4.5rem 1.25rem; }
.section-inner { max-width: var(--container); margin: 0 auto; width: 100%; }
.section-label {
  font-size: 0.7rem; font-weight: 650; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 0.7rem;
}
.section-title {
  font-size: clamp(1.7rem, 3.4vw, 2.45rem); font-weight: 700;
  letter-spacing: -0.025em; line-height: 1.18; margin-bottom: 0.9rem;
}
.section-desc { color: var(--muted); max-width: 36rem; font-size: 1.02rem; }

/* About / Research */
.about-grid {
  display: grid; gap: 2.75rem; align-items: start;
}
@media (min-width: 1024px) {
  .about-grid { grid-template-columns: 1fr 1fr; gap: 3.5rem; }
}
.about-card {
  padding: 1.25rem 1.3rem; border-radius: var(--radius); border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: none;
}
.about-card h3 { font-size: 1.05rem; font-weight: 650; margin-bottom: 0.75rem; }
.about-card p { color: var(--muted); font-size: 0.9rem; line-height: 1.65; margin-bottom: 0.75rem; }
.about-card p:last-child { margin-bottom: 0; }

.stats {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin-top: 1.5rem;
}
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  padding: 1.1rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  text-align: center; transition: border-color 0.25s, transform 0.25s;
}
.stat:hover { border-color: rgba(52, 211, 153, 0.35); transform: translateY(-2px); }
.stat strong {
  display: block; font-size: 1.5rem; color: var(--accent); font-weight: 750;
  letter-spacing: -0.02em; line-height: 1.15;
}
.stat span { font-size: 0.72rem; color: var(--muted); font-weight: 500; }

/* Education timeline */
.edu-list { display: flex; flex-direction: column; gap: 0; margin-top: 0.5rem; }
.edu-item {
  display: grid; gap: 0.25rem; padding: 1rem 1.15rem;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  transition: border-color 0.25s, transform 0.25s;
}
.edu-item:hover { border-color: rgba(52, 211, 153, 0.3); transform: translateX(3px); }
.edu-item .degree { font-weight: 650; font-size: 0.98rem; }
.edu-item .school { color: var(--accent); font-size: 0.84rem; font-weight: 500; }
.edu-item .meta { color: var(--muted); font-size: 0.78rem; }
/* Flattened: no nested boxes inside About Education card */
.edu-item.plain {
  padding: 0.85rem 0 !important;
  border: none !important;
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  border-top: 1px solid var(--border) !important;
}
.edu-item.plain:first-child { border-top: none !important; padding-top: 0 !important; }
.edu-item.plain:last-child { padding-bottom: 0 !important; }
.edu-item.plain:hover { transform: none !important; border-color: transparent !important; }
.edu-item.plain:hover .degree { color: var(--accent); }

/* Experience */
.exp-list { display: flex; flex-direction: column; gap: 1.1rem; margin-top: 2.25rem; }
.exp-card {
  padding: 1.3rem 1.35rem; border-radius: var(--radius); border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 52%, transparent);
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
  transition: all 0.3s var(--ease);
}
.exp-card:hover {
  border-color: rgba(52, 211, 153, 0.3); transform: translateY(-3px); box-shadow: var(--shadow-sm);
}
.exp-header {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.5rem; margin-bottom: 0.75rem;
}
.exp-header h3 { font-size: 1.05rem; font-weight: 650; }
.exp-header .role { color: var(--accent); font-size: 0.85rem; font-weight: 500; }
.exp-header .period { color: var(--muted); font-size: 0.8rem; }
.exp-card ul { list-style: none; padding: 0; }
.exp-card li {
  position: relative; padding-left: 1.1rem; color: var(--muted); font-size: 0.9rem;
  line-height: 1.6; margin-bottom: 0.4rem;
}
.exp-card li::before {
  content: ""; position: absolute; left: 0; top: 0.55em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}

/* Skills */
.skills-grid {
  display: grid; gap: 1rem; margin-top: 2.25rem;
}
@media (min-width: 640px) { .skills-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .skills-grid { grid-template-columns: repeat(3, 1fr); } }
.skill-card {
  padding: 1.25rem; border-radius: var(--radius); border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 52%, transparent);
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
  transition: all 0.3s var(--ease);
}
.skill-card:hover {
  border-color: rgba(52, 211, 153, 0.35); transform: translateY(-3px);
  background: color-mix(in srgb, var(--surface) 68%, transparent); box-shadow: var(--shadow-sm);
}
.skill-card h3 {
  font-size: 0.95rem; font-weight: 650; margin-bottom: 0.75rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.skill-card h3 svg { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }
.skill-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.skill-tag {
  padding: 0.3rem 0.7rem; border-radius: 999px; font-size: 0.72rem; font-weight: 500;
  background: var(--accent-glow); color: var(--accent); border: 1px solid rgba(52, 211, 153, 0.2);
}

/* Gallery */
.gallery-grid {
  display: grid; gap: 1rem; margin-top: 2.25rem;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 768px) { .gallery-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .gallery-grid { grid-template-columns: repeat(4, 1fr); } }
.gallery-item {
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; aspect-ratio: 1;
  transition: transform 0.4s var(--ease), box-shadow 0.4s;
  position: relative;
}
.gallery-item:hover {
  transform: translateY(-5px); box-shadow: var(--shadow-md);
}
.gallery-item img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.7s var(--ease);
}
.gallery-item:hover img { transform: scale(1.06); }
.gallery-item .caption {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 2.25rem 0.9rem 0.75rem;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.5) 55%, transparent 100%);
  color: #fff; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.01em;
  line-height: 1.3; text-shadow: 0 1px 6px rgba(0,0,0,0.5);
  pointer-events: none;
}
@media (max-width: 639px) {
  .gallery-grid { gap: 0.65rem; }
  .gallery-item .caption { font-size: 0.72rem; padding: 1.75rem 0.65rem 0.55rem; }
}

/* Publications & Projects */
.pub-list { display: flex; flex-direction: column; gap: 1rem; margin-top: 2rem; }
.pub-card {
  padding: 1.25rem 1.35rem; border-radius: var(--radius); border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 52%, transparent);
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
  transition: all 0.3s var(--ease);
}
.pub-card:hover {
  border-color: rgba(52, 211, 153, 0.3); transform: translateY(-2px); box-shadow: var(--shadow-sm);
}
.pub-card .type {
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 0.4rem;
}
.pub-card h3 { font-size: 1rem; font-weight: 650; margin-bottom: 0.5rem; line-height: 1.4; }
.pub-card p { color: var(--muted); font-size: 0.85rem; line-height: 1.55; margin-bottom: 0.6rem; }
.pub-card a {
  font-size: 0.8rem; font-weight: 600; color: var(--accent);
  display: inline-flex; align-items: center; gap: 0.3rem;
}
.pub-card a:hover { color: var(--accent-light); }

/* Certifications & Recognition */
.cert-grid {
  display: grid; gap: 0.75rem; margin-top: 2rem;
}
@media (min-width: 640px) { .cert-grid { grid-template-columns: repeat(2, 1fr); } }
.cert-item {
  display: flex; align-items: flex-start; gap: 0.85rem;
  padding: 0.95rem 1.1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 52%, transparent);
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
  transition: border-color 0.25s;
  width: 100%;
}
.cert-item:hover { border-color: rgba(52, 211, 153, 0.3); }
.cert-item .icon {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
  background: var(--accent-glow); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.cert-item .icon svg { width: 18px; height: 18px; }
.cert-item strong { display: block; font-size: 0.88rem; font-weight: 600; margin-bottom: 0.15rem; }
.cert-item span { font-size: 0.78rem; color: var(--muted); }
/* Awards / recognition share the same grid so width matches other cards */
.recognition-grid {
  display: grid; gap: 0.75rem; margin-top: 1.25rem;
}
@media (min-width: 640px) { .recognition-grid { grid-template-columns: repeat(2, 1fr); } }

/* Contact — form first, channels + map below */
.contact-section {
  background: color-mix(in srgb, var(--surface) 40%, transparent);
  border-top: 1px solid var(--border);
}
.contact-grid {
  display: grid;
  gap: 2rem;
  max-width: 980px;
  margin: 0 auto;
  align-items: start;
}
@media (min-width: 860px) {
  .contact-grid { grid-template-columns: 1.05fr 0.95fr; gap: 2.5rem 2.75rem; }
}
.contact-col { min-width: 0; display: flex; flex-direction: column; gap: 0.85rem; }
.contact-col-form { gap: 1rem; }
.contact-direct { display: flex; flex-direction: column; gap: 0.85rem; }
.contact-divider {
  display: flex; align-items: center; gap: 0.75rem;
  margin: 0.15rem 0 0; color: var(--muted); font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.contact-divider::before,
.contact-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.contact-divider span { flex-shrink: 0; }
.contact-place {
  margin: 0; font-size: 0.95rem; line-height: 1.55; color: var(--muted);
}
.contact-place strong { color: var(--text); font-weight: 650; }
.map-open {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.84rem; font-weight: 600; color: var(--accent);
  text-decoration: none; margin-top: 0.15rem;
}
.map-open:hover { text-decoration: underline; }
.botcheck {
  position: absolute; left: -9999px; opacity: 0; height: 0; width: 0;
}
.form-group-msg { margin-bottom: 0.85rem; }
.contact-links { display: flex; flex-direction: column; gap: 0.7rem; }
.contact-link {
  display: flex; align-items: center; gap: 1rem; padding: 1rem 1.1rem;
  border-radius: var(--radius-sm); border: 1px solid var(--border); color: var(--text);
  transition: all 0.25s var(--ease);
}
.contact-link:hover {
  border-color: rgba(52, 211, 153, 0.35);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  transform: translateX(4px);
}
.contact-link .icon {
  width: 44px; height: 44px; border-radius: 11px;
  background: rgba(52, 211, 153, 0.1); color: var(--accent);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.contact-link .icon svg { width: 20px; height: 20px; }
.contact-link strong { display: block; font-size: 0.9rem; font-weight: 600; }
.contact-link span { font-size: 0.8rem; color: var(--muted); }

.contact-form {
  padding: 1.1rem 1.15rem; border-radius: var(--radius); border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 50%, transparent);
}
.contact-form .btn-primary { opacity: 0.95; }
.contact-form .btn-primary:hover { opacity: 1; }
.contact-status {
  margin-top: 0.85rem; font-size: 0.88rem; color: var(--muted); line-height: 1.45;
}
.contact-status.is-ok { color: var(--accent); }
.contact-status.is-err { color: #f87171; }
.form-row { display: grid; gap: 0.7rem; margin-bottom: 0.7rem; }
@media (min-width: 640px) { .form-row { grid-template-columns: 1fr 1fr; } }
.form-group label {
  display: block; font-size: 0.75rem; font-weight: 550; color: var(--muted); margin-bottom: 0.3rem;
}
.form-group input, .form-group textarea {
  width: 100%; padding: 0.6rem 0.85rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font-size: 0.9rem; font-family: inherit; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus, .form-group textarea:focus {
  border-color: rgba(52, 211, 153, 0.5); box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-group textarea { resize: vertical; min-height: 84px; }
.form-note { font-size: 0.75rem; color: var(--muted); margin-top: 0.85rem; }
.form-note a { color: var(--accent); font-weight: 500; }
.form-note a:hover { text-decoration: underline; }

/* Footer — copyright only */
.footer { border-top: 1px solid var(--border); padding: 1.5rem 1.25rem; }
.footer-inner {
  max-width: var(--container); margin: 0 auto;
  text-align: center;
  font-size: 0.78rem; color: var(--muted);
}
.footer-links { display: none; }

/* Back to top — bottom-right corner, compact */
.back-top {
  position: fixed;
  bottom: calc(1.1rem + env(safe-area-inset-bottom, 0px));
  right: max(1rem, env(safe-area-inset-right, 0px));
  width: 38px; height: 38px;
  border-radius: 50%; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: var(--muted); display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: all 0.3s var(--ease); z-index: 40; box-shadow: var(--shadow-sm);
}
.back-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-top:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-glow); }
.back-top svg { width: 15px; height: 15px; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,0.88);
  backdrop-filter: blur(12px); display: flex; align-items: center; justify-content: center;
  padding: 1.5rem; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s;
}
.lightbox.open { opacity: 1; visibility: visible; }
.lightbox-content {
  max-width: 900px; width: 100%; background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden auto; max-height: 94svh;
  transform: scale(0.94) translateY(12px); transition: transform 0.35s var(--ease);
  box-shadow: var(--shadow-lg);
}
.lightbox.open .lightbox-content { transform: scale(1) translateY(0); }
.lightbox-img { width: 100%; max-height: 62svh; object-fit: contain; background: #000; }
.lightbox-body { padding: 1.15rem 1.4rem 1.4rem; }
.lightbox-body h3 { font-size: 1.1rem; font-weight: 650; margin-bottom: 0.3rem; }
.lightbox-body p { color: var(--muted); font-size: 0.88rem; }
.lightbox-close {
  position: absolute; top: 1.25rem; right: 1.25rem; width: 44px; height: 44px;
  border-radius: 50%; border: 1px solid rgba(255,255,255,0.15); background: rgba(0,0,0,0.5);
  color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.2s, transform 0.2s; z-index: 5;
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); transform: scale(1.05); }

.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.18); background: rgba(0,0,0,0.55);
  color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 5;
  transition: background 0.2s, transform 0.2s, border-color 0.2s;
  backdrop-filter: blur(8px);
}
.lightbox-nav:hover {
  background: rgba(52, 211, 153, 0.35); border-color: rgba(52, 211, 153, 0.5);
  transform: translateY(-50%) scale(1.08);
}
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
@media (max-width: 639px) {
  .lightbox-nav { width: 40px; height: 40px; }
  .lightbox-prev { left: 0.5rem; }
  .lightbox-next { right: 0.5rem; }
}
.lightbox-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.35rem;
}
.lightbox-counter {
  font-size: 0.72rem; font-weight: 550; letter-spacing: 0.06em;
  color: var(--muted); text-transform: uppercase;
}

/* Reveal */
/* Hidden only when JS is running (html.js), so content never stays invisible if a script fails */
.js .reveal {
  opacity: 0; transform: translateY(28px);
  transition: opacity 0.75s var(--ease), transform 0.75s var(--ease);
}
.js .reveal.visible, .reveal.visible { opacity: 1; transform: translateY(0); }

.hidden-sm { display: none; }
@media (min-width: 640px) { .hidden-sm { display: inline-flex; } }
.hidden-lg { display: none; }
@media (min-width: 640px) and (max-width: 1079px) { .hidden-lg { display: inline-flex; } }
@media (min-width: 1280px) { .hidden-lg { display: inline-flex; } }
@media (min-width: 1600px) { :root { --container: 1320px; } }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:focus:not(:focus-visible), a:focus:not(:focus-visible) { outline: none; }

/* —— Responsive: best fit any device —— */
@media (max-width: 1079px) {
  .nav { padding: 0 0.55rem; height: auto; min-height: var(--nav-h); padding-top: env(safe-area-inset-top, 0px); }
  .nav-inner { height: 50px; }
}
@media (max-width: 639px) {
  section { padding: 3.25rem 1rem; }
  .section-title { font-size: clamp(1.45rem, 6.5vw, 1.85rem); margin-bottom: 0.7rem; }
  .section-desc { font-size: 0.95rem; }
  .nav-inner { padding: 0 0.65rem; gap: 0.4rem; border-radius: 10px; }
  .logo-mark { width: 36px; height: 36px; border-radius: 10px; }
  .logo-mark svg { width: 20px; height: 20px; }
  .logo-text strong { font-size: 0.84rem; }
  .icon-btn { width: 40px; height: 40px; min-width: 40px; min-height: 40px; }
  .section-title br { display: none; }
  .bio-grid { gap: 1.5rem; margin-top: 1.75rem; }
  .about-grid { gap: 1.25rem; margin-top: 1.75rem !important; }
  .about-card, .exp-card, .skill-card, .pub-card, .contact-form { padding: 1.1rem 1rem; }
  .exp-header { gap: 0.35rem; }
  .exp-header h3 { font-size: 0.98rem; }
  .skills-grid, .cert-grid, .recognition-grid { gap: 0.65rem; }
  .skill-tag { font-size: 0.68rem; padding: 0.28rem 0.6rem; }
  .contact-grid { gap: 1.75rem; }
  .social-icons { gap: 0.5rem; }
  .social-icon { width: 46px; height: 46px; border-radius: 12px; }
  .map-embed { aspect-ratio: 16/11; }
  .form-group input, .form-group textarea { font-size: 16px; /* prevents iOS zoom */ }
  .btn { min-height: 44px; }
  .back-top {
    width: 40px; height: 40px;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    right: max(0.85rem, env(safe-area-inset-right, 0px));
  }
  .menu-window {
    top: calc(var(--nav-h) - 4px + env(safe-area-inset-top, 0px));
    right: max(0.55rem, env(safe-area-inset-right, 0px));
  }
  .menu-window a { min-height: 42px; padding: 0.55rem 0.65rem; }
  .blog-featured { grid-template-columns: 1fr; }
  .footer { padding: 1.25rem 1rem calc(1.25rem + env(safe-area-inset-bottom, 0px)); }
  .footer-inner { font-size: 0.72rem; line-height: 1.5; }
}
@media (max-width: 359px) {
  .logo-text span { display: none; }
  .logo-text strong { font-size: 0.78rem; }
  section { padding: 2.75rem 0.85rem; }
  .hero { padding-left: 0.85rem; padding-right: 0.85rem; }
  .social-icon { width: 44px; height: 44px; }
}
/* Tablets */
@media (min-width: 640px) and (max-width: 959px) {
  section { padding: 4rem 1.5rem; }
  .hero { padding-left: 1.5rem; padding-right: 1.5rem; }
  .hero-video-card { max-width: 440px; }
}
/* Large phones landscape / small tablets */
@media (max-height: 500px) and (orientation: landscape) {
  .hero { min-height: auto; padding-top: calc(var(--nav-h) + 0.75rem); padding-bottom: 1.5rem; }
  .hero-grid { gap: 1.25rem; }
}
/* Prevent horizontal overflow from long words / URLs */
.about-bio-block p, .pub-card p, .exp-card li, .section-desc, .lead {
  overflow-wrap: anywhere; word-break: break-word;
}


/* ========== Blog ========== */
.blog-filters {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
}
.blog-filter {
  padding: 0.4rem 0.95rem; border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent; color: var(--muted);
  font-size: 0.8rem; font-weight: 550; cursor: pointer;
  transition: all 0.2s var(--ease); font-family: inherit;
}
.blog-filter:hover { color: var(--text); border-color: var(--accent); }
.blog-filter.active {
  background: var(--accent); color: #062018; border-color: var(--accent);
}

.blog-featured {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 0;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 1.75rem;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.blog-featured:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  box-shadow: var(--shadow-md);
}
.blog-featured-media {
  position: relative; min-height: 280px; overflow: hidden;
}
.blog-featured-media img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.5s var(--ease);
}
.blog-featured:hover .blog-featured-media img { transform: scale(1.04); }
.blog-tag {
  position: absolute; top: 1rem; left: 1rem;
  padding: 0.28rem 0.7rem; border-radius: 999px;
  background: rgba(6, 32, 24, 0.75); color: var(--accent-light);
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; backdrop-filter: blur(8px);
  border: 1px solid rgba(52, 211, 153, 0.25);
}
html:not(.dark) .blog-tag {
  background: rgba(255,255,255,0.9); color: var(--accent-dark);
  border-color: rgba(5, 150, 105, 0.25);
}
.blog-featured-body {
  padding: 1.75rem 1.85rem; display: flex; flex-direction: column; justify-content: center;
}
.blog-meta {
  display: flex; align-items: center; gap: 0.45rem;
  font-size: 0.78rem; color: var(--muted); margin-bottom: 0.65rem;
}
.blog-featured-body h3 {
  font-size: clamp(1.2rem, 2.2vw, 1.45rem); font-weight: 650;
  line-height: 1.3; margin-bottom: 0.65rem; letter-spacing: -0.02em;
}
.blog-featured-body p {
  color: var(--muted); font-size: 0.92rem; line-height: 1.6; margin-bottom: 1.15rem;
}
.blog-read-btn {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 0.4rem;
  background: none; border: none; padding: 0;
  color: var(--accent); font-weight: 600; font-size: 0.9rem;
  cursor: pointer; font-family: inherit;
  transition: gap 0.2s, color 0.2s;
}
.blog-read-btn:hover { gap: 0.65rem; color: var(--accent-light); }

.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.blog-card {
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); background: var(--surface);
  display: flex; flex-direction: column;
  transition: border-color 0.25s, transform 0.25s var(--ease), box-shadow 0.25s;
}
.blog-card:hover {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.blog-card-media {
  position: relative; aspect-ratio: 16/10; overflow: hidden;
}
.blog-card-media img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.45s var(--ease);
}
.blog-card:hover .blog-card-media img { transform: scale(1.05); }
.blog-card-body {
  padding: 1.15rem 1.25rem 1.35rem; flex: 1; display: flex; flex-direction: column;
}
.blog-card-body h3 {
  font-size: 1.02rem; font-weight: 650; line-height: 1.35;
  margin-bottom: 0.45rem; letter-spacing: -0.015em;
}
.blog-card-body p {
  color: var(--muted); font-size: 0.85rem; line-height: 1.55;
  margin-bottom: 0.9rem; flex: 1;
}
.blog-card .blog-read-btn { font-size: 0.82rem; margin-top: auto; }
.blog-card.is-hidden, .blog-featured.is-hidden { display: none; }
@media (max-width: 959px) {
  .blog-featured { grid-template-columns: 1fr; }
  .blog-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
}
@media (max-width: 639px) {
  .blog-featured { grid-template-columns: 1fr; margin-bottom: 1.25rem; }
  .blog-featured-body { padding: 1.15rem 1.1rem; }
  .blog-grid { grid-template-columns: 1fr; gap: 0.85rem; }
  .blog-filters { width: 100%; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 0.15rem; }
  .blog-filter { flex-shrink: 0; }
}
.blog-empty {
  text-align: center; color: var(--muted); padding: 2rem 1rem; font-size: 0.95rem;
}

@media (max-width: 1023px) {
  .blog-featured { grid-template-columns: 1fr; }
  .blog-featured-media { min-height: 200px; max-height: 260px; }
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 639px) {
  .blog-grid { grid-template-columns: 1fr; }
  .blog-featured-body { padding: 1.25rem 1.2rem 1.5rem; }
}

/* Blog reader (full article) */
.blog-reader {
  position: fixed; inset: 0; z-index: 45; /* below .nav (50) so the navbar stays visible */
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}
.blog-reader.open { opacity: 1; visibility: visible; }
.blog-reader-inner {
  max-width: 720px; margin: 0 auto; padding: 5rem 1.25rem 4rem;
}
.blog-reader-close {
  display: inline-flex; align-items: center; justify-content: center; gap: 0;
  width: 2.5rem; height: 2.5rem; padding: 0;
  background: var(--surface); border: 1px solid var(--border-strong);
  color: var(--text); border-radius: 50%;
  font-size: 0.82rem; font-weight: 550; cursor: pointer;
  margin-bottom: 1.75rem; font-family: inherit;
  transition: border-color 0.2s, background 0.2s;
  flex-shrink: 0; white-space: nowrap;
}
.blog-reader-close:hover { border-color: var(--accent); background: var(--surface-2); }
.blog-reader-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; margin-bottom: 1.25rem; flex-wrap: nowrap;
}
.blog-reader-toolbar .blog-reader-close { margin-bottom: 0; }
.reader-share-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.45rem 0.85rem; font-size: 0.82rem; border-radius: 999px;
  flex-shrink: 0; white-space: nowrap;
}
.reader-share-toast {
  position: fixed; left: 50%; bottom: 2rem; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 0.55rem 1.1rem;
  border-radius: 999px; font-size: 0.82rem; font-weight: 600;
  z-index: 260; box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  animation: reader-toast-in 0.2s ease-out;
}
@keyframes reader-toast-in { from { opacity: 0; transform: translateX(-50%) translateY(6px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.blog-reader-content h1 {
  font-size: clamp(1.55rem, 4vw, 2.1rem); font-weight: 700;
  line-height: 1.25; letter-spacing: -0.03em; margin: 0.5rem 0 1.25rem;
}
.reader-cover {
  position: relative;
  border-radius: var(--radius-sm); overflow: hidden;
  margin-bottom: 1.75rem; border: 1px solid var(--border);
  aspect-ratio: 16/9;
}
.reader-cover.has-album {
  margin-bottom: 0.55rem;
}
.reader-cover img { width: 100%; height: 100%; object-fit: cover; }
.reader-video {
  border-radius: var(--radius-sm); overflow: hidden;
  margin-bottom: 1.75rem; border: 1px solid var(--border);
  aspect-ratio: 16/9; background: #000;
}
.reader-video:not([hidden]) + .reader-gallery:not([hidden]) {
  /* video sits above strip; tighten gap handled by gallery margin */
}
.reader-video video { width: 100%; height: 100%; object-fit: contain; display: block; }
/* Album strip under cover — horizontal thumbs like project detail UIs */
.reader-gallery {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  margin: 0 0 1.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 0.15rem;
}
.reader-gallery:not([hidden]) + .reader-body {
  margin-top: 0.25rem;
}
.reader-gallery-item {
  flex: 0 0 auto;
  width: 4.75rem;
  height: 3.35rem;
  border: 2px solid transparent;
  padding: 0;
  background: none;
  cursor: zoom-in;
  border-radius: 8px;
  overflow: hidden;
  display: block;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.reader-gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  border: none;
  aspect-ratio: auto;
}
.reader-gallery-item.is-active {
  border-color: var(--accent, #f59e0b);
  box-shadow: 0 0 0 1px var(--accent, #f59e0b);
}
.reader-gallery-item:hover {
  border-color: color-mix(in srgb, var(--accent, #f59e0b) 55%, transparent);
}
.reader-gallery-caption {
  display: none; /* captions stay in lightbox only when thumbs are compact */
}
.reader-body {
  font-size: 1.02rem; line-height: 1.75; color: var(--text-soft);
}
.reader-body p { margin-bottom: 1.15rem; }
.reader-body h2 {
  font-size: 1.2rem; font-weight: 650; margin: 1.75rem 0 0.75rem;
  letter-spacing: -0.02em; color: var(--text);
}
.reader-body ul { margin: 0 0 1.15rem 1.25rem; }
.reader-body li { margin-bottom: 0.4rem; }


/* ========== Social icon contacts ========== */
.contact-side-label {
  font-size: 0.72rem; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.08em; margin: 0;
}
.social-icons { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.55rem; }
.social-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  box-shadow: var(--glass-hi);
  color: var(--text);
  opacity: 1;
  transition: transform 0.2s, border-color 0.2s, background 0.2s, color 0.2s;
}
.social-icon svg { width: 20px; height: 20px; }
.social-icon:hover {
  transform: translateY(-2px);
  border-color: rgba(52, 211, 153, 0.4);
  background: var(--glass-strong);
  color: var(--accent);
}
.contact-hint { font-size: 0.75rem; color: var(--muted); margin: 0; line-height: 1.45; }
.contact-inst { font-size: 0.82rem; color: var(--text-soft); margin: -0.15rem 0 0.65rem; }
.contact-inst a { color: var(--accent); font-weight: 600; }
.contact-inst a:hover { text-decoration: underline; }

/* ========== Comments ========== */
.reader-pager {
  margin: 2rem 0; padding-top: 1.75rem; border-top: 1px solid var(--border);
}

/* Album-style other notes: ‹  [4 cards]  › */
.reader-album { display: flex; flex-direction: column; gap: 0.65rem; min-width: 0; }
.reader-album-label {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted);
}
.reader-album-row {
  display: flex; align-items: center; gap: 0.5rem; min-width: 0;
}
.reader-album-arrow {
  flex: 0 0 auto;
  width: 2.5rem; height: 2.5rem; border-radius: 999px;
  border: 1px solid var(--glass-border); background: var(--glass);
  color: var(--text); cursor: pointer;
  font-size: 1.55rem; line-height: 1; font-weight: 400;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit;
  transition: border-color 0.2s, background 0.2s, color 0.2s, opacity 0.2s;
}
.reader-album-arrow:hover:not(:disabled):not(.is-disabled) {
  border-color: var(--accent); color: var(--accent); background: var(--glass-strong);
}
.reader-album-arrow:disabled,
.reader-album-arrow.is-disabled {
  opacity: 0.28; cursor: default;
}
.reader-related-track {
  flex: 1 1 auto; min-width: 0;
  display: flex; gap: 0.55rem; padding: 4px;
  overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.reader-related-track::-webkit-scrollbar { display: none; }
.reader-related-card {
  flex: 0 0 calc((100% - 3 * 0.55rem) / 4); scroll-snap-align: start;
  display: flex; flex-direction: column; gap: 0.4rem; min-width: 0;
  border-radius: var(--radius-sm); border: 1px solid var(--glass-border);
  background: var(--glass); overflow: hidden; cursor: pointer;
  text-decoration: none; color: inherit;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.reader-related-card:hover {
  border-color: var(--accent); background: var(--glass-strong);
  transform: translateY(-2px);
}
.reader-related-card.is-active {
  border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent);
}
.reader-related-thumb {
  width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block;
  background: var(--surface-2);
}
.reader-related-thumb-empty {
  background: linear-gradient(135deg, var(--surface-2), var(--glass));
  display: block; width: 100%; aspect-ratio: 16 / 10;
}
.reader-related-meta {
  display: flex; flex-direction: column; gap: 0.15rem;
  padding: 0 0.45rem 0.5rem; min-width: 0;
}
.reader-related-tag {
  font-size: 0.6rem; font-weight: 650; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--accent);
}
.reader-related-title {
  font-size: 0.72rem; font-weight: 600; color: var(--text); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (max-width: 640px) {
  .reader-related-card { flex-basis: calc((100% - 0.55rem) / 2); }
  .reader-album-arrow { width: 2.15rem; height: 2.15rem; font-size: 1.35rem; }
}
@media (max-width: 380px) {
  .reader-related-track { gap: 0.4rem; }
  .reader-related-card { flex-basis: calc((100% - 0.4rem) / 2); }
}

/* Cover album badge + tappable body images */
.reader-cover { position: relative; }
.reader-album-badge {
  position: absolute; right: 0.65rem; bottom: 0.65rem; z-index: 2;
  border: 0; cursor: pointer; font: inherit;
  font-size: 0.72rem; font-weight: 650;
  padding: 0.35rem 0.7rem; border-radius: 999px;
  background: rgba(0, 0, 0, 0.62); color: #fff;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: background 0.2s;
}
.reader-album-badge:hover { background: rgba(0, 0, 0, 0.78); }
.reader-body img,
.reader-body-img {
  cursor: zoom-in; border-radius: 10px; max-width: 100%; height: auto;
}
.comments-block {
  margin-top: 2.5rem; padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}
.comments-title { font-size: 1.15rem; font-weight: 650; margin-bottom: 0.5rem; }
.comments-note { font-size: 0.8rem; color: var(--muted); margin-bottom: 1.25rem; line-height: 1.5; }
.comment-form-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.comments-list { display: flex; flex-direction: column; gap: 1rem; }
.comment-item {
  padding: 0.9rem 1rem; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
}
.comment-item.is-reply { margin-left: 1.25rem; border-left: 2px solid var(--accent); }
.comment-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; margin-bottom: 0.35rem; flex-wrap: wrap;
}
.comment-author { font-weight: 650; font-size: 0.9rem; }
.comment-time { font-size: 0.72rem; color: var(--muted); }
.comment-text { font-size: 0.9rem; line-height: 1.55; color: var(--text-soft); margin: 0 0 0.5rem; }
.comment-reply-btn {
  background: none; border: none; color: var(--accent); font-size: 0.78rem;
  font-weight: 600; cursor: pointer; padding: 0; font-family: inherit;
}
.comment-reply-btn:hover { text-decoration: underline; }


/* Map */
.map-embed {
  margin-top: 0; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border); aspect-ratio: 16/10; width: 100%;
  background: var(--surface);
}
.map-embed iframe { width: 100%; height: 100%; border: 0; display: block; }
.map-link { display: none; }

/* ---------- Site-wide frosted glass ---------- */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vw 50vh at 10% 6%, rgba(52, 211, 153, 0.14), transparent 62%),
    radial-gradient(48vw 44vh at 94% 28%, rgba(245, 158, 11, 0.07), transparent 62%),
    radial-gradient(64vw 52vh at 58% 100%, rgba(16, 185, 129, 0.11), transparent 62%);
}
.about-card, .stat, .edu-item:not(.plain), .exp-card, .skill-card, .pub-card, .cert-item, .contact-form,
.blog-card, .blog-featured, .comment-item, .lightbox-content {
  background: var(--glass); border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--blur)) saturate(1.35); -webkit-backdrop-filter: blur(var(--blur)) saturate(1.35);
  box-shadow: var(--shadow-sm), var(--glass-hi);
}
/* Plain edu items inside About — never get a card chrome */
.edu-item.plain {
  background: transparent !important;
  border: none !important;
  border-top: 1px solid var(--border) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.edu-item.plain:first-child { border-top: none !important; }
/* Small, numerous elements: light glass (match nav strength on icons) */
.social-icon {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-hi);
}
.social-icon { opacity: 1; }
.social-icon:hover { opacity: 1; background: var(--glass-strong); }
.skill-card:hover, .blog-card:hover, .blog-featured:hover, .exp-card:hover, .pub-card:hover { background: var(--glass-strong); }
.skill-bar, .footer, .blog-section, .contact-section {
  background: color-mix(in srgb, var(--surface) 40%, transparent);
  border-top: 1px solid var(--glass-border);
}
.blog-section { border-bottom: 1px solid var(--glass-border); }
.footer { background: var(--glass); }
.btn-ghost { background: color-mix(in srgb, var(--surface) 45%, transparent); border-color: var(--glass-border); }
.btn-ghost:hover { background: var(--accent-glow); }
.icon-btn { background: color-mix(in srgb, var(--surface) 28%, transparent); }
.back-top, .blog-reader-close, .lightbox-close, .lightbox-nav {
  background: var(--glass-strong); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-color: var(--glass-border);
}
.blog-reader { background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(12px) saturate(1.4); -webkit-backdrop-filter: blur(12px) saturate(1.4); }
.blog-reader-inner { padding-top: calc(var(--nav-h) + env(safe-area-inset-top, 0px) + 1.25rem); }
.blog-reader { scroll-padding-top: calc(var(--notice-h) + var(--nav-h) + 12px); }
.blog-note { color: var(--muted); font-size: 0.9rem; padding: 0.75rem 0; grid-column: 1 / -1; }


/* ========== Reading progress (in-article) ========== */
.reader-progress {
  position: sticky; top: 0; z-index: 5;
  height: 3px; width: 100%;
  background: var(--border);
  margin: -0.5rem 0 1rem;
  border-radius: 2px; overflow: hidden;
}
.reader-progress-bar {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent-light), var(--accent));
  transition: width 0.1s linear;
}

.reader-toolbar-actions {
  display: flex; flex-wrap: nowrap; gap: 0.35rem; align-items: center;
  min-width: 0;
}
.reader-lang-wrap {
  display: inline-flex; align-items: center; gap: 0.25rem;
  min-width: 0;
}
.reader-lang-icon {
  flex-shrink: 0; opacity: 0.75; pointer-events: none;
  display: none;
}

.reader-cite-block {
  margin-top: 1.5rem; padding: 1rem 1.1rem;
  border: 1px solid var(--glass-border); border-radius: var(--radius-sm);
  background: var(--glass);
}
.reader-cite-text {
  font-size: 0.88rem; color: var(--text-soft); line-height: 1.5;
  word-break: break-word; margin: 0.35rem 0 0;
}

/* (reader-gallery-item + caption styles live with the album strip above) */
.gallery-lb-caption {
  position: absolute; bottom: 3.2rem; left: 50%; transform: translateX(-50%);
  max-width: min(90vw, 36rem); text-align: center;
  background: rgba(0,0,0,0.65); color: #fff;
  padding: 0.45rem 0.85rem; border-radius: 8px;
  font-size: 0.85rem; line-height: 1.4;
}

/* Notes tools: filters + search */
.blog-tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem;
  justify-content: flex-end;
}
.blog-search-wrap { min-width: 10rem; flex: 1 1 10rem; max-width: 16rem; }
.blog-search {
  width: 100%; font: inherit; font-size: 0.88rem;
  padding: 0.5rem 0.85rem; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text);
}
.blog-search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.blog-series {
  font-size: 0.68rem; font-weight: 650; color: var(--gold);
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-left: 0.35rem;
}
.pub-related {
  margin-top: 0.75rem; font-size: 0.85rem; color: var(--muted);
}
.pub-related a { color: var(--accent); font-weight: 600; }
.pub-related a:hover { text-decoration: underline; }

.lang-toggle {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
  min-width: 2.4rem;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .reader-related-track { scroll-behavior: auto; }
}

/* Print notes */
@media print {
  .nav, .menu-window, .pop-scrim, .back-top, .blog-filters, .blog-tools,
  .reader-share-btn, .comments-block, #giscus-container,
  .gallery-lb, .photo-lb, .footer, .hero-video-wrap, #theme-toggle, #mobile-btn {
    display: none !important;
  }
  .blog-reader {
    position: static !important; opacity: 1 !important; visibility: visible !important;
    background: #fff !important; color: #000 !important;
  }
  .blog-reader-inner { max-width: 100%; padding: 0; }
  body { background: #fff; color: #000; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #444; }
  .reader-pager { break-inside: avoid; }
}


/* Brief highlight when returning to the note that was opened */
.note-return-flash {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  transition: outline-color 0.4s ease;
}


/* Per-note language / translate control */
.reader-lang {
  font: inherit; font-size: 0.78rem; font-weight: 600;
  padding: 0.4rem 0.55rem; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); cursor: pointer; max-width: 8.5rem;
  min-width: 0; text-overflow: ellipsis;
}
.reader-lang:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.reader-lang.is-busy { opacity: 0.65; pointer-events: none; }
.reader-body.is-translating { opacity: 0.55; transition: opacity 0.2s; }
.reader-lang-status {
  font-size: 0.72rem; color: var(--muted); margin: -0.35rem 0 0.75rem;
}

/* Compact / iconic toolbar on small screens */
@media (max-width: 640px) {
  .blog-reader-toolbar {
    gap: 0.35rem; margin-bottom: 1rem;
  }
  .blog-reader-close { width: 2.4rem; height: 2.4rem; padding: 0; }
  .reader-share-btn {
    padding: 0.42rem 0.55rem;
    gap: 0;
  }
  .reader-share-btn .btn-label {
    display: none;
  }
  .reader-lang-icon {
    display: block;
  }
  .reader-lang {
    max-width: 5.5rem;
    font-size: 0.72rem;
    padding: 0.38rem 0.45rem;
  }
  .reader-toolbar-actions {
    gap: 0.3rem;
  }
}
@media (max-width: 380px) {
  .reader-lang {
    max-width: 4.5rem;
  }
  .reader-share-btn {
    padding: 0.38rem 0.48rem;
  }
}


/* ===== Universal search ===== */
.sx { position: fixed; inset: 0; z-index: 300; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 1rem 1rem;
  background: color-mix(in srgb, var(--bg) 60%, transparent); backdrop-filter: blur(8px); opacity: 0; transition: opacity .18s; }
.sx[hidden] { display: none; } .sx.on { opacity: 1; }
.sx-box { width: min(640px, 100%); max-height: 76vh; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border);
  border-radius: 16px; background: var(--surface); box-shadow: 0 24px 70px rgba(0,0,0,.35); transform: translateY(-8px) scale(.985); transition: transform .18s; }
.sx.on .sx-box { transform: none; }
.sx-bar { display: flex; align-items: center; gap: .6rem; padding: .85rem 1rem; border-bottom: 1px solid var(--border); color: var(--accent); }
.sx-in { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text, inherit); font: inherit; font-size: 1rem; }
.sx-bar kbd { font-size: .68rem; padding: .15rem .4rem; border: 1px solid var(--border); border-radius: 6px; opacity: .7; }
.sx-sugg { display: flex; gap: .4rem; overflow-x: auto; padding: .6rem 1rem 0; scrollbar-width: none; }
.sx-sugg button { flex: none; font: inherit; font-size: .78rem; padding: .25rem .65rem; border-radius: 99px; cursor: pointer; border: 1px solid var(--border); background: transparent; color: inherit; }
.sx-sugg button:hover { border-color: var(--accent); color: var(--accent); }
.sx-list { list-style: none; margin: 0; padding: .5rem; overflow-y: auto; }
.sx-list li[data-i] { display: grid; grid-template-columns: auto 1fr; gap: .1rem .6rem; padding: .6rem .7rem; border-radius: 10px; cursor: pointer; }
.sx-list li[aria-selected] { background: var(--accent-glow); box-shadow: inset 0 0 0 1px var(--accent); }
.sx-type { grid-row: span 2; align-self: start; font-size: .65rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); min-width: 5.2rem; padding-top: .2rem; }
.sx-t { font-weight: 600; font-size: .92rem; } .sx-s { font-size: .78rem; opacity: .7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; border-radius: 3px; }
.sx-empty { padding: 1.2rem; text-align: center; opacity: .7; font-size: .9rem; }
.sx-foot { padding: .5rem 1rem; font-size: .7rem; opacity: .55; border-top: 1px solid var(--border); }
.sx-flash { animation: sxflash 1.8s ease; border-radius: 8px; }
@keyframes sxflash { 0%, 60% { box-shadow: 0 0 0 3px var(--accent); background: var(--accent-glow); } 100% { box-shadow: 0 0 0 3px transparent; } }
@media (max-width: 600px) { .sx { padding-top: 4.5rem; } .sx-type { min-width: 0; grid-row: auto; } .sx-list li[data-i] { grid-template-columns: 1fr; } }

/* ===== Performance polish ===== */
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
.sx-sugg { flex: none; padding-bottom: .2rem; } .sx-sugg:empty { display: none; }
.sx-in:focus-visible { outline: 0; } .sx-in::-webkit-search-cancel-button { display: none; }
.sx-t { font-size: .88rem; line-height: 1.3; }

/* ===== Other notes (related first) ===== */
.reader-album-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.reader-more-all { font: inherit; font-size: .8rem; font-weight: 600; background: none; border: 0; color: var(--accent); cursor: pointer; padding: .2rem 0; }
.reader-more-all:hover { text-decoration: underline; }
.reader-related-card { position: relative; }
.reader-card-badge { position: absolute; top: .4rem; left: .4rem; z-index: 1; font-size: .6rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: .15rem .45rem; border-radius: 99px; background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--accent); backdrop-filter: blur(4px); }
.reader-related-card.is-active .reader-card-badge { background: var(--accent); color: var(--bg); }

/* ===== Navbar: keep logo + 3 actions balanced on small screens ===== */
.nav-inner { gap: .5rem; }
.logo { min-width: 0; flex-shrink: 1; gap: .6rem; }
.logo-text { min-width: 0; }
.logo-text strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-actions { flex-shrink: 0; }
@media (max-width: 480px) {
  .nav-actions { gap: .3rem; }
  .icon-btn { width: 36px; height: 36px; min-width: 36px; min-height: 36px; }
  .icon-btn svg, .menu-btn svg { width: 17px; height: 17px; }
  .logo { gap: .5rem; }
  .logo-mark { width: 34px; height: 34px; flex-shrink: 0; }
  .logo-text strong { font-size: .8rem; letter-spacing: -.03em; }
}
@media (max-width: 360px) {
  .logo-text strong { font-size: .72rem; }
  .icon-btn { width: 34px; height: 34px; min-width: 34px; min-height: 34px; }
}
@media (min-width: 1080px) and (max-width: 1240px) { .nav-links a { padding-inline: .55rem; font-size: .84rem; } .nav-links-divider { display: none; } }
@media (max-width: 350px) { .logo-text strong { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.15; } }

/* ===== Search as a floating window (like the menu): no dim/blur, page stays scrollable ===== */
.sx { position: fixed; inset: 0; z-index: 72; display: block; padding: 0; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; pointer-events: none; opacity: 1; transition: none; }
.sx-box { pointer-events: auto; position: fixed; top: calc(var(--nav-h) - 6px); right: max(.75rem, env(safe-area-inset-right, 0px)); width: min(400px, calc(100vw - 1.5rem));
  max-height: calc(100svh - var(--nav-h) - 1rem); background: var(--glass-strong, var(--glass)); border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--blur)) saturate(1.5); -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5); box-shadow: var(--shadow-sm), var(--glass-hi); border-radius: 12px;
  transform-origin: top right; opacity: 0; transform: translateY(-6px) scale(.96); transition: opacity .18s ease, transform .22s var(--ease); }
.sx.on .sx-box { opacity: 1; transform: none; }
.sx-list { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.sx-bar kbd { display: none; }
.sx-in { font-size: 16px; } /* avoids iOS zoom */
.sx-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .3rem .6rem .3rem 1rem; }
.sx-nudge { display: inline-flex; gap: .3rem; }
.sx-nudge button { width: 32px; height: 28px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--muted); font-size: .7rem; cursor: pointer; }
.sx-nudge button:hover, .sx-nudge button:active { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
@media (max-width: 600px) { .sx { padding: 0; } .sx-box { left: .75rem; right: .75rem; width: auto; } .sx-hint { display: none; } .sx-foot { justify-content: flex-end; } }
@media (hover: none) { .sx-hint { display: none; } }

/* ===== Compact search window: anchored to its icon, custom scroll rail ===== */
.sx-box { width: 300px; max-height: 330px; right: auto; }
.sx-bar { padding: .5rem .7rem; gap: .5rem; }
.sx-bar svg { width: 16px; height: 16px; }
.sx-in { font-size: 16px; }
.sx-sugg { padding: .4rem .7rem 0; }
.sx-sugg button { font-size: .72rem; padding: .18rem .55rem; }
.sx-scroll { position: relative; display: flex; min-height: 0; flex: 1 1 auto; overflow: hidden; }
.sx-list { padding: .35rem .2rem .35rem .35rem; flex: 1 1 auto; scrollbar-width: none; }
.sx-list::-webkit-scrollbar { display: none; }
.sx-list li[data-i] { display: block; padding: .42rem .55rem; }
.sx-t { display: block; font-size: .82rem; font-weight: 600; line-height: 1.25; }
.sx-s { display: block; font-size: .72rem; }
.sx-empty { padding: .8rem; font-size: .82rem; }
.sx-rail { position: relative; flex: none; width: 10px; margin: .35rem .3rem .35rem 0; border-radius: 99px; background: color-mix(in srgb, var(--border) 60%, transparent); touch-action: none; cursor: pointer; }
.sx-thumb { position: absolute; left: 1px; right: 1px; top: 0; min-height: 28px; border-radius: 99px; background: var(--accent); opacity: .75; cursor: grab; }
.sx-thumb:hover, .sx-thumb:active { opacity: 1; }
@media (max-width: 600px) { .sx-box { left: auto; right: auto; } }
.sx-box::before { content: ""; position: absolute; top: -6px; left: calc(var(--cx, 90%) - 6px); width: 12px; height: 12px; transform: rotate(45deg); background: inherit; border-left: 1px solid var(--glass-border); border-top: 1px solid var(--glass-border); border-radius: 3px 0 0 0; pointer-events: none; }
.sx-box { overflow: visible; }
.sx-bar { border-radius: 12px 12px 0 0; }
.sx-scroll { border-radius: 0 0 12px 12px; }

/* ===== Menu window: identical free space on every side of the links ===== */
.menu-window { --pad: .4rem; padding: var(--pad); gap: 0; }
.menu-window a { padding-block: .5rem; padding-inline: .7rem; }
.menu-divider { margin: var(--pad) .7rem; }
@media (max-width: 640px) { .menu-window a { padding-block: .5rem; padding-inline: .7rem; } }

/* ===== Search: very compact scroll rail ===== */
.sx-rail { width: 3px; margin: .5rem .3rem .5rem 0; background: color-mix(in srgb, var(--border) 55%, transparent); }
.sx-thumb { left: 0; right: 0; min-height: 18px; opacity: .85; }
.sx-rail::before { content: ""; position: absolute; inset: 0 -6px; } /* bigger touch target than the visible 3px */
.sx-thumb::before { content: ""; position: absolute; inset: 0 -6px; }
.sx-list { padding-right: .1rem; }
.menu-divider { margin: calc(var(--pad) + 1px) .7rem; }

/* ===== Nav: links centred in the free space; name tucks into the seedling ===== */
.nav-inner { justify-content: flex-start; }
.nav-links { margin-inline: auto; gap: .04rem; }
.nav-links a { padding: .5rem .55rem; }
.nav-links-divider { margin: .35rem .05rem; }
.nav-actions { margin-left: 0; }
@media (max-width: 1079px) { .nav-actions { margin-left: auto; } }
.logo { cursor: pointer; }
.logo-text { max-width: 14rem; overflow: hidden; white-space: nowrap; opacity: 1; transition: max-width .45s var(--ease), opacity .3s ease, margin .45s var(--ease); }
.nav.name-hidden .logo-text { max-width: 0; opacity: 0; }
.nav.name-hidden .logo { gap: 0; }
.logo { transition: gap .45s var(--ease); }

/* ===== Notes filters with counts, rating, location ===== */
.blog-filter { display: inline-flex; align-items: center; gap: .4rem; }
.blog-filter-n { font-size: .68rem; font-weight: 700; padding: .05rem .4rem; border-radius: 99px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); line-height: 1.4; }
.blog-filter.active .blog-filter-n { background: color-mix(in srgb, currentColor 22%, transparent); color: inherit; }
.blog-rating { color: #d99a06; font-weight: 700; }
.blog-loc { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blog-meta { flex-wrap: wrap; row-gap: .2rem; }

/* ===== Hero caption: rule between video and caption, site-coloured, borderless ===== */
.hero-video-card { gap: 0; }
.hero-video-rule { height: 1px; margin: .7rem 0 .6rem; background: var(--border); }
.hero-video-footer { border: 0 !important; background: transparent !important; box-shadow: none !important; padding: 0 .2rem; }


/* ===== Logo: colourful live seedling, no background box, no tilt ===== */
.logo-mark { width: 42px; height: 42px; border-radius: 0; background: none; box-shadow: none; transition: none; }
.logo-mark svg { width: 42px; height: 42px; color: inherit; overflow: visible; filter: drop-shadow(0 2px 4px rgba(22, 101, 52, .22)); }
.logo:hover .logo-mark, .logo:active .logo-mark, .logo:focus .logo-mark { transform: none; box-shadow: none; }
.logo { -webkit-tap-highlight-color: transparent; }
@media (max-width: 480px) { .logo-mark, .logo-mark svg { width: 38px; height: 38px; } .logo-mark { flex-shrink: 0; } }

/* ===== Logo: outlined like the nav buttons, animated DNA helix with a leaf ===== */
.logo-mark { width: 40px; height: 40px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 28%, transparent); box-shadow: none; transition: border-color .2s var(--ease), background .2s var(--ease); }
.logo:hover .logo-mark { border-color: var(--accent); background: var(--accent-glow); transform: none; box-shadow: none; }
.logo-mark svg { width: 28px; height: 28px; filter: none; }
@media (max-width: 480px) { .logo-mark { width: 36px; height: 36px; } .logo-mark svg { width: 25px; height: 25px; } }

.logo-mark { width: 44px; height: 44px; }
#logo-canvas { width: 38px; height: 38px; display: block; }
@media (max-width: 480px) { .logo-mark { width: 40px; height: 40px; } #logo-canvas { width: 34px; height: 34px; } }

/* ===== Logo box = same size as nav buttons ===== */
.logo-mark { width: 42px; height: 42px; }
#logo-canvas { width: 36px; height: 36px; }
button.logo { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
@media (max-width: 480px) { .logo-mark { width: 36px; height: 36px; } #logo-canvas { width: 30px; height: 30px; } }
@media (max-width: 360px) { .logo-mark { width: 34px; height: 34px; } #logo-canvas { width: 28px; height: 28px; } }

/* ===== Reading progress + contents ===== */
.reader-toc { margin: 0 0 1.4rem; border: 1px solid var(--border); border-radius: 12px; background: var(--glass); font-size: .9rem; }
.reader-toc summary { cursor: pointer; padding: .65rem 1rem; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.reader-toc summary::-webkit-details-marker { display: none; }
.reader-toc summary::after { content: "+"; color: var(--accent); font-size: 1.1rem; }
.reader-toc[open] summary::after { content: "–"; }
.reader-toc ol { margin: 0; padding: 0 1rem .8rem 2.1rem; display: grid; gap: .3rem; }
.reader-toc li.h3 { margin-left: .9rem; font-size: .85rem; opacity: .85; }
.reader-toc a { color: inherit; text-decoration: none; } .reader-toc a:hover { color: var(--accent); }
.reader-body h2, .reader-body h3 { scroll-margin-top: calc(var(--nav-h) + 16px); }

/* ===== Smoother browsing ===== */
.blog-card, .blog-featured { contain: layout paint style; }
.reveal { will-change: auto; }
@media (hover: none) { .blog-card:hover, .blog-featured:hover { transform: none; } }


/* ===== Polish: crisp taps, gentle press feedback ===== */
a, button, summary, [role="button"] { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.icon-btn:active, .menu-btn:active, button.logo:active .logo-mark { transform: scale(.94); }
.icon-btn, .menu-btn, .logo-mark { transition: transform .15s var(--ease), border-color .2s var(--ease), background .2s var(--ease), color .2s var(--ease); }
.nav-links a { transition: color .25s ease, background .3s var(--ease); }

/* Notes filter chips: one swipeable row that never widens the page */
.blog-tools { min-width: 0; max-width: 100%; }
.blog-filters { display: flex; flex-wrap: nowrap; gap: .45rem; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 3px 2px; }
.blog-filters::-webkit-scrollbar { display: none; }
.blog-filter { flex: 0 0 auto; }

/* ===== Loading splash: the site icon (same as the browser tab), only while the page is loading ===== */
#splash { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; background: var(--bg); opacity: 0; animation: spIn .3s ease .18s forwards; }
#splash.out { animation: spOut .32s ease forwards; pointer-events: none; }
.sp-tile { position: relative; width: clamp(96px, 24vmin, 150px); aspect-ratio: 1; border-radius: 24%; background: #07120c; display: grid; place-items: center;
  box-shadow: 0 10px 34px rgba(16, 185, 129, .28), inset 0 0 0 1px rgba(52, 211, 153, .18); transform: scale(.9); animation: spTile .55s cubic-bezier(.3,1.3,.5,1) .15s forwards, spBreathe 2.6s ease-in-out 1.4s infinite; }
.sp-tile svg { width: 62%; height: 62%; overflow: visible; }
.sp-p { stroke-dasharray: 1; stroke-dashoffset: 1; animation: spDraw .55s ease forwards; }
.sp-p.p1 { animation-delay: .35s; } .sp-p.p2 { animation-delay: .6s; } .sp-p.p3 { animation-delay: .95s; } .sp-p.p4 { animation-delay: 1.15s; }
.sp-ring { position: absolute; inset: 0; border-radius: inherit; border: 2px solid rgba(52, 211, 153, .55); opacity: 0; animation: spRing 2.2s ease-out 1.3s infinite; }
@keyframes spIn { to { opacity: 1; } } @keyframes spOut { from { opacity: 1; } to { opacity: 0; visibility: hidden; } }
@keyframes spTile { to { transform: scale(1); } }
@keyframes spDraw { to { stroke-dashoffset: 0; } }
@keyframes spBreathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes spRing { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(1.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #splash { display: none; } }

/* ===== Accessibility & print ===== */
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 10000; padding: .6rem 1rem; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 600; text-decoration: none; transition: top .2s var(--ease); }
.skip-link:focus { top: 12px; }
@media print {
  .nav, .menu-window, .sx, #splash, .back-top, .skip-link, .hero-video-card, .blog-reader { display: none !important; }
  body, html { background: #fff !important; color: #000 !important; }
  a { color: #000; text-decoration: underline; }
  section { break-inside: avoid-page; padding-block: 1rem !important; }
}
.sp-p { opacity: 0; animation: spDraw .55s ease var(--d, 0s) forwards, spShow .01s linear var(--d, 0s) forwards; }
.sp-p.p1 { --d: .35s; } .sp-p.p2 { --d: .6s; } .sp-p.p3 { --d: .95s; } .sp-p.p4 { --d: 1.15s; }
@keyframes spShow { to { opacity: 1; } }


/* ===== v13-40 · speed & polish ===== */

/* Hero plays one orchestrated entrance straight from CSS — no waiting for JS or an observer */
@keyframes heroIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.js .hero .reveal { opacity: 1; transform: none; transition: none; animation: heroIn .7s var(--ease) both; }
.js .hero .hero-media.reveal { animation-delay: .12s; }

/* Large blurred layers are the main cause of scroll jank on phones — keep blur for the nav, menus and overlays only */
.about-card, .stat, .edu-item:not(.plain), .exp-card, .skill-card, .pub-card, .cert-item,
.contact-form, .blog-card, .blog-featured, .comment-item {
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.hero-orb { filter: none; }

/* Loading placeholders for the notes grid (replaced the moment posts arrive) */
.blog-skel { border-radius: var(--radius); border: 1px solid var(--glass-border); min-height: 17rem;
  background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--accent) 9%, transparent) 50%, transparent 70%) var(--glass);
  background-size: 220% 100%; animation: skel 1.4s ease-in-out infinite; }
@keyframes skel { from { background-position: 120% 0; } to { background-position: -120% 0; } }

/* Connection status toast */
.net-toast { position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); z-index: 90;
  transform: translate(-50%, 140%); opacity: 0; pointer-events: none; padding: .55rem 1rem; border-radius: 999px;
  font-size: .82rem; font-weight: 600; color: var(--text); background: var(--glass-strong, var(--surface));
  border: 1px solid var(--glass-border); box-shadow: var(--shadow-sm); transition: transform .35s var(--ease), opacity .35s var(--ease); }
.net-toast.on { transform: translate(-50%, 0); opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal, .js .hero .reveal { opacity: 1; transform: none; transition: none; animation: none; }
  .blog-skel { animation: none; }
  .net-toast { transition: none; }
}

/* ===== Blackgram trait guide section ===== */
.guide-section .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tg-tools { display: flex; flex-direction: column; gap: .7rem; margin-bottom: 1.4rem; }
.tg-search { display: flex; align-items: center; gap: .55rem; padding: 0 .9rem; height: 44px; max-width: 28rem; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); }
.tg-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.tg-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: .95rem; }
.tg-group + .tg-group { margin-top: 2rem; }
.tg-group-title { font-size: 1.05rem; font-weight: 700; margin-bottom: .8rem; }
.tg-cards { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .tg-cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .tg-cards { grid-template-columns: repeat(3, 1fr); } }
.tg-card { border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); overflow: hidden; contain: layout paint; }
.tg-card h3 { font-size: 1rem; font-weight: 700; line-height: 1.3; padding: .85rem 1rem 0; }
.tg-note { padding: .25rem 1rem 0; font-size: .82rem; color: var(--muted); line-height: 1.45; }
.tg-strip { display: grid; gap: 3px; margin-top: .8rem; grid-template-columns: repeat(var(--n, 1), 1fr); }
.tg-strip[data-n="1"] { --n: 1; } .tg-strip[data-n="2"] { --n: 2; } .tg-strip[data-n="3"] { --n: 3; }
.tg-ph { position: relative; display: block; padding: 0; border: 0; background: var(--bg-elevated); cursor: zoom-in; aspect-ratio: 4 / 5; overflow: hidden; }
.tg-strip[data-n="1"] .tg-ph { aspect-ratio: 16 / 10; } .tg-strip[data-n="2"] .tg-ph { aspect-ratio: 1 / 1; }
.tg-ph img { width: 100%; height: 100%; object-fit: cover; display: block; -webkit-user-drag: none; user-select: none; transition: transform .35s var(--ease); }
@media (hover: hover) { .tg-ph:hover img { transform: scale(1.04); } }
.tg-ph:focus-visible, .tg-lb-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tg-tag { position: absolute; left: .4rem; bottom: .4rem; max-width: calc(100% - .8rem); padding: .15rem .5rem; border-radius: 999px; font-size: .74rem; font-weight: 700; line-height: 1.4; color: #fff; background: rgba(5, 18, 12, .78); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-grid[aria-busy="true"] { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .tg-grid[aria-busy="true"] { grid-template-columns: repeat(2, 1fr); } }
.tg-skel { min-height: 14rem; border-radius: var(--radius); border: 1px solid var(--glass-border, var(--border));
  background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--accent) 9%, transparent) 50%, transparent 70%) var(--surface); background-size: 220% 100%; animation: skel 1.4s ease-in-out infinite; }
.tg-empty { padding: 1.5rem 0; color: var(--muted); }
.tg-key { margin-top: 1.75rem; font-size: .88rem; color: var(--muted); max-width: 70ch; }
.tg-key strong { color: var(--text-soft); }
.tg-lb { border: 0; padding: 0; margin: auto; background: transparent; color: #fff; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; }
.tg-lb::backdrop { background: rgba(2, 8, 5, .93); }
.tg-lb figure { margin: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; padding: 3.5rem .75rem 1.25rem; }
.tg-lb img { max-width: 100%; max-height: calc(100dvh - 8.5rem); width: auto; height: auto; object-fit: contain; border-radius: var(--radius-xs); -webkit-user-drag: none; }
.tg-lb figcaption { font-size: .92rem; font-weight: 600; text-align: center; max-width: 60ch; padding: 0 3rem; }
.tg-lb-btn { position: absolute; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.22); background: rgba(10, 28, 19, .8); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.tg-lb-close { top: calc(.75rem + env(safe-area-inset-top, 0px)); right: .75rem; }
.tg-lb-prev { left: .5rem; top: 50%; transform: translateY(-50%); } .tg-lb-next { right: .5rem; top: 50%; transform: translateY(-50%); }
.tg-lb[data-single="1"] .tg-lb-prev, .tg-lb[data-single="1"] .tg-lb-next { display: none; }
@media (prefers-reduced-motion: reduce) { .tg-ph img { transition: none; } .tg-skel { animation: none; } }


/* === v13.47 — Notes streams + Latest strip === */
.latest-strip {
  padding: 1.75rem 0 2.25rem;
  border-bottom: 1px solid var(--glass-border);
  background: color-mix(in srgb, var(--surface) 35%, transparent);
}
.latest-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.25rem;
  margin-bottom: 1.1rem;
}
.latest-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  flex: 1 1 auto;
}
.latest-all {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.latest-all:hover { text-decoration: underline; }
.latest-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
@media (max-width: 900px) {
  .latest-grid { grid-template-columns: 1fr; }
}
.latest-card {
  display: block;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card, var(--surface));
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.latest-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.latest-stream {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.latest-card time {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.latest-card h3 {
  font-size: 0.98rem;
  font-weight: 650;
  line-height: 1.35;
  margin: 0 0 0.4rem;
}
.latest-card p {
  font-size: 0.86rem;
  color: var(--muted);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-media-placeholder {
  min-height: 140px;
  background:
    radial-gradient(ellipse at 30% 20%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 55%),
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 12%, var(--surface)), var(--surface));
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 0.75rem;
  position: relative;
}
.blog-media-placeholder::after {
  content: attr(data-stream-label);
  position: absolute;
  left: 0.9rem;
  bottom: 0.85rem;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: color-mix(in srgb, var(--accent) 55%, var(--text));
  opacity: 0.55;
}
.blog-featured-media.blog-media-placeholder { min-height: 200px; }

.blog-guide-panel { margin-top: 0.5rem; }
.blog-guide-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem 1.6rem;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  max-width: 36rem;
}
.blog-guide-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.4rem;
}
.blog-guide-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}
.blog-guide-card p {
  margin: 0 0 1.1rem;
  color: var(--muted);
  line-height: 1.55;
}

/* Tech note code blocks in reader */
.reader-body pre {
  position: relative;
  overflow-x: auto;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 85%, #000);
  font-size: 0.86rem;
  line-height: 1.5;
}
.reader-body pre code { background: none; padding: 0; font-size: inherit; }
.reader-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  padding: 0.1em 0.35em;
  border-radius: 5px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.reader-body pre { position: relative; }
.reader-body .code-copy {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--text);
  cursor: pointer;
}
.reader-body .code-copy:hover { border-color: var(--accent); color: var(--accent); }

/* ========== Advisor section ========== */
.advisor-section {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 35%, transparent);
  padding: clamp(3rem, 6vw, 4.5rem) 0;
}
.advisor-disclaimer {
  margin-top: 1.75rem;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: 36rem;
}
.advisor-grid .blog-card { cursor: pointer; }

/* Cover album: semi-transparent prev/next on the large image */
.reader-cover-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 2.35rem;
  height: 2.35rem;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.55;
  transition: opacity 0.15s, background 0.15s;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.reader-cover:hover .reader-cover-nav,
.reader-cover-nav:focus-visible {
  opacity: 0.95;
}
.reader-cover-nav:hover {
  background: rgba(0, 0, 0, 0.5);
  opacity: 1;
}
.reader-cover-prev { left: 0.55rem; }
.reader-cover-next { right: 0.55rem; }
@media (max-width: 640px) {
  .reader-cover-nav { opacity: 0.75; width: 2.1rem; height: 2.1rem; font-size: 1.35rem; }
}

/* Notes nav: hover/tap subsections — match menu-window glass, compact */
.nav-item-has-sub {
  position: relative;
  display: flex;
  align-items: center;
  /* invisible bridge so pointer can reach the panel without closing */
  padding-bottom: 0;
}
.nav-item-has-sub.is-open .nav-notes-link {
  color: var(--accent);
}
.nav-sub {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  /* pad top so hover path from link → panel stays inside wrap */
  padding: 0.35rem 0.3rem 0.3rem;
  margin-top: 0;
  min-width: 7.25rem;
  width: max-content;
  border-radius: 12px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--blur)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5);
  box-shadow: var(--shadow-sm), var(--glass-hi);
  display: flex;
  flex-direction: column;
  gap: 0.02rem;
  z-index: 80;
}
/* hit-area above panel so mouseleave doesn't fire in the gap */
.nav-sub::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -0.55rem;
  height: 0.55rem;
}
.nav-sub[hidden] { display: none !important; }
.nav-sub a {
  display: block;
  padding: 0.32rem 0.55rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.25;
  transition: background 0.15s ease;
}
.nav-sub a:hover,
.nav-sub a:focus-visible {
  background: color-mix(in srgb, var(--surface-2) 65%, transparent);
  color: var(--text);
}
.menu-sub-link {
  padding-left: 2.75rem !important;
  font-size: 0.88rem !important;
  opacity: 0.9;
}

/* ========== Small-screen polish (energy + layout) ========== */
@media (max-width: 639px) {
  html { -webkit-text-size-adjust: 100%; }
  body { overflow-x: hidden; }

  .hero-ctas {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .hero-ctas .btn {
    flex: 1 1 calc(50% - 0.35rem);
    min-width: 0;
  }
  .hero-video-card:hover { transform: none; } /* no lift on touch */
  .hero-video-footer { padding: 0.55rem 0.7rem; }
  .hero-video-footer strong { font-size: 0.8rem; }
  .hero-video-footer span { font-size: 0.68rem; }

  .blog-tools {
    width: 100%;
    justify-content: flex-start;
  }
  .blog-filters {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0.35rem;
  }
  .blog-filters::-webkit-scrollbar { display: none; }
  .blog-filter {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 0.8rem;
    padding: 0.4rem 0.7rem;
  }

  .blog-reader-content {
    padding-left: 0.15rem;
    padding-right: 0.15rem;
  }
  .blog-reader-toolbar {
    gap: 0.35rem;
    flex-wrap: wrap;
  }
  .reader-gallery-item {
    width: 4.1rem;
    height: 2.9rem;
  }
  .reader-cover-nav {
    /* always slightly visible on touch (no hover) */
    opacity: 0.72;
  }

  .latest-grid { gap: 0.65rem; }
  .latest-card { padding: 0.85rem 0.9rem; }

  .nav-sub {
    left: 0;
    transform: none;
    right: auto;
    min-width: 7.5rem;
  }

  .menu-sub-link {
    padding-left: 2.5rem !important;
    font-size: 0.86rem !important;
    opacity: 0.85;
    min-height: 40px;
  }

  /* avoid orbs burning GPU on small phones */
  .hero-orb {
    opacity: 0.45;
    filter: blur(14px);
  }
}

@media (max-width: 380px) {
  .hero-ctas .btn {
    flex: 1 1 100%;
  }
  .section-label { font-size: 0.68rem; }
  .blog-meta { font-size: 0.75rem; flex-wrap: wrap; }
}

/* Prefer less motion / less battery */
@media (prefers-reduced-motion: reduce) {
  .hero-orb { display: none !important; }
  .hero-video-card:hover { transform: none; }
  .reader-cover-nav { transition: none; }
}

/* Pause decorative animation when page not visible is handled in JS;
   keep transforms cheap on low-end devices */
@media (max-width: 639px) and (prefers-reduced-motion: no-preference) {
  .js .reveal {
    transform: translateY(16px);
    transition-duration: 0.45s;
  }
}


/* ===== Listen (text-to-speech) ===== */
.reader-listen-btn { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.45rem 0.85rem; font-size: 0.82rem; border-radius: 999px; }
.reader-listen-btn[hidden] { display: none; }
.reader-listen-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.reader-listen {
  position: sticky; top: calc(var(--nav-h, 64px) + env(safe-area-inset-top, 0px) + 0.5rem); z-index: 6;
  margin: 0 0 1.1rem; padding: 0.55rem 0.65rem 0.45rem;
  background: var(--glass-strong); border: 1px solid var(--glass-border, var(--border-strong));
  border-radius: 16px; backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 10px 30px -14px rgba(0, 0, 0, 0.45);
}
.reader-listen[hidden] { display: none; }
.rl-row { display: flex; align-items: center; gap: 0.4rem; }
.rl-btn {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 2.4rem; height: 2.4rem; border-radius: 50%; cursor: pointer; font: inherit;
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.rl-btn:hover { border-color: var(--accent); color: var(--accent); }
.rl-btn:focus-visible, .rl-field select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rl-play { width: 2.9rem; height: 2.9rem; background: linear-gradient(90deg, var(--accent-light), var(--accent)); border-color: transparent; color: #04140d; }
.rl-play:hover { color: #04140d; filter: brightness(1.08); }
.rl-play .rl-ico-pause { display: none; }
.rl-play.is-playing .rl-ico-play { display: none; }
.rl-play.is-playing .rl-ico-pause { display: block; }
.rl-close { margin-left: auto; width: 2rem; height: 2rem; }
.rl-field select {
  font: inherit; font-size: 0.78rem; font-weight: 600; padding: 0.4rem 0.5rem; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; max-width: 100%;
}
.rl-voice-wrap { min-width: 0; flex: 1 1 auto; }
.rl-voice-wrap select { width: 100%; text-overflow: ellipsis; }
.rl-bar { height: 3px; margin-top: 0.5rem; border-radius: 2px; background: var(--border); overflow: hidden; }
.rl-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-light), var(--accent)); transition: width 0.25s linear; }
.rl-status { margin: 0.35rem 0 0; font-size: 0.72rem; color: var(--muted); min-height: 1em; }
.reader-body .tts-current, .reader-body .tts-current * { scroll-margin-top: calc(var(--nav-h, 64px) + 8rem); }
.reader-body .tts-current {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow: -0.5rem 0 0 color-mix(in srgb, var(--accent) 14%, transparent), 0.5rem 0 0 color-mix(in srgb, var(--accent) 14%, transparent);
  border-radius: 4px; transition: background 0.2s;
}
#reader-title.tts-current { background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 6px; }
@media (max-width: 640px) {
  .reader-listen-btn { padding: 0.42rem 0.55rem; gap: 0; }
  .reader-listen-btn .btn-label { display: none; }
  .rl-row { flex-wrap: wrap; row-gap: 0.4rem; }
  .rl-voice-wrap { order: 5; flex-basis: 100%; }
  .rl-close { order: 4; }
}
@media (prefers-reduced-motion: reduce) { .rl-bar span { transition: none; } }
@media print { .reader-listen, .reader-listen-btn { display: none !important; } }


/* ===== Daily brief ===== */
.news-section[hidden] { display: none; }
.news-grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.news-card { padding: 1rem 1.05rem; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); transition: transform .25s var(--ease), border-color .25s, box-shadow .25s; }
.news-card:hover { transform: translateY(-2px); border-color: rgba(52, 211, 153, 0.35); }
.news-card h3 { font-size: 0.98rem; line-height: 1.35; margin: 0.25rem 0 0.4rem; }
.news-card h3 a { color: inherit; text-decoration: none; }
.news-card h3 a:hover { color: var(--accent); }
.news-card p { font-size: 0.85rem; color: var(--muted); line-height: 1.55; margin: 0; }
.news-card .news-meta { font-size: 0.7rem; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); margin: 0; }
.news-foot { margin-top: 1rem; font-size: 0.85rem; }
.news-foot a { color: var(--accent); }

/* ===== Polish: transitions & perceived speed ===== */
/* note reader: content eases up as the overlay fades in */
.blog-reader .blog-reader-inner { transform: translateY(18px); opacity: 0.001; transition: transform .38s var(--ease), opacity .3s ease; }
.blog-reader.open .blog-reader-inner { transform: none; opacity: 1; }
/* tactile press feedback */
.blog-card, .blog-featured, .latest-card, .tg-card, .btn, .rl-btn, .blog-reader-close { -webkit-tap-highlight-color: transparent; }
.blog-card:active, .blog-featured:active, .latest-card:active { transform: scale(0.985); transition-duration: .08s; }
.btn:active, .rl-btn:active, .blog-reader-close:active { transform: scale(0.94); }
/* keyboard focus is always visible and consistent */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* smoother image fade-in once decoded */
img[loading="lazy"] { transition: opacity .35s ease; }
@media (prefers-reduced-motion: reduce) {
  .blog-reader .blog-reader-inner { transform: none; transition: none; }
  .blog-card:active, .blog-featured:active, .latest-card:active, .btn:active, .rl-btn:active, .blog-reader-close:active { transform: none; }
}

/* =========================================================
   Site guide (lightweight FAQ + contact helper)
   Discrete launcher — not always-on chrome
   ========================================================= */
#site-guide-root {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  /* sit above the back-to-top button so both remain tappable on phones */
  bottom: calc(3.6rem + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  font-family: var(--font);
}
#site-guide-root[hidden] { display: none !important; }
#site-guide-btn {
  width: 3.15rem; height: 3.15rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--glass-strong);
  color: var(--accent);
  box-shadow: var(--shadow-md), var(--glass-hi);
  cursor: pointer;
  display: grid; place-items: center;
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  transition: transform 0.2s var(--ease), background 0.2s, box-shadow 0.2s;
}
#site-guide-btn:hover {
  transform: translateY(-2px);
  background: color-mix(in srgb, var(--surface-2) 80%, transparent);
  box-shadow: var(--shadow-lg);
}
#site-guide-btn svg { width: 1.35rem; height: 1.35rem; }
#site-guide-btn[aria-expanded="true"] {
  background: var(--accent-dark);
  color: #ecfdf5;
  border-color: transparent;
}
#site-guide-panel {
  position: absolute;
  right: 0;
  bottom: calc(3.15rem + 0.65rem);
  width: min(22.5rem, calc(100vw - 1.75rem));
  max-height: min(28rem, calc(100svh - 6rem));
  display: flex; flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
#site-guide-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
#site-guide-panel[hidden] { display: none !important; }
.sg-header {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.sg-avatar {
  width: 2rem; height: 2rem; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-2));
  color: var(--accent);
  display: grid; place-items: center; flex-shrink: 0;
}
.sg-avatar svg { width: 1.05rem; height: 1.05rem; }
.sg-title { font-size: 0.9rem; font-weight: 600; color: var(--text); line-height: 1.2; }
.sg-sub { font-size: 0.72rem; color: var(--muted); }
.sg-close {
  margin-left: auto; background: transparent; border: 0;
  color: var(--muted); cursor: pointer; width: 1.75rem; height: 1.75rem;
  border-radius: 999px; display: grid; place-items: center; font-size: 1.15rem;
}
.sg-close:hover { background: var(--surface-2); color: var(--text); }
.sg-messages {
  flex: 1; overflow-y: auto; padding: 0.85rem 0.9rem;
  display: flex; flex-direction: column; gap: 0.55rem;
  overscroll-behavior: contain;
}
.sg-bubble {
  max-width: 92%;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text-soft);
}
.sg-bubble.bot {
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.sg-bubble.user {
  align-self: flex-end;
  background: color-mix(in srgb, var(--accent-dark) 75%, #000);
  color: #ecfdf5;
  border: 1px solid transparent;
}
.sg-bubble a {
  color: var(--accent-light);
  font-weight: 560;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.sg-bubble.user a { color: #fff; }
.sg-quick {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
  padding: 0 0.9rem 0.55rem;
}
.sg-chip {
  font-size: 0.75rem;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.sg-chip:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--text);
}
.sg-actions {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  padding: 0 0.9rem 0.65rem;
}
.sg-action {
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-soft);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.3rem;
  cursor: pointer;
}
.sg-action:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.sg-input-row {
  display: flex; gap: 0.4rem;
  padding: 0.55rem 0.7rem 0.7rem;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 40%, transparent);
}
.sg-input-row input {
  flex: 1;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
  font-size: 0.84rem;
  font-family: inherit;
  outline: none;
}
.sg-input-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.sg-send {
  border: 0;
  background: var(--accent-dark);
  color: #ecfdf5;
  border-radius: var(--radius-sm);
  width: 2.35rem; height: 2.35rem;
  display: grid; place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.sg-send:hover { background: var(--accent); }
.sg-send svg { width: 1rem; height: 1rem; }
@media (max-width: 480px) {
  #site-guide-root {
    right: 0.75rem;
    bottom: calc(3.5rem + env(safe-area-inset-bottom, 0px));
  }
  #site-guide-panel { width: calc(100vw - 1.5rem); }
}
