@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Fira+Code:wght@400;500;600;700&display=swap');

:root {
  /* ── Spatial UI (VisionOS) Optimized ── */
  --font-body:  'Inter', 'Microsoft JhengHei', '微軟正黑體', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:  'Fira Code', 'Microsoft JhengHei', monospace;
  
  --bg:         #F2F2F7;
  --surface:    rgba(255, 255, 255, 0.8); 
  --surface-hover: rgba(255, 255, 255, 0.95);
  --border:     transparent; 
  --text:       #000000;
  --muted:      #86868B;
  
  --accent:     #007AFF;
  --green:      #34C759;
  --purple:     #5856D6;
  --cyan:       #32ADE6;
  
  --radius:     24px;
  --shadow:     0 4px 20px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --glow:       0 0 20px rgba(0, 122, 255, 0.15);
  --transition: 400ms cubic-bezier(0.23, 1, 0.32, 1);
  
  --bg-element: rgba(0, 0, 0, 0.04);
  --bg-hover:   rgba(0, 0, 0, 0.08);
  --line:       rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] {
  --bg:         #000000;
  --surface:    rgba(28, 28, 30, 0.7);
  --surface-hover: rgba(44, 44, 46, 0.85);
  --border:     rgba(255, 255, 255, 0.05);
  --text:       #FFFFFF;
  --muted:      #98989D;
  --accent:     #0A84FF;
  
  --shadow:     0 20px 40px rgba(0, 0, 0, 0.5);
  --bg-element: rgba(255, 255, 255, 0.08);
  --bg-hover:   rgba(255, 255, 255, 0.12);
  --line:       rgba(255, 255, 255, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s ease, color 0.4s ease;
  font-size: 16px;
}

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

/* ── Layout ── */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 100px 24px 40px;
}

/* ── Navbar ── */
.navbar {
  position: fixed;
  top: 16px; left: 16px; right: 16px;
  height: 64px;
  background: var(--surface);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: none;
  border-radius: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 18px;
  color: var(--accent);
  text-shadow: 0 0 10px rgba(0, 122, 255, 0.2);
}

.tab-btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition);
}
.tab-btn:hover { color: var(--text); background: var(--bg-element); }
.tab-btn.active { 
  color: var(--text); 
  background: var(--surface); 
  font-weight: 700; 
  box-shadow: 0 2px 8px rgba(0,0,0,0.08); 
}

.theme-toggle {
  background: var(--surface);
  border: none;
  color: var(--text);
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
}
.theme-toggle:hover {
  transform: rotate(15deg) scale(1.1);
}

/* ── Bento Grid ── */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
}

.bento-item {
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: none;
  border-radius: var(--radius);
  padding: 32px;
  transition: all var(--transition);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.bento-item:hover {
  transform: scale(1.01);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
  background: var(--surface-hover);
}

/* ── Bento Sizes ── */
.span-12 { grid-column: span 12; }
.span-8 { grid-column: span 8; }
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }

/* ── Hero Item ── */
.hero-item {
  background: linear-gradient(135deg, var(--accent) 0%, #0056B3 100%);
  color: white; border: none;
  position: relative;
}
.hero-item:hover {
  background: linear-gradient(135deg, var(--accent) 0%, #0056B3 100%);
}
.hero-item::after {
  content: '';
  position: absolute; top: -50%; right: -20%;
  width: 300px; height: 300px;
  background: rgba(255,255,255,0.2);
  filter: blur(80px);
  border-radius: 50%;
  pointer-events: none;
}
.hero-item h1 { 
  font-size: 56px; 
  font-weight: 800; 
  letter-spacing: -0.04em; 
  margin-bottom: 20px; 
  line-height: 1.1;
}
.hero-item p { font-size: 20px; opacity: 0.9; max-width: 600px; font-weight: 500; }

/* ── Dept Cards ── */
.dept-card .dept-name { font-size: 22px; font-weight: 700; margin-bottom: 8px; color: var(--accent); }
.dept-card .dept-desc { font-size: 16px; color: var(--muted); margin-bottom: 24px; }
.dept-card .tag-container { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }

.tag {
  font-family: var(--font-mono); 
  font-size: 15px; /* 放大字級 14px -> 15px */
  font-weight: 600;
  background: var(--bg-element); 
  color: var(--text); 
  border: none;
  padding: 10px 18px; /* 放大點擊與留白範圍 */
  border-radius: 14px; 
  transition: all 200ms;
  display: inline-block; 
  white-space: nowrap;
  cursor: pointer;
}
.tag:hover { 
  background: var(--accent); 
  color: white; 
  box-shadow: var(--glow); 
}

/* ── Workflows Tab Button ── */
.wf-tab-btn {
  font-family: var(--font-body);
  font-size: 16px; /* 放大字級 14px -> 16px */
  font-weight: 700; /* 加粗，讓大寫字母更有力 */
  padding: 12px 28px; /* 增加點擊範圍 */
  border-radius: 12px;
  border: none;
  background: var(--bg-element);
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.wf-tab-btn:hover { color: var(--text); background: var(--bg-hover); }
.wf-tab-btn.active { 
  background: var(--surface); 
  color: var(--text); 
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ── Notes Grid ── */
.notes-item { background: var(--surface); border: none; box-shadow: inset 0 0 20px rgba(0,0,0,0.02); }
.notes-item .notes-title { font-size: 22px; font-weight: 700; margin-bottom: 16px; color: var(--green); }
.notes-item li { font-size: 16px; color: var(--muted); margin-bottom: 12px; list-style: none; display: flex; gap: 12px; }
.notes-item li::before { content: "→"; color: var(--green); font-weight: 900; }

/* ── Skill Panel ── */
.skill-panel {
  position: fixed; right: 0; top: 0; bottom: 0; width: 440px;
  background: var(--surface);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: none;
  z-index: 1100; transform: translateX(100%); transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 48px; display: flex; flex-direction: column; gap: 32px;
}
.skill-panel.open { transform: translateX(0); box-shadow: -20px 0 60px rgba(0,0,0,0.15); }

/* ── Vertical Timeline ── */
.timeline {
  position: relative;
  padding: 24px 0 24px 32px;
}
.timeline::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 11px;
  width: 1px;
  background: var(--line);
}
.timeline-item {
  position: relative;
  margin-bottom: 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.timeline-marker {
  position: absolute;
  left: -32px; top: 50%;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  z-index: 1;
  transform: translateY(-50%);
  box-shadow: 0 0 0 6px var(--bg);
}
.timeline-content {
  background: var(--bg-element);
  border-radius: var(--radius);
  padding: 32px 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  align-items: center;
  transition: all 0.3s ease;
}
.timeline-content:hover {
  background: var(--bg-hover);
  transform: translateX(8px);
}
.timeline-header { flex: 1 1 320px; }
.timeline-actions {
  flex: 3 1 600px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: stretch;
}
.timeline-step {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  background: var(--surface);
  padding: 20px 24px;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  min-width: 260px;
  flex: 1;
}

/* ── Responsive ── */

/* Tablet ≤ 900px */
@media (max-width: 900px) {
  .span-8, .span-6, .span-4 { grid-column: span 12; }
  .bento-grid { gap: 12px; }
}

/* Mobile ≤ 600px */
@media (max-width: 600px) {
  .container { padding: 96px 12px 24px; }

  /* code 區塊：長指令可橫滑，不截斷 */
  code {
    white-space: pre;
    overflow-x: auto;
    max-width: 100%;
    display: block;
  }
  /* inline code 維持 inline */
  li code, p code { display: inline; white-space: normal; }

  /* Navbar: Row1 = brand + moon，Row2 = tabs 橫滑 */
  .navbar {
    top: 8px; left: 8px; right: 8px;
    height: auto;
    padding: 10px 14px 8px;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 0;
    border-radius: 20px;
  }
  /* brand+tabs wrapper: wrap 讓 tabs 換到下一行 */
  .navbar > div:first-child {
    flex: 1 1 auto;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
  }
  /* tabs 佔滿第二行 + 可橫滑 */
  .navbar > div:first-child > div:last-child {
    flex: 0 0 100%;
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 2px;
  }
  .navbar > div:first-child > div:last-child::-webkit-scrollbar { display: none; }
  /* moon+github: 壓縮到上排右側 */
  .navbar > div:last-child { flex: 0 0 auto; gap: 10px; }
  /* 隱藏 GITHUB 文字，只保留 moon icon */
  .navbar a { display: none; }
  .navbar-brand { font-size: 14px; }
  .tab-btn { font-size: 11px; padding: 5px 10px; white-space: nowrap; flex-shrink: 0; }

  /* Bento — !important 覆蓋 inline style */
  .bento-item { padding: 20px !important; border-radius: 16px; }

  /* Workflow sub-tab bar：橫滑不溢出 */
  .wf-tab-bar { overflow-x: auto !important; overflow-y: visible; scrollbar-width: none; flex-wrap: nowrap; width: 100% !important; }
  .wf-tab-bar::-webkit-scrollbar { display: none; }
  .wf-tab-btn { flex-shrink: 0; }

  /* Hero */
  .hero-item h1 { font-size: 36px; }
  .hero-item p  { font-size: 15px; }

  /* Skill side panel: full width on mobile */
  .skill-panel { width: 100%; padding: 24px; }

  /* Timeline */
  .timeline { padding: 16px 0 16px 24px; }
  .timeline-content { padding: 16px !important; flex-direction: column; gap: 12px; }
  .timeline-header  { flex: 0 0 100% !important; }
  .timeline-actions { flex: 0 0 100% !important; gap: 10px; }
  .timeline-step { min-width: unset; padding: 14px 16px; }
}
