/* ========== RESET ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* ========== CSS VARIABLES ========== */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-hover: #f8f8f8;
  --surface-glass: rgba(255, 255, 255, 0.92);
  --border: #eaeaea;
  --border-hover: #d0d0d0;
  --border-subtle: #f0f0f0;
  --text-primary: #111111;
  --text-secondary: #555555;
  --text-muted: #888888;
  --hover-bg: #f5f5f5;
  --accent: #3b82f6;
  --accent-light: rgba(59, 130, 246, 0.08);
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  --accent-red: #e60000;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.03), 0 2px 4px rgba(0, 0, 0, 0.02);
  --shadow-md:
    0 4px 12px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.03),
    0 0 0 1px rgba(0, 0, 0, 0.02);
  --shadow-lg:
    0 8px 24px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04),
    0 0 0 1px rgba(0, 0, 0, 0.02);
  --shadow-xl:
    0 16px 48px rgba(0, 0, 0, 0.1), 0 8px 16px rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(0, 0, 0, 0.02);
  --shadow-glow: 0 0 0 1px rgba(0, 0, 0, 0.03), 0 2px 8px rgba(0, 0, 0, 0.04);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --border-radius: 12px;
  --border-radius-lg: 16px;
  --text-hidden: #fafafa;
  --text-revealed: #555555;
  --snake-color: #111111;
}

[data-theme="dark"] {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-hover: #222222;
  --surface-glass: rgba(20, 20, 20, 0.95);
  --border: #2a2a2a;
  --border-hover: #3a3a3a;
  --border-subtle: #222222;
  --text-primary: #fafafa;
  --text-secondary: #a0a0a0;
  --text-muted: #606060;
  --hover-bg: #222222;
  --accent: #60a5fa;
  --accent-light: rgba(96, 165, 250, 0.1);
  --accent-gradient: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
  --accent-red: #e60000;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.15);
  --shadow-md:
    0 4px 12px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.03);
  --shadow-lg:
    0 8px 24px rgba(0, 0, 0, 0.4), 0 4px 8px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.03);
  --shadow-xl:
    0 16px 48px rgba(0, 0, 0, 0.5), 0 8px 16px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  --shadow-glow:
    0 0 0 1px rgba(255, 255, 255, 0.05), 0 2px 8px rgba(0, 0, 0, 0.3);
  --text-hidden: #0f0f0f;
  --text-revealed: #888888;
  --snake-color: #fafafa;
}

/* ========== BASE ========== */
html {
  scroll-behavior: smooth;
}
html,
body {
  min-height: 100vh;
}
body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Homepage layout */
body.page-home {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  min-height: 100vh;
}

/* Subpage layout */
body.page-sub {
  padding: 0;
  text-align: left;
}

/* ========== MOUSE SPOTLIGHT ========== */
.mouse-spotlight {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: radial-gradient(
    600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(251, 146, 60, 0.12),
    transparent 50%
  );
}

/* Cyan version for dark mode */
[data-theme="dark"] .mouse-spotlight {
  background: radial-gradient(
    600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(34, 211, 238, 0.08),
    transparent 50%
  );
}

body.page-home .mouse-spotlight {
  opacity: 1;
}

@media (max-width: 1023px) {
  .mouse-spotlight {
    display: none;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

/* ========== THEME TOGGLE ========== */
button.theme-toggle {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  color: inherit;
}

.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 52px;
  height: 28px;
  background: var(--surface-glass);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 3px;
  transition: all 0.2s ease;
  z-index: 1000;
  box-shadow: var(--shadow-md);
  direction: ltr;
}
@media (min-width: 768px) {
  .theme-toggle {
    top: 24px;
    right: 24px;
    width: 56px;
    height: 30px;
  }
}

.theme-toggle:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg);
  transform: scale(1.02);
}
/* Disable hover on touch devices */
@media (hover: none) {
  .theme-toggle:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-md);
    transform: scale(1);
  }
}

.theme-toggle:active {
  transform: scale(0.98);
}
.theme-toggle-circle {
  width: 24px;
  height: 24px;
  background: var(--text-primary);
  border-radius: 50%;
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle-circle svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.theme-toggle-sun {
  stroke: var(--bg);
  stroke-width: 2;
  fill: none;
  display: block;
}
.theme-toggle-moon {
  stroke: var(--bg);
  stroke-width: 2;
  fill: none;
  display: none;
}
[data-theme="dark"] .theme-toggle-circle {
  transform: translateX(22px);
}
@media (min-width: 768px) {
  [data-theme="dark"] .theme-toggle-circle {
    transform: translateX(26px);
  }
}
[data-theme="dark"] .theme-toggle-sun {
  display: none;
}
[data-theme="dark"] .theme-toggle-moon {
  display: block;
}

/* ========== FOCUS STATES (keyboard) ========== */
.theme-toggle:focus-visible,
.back-nav:focus-visible,
.lang-toggle:focus-visible,
.nav-button:focus-visible,
.contact-btn:focus-visible,
.dropdown-item:focus-visible,
.skill-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ========== BACK BUTTON (Subpages) ========== */
.back-nav {
  position: fixed;
  top: 16px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--surface-glass);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
  z-index: 1000;
  box-shadow: var(--shadow-md);
  letter-spacing: -0.01em;
  min-height: 40px;
}
@media (min-width: 768px) {
  .back-nav {
    top: 24px;
    left: 24px;
  }
}

.back-nav svg {
  width: 16px;
  height: 16px;
  stroke: var(--text-muted);
  stroke-width: 2;
  transition: all 0.2s ease;
}
.back-nav:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  transform: translateX(-2px);
}
.back-nav:hover svg {
  stroke: var(--text-primary);
}


/* ========== CONTAINER ========== */
.container {
  width: 100%;
  max-width: 900px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  z-index: 10;
}

/* Subpage container */
.sub-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 100px 30px 60px;
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ========== ANIMATIONS ========== */
@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-8px);
  }
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(25px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes blink {
  0%,
  40% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}
@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}
@keyframes badgePulse {
  0%,
  100% {
    box-shadow:
      0 4px 12px rgba(230, 0, 0, 0.3),
      0 0 20px rgba(230, 0, 0, 0.15);
  }
  50% {
    box-shadow:
      0 4px 16px rgba(230, 0, 0, 0.45),
      0 0 28px rgba(230, 0, 0, 0.25);
  }
}

/* ========== HEADER ========== */
header {
  margin-bottom: 24px;
  text-align: center;
  opacity: 0;
  animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  position: relative;
}

.avatar {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  animation: float 5s ease-in-out infinite;
  transition:
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.3s ease;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.15) 0%,
    rgba(255, 255, 255, 0.05) 40%,
    rgba(255, 255, 255, 0.02) 60%,
    rgba(255, 255, 255, 0.1) 100%
  );
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.2),
    inset 0 1px 1px rgba(255, 255, 255, 0.25),
    inset 0 -1px 1px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
  text-decoration: none;
}
@media (min-width: 768px) {
  .avatar {
    width: 88px;
    height: 88px;
    border-radius: 22px;
  }
}
@media (min-width: 1024px) {
  .avatar {
    width: 96px;
    height: 96px;
    border-radius: 24px;
  }
}

.avatar::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    ellipse at 30% 20%,
    rgba(255, 255, 255, 0.3) 0%,
    transparent 50%
  );
  pointer-events: none;
  z-index: 2;
}
.avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.12) 0%,
    transparent 40%,
    transparent 60%,
    rgba(255, 255, 255, 0.06) 100%
  );
  pointer-events: none;
  z-index: 3;
}
.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  position: relative;
  z-index: 1;
}
[data-theme="light"] .avatar {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(255, 255, 255, 0.2) 40%,
    rgba(255, 255, 255, 0.1) 60%,
    rgba(255, 255, 255, 0.35) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.08),
    inset 0 1px 2px rgba(255, 255, 255, 0.6),
    inset 0 -1px 1px rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .avatar-img {
  filter: none;
}
.avatar:hover {
  transform: scale(1.08) translateY(-3px);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.25),
    inset 0 1px 2px rgba(255, 255, 255, 0.35),
    0 0 30px rgba(59, 130, 246, 0.12);
}


h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 14px;
  letter-spacing: -0.04em;
  background: linear-gradient(
    180deg,
    var(--text-primary) 0%,
    var(--text-secondary) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
@media (min-width: 768px) {
  h1 {
    font-size: 2.2rem;
  }
}
@media (min-width: 1024px) {
  h1 {
    font-size: 2.5rem;
  }
}


/* Subpage title */
.page-header-box {
  text-align: center;
  margin-bottom: 36px;
  padding: 20px 0 24px;
  position: relative;
  opacity: 0;
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.page-header-box::after {
  content: "";
  display: block;
  width: 40px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin: 14px auto 0;
  opacity: 0.6;
}
.page-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  text-align: center;
}
.page-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 0;
  letter-spacing: -0.01em;
}

/* ========== TYPING ========== */
.hero-statement {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-primary);
  letter-spacing: -0.015em;
  position: relative;
  z-index: 2;
}
@media (min-width: 768px) {
  .hero-statement {
    font-size: 1.15rem;
  }
}
@media (min-width: 1024px) {
  .hero-statement {
    font-size: 1.25rem;
  }
}

.hero-statement .static {
  color: var(--text-secondary);
}
.typing-wrapper {
  display: inline-block;
  position: relative;
}
.typing-text {
  color: var(--text-primary);
  font-weight: 600;
  background: linear-gradient(
    135deg,
    var(--text-primary) 0%,
    var(--text-secondary) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--text-muted);
  margin-left: 1px;
  vertical-align: text-bottom;
  border-radius: 2px;
  animation: blink 1.1s ease-in-out infinite;
}

/* ========== BIO ========== */
.bio {
  font-size: 0.875rem;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto 20px;
  line-height: 1.7;
  letter-spacing: -0.01em;
}
@media (min-width: 768px) {
  .bio {
    font-size: 0.9rem;
  }
}
@media (min-width: 1024px) {
  .bio {
    font-size: 0.95rem;
  }
}


/* ========== TECH BADGES ========== */
.tech-badges {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
}
.badge {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  transition: var(--transition);
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: var(--shadow-sm);
  min-height: 32px;
}
@media (min-width: 768px) {
  .badge {
    font-size: 0.8rem;
    min-height: 34px;
  }
}

.badge svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  opacity: 0.8;
}
.badge:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
}
.badge:hover svg {
  opacity: 1;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
  margin-right: 2px;
  animation: pulse-dot 2s ease-in-out infinite;
}

/* ========== DIVIDER ========== */
.divider {
  width: 180px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--border-hover),
    transparent
  );
  margin: 32px auto;
  opacity: 0.6;
}

/* ========== NAV BUTTONS (Homepage) ========== */
.nav-container {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
  opacity: 0;
  animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.15s forwards;
  flex-direction: column;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}
@media (min-width: 768px) {
  .nav-container {
    flex-direction: row;
    max-width: none;
  }
}

.nav-button {
  padding: 13px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  color: var(--text-primary);
  cursor: pointer;
  transition:
    all 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  font-weight: 500;
  position: relative;
  box-shadow: var(--shadow-md);
  min-width: 135px;
  justify-content: center;
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  letter-spacing: -0.01em;
  width: 100%;
  min-height: 44px;
}
@media (min-width: 768px) {
  .nav-button {
    width: auto;
  }
}

.nav-button svg {
  width: 17px;
  height: 17px;
  stroke: var(--text-secondary);
  stroke-width: 1.75;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.nav-button:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-xl);
  border-color: var(--text-primary);
  background: var(--text-primary);
  color: var(--bg);
}
.nav-button:hover svg {
  stroke: var(--bg);
  transform: scale(1.05);
}

.nav-button:active {
  transform: translateY(-1px);
  transition-duration: 0.1s;
}
.nav-item {
  position: relative;
}
.nav-item:hover .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
/* Mobile: Enable dropdown via JS click */
.nav-item.active .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
@media (min-width: 1024px) {
  .nav-item:hover .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
  }
}


.nav-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  background: var(--accent-red, #e60000);
  color: #fff;
  padding: 4px 9px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.68rem;
  min-width: 22px;
  text-align: center;
  box-shadow:
    0 4px 12px rgba(230, 0, 0, 0.3),
    0 0 20px rgba(230, 0, 0, 0.15);
  z-index: 2;
  border: 2px solid var(--bg);
  letter-spacing: 0.02em;
  animation: badgePulse 2.5s ease-in-out infinite;
}

/* Dropdown */
.dropdown {
  position: absolute;
  bottom: calc(100% + 35px);
  left: 50%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(6px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 20;
  min-width: 240px;
  background: var(--surface-glass);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-lg);
  padding: 8px;
  box-shadow: var(--shadow-xl);
}
.dropdown::before {
  content: "";
  position: absolute;
  bottom: -35px;
  left: 0;
  right: 0;
  height: 35px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.15s ease;
  font-size: 0.85rem;
  text-align: left;
}
.dropdown-item:hover {
  background: var(--hover-bg);
  border-color: var(--border-subtle);
}
.dropdown-item:hover svg {
  stroke: var(--text-primary);
}

.dropdown-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: var(--text-muted);
  stroke-width: 1.75;
  transition: all 0.15s ease;
}
.dropdown-item .item-text {
  flex: 1;
}
.dropdown-item strong {
  display: block;
  font-weight: 600;
  margin-bottom: 1px;
  letter-spacing: -0.01em;
  font-size: 0.84rem;
}
.dropdown-item small {
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.35;
}
.dropdown-more {
  border-top: 1px solid var(--border-subtle);
  margin-top: 2px;
  padding-top: 10px;
}
.dropdown-more strong {
  color: var(--accent);
  font-weight: 600;
}

/* ========== CONTACT ROW (Homepage) ========== */
.contact-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
  position: relative;
  z-index: 10;
  opacity: 0;
  animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.3s forwards;
  flex-direction: column;
  width: 100%;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}
@media (min-width: 768px) {
  .contact-row {
    flex-direction: row;
    max-width: none;
  }
}

.contact-btn {
  padding: 11px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  font-size: 0.82rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  position: relative;
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  letter-spacing: -0.01em;
  width: 100%;
  justify-content: center;
  min-height: 44px;
}
@media (min-width: 768px) {
  .contact-btn {
    width: auto;
  }
}

.contact-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: all 0.2s ease;
}
.contact-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
  color: var(--text-primary);
}
.contact-btn:hover svg {
  opacity: 1;
}
.contact-btn.primary:hover {
  box-shadow: var(--shadow-xl);
}

.contact-btn.primary {
  background: var(--text-primary);
  color: var(--bg);
  border-color: var(--text-primary);
}
.contact-btn.primary svg {
  opacity: 1;
}
.cv-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  background: var(--accent-red);
  color: #fff;
  padding: 3px 8px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.62rem;
  line-height: 1.2;
  text-align: center;
  box-shadow: 0 4px 12px rgba(230, 0, 0, 0.3);
  z-index: 2;
  border: 2px solid var(--bg);
  animation: badgePulse 2.5s ease-in-out infinite;
}

/* ========== FOOTER ========== */
.footer-info {
  width: 100%;
  margin-top: 32px;
  opacity: 0;
  animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.4s forwards;
}
.footer-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  text-align: center;
}
.footer-text a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
}
.footer-text a:hover {
  color: var(--text-primary);
}

/* Terminal link in footer */
.footer-text .terminal-link {
  color: var(--text-muted);
  text-decoration: none;
  font-family:
    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
  opacity: 0.6;
  transition: opacity 0.2s;
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-flex;
  align-items: center;
}
.footer-text .terminal-link:hover {
  opacity: 1;
}

/* ========== PROJECTS LIVE BADGE (nav) ========== */
@keyframes pulseNavLive {
  0% {
    box-shadow: 0 0 0 0 rgba(39, 201, 63, 0.35);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(39, 201, 63, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(39, 201, 63, 0);
  }
}
.nav-button .dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  animation: pulseNavLive 1.6s infinite;
  opacity: 0.9;
}
.live-dot {
  width: 8px;
  height: 8px;
  background: #27c93f;
  border-radius: 50%;
  flex-shrink: 0;
  margin-left: auto;
  box-shadow: 0 0 8px rgba(39, 201, 63, 0.6);
  animation: liveDotBlink 1.5s ease-in-out infinite;
}
@keyframes liveDotBlink {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 8px rgba(39, 201, 63, 0.6);
  }
  50% {
    opacity: 0.4;
    box-shadow: 0 0 4px rgba(39, 201, 63, 0.3);
  }
}


/* ========== SUBPAGE DETAIL CARDS ========== */
.detail-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  overflow: hidden;
  position: relative;
  transform: translateY(0);
}
.detail-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), 
    rgba(59, 130, 246, 0.08) 0%, 
    transparent 50%);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
.detail-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0);
  transition: box-shadow 0.3s ease;
  pointer-events: none;
}
.detail-card:nth-child(2) {
  animation-delay: 0.08s;
}
.detail-card:nth-child(3) {
  animation-delay: 0.16s;
}
.detail-card:nth-child(4) {
  animation-delay: 0.24s;
}
.detail-card:nth-child(5) {
  animation-delay: 0.32s;
}
.detail-card:nth-child(6) {
  animation-delay: 0.4s;
}
.detail-card:nth-child(7) {
  animation-delay: 0.48s;
}
@media (min-width: 1024px) {
  .detail-card:hover {
    border-color: rgba(59, 130, 246, 0.3);
    background: var(--surface);
    box-shadow: 
      0 12px 48px -12px rgba(59, 130, 246, 0.2),
      0 8px 24px -8px rgba(0, 0, 0, 0.08),
      0 0 0 1px rgba(59, 130, 246, 0.08);
    transform: translateY(-8px) scale(1.005);
  }
  .detail-card:hover::before {
    opacity: 1;
  }
  .detail-card:hover::after {
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.15);
  }
}


.detail-card .card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 24px 24px 0;
  margin-bottom: 0;
}
.detail-card .card-icon {
  width: 50px;
  height: 50px;
  background: var(--surface-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@media (min-width: 1024px) {
  .detail-card:hover .card-icon {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.15);
  }
  .detail-card:hover .card-icon svg {
    stroke: #3b82f6;
    transform: scale(1.1);
  }
}

.detail-card .card-icon svg {
  width: 22px;
  height: 22px;
  stroke: var(--text-primary);
  stroke-width: 1.75;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.detail-card .card-title {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.detail-card .card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 500;
}
.detail-card .card-body {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.7;
  padding: 16px 24px 0;
}
.detail-card .card-body p {
  margin: 0 0 10px;
}
.detail-card .card-body ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.detail-card .card-body li {
  padding: 4px 0;
  padding-left: 20px;
  position: relative;
  font-size: 0.84rem;
  line-height: 1.6;
}
.detail-card .card-body li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3b82f6;
  opacity: 0.5;
}
.detail-card .card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 16px 24px 20px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}
.detail-card .card-tag {
  padding: 4px 11px;
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.12);
  border-radius: 100px;
  font-size: 0.7rem;
  color: #3b82f6;
  font-weight: 600;
  transition: all 0.2s ease;
}
@media (min-width: 1024px) {
  .detail-card .card-tag:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.4);
    color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
  }
}


/* Project card special */
.detail-card .project-meta {
  display: flex;
  gap: 12px;
  margin-top: 0;
  padding: 12px 24px 0;
  flex-wrap: wrap;
}
.project-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.project-meta-item svg {
  width: 13px;
  height: 13px;
  stroke: var(--text-muted);
  stroke-width: 2;
}

/* Skills page groups */
.skill-group {
  margin-bottom: 0;
  padding: 16px 24px 20px;
}
.skill-group-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.skill-group-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.skill-chip {
  padding: 8px 16px;
  background: var(--hover-bg);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}
.skill-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.skill-chip:hover svg {
  opacity: 1;
}

.skill-chip svg {
  width: 14px;
  height: 14px;
  opacity: 0.5;
}

/* Cert detail */
.cert-detail-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.25s ease;
}
.detail-card:hover .cert-detail-icon {
  background: #3b82f6;
  border-color: #3b82f6;
}
.detail-card:hover .cert-detail-icon svg {
  stroke: #fff;
}

.cert-detail-icon svg {
  width: 22px;
  height: 22px;
  stroke: #3b82f6;
  stroke-width: 1.75;
  transition: stroke 0.25s ease;
}

/* ========== BACKGROUND TEXT ========== */
.testimonials-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding: 25px 0;
  mask-image: radial-gradient(
    ellipse 55% 45% at 50% 50%,
    transparent 0%,
    transparent 30%,
    rgba(0, 0, 0, 0.1) 45%,
    rgba(0, 0, 0, 0.3) 55%,
    rgba(0, 0, 0, 0.6) 68%,
    black 85%
  );
  -webkit-mask-image: radial-gradient(
    ellipse 55% 45% at 50% 50%,
    transparent 0%,
    transparent 30%,
    rgba(0, 0, 0, 0.1) 45%,
    rgba(0, 0, 0, 0.3) 55%,
    rgba(0, 0, 0, 0.6) 68%,
    black 85%
  );
  contain: layout style;
}

/* Subpages: hide background text entirely */
.page-sub .testimonials-bg,
.page-sub #snake-canvas,
.page-sub #badge-canvas {
  display: none !important;
}
.testimonial-row {
  display: flex;
  justify-content: center;
  gap: 0;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow: hidden;
  transform: translateZ(0);
  contain: layout style;
}
.testimonial-item {
  display: inline-flex;
  align-items: center;
  gap: 0;
  font-size: 0.7rem;
  font-family: "Retropix", monospace;
  flex-shrink: 0;
}
.testimonial-separator {
  margin: 0 8px;
}
.testimonial-char {
  display: inline-block;
  color: var(--text-hidden);
}
.testimonial-username {
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.testimonial-quote {
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* ========== SNAKE CANVAS ========== */
#snake-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

/* ========== 3D NAME TAG / BADGE CANVAS ========== */
#badge-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 40;
}

/* ========== SNAKE HUD ========== */
.snake-hud {
  position: fixed;
  top: 18px;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--surface-glass);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  z-index: 1000;
  letter-spacing: -0.01em;
  min-height: 36px;
  user-select: none;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-8px) scale(0.95);
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.snake-hud.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0) scale(1);
}

.snake-hud:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
}

.snake-hud-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.25);
    opacity: 1;
  }
}

.snake-hud strong {
  color: var(--text-primary);
  font-weight: 600;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  display: inline-block;
  transition: transform 0.2s ease;
}

.snake-hud-divider {
  opacity: 0.3;
  font-size: 0.75rem;
}

.snake-hud.score-pop #snake-score {
  animation: score-pop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes score-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.45); color: #22c55e; }
  100% { transform: scale(1); }
}

.snake-hud.game-over {
  animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97);
  border-color: var(--accent-red);
}

@keyframes shake {
  10%, 90% { transform: translate3d(calc(-50% - 2px), 0, 0); }
  20%, 80% { transform: translate3d(calc(-50% + 2px), 0, 0); }
  30%, 50%, 70% { transform: translate3d(calc(-50% - 3px), 0, 0); }
  40%, 60% { transform: translate3d(calc(-50% + 3px), 0, 0); }
}

.page-sub .snake-hud {
  display: none !important;
}

/* ========== TOAST ========== */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(80px) scale(0.95);
  background: var(--text-primary);
  color: var(--bg);
  padding: 12px 24px;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  opacity: 0;
  z-index: 2000;
  backdrop-filter: blur(12px);
  letter-spacing: -0.01em;
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.toast.show {
  transform: translateX(-50%) translateY(0) scale(1);
  opacity: 1;
}

/* ========== RESPONSIVE ========== */
/* Mobile Performance: Disable heavy effects on small screens */
@media (max-width: 767px) {
  /* Layout & container padding */
  body.page-home {
    padding: 24px 12px 36px;
  }
  .container {
    padding: 10px 8px;
    max-width: 100%;
  }

  /* Header & Avatar */
  header {
    margin-bottom: 18px;
  }
  .avatar {
    width: 68px;
    height: 68px;
    margin: 0 auto 14px;
    border-radius: 18px;
  }

  /* Typography on mobile */
  h1 {
    font-size: 1.75rem;
    line-height: 1.25;
    margin-bottom: 8px;
    letter-spacing: -0.035em;
  }
  html[lang="ar"] h1 {
    font-size: 1.85rem;
    letter-spacing: 0;
  }

  .hero-statement {
    font-size: 0.95rem;
    margin-bottom: 12px;
    line-height: 1.4;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35ch;
    min-height: 26px;
  }
  html[lang="ar"] .hero-statement {
    font-size: 0.98rem;
  }

  .bio {
    font-size: 0.85rem;
    line-height: 1.62;
    max-width: 360px;
    margin: 0 auto 18px;
    padding: 0 4px;
    letter-spacing: -0.005em;
  }
  html[lang="ar"] .bio {
    font-size: 0.88rem;
    line-height: 1.75;
    max-width: 370px;
  }

  /* Tech badges */
  .tech-badges {
    gap: 6px;
    max-width: 340px;
    margin: 0 auto;
  }
  .badge {
    padding: 5px 11px;
    font-size: 0.72rem;
    min-height: 28px;
  }

  /* Navigation on mobile */
  .nav-container {
    max-width: 360px;
    width: 100%;
    gap: 10px;
  }
  .nav-button {
    padding: 13px 18px;
    font-size: 0.92rem;
    min-height: 50px;
  }

  /* Simplify glassmorphic effects */
  .theme-toggle,
  .back-nav,
  .dropdown {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  
  /* Hide background effects on mobile for better performance */
  .testimonials-bg,
  #snake-canvas,
  .snake-hud {
    display: none !important;
  }
  
  /* Reduce shadow complexity */
  .nav-button,
  .contact-btn,
  .detail-card {
    box-shadow: var(--shadow-sm);
  }
}

@media (max-width: 380px) {
  h1 {
    font-size: 1.55rem;
  }
  .hero-statement {
    font-size: 0.88rem;
  }
  .bio {
    font-size: 0.80rem;
    line-height: 1.58;
  }
}

/* Tablet optimizations */
@media (min-width: 768px) and (max-width: 1023px) {
  body.page-home {
    padding: 60px 30px;
  }
}

/* Desktop optimizations */
@media (min-width: 1024px) {
  /* Re-enable hover effects only on desktop */
  .nav-button:hover,
  .contact-btn:hover,
  .badge:hover {
    transform: translateY(-2px);
  }
}

/* ========== LANGUAGE TOGGLE ========== */
.lang-toggle {
  position: fixed;
  top: 16px;
  right: 78px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 14px;
  background: var(--surface-glass);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  cursor: pointer;
}
@media (min-width: 768px) {
  .lang-toggle {
    top: 24px;
    right: 90px;
    height: 30px;
  }
}
.lang-toggle:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
}

/* ========== ARABIC / RTL ========== */
html[lang="ar"],
html[lang="ar"] body,
html[lang="ar"] button,
html[lang="ar"] input,
html[lang="ar"] textarea,
html[lang="ar"] select,
html[lang="ar"] .nav-button,
html[lang="ar"] .contact-btn,
html[lang="ar"] .back-nav {
  font-family:
    "Cairo",
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
}
/* Arabic script is cursive — letter-spacing breaks letter joining */
html[lang="ar"] * {
  letter-spacing: normal;
}
html[lang="ar"] .testimonial-item {
  font-family: "Cairo", sans-serif;
}

html[dir="rtl"] body.page-sub {
  text-align: right;
}
html[dir="rtl"] .theme-toggle {
  right: auto;
  left: 16px;
  direction: ltr;
}
html[dir="rtl"] .lang-toggle {
  right: auto;
  left: 78px;
}
@media (min-width: 768px) {
  html[dir="rtl"] .theme-toggle {
    left: 24px;
    direction: ltr;
  }
  html[dir="rtl"] .lang-toggle {
    left: 90px;
  }
}
html[dir="rtl"] .back-nav {
  left: auto;
  right: 16px;
}
@media (min-width: 768px) {
  html[dir="rtl"] .back-nav {
    right: 24px;
  }
}
html[dir="rtl"] .back-nav:hover {
  transform: translateX(2px);
}
html[dir="rtl"] .back-nav svg {
  transform: scaleX(-1);
}
html[dir="rtl"] .dropdown {
  min-width: 270px;
}
html[dir="rtl"] .dropdown-item,
html[dir="rtl"] .dropdown-item .item-text {
  text-align: right;
}
html[dir="rtl"] .dropdown-more {
  flex-direction: row-reverse;
  justify-content: space-between;
}
html[dir="rtl"] .dropdown-more .item-text {
  text-align: right;
  flex: 1;
}
html[dir="rtl"] .dropdown-more svg {
  transform: scaleX(-1);
  flex-shrink: 0;
  transition: transform 0.2s ease, stroke 0.15s ease;
}
html[dir="rtl"] .dropdown-more:hover svg {
  transform: scaleX(-1) translateX(3px);
}
html[dir="rtl"] .snake-hud {
  left: 50%;
  right: auto;
  transform: translateX(-50%) translateY(-8px) scale(0.95);
}
html[dir="rtl"] .snake-hud.show {
  transform: translateX(-50%) translateY(0) scale(1);
}
html[dir="rtl"] .nav-badge {
  right: auto;
  left: -10px;
}
html[dir="rtl"] .status-dot {
  margin-right: 0;
  margin-left: 2px;
}
html[dir="rtl"] .cursor {
  margin-left: 0;
  margin-right: 1px;
}
html[dir="rtl"] .live-dot {
  margin-left: 0;
  margin-right: auto;
}
html[dir="rtl"] .detail-card .card-body li {
  padding-left: 0;
  padding-right: 20px;
}
html[dir="rtl"] .detail-card .card-body li::before {
  left: auto;
  right: 6px;
}
html[dir="rtl"] .terminal-link {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-flex;
  align-items: center;
}

/* ========== 3D BADGE INSPECTION MODAL ========== */
#badge-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(4, 7, 13, 0.68);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

body.badge-inspecting #badge-backdrop {
  opacity: 1;
  pointer-events: auto;
}

body.badge-inspecting #badge-canvas {
  z-index: 9999;
  pointer-events: auto;
}

.badge-close-btn {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(15, 22, 36, 0.85);
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 10001;
  opacity: 0;
  pointer-events: none;
}

html[dir="rtl"] .badge-close-btn {
  right: auto;
  left: 24px;
}

body.badge-inspecting .badge-close-btn {
  opacity: 1;
  pointer-events: auto;
}

.badge-close-btn:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.6);
  color: #38bdf8;
  transform: scale(1.08) rotate(90deg);
}

.badge-inspect-hint {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(11, 16, 28, 0.90);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 8px 22px;
  border-radius: 999px;
  color: #cbd5e1;
  font-family: 'SF Mono', monospace, -apple-system;
  font-size: 13px;
  letter-spacing: 0.5px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.4s ease;
}

body.badge-inspecting .badge-inspect-hint {
  opacity: 1;
}

@media (max-width: 640px) {
  .badge-close-btn {
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
  }
  html[dir="rtl"] .badge-close-btn {
    left: 16px;
  }
  .badge-inspect-hint {
    bottom: 24px;
    font-size: clamp(9.5px, 2.75vw, 11px);
    padding: 7px 16px;
    max-width: 95vw;
    white-space: nowrap;
    letter-spacing: 0.2px;
  }
}

/* ========== BLOG / ACTIVITY LOG ========== */
.blog-timeline {
  position: relative;
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.blog-timeline-item {
  display: grid;
  grid-template-columns: 140px 60px 1fr;
  align-items: start;
  position: relative;
}

.blog-timeline-aside {
  text-align: right;
  padding-top: 26px;
  padding-right: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.blog-date {
  font-size: 0.82rem;
  font-weight: 700;
  color: #3b82f6;
  line-height: 1.3;
  letter-spacing: 0.02em;
}

.blog-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.blog-badge-release {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.25);
}

.blog-badge-devops {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.25);
}

.blog-badge-cloud {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.25);
}

.blog-badge-mobile {
  background: rgba(168, 85, 247, 0.12);
  color: #a855f7;
  border-color: rgba(168, 85, 247, 0.25);
}

.blog-badge-milestone {
  background: rgba(236, 72, 153, 0.12);
  color: #ec4899;
  border-color: rgba(236, 72, 153, 0.25);
}

.blog-timeline-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  padding-top: 28px;
  height: 100%;
}

.blog-timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3b82f6;
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px #3b82f6;
  z-index: 10;
  flex-shrink: 0;
  position: relative;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.blog-timeline-dot::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
}

.blog-timeline-line {
  width: 2px;
  flex-grow: 1;
  background: var(--border);
  margin-top: 0;
}

.blog-timeline-item:last-child .blog-timeline-line {
  background: linear-gradient(to bottom, var(--border), transparent);
}

.blog-timeline-content {
  padding-left: 16px;
  padding-bottom: 2.25rem;
}

.blog-card {
  margin-bottom: 0;
  scroll-margin-top: 80px;
}

.blog-card .card-header {
  padding: 24px 24px 0;
  margin-bottom: 0;
  align-items: flex-start;
}

.blog-card-header-text {
  flex: 1;
}

.blog-card .card-body {
  padding: 14px 24px 0;
}

.blog-card .card-body p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.65;
  margin-bottom: 16px;
}

.blog-card-meta-mobile {
  display: none;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.blog-card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.blog-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 8px;
  padding: 6px 14px;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.blog-link svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
  transition: transform 0.2s ease;
}

.blog-link:hover {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}

.blog-link:hover svg {
  transform: translateX(2px);
}

.blog-link-subtle {
  color: var(--text-secondary);
  background: var(--surface);
  border-color: var(--border);
}

.blog-link-subtle:hover {
  color: var(--text-primary);
  background: var(--surface);
  border-color: var(--text-secondary);
}

.blog-card .card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 16px 24px 20px;
  margin-top: 16px;
  border-top: 1px solid var(--border);
}

@media (min-width: 1024px) {
  .blog-timeline-item:hover .blog-timeline-dot {
    transform: scale(1.25);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25);
  }

  .blog-timeline-item:hover .blog-card {
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow:
      0 12px 48px -12px rgba(59, 130, 246, 0.22),
      0 8px 24px -8px rgba(0, 0, 0, 0.08),
      0 0 0 1px rgba(59, 130, 246, 0.1);
    transform: translateY(-4px) scale(1.004);
  }
}

/* Mobile Blog View */
@media (max-width: 767px) {
  .blog-timeline-item {
    grid-template-columns: 24px 1fr;
  }

  .blog-timeline-aside {
    display: none;
  }

  .blog-card-meta-mobile {
    display: flex;
  }

  .blog-timeline-connector {
    padding-top: 24px;
  }

  .blog-timeline-content {
    padding-left: 12px;
    padding-bottom: 1.75rem;
  }

  .blog-timeline-dot {
    width: 13px;
    height: 13px;
  }

  .blog-timeline-dot::after {
    width: 5px;
    height: 5px;
  }

  .blog-card .card-header {
    padding: 18px 18px 0;
  }

  .blog-card .card-body {
    padding: 12px 18px 0;
  }

  .blog-card .card-tags {
    padding: 12px 18px 16px;
  }
}

/* RTL Support */
html[dir="rtl"] .blog-timeline-aside {
  text-align: left;
  padding-right: 0;
  padding-left: 18px;
  align-items: flex-start;
}

html[dir="rtl"] .blog-timeline-content {
  padding-left: 0;
  padding-right: 16px;
}

@media (max-width: 767px) {
  html[dir="rtl"] .blog-timeline-content {
    padding-left: 0;
    padding-right: 12px;
  }
}

html[dir="rtl"] .blog-link:hover svg {
  transform: translateX(-2px);
}
