/* --- Modern Design System Tokens --- */
:root {
  --primary-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --accent-blue: #3b82f6;
  --accent-orange: #f59e0b;
  --accent-success: #10b981;
  --accent-danger: #ef4444;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --card-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  --filter-bg: #f8f9fa;
  --filter-btn-bg: #ffffff;
  --filter-btn-active: var(--accent-blue);
}

/* Dark Mode Color Overrides */
body.dark-mode {
  --accent-blue: #60a5fa;
  /* Lighter blue for dark mode */
  --accent-orange: #fbbf24;
  --accent-success: #34d399;
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
  --filter-bg: #1e293b;
  --filter-btn-bg: #334155;
}

body.dark-mode .text-primary,
body.dark-mode .btn-link {
  color: var(--accent-blue) !important;
}

/* Hero Section Styles */
.hero-section {
  background: var(--primary-gradient) !important;
  color: #ffffff !important;
  padding: 100px 20px;
  text-align: center;
  margin-bottom: 50px;
  border-radius: 24px;
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
  animation: pulse 10s infinite alternate;
  pointer-events: none;
}

@keyframes pulse {
  0% {
    transform: translate(0, 0);
  }

  100% {
    transform: translate(5%, 5%);
  }
}

.hero-title {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
  color: #ffffff !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.9) !important;
  margin-bottom: 2.5rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.7;
  font-weight: 400;
}

.hero-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.hero-btn {
  display: inline-block;
  padding: 14px 32px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid transparent;
  cursor: pointer;
}

.hero-btn-primary {
  background-color: var(--accent-blue);
  color: #ffffff;
  box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
}

.hero-btn-primary:hover {
  background-color: #2563eb;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
  color: #ffffff;
  text-decoration: none;
}

.hero-btn-secondary {
  background-color: transparent;
  border-color: rgba(255, 255, 255, 0.5);
  color: #ffffff;
}

.hero-btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: #ffffff;
  transform: translateY(-3px);
  text-decoration: none;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2.5rem;
  }

  .hero-subtitle {
    font-size: 1.1rem;
  }

  .hero-section {
    padding: 60px 20px;
    border-radius: 16px;
  }
}

/* Profile Card Styles */
.profile-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 32px;
  text-align: center;
  box-shadow: var(--card-shadow);
  margin-bottom: 30px;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

.profile-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--card-shadow-hover);
}

.profile-avatar img {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 20px;
  border: 4px solid #ffffff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.profile-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 12px;
}

/* Global Card Component Upgrade */
.card {
  border: 1px solid rgba(0, 0, 0, 0.05) !important;
  border-radius: 16px !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  background: #ffffff;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--card-shadow-hover) !important;
  border-color: var(--accent-blue) !important;
}

.profile-tag {
  background-color: rgba(59, 130, 246, 0.08);
  color: var(--accent-blue);
  padding: 6px 16px;
  border-radius: 100px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid rgba(59, 130, 246, 0.1);
  display: inline-block;
  cursor: pointer;
}

.profile-tag:hover {
  background-color: var(--accent-blue);
  color: #ffffff;
  text-decoration: none;
  transform: scale(1.05);
}

/* Enhanced Buttons */
.btn-outline-primary {
  border: 2px solid var(--accent-blue) !important;
  color: var(--accent-blue) !important;
  border-radius: 10px;
  font-weight: 600;
}

.btn-outline-orange {
  border: 2px solid var(--accent-orange) !important;
  color: var(--accent-orange) !important;
  border-radius: 10px;
  background: transparent;
}

.btn-outline-orange:hover {
  background-color: var(--accent-orange) !important;
  color: #ffffff !important;
}

.btn-outline-success {
  border: 2px solid var(--accent-success) !important;
  color: var(--accent-success) !important;
  border-radius: 10px;
}

.btn-outline-success:hover {
  background-color: var(--accent-success) !important;
  color: #ffffff !important;
}

.btn-outline-danger {
  border: 2px solid var(--accent-danger) !important;
  color: var(--accent-danger) !important;
  border-radius: 10px;
}

.btn-outline-danger:hover {
  background-color: var(--accent-danger) !important;
  color: #ffffff !important;
}


/* Restore sticky TOC */
.toc-container {
  position: sticky;
  margin: 0;
  position: relative;
  left: 16px;
  top: 13px;
  font-size: 19px;
  z-index: 2147483647 !important;
  /* Max z-index to ensure visibility */
}

#return-to-top:hover,
#go-to-bottom:hover {
  background: rgba(0, 0, 0, 0.9);
}

#return-to-top:hover i,
#go-to-bottom:hover i {
  color: #fff;
  top: 5px;
}

/* --------------------------
   About Page Styles
   -------------------------- */

/* Profile Sidebar */
.profile-sidebar {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 40px 30px;
  border-radius: 24px;
  box-shadow: var(--card-shadow);
  text-align: center;
  position: sticky !important;
  top: 130px;
  z-index: 10;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 1px solid var(--glass-border);
}

.profile-sidebar:hover {
  transform: translateY(-5px);
  box-shadow: var(--card-shadow-hover);
}

.social-links li a {
  display: inline-block;
  width: 44px;
  height: 44px;
  line-height: 44px;
  background: rgba(59, 130, 246, 0.05);
  border-radius: 12px;
  color: var(--accent-blue);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(59, 130, 246, 0.1);
}

.social-links li a:hover {
  background: var(--accent-blue);
  color: #fff;
  transform: translateY(-3px) rotate(8deg);
  box-shadow: 0 5px 15px rgba(59, 130, 246, 0.3);
}

/* Timeline Upgrade */
.timeline {
  position: relative;
  padding-left: 40px;
  border-left: none;
  /* Removed old border */
}

.timeline::before {
  content: '';
  position: absolute;
  left: 17px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--accent-blue) 0%, rgba(59, 130, 246, 0.1) 100%);
  border-radius: 3px;
}

.timeline-item {
  position: relative;
  margin-bottom: 40px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -31px;
  top: 5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--accent-blue);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
  transition: all 0.3s ease;
  z-index: 2;
}

.timeline-item:hover::before {
  transform: scale(1.3);
  background: var(--accent-blue);
}

.timeline-year {
  color: var(--accent-blue);
  background-color: rgba(59, 130, 246, 0.1);
  padding: 4px 14px;
  border-radius: 100px;
  display: inline-block;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  margin-bottom: 8px;
}


/* Skills */
.skill-category {
  background: #fff;
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
  margin-bottom: 30px;
}

.skill-title {
  border-bottom: 2px solid #f8f9fa;
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.skill-title i {
  color: #3b71ca;
  margin-right: 10px;
}

.skill-tags {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.skill-tags li {
  background: #f8f9fa;
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 0.9rem;
  color: #555;
  transition: all 0.3s ease;
}

.skill-tags li:hover {
  background: #3b71ca;
  color: #fff;
  transform: translateY(-2px);
}

/* GitHub Projects */
.github-project-card {
  background: #fff;
  padding: 25px;
  border-radius: 10px;
  border: 1px solid #e9ecef;
  transition: all 0.3s ease;
  margin-bottom: 20px;
}

.github-project-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.github-link {
  display: flex;
  align-items: center;
  font-weight: 700;
  color: #333;
  margin-bottom: 10px;
}

.github-link i {
  font-size: 1.2rem;
  margin-right: 10px;
}

.project-description {
  color: #666;
  font-size: 0.95rem;
  margin: 0;
}


/*   - - - - - - - - - - - - - - - - - - - - - - - - - -           Link Card Styles           - - - - - - - - - - - - - - - - - - - - - - - - - -   */
/* --- Advanced 3D Link Cards --- */
.links-page .row {
  perspective: 2000px;
  /* 為整區容器開啟 3D 空間視角 */
}

.link-card {
  transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.8s ease;
  cursor: pointer;
  transform-style: preserve-3d;
  /* 核心：允許子元素在 3D 空間中定位 */
  backface-visibility: hidden;
  will-change: transform;
  /* 關鍵修復：確保 hover 感應穩定 */
  pointer-events: auto;
  /* 確保卡片本身接收事件 */
}

/* 確保內部所有元素都不會干擾 hover 感應區域 */
.link-card>* {
  pointer-events: none;
}

/* 但要保留按鈕的可點擊性 */
.link-card .btn,
.link-card a {
  pointer-events: auto;
}

.link-card:hover {
  /* 移除 translateZ(15px)，改用單純的傾斜，防止卡片「撞到」或「逃離」鼠標導致閃爍 */
  transform: rotateX(6deg) rotateY(-4deg);
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.15),
    0 0 30px rgba(59, 113, 202, 0.1) !important;
  z-index: 10;
}

/* 內容層級深度感 (Parallax Effect) */
.link-card .card-body {
  transform: translateZ(40px);
  /* 讓內容浮出平面 40px */
  transform-style: preserve-3d;
}

.link-card .link-icon {
  transform: translateZ(60px);
  /* 讓圖示浮得最高 */
  filter: drop-shadow(0 15px 15px rgba(0, 0, 0, 0.25));
  transition: transform 0.6s ease;
}

.link-card .card-title {
  transform: translateZ(50px);
  /* 標題深度介於圖示與內容之間 */
  font-weight: 800;
}

.link-card .btn {
  transform: translateZ(35px);
  /* 按鈕稍微浮起 */
}

/* 點擊後的觸感反饋 */
.link-card:active {
  transform: rotateX(2deg) rotateY(-1deg) translateZ(5px);
  transition: transform 0.1s ease;
}

/* Ensure stretched link works even if Bootstrap utility is missing */
.stretched-link::after {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  pointer-events: auto;
  content: "";
  background-color: rgba(0, 0, 0, 0);
}

/*   - - - - - - - - - - - - - - - - - - - - - - - - - -           Dark Mode Styles           - - - - - - - - - - - - - - - - - - - - - - - - - -   */
body.dark-mode {
  background-color: #121212 !important;
  background-image: none !important;
  color: #e0e0e0 !important;
}

body.dark-mode .card,
body.dark-mode .profile-card,
body.dark-mode .skill-category,
body.dark-mode .github-project-card,
body.dark-mode .profile-sidebar {
  background-color: #1e1e1e !important;
  border-color: #333 !important;
  color: #e0e0e0 !important;
}

body.dark-mode .card-body {
  background-color: #1e1e1e !important;
}

body.dark-mode .card-title,
body.dark-mode .profile-name,
body.dark-mode .skill-title,
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
  color: #ffffff !important;
}

body.dark-mode .text-dark {
  color: #e0e0e0 !important;
}

body.dark-mode .text-muted {
  color: #a0a0a0 !important;
}

body.dark-mode a {
  color: #64b5f6 !important;
}

body.dark-mode a:hover {
  color: #90caf9 !important;
}

body.dark-mode .btn-outline-primary {
  color: #64b5f6 !important;
  border-color: #64b5f6 !important;
}

body.dark-mode .btn-outline-primary:hover {
  background-color: #64b5f6 !important;
  color: #121212 !important;
}

body.dark-mode .footer-section {
  background-color: #000000 !important;
  border-top: 1px solid #333 !important;
}

body.dark-mode .newsletter-section {
  background-color: #1e1e1e !important;
  border-bottom: 1px solid #333 !important;
}

body.dark-mode .timeline-item::before {
  background-color: #64b5f6 !important;
  box-shadow: 0 0 0 3px #333 !important;
}

body.dark-mode .skill-tags li {
  background-color: #333 !important;
  color: #e0e0e0 !important;
}

body.dark-mode .social-links li a {
  background-color: #333 !important;
  color: #e0e0e0 !important;
}

/*   - - - - - - - - - - - - - - - - - - - - - - - - - -           S c r o l l   B u t t o n s   ( T o p   &   B o t t o m )           - - - - - - - - - - - - - - - - - - - - - - - - - -   */
#return-to-top,
#go-to-bottom {
  position: fixed;
  right: 30px;
  width: 50px;
  height: 50px;
  background: rgba(0, 0, 0, 0.5);
  /* Semi-transparent dark base */
  border-radius: 50%;
  z-index: 99999 !important;
  /* Force on top */
  transition: all 0.3s ease;

  /* CRITICAL: Override theme's visibility: hidden and opacity: 0 */
  visibility: visible !important;
  opacity: 1 !important;

  /* Centering Icons */
  display: block;
  /* jQuery fadeIn works best with block/inline */
  text-align: center;
  line-height: 50px;
  /* Vertically center the icon */
  font-size: 20px;
  text-decoration: none;
  /* Remove underline */
}

/* Positioning */
#return-to-top {
  bottom: 30px;
}

#go-to-bottom {
  bottom: 90px;
  /* Stacked above the top button */
}

/* Icon Styles */
#return-to-top i,
#go-to-bottom i {
  color: #fff;
  position: static;
  /* Remove any absolute positioning from theme */
  margin: 0;
  line-height: 50px;
  /* Ensure line-height inheritance/match */
}

/* Hover Effects */
#return-to-top:hover,
#go-to-bottom:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

#return-to-top:hover i,
#go-to-bottom:hover i {
  color: #fff;
  /* Keep white */
}

/* Dark Mode Overrides */
body.dark-mode #return-to-top,
body.dark-mode #go-to-bottom {
  background: rgba(255, 255, 255, 0.2);
}

body.dark-mode #return-to-top:hover,
body.dark-mode #go-to-bottom:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* Links Page Sidebar */
.sticky-sidebar {
  position: -webkit-sticky;
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 15px;
  z-index: 100;
}

/* Ensure parent containers allow sticky */
body,
html {
  overflow-x: unset;
}

.links-page,
.section-sm,
.container,
.row {
  overflow: visible !important;
}

.sticky-sidebar::-webkit-scrollbar {
  width: 6px;
}

.sticky-sidebar::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 4px;
}

/* Adjust card z-index for stretched-link + button compatibility */
.z-index-2 {
  z-index: 2;
  position: relative;
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* --------------------------
   Featured Slider Styles
   -------------------------- */
.featured-post-slider {
  position: relative;
}

.featured-post-thumb {
  flex: 0 0 300px;
  /* Fixed width for image container */
  max-width: 300px;
}

.featured-post-thumb img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 5px;
}

.featured-post-content {
  flex: 1;
  padding-left: 20px;
}

.card-style {
  background: #fff;
  border: 1px solid #e1e4e8;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  margin: 5px;
  /* Add margin to avoid shadow cutoff */
}

/* Slick Dots Customization */
.featured-post-slider .slick-dots {
  bottom: 0px;
  right: 20px;
  text-align: right;
  width: auto;
}

.featured-post-slider .slick-dots li button:before {
  font-size: 10px;
  opacity: 0.5;
}

.featured-post-slider .slick-dots li.slick-active button:before {
  opacity: 1;
  color: #3b71ca;
}

/* Dark Mode Support for Slider */
body.dark-mode .card-style {
  background-color: #1e1e1e;
  border-color: #333;
}

body.dark-mode .featured-post-content h3 a {
  color: #fff !important;
}

/* Responsive */
@media (max-width: 768px) {
  .card-style {
    flex-direction: column;
  }

  .featured-post-thumb {
    flex: 0 0 auto;
    max-width: 100%;
    margin-right: 0 !important;
    margin-bottom: 15px;
  }

  .featured-post-thumb img {
    height: auto;
    max-height: 200px;
  }

  .featured-post-content {
    padding-left: 0;
  }
}

/* --------------------------
   Recipe Content Styles
   -------------------------- */
.recipe-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  overflow: hidden;
}

.recipe-content th {
  background-color: #3b71ca;
  color: #ffffff;
  padding: 12px 15px;
  text-align: left;
  font-weight: 600;
}

.recipe-content td {
  padding: 12px 15px;
  border-bottom: 1px solid #e9ecef;
}

.recipe-content tr:last-of-type td {
  border-bottom: 2px solid #3b71ca;
}

.recipe-content tr:nth-of-type(even) {
  background-color: #f8f9fa;
}

.recipe-content h4 {
  margin-top: 30px;
  margin-bottom: 15px;
  padding-left: 15px;
  border-left: 5px solid #3b71ca;
  color: #333;
  font-weight: 700;
}

.recipe-content img {
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin: 20px 0;
  max-width: 100%;
  height: auto;
}

/* Dark Mode Support for Recipes */
body.dark-mode .recipe-content table {
  background-color: #1e1e1e;
  box-shadow: none;
}

body.dark-mode .recipe-content th {
  background-color: #3b71ca;
  color: #ffffff;
}

body.dark-mode .recipe-content td {
  border-bottom-color: #333;
  color: #e0e0e0;
}

body.dark-mode .recipe-content tr:last-of-type td {
  border-bottom-color: #3b71ca;
}

body.dark-mode .recipe-content tr:nth-of-type(even) {
  background-color: #2d2d2d;
}

body.dark-mode .recipe-content h4 {
  color: #e0e0e0;
  border-left-color: #64b5f6;
}

/* Center text in related/recent posts */
.post-item {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

/* Orange/Terracotta Utilities for Real Estate Section */
.text-orange {
  color: #E07A5F !important;
}

.btn-outline-orange {
  color: #E07A5F;
  border: 1px solid #E07A5F !important;
  background-color: transparent;
}

.btn-outline-orange:hover {
  color: #fff;
  background-color: #E07A5F;
  border-color: #E07A5F;
}

/* --- Floating Glass Navbar --- */
.navigation {
  position: fixed;
  top: 15px;
  left: 0;
  right: 0;
  z-index: 1000;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: transparent;
}

.navigation .navbar {
  background: #ffffff !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 20px;
  margin: 0 20px;
  padding: 12px 24px !important;
  border: 1px solid rgba(0, 0, 0, 0.05) !important;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
  transition: all 0.4s ease;
}

/* Dark Mode Navbar */
body.dark-mode .navigation .navbar {
  background: #0f172a !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.nav-link {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  padding: 8px 16px !important;
  transition: all 0.3s ease !important;
  border-radius: 10px;
  color: #1e293b !important;
}

body.dark-mode .nav-link {
  color: #f1f5f9 !important;
}

.nav-link:hover {
  background: rgba(59, 130, 246, 0.08);
  color: var(--accent-blue) !important;
  transform: translateY(-2px);
}

.navbar-brand h3 {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  margin-bottom: 0;
  background: linear-gradient(135deg, var(--accent-blue), #6366f1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Sticky behavior logic via body class (will need small JS) */
body.scrolled .navigation {
  top: 10px;
}

body.scrolled .navigation .navbar {
  padding: 8px 24px !important;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
}

body.dark-mode.scrolled .navigation .navbar {
  background: rgba(15, 23, 42, 0.95) !important;
}

/* Reveal Animations Keyframes */
@keyframes fadeInUpReveal {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reveal-on-scroll {
  opacity: 0;
  animation: fadeInUpReveal 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* --------------------------
   Dropdown Hover Support (Desktop)
   -------------------------- */
@media (min-width: 992px) {
  .dropdown:hover .dropdown-menu {
    display: block;
    margin-top: 5px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    animation: fadeInSlide 0.3s ease forwards;
  }

  .dropdown-item {
    border-radius: 8px;
    font-weight: 500;
    padding: 10px 16px;
  }

  .dropdown-item:hover {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
    transform: translateX(5px);
  }
}

@keyframes fadeInSlide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --------------------------
   Links Page Sidebar Animation
   -------------------------- */
.sticky-sidebar .nav-link {
  position: relative;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  border-left: 3px solid transparent;
}

.sticky-sidebar .nav-link:hover {
  color: #3b71ca !important;
  background-color: rgba(59, 113, 202, 0.15);
  /* Increased opacity from 0.08 */
  border-left-color: #3b71ca;
  font-weight: 600;
  /* Add font weight for extra pop */
  padding-left: 1.25rem;
  /* Slide right effect */
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.05);
  /* Subtle shadow for depth */
}

/* Specific adjustment for sub-links to maintain hierarchy */
.sticky-sidebar .pl-3 .nav-link:hover {
  padding-left: 0.75rem !important;
  /* Adjust based on original padding? original is nav-link (1rem px usually) */
  /* Bootstrap nav-link has 1rem padding-left by default? No, usually 1rem. */
  /* Let's just trust the relative movement. */
  border-left-width: 2px;
}

/* Dark Mode Support for Sidebar */
body.dark-mode .sticky-sidebar .nav-link:hover {
  color: #64b5f6 !important;
  background-color: rgba(100, 181, 246, 0.1);
  border-left-color: #64b5f6;
}

/* --------------------------
   Hero Section Animations (Tech / Cyberpunk)
   -------------------------- */

/* 1. Tech Background Grid */
.hero-section {
  background:
    linear-gradient(rgba(59, 113, 202, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 113, 202, 0.1) 1px, transparent 1px),
    linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%) !important;
  background-size: 30px 30px, 30px 30px, 100% 100% !important;
  border: 1px solid rgba(59, 113, 202, 0.3);
  position: relative;
  overflow: hidden;
}

/* 2. Holographic Shimmer Title (Cleaner Tech Effect) */
.hero-title {
  position: relative;
  display: inline-block;
  color: #fff;
  background: linear-gradient(to right, #fff 20%, #3b71ca 40%, #E07A5F 60%, #fff 80%);
  background-size: 200% auto;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  animation: shimmer 5s linear infinite;
}

.hero-title::before,
.hero-title::after {
  display: none;
  /* Remove chaotic glitch layers */
}

@keyframes shimmer {
  to {
    background-position: 200% center;
  }
}

.hero-title:hover {
  text-shadow: 0 0 15px rgba(59, 113, 202, 0.5);
  transform: scale(1.05);
  /* Smooth zoom */
}

/* 3. Realistic Typing Reveal - Multi-line compatible */
.hero-subtitle {
  font-family: inherit;
  color: #fff !important;
  line-height: 1.8;
  margin: 0 auto 2rem auto;
  max-width: 800px;
  position: relative;
  display: inline-block;

  /* The Reveal: Using clip-path for character-by-character feel */
  clip-path: inset(0 100% 0 0);
  animation: revealSteps 4s steps(100) forwards;
  animation-delay: 0.8s;

  /* Ensure it wraps nicely on all screens */
  white-space: normal;
  overflow: visible;
}

/* The Cursor: Only appears after typing is done */
.hero-subtitle::after {
  content: '|';
  color: #E07A5F;
  font-weight: 900;
  display: inline-block;
  margin-left: 2px;
  opacity: 0;
  /* Hidden at start */
  animation:
    showCursor 0s forwards,
    blink-caret 0.75s step-end infinite;
  animation-delay: 4.8s;
  /* Appears exactly when typing ends (0.8 + 4) */
}

@keyframes revealSteps {
  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes showCursor {
  to {
    opacity: 1;
  }
}

@keyframes blink-caret {

  from,
  to {
    opacity: 0;
  }

  50% {
    opacity: 1;
  }
}

/* 4. Holographic Title Glow - Enhanced */
.hero-title {
  position: relative;
  background: linear-gradient(45deg,
      #ffffff 20%,
      #64b5f6 40%,
      #ffffff 50%,
      #64b5f6 60%,
      #ffffff 80%);
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shine 4s linear infinite;
  text-shadow: 0 0 25px rgba(100, 181, 246, 0.4) !important;
}

@keyframes shine {
  to {
    background-position: 200% center;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile Tweak: Ensure animation doesn't kill contrast on small screens */
@media (max-width: 768px) {
  .hero-subtitle {
    background-position: 0 0;
    /* Fully visible by default or simpler animation */
    -webkit-text-fill-color: #fff;
    background-clip: initial;
    -webkit-background-clip: initial;
    animation: fadeInUp 1s ease-out forwards;
  }
}

@keyframes typing {
  from {
    width: 0
  }

  to {
    width: 100%
  }
}

@keyframes blink-caret {

  from,
  to {
    border-color: transparent
  }

  50% {
    border-color: #E07A5F;
  }
}

/* --------------------------
   Footer Tech Styling
   -------------------------- */

/* Animated Scrolling Grid Background */
@keyframes gridScroll {
  from {
    background-position: 0 0, 0 0, 0 0;
  }

  to {
    background-position: 40px 40px, 40px 40px, 0 0;
  }
}

.footer-section {
  /* Light Mode Default: Light gray background with faint blue grid */
  background:
    linear-gradient(rgba(59, 113, 202, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 113, 202, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, #f8f9fa 0%, #e9ecef 100%) !important;
  background-size: 40px 40px, 40px 40px, 100% 100% !important;
  border-top: 1px solid rgba(59, 113, 202, 0.2);
  /* Subtle divider */
  position: relative;
  color: #555 !important;
  /* Darker text for light mode */
  animation: gridScroll 4s linear infinite;
}

/* Footer Headings */
.footer-section h6 {
  color: #333;
  /* Dark title */
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
  position: relative;
  display: inline-block;
  padding-bottom: 10px;
  font-weight: bold;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.footer-section h6::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 30px;
  height: 2px;
  background: #E07A5F;
  transition: width 0.3s ease;
  box-shadow: 0 0 5px #E07A5F;
}

.footer-section .col-lg-3:hover h6::after {
  width: 100%;
}

/* Footer Links & Rows */
.footer-section ul li {
  margin-bottom: 10px;
}

.footer-section a {
  color: #666 !important;
  transition: all 0.3s ease;
  text-decoration: none;
  display: flex;
  /* Flex for icon alignment */
  align-items: center;
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid transparent;
}

.footer-section a:hover {
  color: #3b71ca !important;
  background: rgba(59, 113, 202, 0.05);
  /* Lighter hover bg */
  border-color: rgba(59, 113, 202, 0.2);
  transform: translateX(5px);
  box-shadow: 0 2px 10px rgba(59, 113, 202, 0.1);
}

.footer-section i {
  color: #3b71ca;
  /* Tech blue icons */
  margin-right: 12px;
  transition: all 0.3s ease;
}

.footer-section a:hover i {
  color: #E07A5F;
  /* Orange on hover */
  transform: rotate(360deg) scale(1.2);
  /* Tech spin & pop */
  text-shadow: 0 0 5px #E07A5F;
}

/* Newsletter in Footer */
.newsletter-section {
  background: #121212 !important;
  border-bottom: 1px solid #333;
  padding: 40px 0;
}

.newsletter-section h2 {
  color: #fff;
  font-family: 'Courier New', monospace;
}

/* Cookie Box Styles (Restored & Tech-ified) */
.cookie-box {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  padding: 1rem 0;
  background: rgba(20, 20, 20, 0.98);
  border-top: 1px solid #3b71ca;
  color: #fdfdfd;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
}

.cookie-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  width: 100%;
  max-width: 1140px;
  /* Container width */
  padding: 0 15px;
}

.cookie-box-hide {
  display: none !important;
}

/* Dark Mode Overrides for Footer */
body.dark-mode .footer-section {
  /* Dark Mode: Deep black/grey with clearer grid */
  background:
    linear-gradient(rgba(59, 113, 202, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 113, 202, 0.1) 1px, transparent 1px),
    linear-gradient(to bottom, #1a1a1a 0%, #000 100%) !important;
  background-size: 40px 40px, 40px 40px, 100% 100% !important;
  color: #a0a0a0 !important;
  border-top-color: #64b5f6;
}

body.dark-mode .footer-section h6 {
  color: #fff;
}

body.dark-mode .footer-section a {
  color: #a0a0a0 !important;
}

body.dark-mode .footer-section a:hover {
  color: #fff !important;
  background: rgba(59, 113, 202, 0.2);
  border-color: rgba(59, 113, 202, 0.4);
}

/* --------------------------
   Content & Card Animations (Tech 3D)
   -------------------------- */

/* 全站文章與分類卡片通用的 3D 效果 */
.card,
.category-card {
  perspective: 1000px;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.8s ease;
  backface-visibility: hidden;
  will-change: transform;
}

/* 鎖定感應區域，防止 3D 位移導致的 Hover 迴圈 */
.card>*,
.category-card>* {
  pointer-events: none;
}

.card a,
.card .btn,
.category-card a {
  pointer-events: auto;
}

.card:hover,
.category-card:hover {
  /* 移除會導致元素高度變化的位移，只保留旋轉，穩定 hover 狀態 */
  transform: rotateX(5deg) rotateY(-2deg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15) !important;
  border-color: #3b71ca;
}

/* 卡片內部的深度分層 */
.card-body {
  transform: translateZ(25px);
  transform-style: preserve-3d;
}

.card img,
.card-title {
  transform: translateZ(40px);
  transition: transform 0.8s ease;
}

.card:hover img {
  transform: translateZ(50px) scale(1.05);
}

/* 側邊欄 3D 懸浮 */
.sidebar-nav .nav-link {
  transform-style: preserve-3d;
  transition: all 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.sidebar-nav .nav-link:hover {
  transform: translateZ(10px) translateX(5px);
  background-color: rgba(96, 165, 250, 0.1);
  box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.05);
}

/* 按鈕按壓 3D 效果 */
.btn {
  transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
  transform-style: preserve-3d;
}

.btn:hover {
  transform: translateZ(15px) translateY(-2px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.btn:active {
  transform: translateZ(2px) translateY(0);
}

/* Dark Mode Tech Card Adjustments */
body.dark-mode .card:hover,
body.dark-mode .category-card:hover {
  border-color: #64b5f6;
  box-shadow: 0 5px 15px rgba(100, 181, 246, 0.2);
  background-color: #2d2d2d !important;
}

/* --------------------------
   Theme Switch Icons & Visibility Enhancements
   -------------------------- */
.theme-switch {
  width: 60px !important;
  /* Wider switch */
  height: 30px !important;
  /* Taller switch */
  margin-bottom: 0 !important;
  /* Fix Bootstrap label margin */
  margin-top: 4px;
  /* Optically center it lower */
}

/* Fix Navbar Vertical Alignment */
@media (min-width: 992px) {
  .navbar-collapse {
    align-items: center !important;
  }
}

.theme-switch .slider {
  position: relative;
  border: 2px solid #ddd;
  /* Subtle border to define edges */
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  /* Inner shadow for depth */
}

/* Light Mode Background (Default) - Sky Blue */
.theme-switch .slider {
  background-color: #87CEEB;
}

/* Dark Mode Background (Checked) - Deep Space Blue */
input:checked+.slider {
  background-color: #1a1a2e !important;
  border-color: #555;
}

.theme-switch .slider:before {
  /* Adjust knob size and position for new dimensions */
  height: 22px !important;
  width: 22px !important;
  left: 2px !important;
  bottom: 2px !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.slider:before {
  transform: translateX(30px) !important;
  /* Adjust travel distance */
}

.theme-switch .sun-icon,
.theme-switch .moon-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  /* Larger icons */
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 1;
}

/* Sun Icon (Left) - Shows in Dark Mode */
.theme-switch .sun-icon {
  left: 8px;
  color: #ffffff;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
  /* Glow effect */
  opacity: 0;
  transform: translateY(-50%) rotate(-90deg);
  /* Rotate in effect */
}

/* Moon Icon (Right) - Shows in Light Mode */
.theme-switch .moon-icon {
  right: 8px;
  color: #f1c40f;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.3));
  opacity: 1;
  transform: translateY(-50%) rotate(0deg);
}

/* Interaction States */
input:checked+.slider .sun-icon {
  opacity: 1;
  transform: translateY(-50%) rotate(0deg);
}

input:checked+.slider .moon-icon {
  opacity: 0;
  transform: translateY(-50%) rotate(90deg);
  /* Rotate out effect */
}

/* Copy Button Styles */
.copy-button {
  position: absolute;
  top: 5px;
  right: 5px;
  display: none;
  border: 1px solid #ddd;
  background-color: #fff;
  color: #333;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
  z-index: 10;
  transition: all 0.2s;
}

pre:hover .copy-button {
  display: block;
}

.copy-button:hover {
  background-color: #f0f0f0;
  border-color: #ccc;
}

body.dark-mode .copy-button {
  background-color: #333;
  color: #fff;
  border-color: #555;
}

body.dark-mode .copy-button:hover {
  background-color: #444;
}

pre {
  position: relative;
  /* Crucial for absolute positioning of the button */
}

/* --------------------------
   Article Content: Premium Canvas System
   -------------------------- */
.post-content {
  background: #ffffff;
  color: #334155;
  font-family: 'Inter', sans-serif;
  font-size: 1.15rem;
  line-height: 1.85;
  padding: 60px;
  border-radius: 32px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  margin-top: 30px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
}

/* Article Tags */
.post-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.post-tag-item {
  background: rgba(59, 130, 246, 0.05);
  color: var(--accent-blue) !important;
  padding: 6px 16px;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none !important;
  border: 1px solid rgba(59, 130, 246, 0.1) !important;
  transition: all 0.3s ease;
}

.post-tag-item:hover {
  background: var(--accent-blue);
  color: #ffffff !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

/* Badge Upgrades */
.badge {
  padding: 6px 14px;
  border-radius: 100px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.7rem;
}

.badge-primary {
  background: rgba(59, 130, 246, 0.1) !important;
  color: var(--accent-blue) !important;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Mobile Responsive Navigation (Glassmorphism) */
@media (max-width: 991px) {
  .navigation .navbar-collapse {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    margin-top: 15px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  }

  body.dark-mode .navigation .navbar-collapse {
    background: rgba(15, 23, 42, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
  }

  .nav-item {
    margin: 8px 0;
  }

  .nav-link {
    font-size: 1.1rem;
    padding: 12px !important;
  }
}

body.dark-mode .post-content {
  background: #1e293b;
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.05);
}

/* Category Specific Theming */
.category-real-estate .post-content {
  border-left: 8px solid var(--accent-orange);
}

.category-automation .post-content {
  border-left: 8px solid var(--accent-blue);
  background-image: radial-gradient(var(--glass-border) 1px, transparent 1px);
  background-size: 24px 24px;
}

.category-lifestyle .post-content {
  border-left: 8px solid var(--accent-success);
  font-family: 'Noto Serif TC', serif;
}

/* Headings */
.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: #0f172a;
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
}

body.dark-mode .post-content h1,
body.dark-mode .post-content h2,
body.dark-mode .post-content h3,
body.dark-mode .post-content h4 {
  color: #f8fafc;
}

.post-content h2 {
  font-size: 1.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid rgba(0, 0, 0, 0.05);
}

body.dark-mode .post-content h2 {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* Links & Accents */
.post-content a {
  color: var(--accent-blue);
  text-decoration: none;
  border-bottom: 2px solid rgba(59, 130, 246, 0.1);
  transition: all 0.2s ease;
}

.post-content a:hover {
  background: rgba(59, 130, 246, 0.05);
  border-bottom-color: var(--accent-blue);
}

/* Blockquotes */
.post-content blockquote {
  background: #f8fafc;
  border-left: 4px solid var(--accent-blue);
  padding: 24px 32px;
  margin: 32px 0;
  border-radius: 0 16px 16px 0;
}

body.dark-mode .post-content blockquote {
  background: rgba(15, 23, 42, 0.5);
}

.post-content blockquote p {
  font-style: italic;
  font-size: 1.2rem;
  color: #475569 !important;
  margin-bottom: 0 !important;
}

body.dark-mode .post-content blockquote p {
  color: #cbd5e1 !important;
}

/* Images */
.post-content img {
  border-radius: 20px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  margin: 40px 0;
  max-width: 100%;
}

/* --- Table of Contents (TOC) --- */
.toc-container {
  position: sticky;
  top: 140px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--card-shadow);
}

.toc-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: #64748b;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
}

.toc-title::before {
  content: '';
  width: 12px;
  height: 2px;
  background: var(--accent-blue);
  margin-right: 8px;
}

.toc-content nav ul {
  list-style: none;
  padding-left: 0;
}

.toc-content nav ul ul {
  padding-left: 16px;
  border-left: 1px solid rgba(0, 0, 0, 0.05);
  margin-top: 4px;
  margin-bottom: 4px;
}

.toc-content a {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: #475569;
  text-decoration: none;
  display: block;
  padding: 6px 0;
  transition: all 0.2s ease;
}

.toc-content a:hover {
  color: var(--accent-blue);
  transform: translateX(4px);
}

/* Active TOC state (if linked by scroll) */
.toc-content a.active {
  color: var(--accent-blue);
  font-weight: 600;
}

/* --- Post Navigation (Prev/Next) --- */
.navigation-container {
  margin-top: 60px;
}

.post-navigation .prev-post,
.post-navigation .next-post {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 24px;
  border-radius: 20px;
  transition: all 0.3s ease;
}

.post-navigation .prev-post:hover,
.post-navigation .next-post:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--accent-blue);
}

.post-navigation span {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.05em;
}

.post-navigation h5 {
  font-family: 'Outfit', sans-serif;
  margin-top: 8px;
  color: #1e293b;
  font-weight: 700;
}

body.dark-mode .post-navigation h5 {
  color: #f1f5f9;
}

/* --------------------------
   TOC Hover Animations
   -------------------------- */
.toc-content a {
  display: block;
  padding: 5px 0;
  color: #666;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 3px solid transparent;
  position: relative;
}

.toc-content a:hover {
  color: var(--accent-blue) !important;
  padding-left: 12px;
  /* Slide effect */
  border-left-color: var(--accent-blue);
  background: linear-gradient(90deg, rgba(96, 165, 250, 0.1) 0%, transparent 100%);
}

.toc-content ul {
  padding-left: 20px;
}

/* --------------------------
   Reinforce Copy Button Visibility
   -------------------------- */
/* Ensure pre blocks are positioned to hold the button */
pre,
.highlight {
  position: relative !important;
}

/* Ensure button is always on top and visible */
.copy-button {
  z-index: 1000 !important;
  opacity: 0;
  /* Hidden by default */
  transform: translateY(-5px);
  transition: all 0.2s ease;
}

/* Show on hover of the pre/highlight container */
pre:hover .copy-button,
.highlight:hover .copy-button {
  display: block !important;
  opacity: 1;
  transform: translateY(0);
}

/* Fix for nested code blocks (Hugo often wraps pre in div.highlight) */


/* --------------------------
   Fix Slick Slider Overflow & Layout
   -------------------------- */
.real-estate-slider,
.automation-slider,
.lifestyle-slider {
  max-width: 100%;
  position: relative;
  /* Add padding to the sides to reserve space for arrows so they don't block content */
  padding: 0 70px;
  margin-bottom: 30px;
}

/* --- Equal Height Cards (Flexbox Magic) - SCOPED --- */
.real-estate-slider .slick-track,
.automation-slider .slick-track,
.lifestyle-slider .slick-track {
  display: flex !important;
}

.real-estate-slider .slick-slide,
.automation-slider .slick-slide,
.lifestyle-slider .slick-slide {
  height: auto !important;
  /* Let flexbox determine height */
  display: flex !important;
  justify-content: center;
}

/* The wrapper div inside the slide */
.real-estate-slider .slick-slide>div,
.automation-slider .slick-slide>div,
.lifestyle-slider .slick-slide>div {
  width: 100%;
  display: flex;
  flex-direction: column;
  flex: 1;
  /* Fill the slide */
}

/* The card itself matches the height */
.real-estate-slider .slick-slide>div>.card,
.automation-slider .slick-slide>div>.card,
.lifestyle-slider .slick-slide>div>.card {
  flex: 1;
  display: flex !important;
  flex-direction: column;
  height: 100%;
  /* Ensure it fills the height */
}

.real-estate-slider .slick-slide>div>.card .card-body,
.automation-slider .slick-slide>div>.card .card-body,
.lifestyle-slider .slick-slide>div>.card .card-body {
  flex: 1;
  display: flex !important;
  flex-direction: column;
}

/* --- Improved Arrow Styling & Positioning --- */
.slick-prev,
.slick-next {
  width: 30px;
  height: 30px;
  z-index: 20;
  /* Center vertically */
  top: 50%;
  transform: translateY(-50%);
}

/* Position them in the padded area we created */
.slick-prev {
  left: 20px !important;
}

.slick-next {
  right: 20px !important;
}

/* Style the arrow icons (Pseudo-elements) */
.slick-prev:before,
.slick-next:before {
  font-family: 'Font Awesome 5 Free';
  /* Use FontAwesome if available, or fallback */
  font-weight: 900;
  font-size: 20px;
  color: #adb5bd;
  /* Neutral grey, not ugly blue */
  opacity: 1;
  transition: all 0.3s ease;
}

.slick-prev:before {
  content: "←";
  /* Fallback to standard arrow if FA fails */
}

.slick-next:before {
  content: "→";
}

/* Hover effects for arrows */
.slick-prev:hover:before,
.slick-next:hover:before {
  color: var(--accent-blue);
  /* Primary color on hover */
  transform: scale(1.2);
}

/* Ensure the track doesn't calculate wild widths */
.slick-list {
  margin: 0 -10px;
  /* Counteract padding if needed */
}

/* Fix for slick track width calculation issues */
.slick-slider {
  width: 100%;
  box-sizing: border-box;
}

/* Prevent body horizontal scroll */
body {
  overflow-x: hidden;
}

/* --- Compact Card Styling for Slider --- */
.slick-slide .card-body {
  padding: 1rem !important;
  /* Reduce padding from default */
}

.slick-slide .h5 {
  margin-top: 0.5rem !important;
  margin-bottom: 0.5rem !important;
  font-size: 1.1rem;
  /* Slightly smaller title */
}

.slick-slide .post-meta {
  margin-bottom: 0.5rem !important;
  font-size: 0.85rem;
}

.slick-slide .card-text {
  margin-bottom: 0.5rem !important;
  font-size: 0.95rem;
  line-height: 1.5;
}

.slick-slide .btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

/* --- Tighten Homepage Layout --- */
.hero-section {
  padding-bottom: 20px !important;
  /* Reduce space below hero */
}

/* Reduce top padding for category section (Topic Explorer) */
section.section.pb-0 {
  padding-top: 40px !important;
  /* Was ~80-100px */
}

/* Reduce gap between category slider and next content */
.category-slider {
  margin-bottom: 30px !important;
  /* Tighten up */
}

/* Reduce space below "Topic Explorer" title */
.col-12.mb-4 h3.section-title {
  margin-bottom: 0.5rem !important;
}

/* --- Compact Footer Layout --- */
footer .h5,
footer .h4 {
  margin-bottom: 1rem !important;
  /* Reduce space below headers */
}

/* Reduce spacing in lists */
footer ul li {
  margin-bottom: 0.25rem !important;
  /* Was mb-3 (1rem) */
}

footer ul li a {
  padding-top: 2px !important;
  padding-bottom: 2px !important;
  display: inline-block !important;
  /* Prevent full-width flex stretching if applicable */
}

/* Reduce column margins */
footer .mb-5 {
  margin-bottom: 1.5rem !important;
  /* Reduce space between rows/columns */
}

/* Reduce logo section margin */
footer .mb-4 {
  margin-bottom: 1rem !important;
}

/* Compact the logo image if needed */
footer img {
  margin-bottom: 1rem !important;
}

/* Multi-column layout for Quick Links to save vertical space */
footer .quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  /* Adjust gap as needed */
}

footer .quick-links li {
  width: 48%;
  /* 2 items per row ~50% each */
  margin-bottom: 0.25rem !important;
}

/* Ensure nice alignment */
footer .quick-links li a {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;

}

/* --- Domineering Sliders (Beast Mode) --- */
.real-estate-slider .card,
.automation-slider .card,
.lifestyle-slider .card {
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.27), box-shadow 0.3s ease;
  border: none;
  /* Remove default border for cleaner look */
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  /* Soft initial shadow */
}

/* Hover effect: Scale up and lift */
.real-estate-slider .card:hover,
.automation-slider .card:hover,
.lifestyle-slider .card:hover {
  transform: scale(1.05);
  /* Slight zoom */
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2) !important;
  /* Deep shadow */
  z-index: 5;
}

/* Larger Section Titles */
h3.section-title {
  font-size: 2rem !important;
  /* Bigger title */
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  padding-left: 15px;
}

/* Add a colored bar next to titles for "霸氣" look */
h3.section-title.text-orange {
  border-left: 6px solid #fd7e14;
}

h3.section-title.text-success {
  border-left: 6px solid #28a745;
}

h3.section-title.text-danger {
  border-left: 6px solid #dc3545;
}

/* --- Further Compact Footer --- */
.footer-section {
  padding-top: 40px !important;
  /* Reduce top padding */
  padding-bottom: 20px !important;
  /* Reduce bottom padding */
}

/* --- Dark Mode Search Button Fix --- */
body.dark-mode .btn-search,
body.dark-mode .input-group-text,
body.dark-mode .newsletter-form button {
  color: #fff !important;
  /* White text */
  background-color: #3b71ca;
  /* Ensure background is visible */
  border-color: #3b71ca;
}

/* Ensure input text is visible in dark mode too */
body.dark-mode .newsletter-form input {
  color: #fff;
  background-color: #333;
  border-color: #555;
}

/* --- Fix Search Input in Dark Mode --- */
/* The input field in the overlay */
#search-query {
  color: #333;
  /* Default dark text for light mode */
}

body.dark-mode #search-query {
  color: #fff !important;
  /* Force white text in dark mode */
  background-color: transparent;
  /* Or match the dark background */
}

/* Ensure the placeholder is also visible */
body.dark-mode #search-query::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

/* --- Redesign Header Search Button --- */
/* The magnifying glass button in the nav */
/* --- Simple Header Search Button --- */
button.search-btn {
  border: none;
  background: transparent;
  font-size: 1.2rem;
  padding: 10px;
  cursor: pointer;
  color: #333;
  /* Default text color */
  transition: color 0.3s ease;
}

button.search-btn:hover {
  color: #3b71ca;
}

/* Dark mode visibility */
body.dark-mode button.search-btn {
  color: #fff !important;
  /* Force white text */
}

body.dark-mode button.search-btn:hover {
  color: #3b71ca !important;
}




/* --- Revamped Search Modal (Full Screen + Clean) --- */
/* --- Top-Bar Search Overlay (Only Top Half) --- */
.search-wrapper {
  background-color: #000 !important;
  /* Force black background */
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 140px;
  /* Only top part */
  z-index: 9999;
  display: flex !important;
  /* Override theme's display logic */
  align-items: center;
  justify-content: center;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.search-wrapper.open {
  opacity: 1;
  /* Fully opaque bar */
  visibility: visible;
}

/* Dark mode override */
body.dark-mode .search-wrapper {
  background-color: #1a1a1a !important;
  /* Dark grey */
}

/* Form Container */
.search-wrapper form {
  width: 100%;
  max-width: 800px;
  padding: 0 40px;
  /* Space for close button */
}

/* Ensure input text is visible */
#search-query {
  color: #fff !important;
  background-color: transparent !important;
  font-size: 1.5rem;
  /* Slightly smaller than full-screen */
  border-bottom: 1px solid #555;
  height: 60px;
}

/* Ensure placeholder is visible */
#search-query::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

/* Close button - Enhanced Visibility */
.search-close {
  z-index: 10000;
  position: absolute;
  top: 50%;
  right: 30px;
  transform: translateY(-50%);
  cursor: pointer;

  /* Make it a visible circular button */
  width: 50px;
  height: 50px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex !important;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
}

/* Target the icon specifically to override text-dark or other font classes */
.search-close i {
  color: #fff !important;
  font-size: 1.2rem;
  font-weight: bold;
}

.search-close:hover {
  background-color: #dc3545;
  /* Red background on hover */
  border-color: #dc3545;
  transform: translateY(-50%) rotate(90deg);
  /* Rotate effect */
  color: #fff !important;
}

/* Force the overlay to break out of any parent constraints */
.search {
  position: static !important;
}

/* We don't need to lock scroll for just a top bar, but it helps focus */
body.search-open {
  overflow: hidden;
}

/* --- Search Result Card Enhancements & Animations --- */
.search-result-card {
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.27);
  overflow: hidden;
  background: #fff;
  border-radius: 12px !important;
}

body.dark-mode .search-result-card {
  background: #23201d;
  color: #fff;
}

.search-result-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15) !important;
}

.card-img-wrapper {
  height: 160px;
  overflow: hidden;
}

.card-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.search-result-card .card-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-result-card:hover .card-img-wrapper img {
  transform: scale(1.1);
}

/* Staggered Fade-in Animation */
@keyframes fadeInUpSearch {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-item-fade {
  opacity: 0;
  animation: fadeInUpSearch 0.6s ease forwards;
}

/* Stagger delay for items */
.search-item-fade:nth-child(1) {
  animation-delay: 0.1s;
}

.search-item-fade:nth-child(2) {
  animation-delay: 0.2s;
}

.search-item-fade:nth-child(3) {
  animation-delay: 0.3s;
}

.search-item-fade:nth-child(4) {
  animation-delay: 0.4s;
}

.search-item-fade:nth-child(5) {
  animation-delay: 0.5s;
}

.search-item-fade:nth-child(6) {
  animation-delay: 0.6s;
}

.search-item-fade:nth-child(7) {
  animation-delay: 0.7s;
}

.search-item-fade:nth-child(8) {
  animation-delay: 0.8s;
}

.hover-blue:hover {
  color: #3b71ca !important;
  text-decoration: none;
}

/* --------------------------
   About Page: Modern Editorial Design
   -------------------------- */

.about-page-section {
  background-color: var(--primary-bg-color);
  /* Matches theme background */
  padding: 80px 0;
}

/* --------------------------
   About Page: Premium Card Design
   -------------------------- */

.premium-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 25px;
}

.premium-card {
  background: var(--secondary-bg-color, #ffffff);
  border-radius: 16px;
  padding: 30px;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-color, #f0f0f0);
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  overflow: hidden;
  height: 100%;
}

.premium-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

.card-icon-box {
  width: 50px;
  height: 50px;
  background: rgba(var(--primary-color-rgb), 0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  font-size: 1.4rem;
  color: var(--primary-color);
}

.premium-card.professional .card-icon-box {
  background: rgba(107, 144, 128, 0.1);
  color: #6B9080;
}

.premium-card.tech .card-icon-box {
  background: rgba(74, 144, 226, 0.1);
  color: #4A90E2;
}

.premium-card.lifestyle .card-icon-box {
  background: rgba(224, 122, 95, 0.1);
  color: #E07A5F;
}

.card-tag {
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  display: block;
}

/* About Page Specifics */
.profile-sidebar {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 32px;
  padding: 32px;
  text-align: center;
}

.profile-sidebar img {
  border-radius: 24px;
  margin-bottom: 24px;
}

/* Timeline Stylizing */
.timeline {
  position: relative;
  padding-left: 32px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent-blue), transparent);
}

.timeline-item {
  position: relative;
  margin-bottom: 40px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -37px;
  top: 6px;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border: 3px solid var(--accent-blue);
  border-radius: 50%;
  z-index: 1;
}

body.dark-mode .timeline-item::before {
  background: #1e293b;
}

.timeline-year {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  color: var(--accent-blue);
  font-size: 1.25rem;
  margin-bottom: 4px;
}

/* Skill Tags */
.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.skill-tags li {
  background: rgba(59, 130, 246, 0.05);
  color: var(--accent-blue);
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid rgba(59, 130, 246, 0.1);
}

body.dark-mode .skill-tags li {
  background: rgba(255, 255, 255, 0.03);
  color: #e2e8f0;
}

.skill-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
}

.skill-title i {
  margin-right: 12px;
  color: var(--accent-blue);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 15px;
  color: var(--primary-text-color);
  line-height: 1.4;
}

.card-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--secondary-text-color);
  margin: 0;
}

.card-footer-glow {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  transition: background 0.3s ease;
}

.premium-card.professional:hover .card-footer-glow {
  background: #6B9080;
}

.premium-card.tech:hover .card-footer-glow {
  background: #4A90E2;
}

.premium-card.lifestyle:hover .card-footer-glow {
  background: #E07A5F;
}

/* About Page Typography */
.section-subtitle {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--primary-text-color);
}

.section-divider-long {
  width: 80px;
  height: 3px;
  background: var(--primary-color);
  margin-bottom: 30px;
  border-radius: 2px;
}

.intro-text {
  font-family: 'Noto Serif TC', serif;
  font-size: 1.1rem;
  line-height: 1.9;
  color: var(--primary-text-color);
}

.intro-text p:last-child {
  margin-bottom: 0;
}

.about-main-card {
  border-left: 6px solid var(--primary-color);
  background: var(--secondary-bg-color);
}

.contact-card {
  padding: 20px 30px !important;
  background: linear-gradient(to right, rgba(var(--primary-color-rgb), 0.05), transparent);
}

.contact-card .card-icon-box {
  flex-shrink: 0;
}

/* Dark Mode Adjustments */
body.dark-mode .premium-card {
  background: #1e1e1e;
  border-color: #333;
}

body.dark-mode .card-title {
  color: #fff;
}

body.dark-mode .card-text {
  color: #A8A4A0;
}

@media (max-width: 768px) {
  .premium-card {
    padding: 25px;
  }
}

/* --------------------------
   Related Links: Ethereal Cloud Style
   -------------------------- */

.link-premium-card {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  /* Maximum Softness: Pill Shape */
  border-radius: 100px;
  padding: 12px 40px 12px 12px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  height: auto;
  min-height: 90px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  /* Weightless Shadow */
  box-shadow:
    0 20px 40px -15px rgba(0, 0, 0, 0.05),
    inset 0 0 20px rgba(255, 255, 255, 0.5);
  transition: all 0.7s cubic-bezier(0.19, 1, 0.22, 1);
  cursor: pointer;
  overflow: hidden;
}

.link-premium-card:hover {
  transform: translateY(-5px) scale(1.01);
  background: rgba(255, 255, 255, 0.8);
  box-shadow:
    0 30px 60px -12px rgba(var(--primary-color-rgb), 0.12),
    inset 0 0 30px rgba(255, 255, 255, 1);
  border-color: rgba(var(--primary-color-rgb), 0.2);
}

.link-card-visual {
  width: 65px;
  height: 65px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.03);
  transition: all 0.6s ease;
}

.link-premium-card:hover .link-card-visual {
  transform: rotate(10deg);
  box-shadow: 0 8px 25px rgba(var(--primary-color-rgb), 0.15);
}

.link-img {
  max-width: 60%;
  max-height: 60%;
  object-fit: contain;
  transition: transform 0.5s ease;
  filter: grayscale(20%) opacity(0.8);
}

.link-premium-card:hover .link-img {
  filter: grayscale(0%) opacity(1);
}

.link-img-placeholder {
  font-size: 1.5rem;
  color: var(--primary-color);
  opacity: 0.4;
}

.link-card-body {
  padding: 0;
  z-index: 1;
  text-align: left;
}

.link-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--primary-text-color);
  transition: color 0.3s ease;
}

.link-desc {
  font-size: 0.85rem;
  color: var(--secondary-text-color);
  line-height: 1.4;
  margin-bottom: 0;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

/* Moving Aura in Background */
.link-premium-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(var(--primary-color-rgb), 0.05) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.8s ease;
  pointer-events: none;
}

.link-premium-card:hover::before {
  opacity: 1;
  animation: drift 10s infinite linear;
}

@keyframes drift {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Dark Mode: "Void Glass" */
body.dark-mode .link-premium-card {
  background: rgba(30, 30, 30, 0.4);
  border-color: rgba(255, 255, 255, 0.05);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

body.dark-mode .link-card-visual {
  background: #2a2a2a;
}

@media (max-width: 768px) {
  .link-premium-card {
    padding: 10px 25px 10px 10px;
    border-radius: 50px;
  }

  .link-desc {
    max-width: 150px;
  }
}

/* ── Links Page: Sidenav ── */
.sidebar-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #aaa;
}

.links-sidenav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidenav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  text-align: left;
  transition: background 0.18s, transform 0.18s;
  color: #444;
  font-size: 0.875rem;
}

.sidenav-btn:hover {
  background: rgba(59, 113, 202, 0.07);
  transform: translateX(3px);
  color: #3b71ca;
}

.sidenav-btn.active {
  background: rgba(59, 113, 202, 0.12);
  color: #3b71ca;
  font-weight: 600;
}

.sidenav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidenav-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidenav-count {
  font-size: 0.72rem;
  background: rgba(0, 0, 0, 0.07);
  border-radius: 10px;
  padding: 1px 6px;
  color: #888;
  flex-shrink: 0;
}

.sidenav-btn.active .sidenav-count {
  background: rgba(59, 113, 202, 0.15);
  color: #3b71ca;
}

body.dark-mode .sidenav-btn { color: #ccc; }
body.dark-mode .sidenav-btn:hover { background: rgba(100, 181, 246, 0.1); color: #64b5f6; }
body.dark-mode .sidenav-btn.active { background: rgba(100, 181, 246, 0.15); color: #64b5f6; }
body.dark-mode .sidenav-count { background: rgba(255,255,255,0.08); color: #aaa; }

/* ── Links Page: Category Header ── */
.lk-cat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 0;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  cursor: pointer;
  user-select: none;
}

.lk-cat-header:hover { opacity: 0.85; }

.lk-cat-bar {
  width: 4px;
  height: 20px;
  border-radius: 2px;
  flex-shrink: 0;
}

.lk-cat-name {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.lk-cat-count {
  font-size: 0.72rem;
  background: rgba(0,0,0,0.07);
  color: #888;
  border-radius: 10px;
  padding: 2px 7px;
  font-weight: 500;
}

.lk-cat-toggle {
  font-size: 0.9rem;
  color: #aaa;
  margin-left: auto;
}

body.dark-mode .lk-cat-header { border-color: rgba(255,255,255,0.1); }
body.dark-mode .lk-cat-count  { background: rgba(255,255,255,0.1); color: #aaa; }

/* ── Links Page: Row View ── */
.lk-rows {
  display: flex;
  flex-direction: column;
}

.lk-row {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0;
  text-decoration: none !important;
  color: inherit;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  transition: background 0.15s;
  border-radius: 0;
  min-height: 44px;
  overflow: hidden;
}

.lk-row:hover {
  background: rgba(59, 113, 202, 0.05);
  color: inherit;
}

.lk-row:last-child { border-bottom: none; }

.lk-row-bar {
  width: 3px;
  align-self: stretch;
  flex-shrink: 0;
  min-height: 44px;
}

.lk-row-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #2c3e50;
  white-space: nowrap;
  padding: 0 12px 0 14px;
  flex-shrink: 0;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lk-row-desc {
  font-size: 0.78rem;
  color: #999;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 8px;
}

.lk-row-arrow {
  font-size: 0.85rem;
  color: #bbb;
  padding: 0 14px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}

.lk-row:hover .lk-row-arrow {
  opacity: 1;
  color: #3b71ca;
}

.lk-row:hover .lk-row-name { color: #3b71ca; }

/* dark mode rows */
body.dark-mode .lk-row { border-color: rgba(255,255,255,0.06); }
body.dark-mode .lk-row:hover { background: rgba(100,181,246,0.08); }
body.dark-mode .lk-row-name { color: #e0e0e0; }
body.dark-mode .lk-row:hover .lk-row-name { color: #64b5f6; }
body.dark-mode .lk-row-desc { color: #777; }
body.dark-mode .lk-row:hover .lk-row-arrow { color: #64b5f6; }

/* ── 搜尋框 ── */
#linkSearch, #linkSearchMobile {
  border-radius: 20px;
  font-size: 0.85rem;
}

#linkSearch:focus, #linkSearchMobile:focus {
  box-shadow: 0 0 0 3px rgba(59, 113, 202, 0.15);
  border-color: #3b71ca;
}

/* ── 視圖切換 ── */
.view-toggle-group .btn { font-size: 0.78rem; padding: 3px 10px; }

/* ── 搜尋狀態 ── */
.search-status-pill {
  display: inline-block;
  background: rgba(59, 113, 202, 0.08);
  border-left: 3px solid #3b71ca;
  padding: 5px 12px;
  border-radius: 0 6px 6px 0;
  font-size: 0.82rem;
  color: #555;
}

body.dark-mode .search-status-pill { color: #ccc; background: rgba(100,181,246,0.08); border-color: #64b5f6; }

.min-width-0 { min-width: 0; }
.gap-2 { gap: 0.5rem; }

/* Links Page Enhanced Sidebar */
.sidebar-nav .category-group {
  border-left: 3px solid transparent;
  transition: all 0.3s ease;
  padding-left: 10px;
}

.sidebar-nav .category-group:hover {
  padding-left: 15px;
}

.color-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 10px;
  vertical-align: middle;
}

.category-link {
  display: flex;
  align-items: center;
  padding: 8px 12px !important;
  border-radius: 6px;
  transition: all 0.2s ease;
  color: #212529;
  /* 白天模式預設深色 */
}

/* 確保導覽列標題在白天模式也是深色 */
.sticky-sidebar h4 {
  color: #212529;
}

/* 黑夜模式下的文字顏色 */
body.dark-mode .category-link,
body.dark-mode .sticky-sidebar h4 {
  color: #f8f9fa;
}

/* 子連結在白天模式的顏色增強 */
.sub-links .nav-link {
  color: #6c757d !important;
}

body.dark-mode .sub-links .nav-link {
  color: #adb5bd !important;
}

.category-group[data-color='primary']:hover .category-link {
  background-color: rgba(59, 113, 202, 0.1);
  border-left: 4px solid #3b71ca;
  color: #3b71ca;
  /* Hover 時變色 */
}

.category-group[data-color='success']:hover .category-link {
  background-color: rgba(40, 167, 69, 0.1);
  border-left: 4px solid #28a745;
  color: #28a745;
  /* Hover 時變色 */
}

.category-group[data-color='warning']:hover .category-link {
  background-color: rgba(255, 193, 7, 0.1);
  border-left: 4px solid #ffc107;
  color: #ffc107;
}

.category-group[data-color='danger']:hover .category-link {
  background-color: rgba(220, 53, 69, 0.1);
  border-left: 4px solid #dc3545;
  color: #dc3545;
}

.category-group[data-color='info']:hover .category-link {
  background-color: rgba(23, 162, 184, 0.1);
  border-left: 4px solid #17a2b8;
  color: #17a2b8;
}

.category-group[data-color='secondary']:hover .category-link {
  background-color: rgba(108, 117, 125, 0.1);
  border-left: 4px solid #6c757d;
  color: #6c757d;
}

.category-group[data-color='dark']:hover .category-link {
  background-color: rgba(52, 58, 64, 0.1);
  border-left: 4px solid #343a40;
  color: #343a40;
}

.sidebar-nav .hover-primary:hover {
  color: #3b71ca !important;
}

.sidebar-nav .hover-success:hover {
  color: #28a745 !important;
}

.sidebar-nav .hover-warning:hover {
  color: #ffc107 !important;
}

.sidebar-nav .hover-danger:hover {
  color: #dc3545 !important;
}

.sidebar-nav .hover-info:hover {
  color: #17a2b8 !important;
}

.sidebar-nav .hover-secondary:hover {
  color: #6c757d !important;
}

.sidebar-nav .hover-dark:hover {
  color: #343a40 !important;
}

.sub-links {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease-out;
}

.category-group:hover .sub-links {
  max-height: 500px;
}

/* ----------------------------------------------------------- */
/* Fix for Slick Slider Dots showing strange .1.2.3 numbers    */
/* ----------------------------------------------------------- */
.slick-dots li button {
  font-size: 0 !important;
  line-height: 0 !important;
  color: transparent !important;
  display: block;
  width: 20px;
  height: 20px;
  padding: 5px;
  cursor: pointer;
  border: 0;
  outline: none;
  background: transparent;
}

.slick-dots li button:focus,
.slick-dots li button:hover {
  outline: none;
}

.slick-dots li button:before {
  font-family: 'slick';
  font-size: 12px !important;
  line-height: 20px;
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  content: '';
  text-align: center;
  opacity: 0.25;
  color: black;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.slick-dots li.slick-active button:before {
  opacity: 0.75;
  color: var(--primary-color, black);
}

/* Dark mode support */
body.dark-mode .slick-dots li button:before {
  color: white;
  opacity: 0.5;
}

body.dark-mode .slick-dots li.slick-active button:before {
  color: white;
  opacity: 1;
}


/* --- Modern Link Dashboard & Sticky Sidebar --- */
.links-dashboard {
  --sidebar-w: 260px;
  --header-h: 80px;
}

/* Sidebar Fix: 防止長度超過視窗無法滾動 */
.dashboard-sidebar {
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-blue) transparent;
}

.dashboard-sidebar::-webkit-scrollbar {
  width: 4px;
}

.dashboard-sidebar::-webkit-scrollbar-thumb {
  background-color: rgba(59, 130, 246, 0.3);
  border-radius: 20px;
}

/* Sidebar Components */
.sidebar-nav-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-filter-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 15px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: #64748b;
  font-weight: 600;
  text-align: left;
  transition: all 0.3s ease;
  cursor: pointer;
}

.nav-filter-btn:hover {
  background: rgba(59, 130, 246, 0.05);
  color: var(--accent-blue);
}

.nav-filter-btn.active {
  background: var(--filter-btn-bg);
  color: var(--accent-blue);
  border-color: var(--glass-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.badge-count {
  font-size: 0.75rem;
  padding: 2px 8px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 20px;
  color: var(--accent-blue);
}

/* Color Dots for Categories */
.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
}

/* Spotlight Search UI */
.spotlight-search-wrapper {
  background: var(--filter-bg);
  padding: 8px;
  border-radius: 18px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.search-input-group {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 15px;
  background: var(--filter-btn-bg);
  border-radius: 14px;
}

.spotlight-search-input {
  flex-grow: 1;
  border: none;
  background: transparent;
  font-size: 1.1rem;
  color: inherit;
  padding: 5px 0;
}

.spotlight-search-input:focus {
  outline: none;
}

.search-prefix {
  color: var(--accent-blue);
  font-size: 1.2rem;
}

.search-kbd {
  font-size: 10px;
  padding: 2px 6px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 4px;
  color: #94a3b8;
  font-weight: 700;
}

/* Modern Link Cards (Grid) */
.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

/* 為了讓分類標題跨行，容器改用 flex 或獨立 Grid */
.link-category-group {
  grid-column: 1 / -1;
}

.link-modern-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--filter-btn-bg);
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  position: relative;
  overflow: hidden;
}

.card-visual-header {
  height: 140px;
  overflow: hidden;
  position: relative;
  background: #f8fafc;
}

.card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.card-thumb-placeholder {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: #cbd5e1;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.card-actions-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.link-modern-card:hover .card-actions-overlay {
  opacity: 1;
}

.link-modern-card:hover .card-thumb {
  transform: scale(1.08);
}

.action-btn-circle {
  width: 45px;
  height: 45px;
  background: #ffffff;
  color: var(--accent-blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(10px);
  transition: transform 0.3s ease;
}

.link-modern-card:hover .action-btn-circle {
  transform: translateY(0);
}

.card-info {
  padding: 18px;
  flex-grow: 1;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: inherit;
}

.card-desc {
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.6;
  margin: 0;
  opacity: 0.8;
}

/* Category header style */
.category-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.1);
  padding: 4px 12px;
  border-radius: 30px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Dark Mode Overrides */
body.dark-mode .spotlight-search-wrapper {
  background: rgba(30, 41, 59, 0.7);
}

body.dark-mode .card-visual-header {
  background: #1e293b;
}

body.dark-mode .card-thumb-placeholder {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #334155;
}

body.dark-mode .card-desc {
  color: #94a3b8;
}

body.dark-mode .dashboard-sidebar::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.1);
}

@media (max-width: 991px) {
  .dashboard-sidebar {
    position: relative;
    top: 0;
    max-height: none;
    margin-bottom: 30px;
    padding: 15px;
    background: var(--filter-bg);
    border-radius: 20px;
    overflow-x: auto;
    display: flex;
  }

  .sidebar-nav-container {
    flex-direction: row;
    overflow-x: auto;
    width: 100%;
    padding-bottom: 5px;
  }

  .nav-filter-btn {
    white-space: nowrap;
    width: auto;
  }

  .sidebar-header {
    display: none;
  }
}

/* ============================================================
   UI 改善 2026-03-29
   ============================================================ */

/* Phase 1: 移除全頁格線背景（亮色模式） */
body {
  background-image: none !important;
}

/* Phase 2: 繼續閱讀按鈕（現代填色圓角） */
.btn-read-more {
  display: inline-block;
  padding: 4px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 20px;
  text-decoration: none !important;
  transition: background-color 0.2s ease, transform 0.15s ease;
  letter-spacing: 0.3px;
  white-space: nowrap;
  border: none;
}

.btn-read-more:hover {
  transform: translateY(-1px);
  text-decoration: none !important;
}

.btn-read-more-orange {
  background-color: #fd7e14;
  color: #fff !important;
}
.btn-read-more-orange:hover {
  background-color: #e96c04;
  color: #fff !important;
}

.btn-read-more-green {
  background-color: #28a745;
  color: #fff !important;
}
.btn-read-more-green:hover {
  background-color: #1e7e34;
  color: #fff !important;
}

.btn-read-more-red {
  background-color: #dc3545;
  color: #fff !important;
}
.btn-read-more-red:hover {
  background-color: #c82333;
  color: #fff !important;
}

body.dark-mode .btn-read-more-orange { background-color: #e96c04; }
body.dark-mode .btn-read-more-green  { background-color: #1e7e34; }
body.dark-mode .btn-read-more-red    { background-color: #c82333; }

/* Phase 3: Section 標題中英文拆分（手機版修正） */
.section-title-main {
  display: block;
  line-height: 1.2;
}

.section-title-sub {
  display: block;
  font-size: 0.58em;
  font-weight: 600;
  letter-spacing: 2px;
  opacity: 0.7;
  text-transform: uppercase;
  line-height: 1.5;
}

@media (min-width: 576px) {
  .section-title-main {
    display: inline;
  }
  .section-title-sub {
    display: inline;
    font-size: 0.52em;
    margin-left: 0.4em;
  }
}

@media (max-width: 575px) {
  h3.section-title {
    font-size: 1.4rem !important;
  }
}