/* ============================================
   custom-tech.css — 科技風格強化
   里肌肉部落格 by Boyce
   沉穩科技感：深色 + 青藍霓虹 + 毛玻璃
   ============================================ */

/* ---------- 全局字型補強 ---------- */
@import url('https://fonts.googleapis.com/css2?family=Chiron+GoRound+TC:wght@200..900&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;700&family=Orbitron:wght@400;600;700;900&display=swap');

/* ---------- CSS 變數 ---------- */
:root {
  --tech-cyan: #00d4ff;
  --tech-cyan-dim: rgba(0, 212, 255, 0.15);
  --tech-cyan-glow: rgba(0, 212, 255, 0.35);
  --tech-blue: #3b82f6;
  --tech-blue-dim: rgba(59, 130, 246, 0.12);
  --tech-grid-color: rgba(0, 212, 255, 0.045);
  --tech-border: rgba(0, 212, 255, 0.22);
  --tech-scan-speed: 4s;
  --tech-glow-spread: 0 0 8px rgba(0, 212, 255, 0.1), 0 0 16px rgba(0, 212, 255, 0.05);
}

/* ============================================
   背景：細微電路網格
   ============================================ */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--tech-grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--tech-grid-color) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 1;
}

/* ============================================
   Navbar：毛玻璃 + 頂部發光邊
   ============================================ */
navbar {
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  background: rgba(22, 28, 42, 0.72) !important;
  border-bottom: 1px solid var(--tech-border);
  box-shadow: 0 2px 32px rgba(0, 0, 0, 0.35), inset 0 -1px 0 var(--tech-border);
  position: relative;
}

navbar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--tech-cyan) 30%, var(--tech-blue) 70%, transparent 100%);
  opacity: 0.85;
}

/* Nav 連結 hover 用 cyan */
.main-nav-link:hover,
.nav-icon:hover {
  color: var(--tech-cyan) !important;
  fill: var(--tech-cyan) !important;
  text-shadow: 0 0 8px var(--tech-cyan);
}

/* ============================================
   網站標題：Orbitron 科技字型
   ============================================ */
#title-nav a {
  font-family: 'Orbitron', 'JetBrains Mono', monospace !important;
  letter-spacing: 0.04em;
  font-size: 16px !important;
  /* 想要調大首頁左上角標題大小，修改這個數字 (原 14px) */
}

/* ============================================
   文章卡片：hover 霓虹光暈
   ============================================ */
.article-inner {
  transition: box-shadow 0.3s ease, transform 0.25s ease !important;
  border: 1px solid transparent;
}

.article-inner:hover {
  box-shadow: var(--tech-glow-spread) !important;
  border-color: var(--tech-border);
  transform: translateY(-2px);
}

/* 卡片 fade-in-up 動畫 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

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

.article {
  animation: fadeInUp 0.45s ease both;
}

.article:nth-child(1) {
  animation-delay: 0.05s;
}

.article:nth-child(2) {
  animation-delay: 0.12s;
}

.article:nth-child(3) {
  animation-delay: 0.18s;
}

.article:nth-child(4) {
  animation-delay: 0.24s;
}

.article:nth-child(5) {
  animation-delay: 0.30s;
}

/* ============================================
   文章標題：h1 掃描線動畫
   ============================================ */
.article-title h1,
.article-title .article-title-link {
  position: relative;
  overflow: hidden;
}

.article-title h1::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.06), transparent);
  animation: scanline var(--tech-scan-speed) linear infinite;
  pointer-events: none;
}

@keyframes scanline {
  0% {
    left: -60%;
  }

  100% {
    left: 160%;
  }
}

/* 文章頁 h2/h3 左側有色條 + 微發光 */
.article-entry h2 {
  border-left: 3px solid var(--tech-cyan);
  padding-left: 14px;
  box-shadow: -3px 0 10px rgba(0, 212, 255, 0.2);
  margin-left: -16px;
}

.article-entry h3 {
  border-left: 2px solid var(--tech-blue);
  padding-left: 12px;
  margin-left: -14px;
  opacity: 0.92;
}

/* ============================================
   程式碼區塊：終端機風格強化
   ============================================ */
.highlight,
figure.highlight {
  position: relative;
  border: 1px solid var(--tech-border);
  border-radius: 10px;
  overflow: hidden;
}

/* 終端機標題列 */
.highlight::before,
figure.highlight::before {
  content: '● ● ●';
  display: block;
  background: rgba(0, 12, 22, 0.85);
  color: rgba(0, 212, 255, 0.5);
  font-size: 11px;
  letter-spacing: 3px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--tech-border);
  font-family: 'JetBrains Mono', monospace;
}

/* 程式碼複製按鈕 */
.copy-btn {
  position: absolute;
  top: 6px;
  right: 12px;
  color: rgba(0, 212, 255, 0.6);
  cursor: pointer;
  z-index: 10;
  font-size: 14px;
  transition: color 0.2s, text-shadow 0.2s;
}

.copy-btn:hover {
  color: var(--tech-cyan);
  text-shadow: 0 0 8px var(--tech-cyan);
}

/* 游標閃爍（加在 .highlight 的 code 第一行前） */
.highlight .line:first-child::before,
figure.highlight .line:first-child::before {
  content: '▌';
  color: var(--tech-cyan);
  opacity: 0.7;
  animation: blink 1.1s step-end infinite;
  margin-right: 2px;
  font-size: 0.85em;
}

@keyframes blink {

  0%,
  100% {
    opacity: 0.7;
  }

  50% {
    opacity: 0;
  }
}

/* inline code */
.article-entry code:not([class]) {
  background: var(--tech-cyan-dim);
  border: 1px solid var(--tech-border);
  color: var(--tech-cyan);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88em;
}

/* ============================================
   全局字型補強：更好閱讀的科技/黑體字型
   ============================================ */
body,
.article-entry {
  font-family: 'Inter', "Chiron GoRound TC", 'PingFang TC', 'Microsoft JhengHei', sans-serif !important;
  font-optical-sizing: auto;
  line-height: 1.7;
  letter-spacing: 0.04em;
  font-size: 1.15em;
  /* 這裡控制全站文章內容字體大小 (內建預設是 1em 或 16px)，你可以改成 1.25em 測試看看 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   引用區塊：左青藍邊 + 「越來越深」背景
   ============================================ */
.article-entry blockquote {
  border-left: 3px solid var(--tech-cyan) !important;
  background: linear-gradient(90deg, rgba(0, 15, 30, 0.4) 0%, rgba(0, 8, 16, 0.7) 100%) !important;
  padding: 16px 20px;
  border-radius: 0 8px 8px 0;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.5);
  margin: 1.5em 0;
  color: var(--neut-L90);
}

/* ============================================
   滿版閱讀優化 (Sidebar 關閉後)
   (已重新啟用 Sidebar，移除強制寬度)
   ============================================ */

/* ============================================
   側邊欄 Widget：輕微毛玻璃 (保留給其他可能的元件)
   ============================================ */
.widget {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 212, 255, 0.1);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.widget:hover {
  border-color: var(--tech-border);
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.1);
}

/* Widget 標題左色條顏色改為 cyan */
.widget-title::before {
  background-color: var(--tech-cyan) !important;
  box-shadow: 0 0 8px var(--tech-cyan);
}

/* ============================================
   歸檔頁面：科技年份時間軸
   ============================================ */
.archive-year-wrap {
  position: relative;
}

.archive-year {
  font-family: 'Orbitron', monospace;
  letter-spacing: 0.08em;
  font-size: 1.35rem;
  color: var(--tech-cyan) !important;
  text-shadow: 0 0 12px rgba(0, 212, 255, 0.45);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* 年份前的發光點 */
.archive-year::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tech-cyan);
  box-shadow: 0 0 8px var(--tech-cyan), 0 0 16px rgba(0, 212, 255, 0.45);
  flex-shrink: 0;
}

/* 文章列表 timeline 連接線 */
.archive-article {
  position: relative;
  padding-left: 8px;
  border-left: 1px solid rgba(0, 212, 255, 0.15);
  margin-left: 3px;
  transition: border-color 0.2s;
}

.archive-article:hover {
  border-left-color: var(--tech-cyan);
}

/* 歸檔日期 */
.archive-article-date {
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 0.8rem;
  color: var(--tech-cyan) !important;
  opacity: 0.7;
  letter-spacing: 0.04em;
}

/* 歸檔文章 hover 標題發光 */
.archive-article-title:hover {
  color: var(--tech-cyan) !important;
  text-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

/* ============================================
   分頁導覽：科技感按鈕
   ============================================ */
.page-number.current,
.extend {
  font-family: 'JetBrains Mono', monospace;
}

/* ============================================
   標籤 Tag：霓虹感
   ============================================ */
.article-tag-list-link:hover,
.widget-tag-list-link:hover {
  color: var(--tech-cyan) !important;
  text-shadow: 0 0 6px rgba(0, 212, 255, 0.4);
}

/* ============================================
   回到頂部按鈕
   ============================================ */
#back-to-top-btn {
  border: 1px solid var(--tech-border);
  box-shadow: 0 0 14px rgba(0, 212, 255, 0.2);
  transition: box-shadow 0.25s, background-color 0.2s;
  /* Removed transform transition */
}

#back-to-top-btn:hover {
  box-shadow: var(--tech-glow-spread);
  /* Removed transform: translateY(-3px); which causes jittering */
  background-color: rgba(0, 212, 255, 0.1);
}

/* ============================================
   滾動條
   ============================================ */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--tech-cyan), var(--tech-blue));
  border-radius: 10px;
}

/* ============================================
   選取文字：發光
   ============================================ */
::selection {
  background: rgba(0, 212, 255, 0.25) !important;
  color: #fff !important;
  text-shadow: 0 0 8px var(--tech-cyan);
}

/* ============================================
   連結 hover 顏色
   ============================================ */
.article-entry a:not([class]) {
  transition: color 0.2s, text-shadow 0.2s;
}

.article-entry a:not([class]):hover {
  color: var(--tech-cyan) !important;
  text-shadow: 0 0 6px rgba(0, 212, 255, 0.35);
}

/* ============================================
   頁尾
   ============================================ */
#footer {
  border-top: 1px solid var(--tech-border);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
}

/* ============================================
   RWD - Mobile 調整
   ============================================ */
@media (max-width: 767px) {
  .article-entry h2 {
    margin-left: -12px;
  }

  .article-entry h3 {
    margin-left: -10px;
  }

  body::before {
    background-size: 28px 28px;
  }

  /* 恢復手機版的預設字體大小 */
  body,
  .article-entry {
    font-size: 1em !important;
  }

  #title-nav a {
    font-size: 14px !important;
  }
}

/* ============================================
   首頁：成就下方的互動玻璃擬態狀態視窗
   ============================================ */
.glass-status-panel {
  background: rgba(16, 22, 38, 0.45);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid rgba(0, 212, 255, 0.15);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(0, 212, 255, 0.08);
  margin-top: 2.5rem;
  overflow: hidden;
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-status-panel:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(0, 212, 255, 0.15), 0 0 20px rgba(0, 212, 255, 0.1);
  border-color: rgba(0, 212, 255, 0.3);
}

.glass-header {
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(0, 212, 255, 0.1);
}

.window-controls {
  display: flex;
  gap: 6px;
  margin-right: 12px;
}

.window-controls .ctrl {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.window-controls .close {
  background: #ff5f56;
}

.window-controls .min {
  background: #ffbd2e;
}

.window-controls .max {
  background: #27c93f;
}

.window-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-lo);
  letter-spacing: 0.05em;
  opacity: 0.7;
}

.glass-body {
  padding: 24px;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Orbitron', 'JetBrains Mono', monospace;
  font-size: 0.85rem;
}

.status-row i {
  color: var(--tech-cyan);
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.pulse-icon {
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0% {
    text-shadow: 0 0 0 rgba(0, 212, 255, 0.7);
    opacity: 1;
  }

  50% {
    text-shadow: 0 0 12px rgba(0, 212, 255, 0.9);
    opacity: 0.7;
  }

  100% {
    text-shadow: 0 0 0 rgba(0, 212, 255, 0.7);
    opacity: 1;
  }
}

.status-text {
  color: var(--text-lo);
}

.highlight-cyan {
  color: var(--tech-cyan);
  font-weight: 600;
  text-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
  margin-left: auto;
}

.mt-2 {
  margin-top: 1.5rem;
}

.github-chart {
  filter: hue-rotate(170deg) saturate(1.5) brightness(0.9);
}

/* ============================================
   🚀 進階科技感強化 (Cyberpunk / Sci-Fi Enhancements)
   ============================================ */

/* 標題霓虹閃爍 (Title Neon Glow) */
.hero-name,
.article-title h1 {
  text-shadow: 0 0 10px var(--tech-cyan), 0 0 20px rgba(0, 212, 255, 0.4), 0 0 40px rgba(0, 212, 255, 0.2) !important;
  animation: neon-flicker 4s infinite alternate;
}

@keyframes neon-flicker {

  0%,
  19%,
  21%,
  23%,
  25%,
  54%,
  56%,
  100% {
    text-shadow: 0 0 10px var(--tech-cyan), 0 0 20px rgba(0, 212, 255, 0.4), 0 0 40px rgba(0, 212, 255, 0.2);
    opacity: 1;
  }

  20%,
  24%,
  55% {
    text-shadow: none;
    opacity: 0.8;
  }
}

/* 酷炫按鈕特效 (Cyber Buttons) */
.btn-primary,
.btn-outline {
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.btn-primary::after,
.btn-outline::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: all 0.5s;
  z-index: -1;
}

.btn-primary:hover::after,
.btn-outline:hover::after {
  left: 100%;
}

/* 霓虹邊框卡片 (Neon Border Cards) */
.service-card,
.project-card,
.article-inner {
  border: 1px solid rgba(0, 212, 255, 0.1);
  box-shadow: inset 0 0 20px rgba(0, 212, 255, 0.02);
  transition: all 0.3s ease;
}

.service-card:hover,
.project-card:hover,
.article-inner:hover {
  border-color: var(--tech-cyan);
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.3), inset 0 0 15px rgba(0, 212, 255, 0.1);
  transform: translateY(-5px);
}

/* 發光分隔線 */
.section-title {
  border-bottom: 2px solid transparent !important;
  border-image: linear-gradient(90deg, var(--tech-cyan), transparent) 1 !important;
}

/* 科技感捲動列更新 */
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--tech-cyan), #6c5ce7);
  box-shadow: 0 0 10px var(--tech-cyan);
}

/* ============================================
   文章列表 - 大綱條列樣式 (亮暗主題通用)
   ============================================ */
.post-outline-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 4px;
}

.post-outline-list li {
  position: relative;
  padding: 6px 0 6px 22px;
  font-size: 0.88em;
  line-height: 1.5;
  /* 亮色主題下用深灰，暗色主題下用淺藍灰 */
  color: var(--text-mid, #555);
  border-bottom: 1px solid rgba(128, 128, 128, 0.10);
}

/* 暗色主題下強制亮色 */
html[theme='dark'] .post-outline-list li,
.dark .post-outline-list li {
  color: rgba(180, 210, 240, 0.8);
  border-bottom-color: rgba(0, 212, 255, 0.07);
}

.post-outline-list li::before {
  content: '⟩';
  position: absolute;
  left: 4px;
  color: var(--tech-cyan);
  font-weight: bold;
  text-shadow: 0 0 5px rgba(0, 212, 255, 0.5);
}

/* outline 是純文字字串時的段落樣式 */
.post-outline-text {
  margin: 8px 0 4px;
  font-size: 0.9em;
  line-height: 1.65;
  color: var(--text-mid, #555);
}

html[theme='dark'] .post-outline-text,
.dark .post-outline-text {
  color: rgba(180, 210, 240, 0.8);
}

/* ============================================
   全站響應式排版強化 (Mobile-First)
   ============================================ */

/* 手機版基礎字體、間距控制 */
@media (max-width: 640px) {

  /* 全站 body 字體恢復預設，避免太大 */
  body,
  .article-entry {
    font-size: 1em !important;
    letter-spacing: 0.02em !important;
  }

  /* 文章內容 */
  .article-entry {
    line-height: 1.75;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* 文章標題在手機上縮小 */
  .article-entry h1 {
    font-size: 1.5em;
  }

  .article-entry h2 {
    font-size: 1.25em;
  }

  .article-entry h3 {
    font-size: 1.1em;
  }

  /* Code block 橫向滾動，不讓它撐破版面 */
  .article-entry pre,
  .article-entry code {
    font-size: 0.82em !important;
    overflow-x: auto;
    max-width: 100%;
  }

  /* 文章內 table 可橫向滾動 */
  .article-entry table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 0.85em;
  }

  /* 導航列 logo 縮小 */
  #title-nav a {
    font-size: 13px !important;
    letter-spacing: 0.02em;
  }

  /* 文章大綱列表手機版字體 */
  .post-outline-list li {
    font-size: 0.85em;
    padding: 5px 0 5px 20px;
  }

  /* Cyber sorting lab 手機版 */
  .cyber-sorting-lab .algo-nav-bar {
    gap: 5px;
    padding: 10px 12px 0;
  }

  .algo-nav-btn {
    font-size: 0.72rem !important;
    padding: 6px 10px !important;
  }

  .array-container {
    height: 160px !important;
    padding: 0 12px 16px !important;
    gap: 3px !important;
  }

  .status-panel {
    font-size: 0.78rem !important;
  }
}

/* 平板 (641px - 1023px) */
@media (min-width: 641px) and (max-width: 1023px) {

  body,
  .article-entry {
    font-size: 1.05em !important;
  }

  .article-entry h1 {
    font-size: 1.65em;
  }

  .article-entry h2 {
    font-size: 1.35em;
  }
}