/* CourseKit Help — minimal overrides on top of Pico.css */

/* CourseKit 品牌色：CKColors.primaryBlue (#2196F3) Material Blue 500
   設計 token 集中在這裡，下面樣式一律用 var(--ck-*)，換色一處改完。 */
:root {
  --pico-primary: #2196F3;
  --pico-primary-hover: #1E88E5;
  --pico-primary-focus: rgba(33, 150, 243, 0.25);
  --pico-primary-inverse: #FFF;

  --ck-primary-tint: rgba(33, 150, 243, 0.08);
  --ck-warn: #F59E0B;
  --ck-info: #3B82F6;
}

[data-theme="dark"] {
  --pico-primary: #64B5F6;
  --pico-primary-hover: #90CAF9;

  --ck-primary-tint: rgba(100, 181, 246, 0.15);
}

main {
  margin-bottom: 4rem;
}

main h2 {
  margin-top: 3rem;
}

main h3 {
  margin-top: 2rem;
}

.tagline {
  color: var(--pico-muted-color);
  font-size: 1.15rem;
  margin-bottom: 2rem;
}

.lang-switch {
  font-size: 0.9rem;
}

.lang-switch [aria-current="true"] {
  font-weight: 700;
  color: var(--pico-primary);
}

footer {
  text-align: center;
  margin-top: 4rem;
  padding-bottom: 2rem;
  color: var(--pico-muted-color);
}

table {
  font-size: 0.95rem;
}

blockquote {
  border-left-color: var(--pico-primary);
}

blockquote.warn {
  border-left-color: var(--ck-warn);
}

blockquote.info {
  border-left-color: var(--ck-info);
}

.lang-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.lang-cards article {
  text-align: center;
  margin: 0;
}

.lang-cards a {
  text-decoration: none;
}

/* App Store / Google Play 下載 badge — 黑底白字 pill 樣式，
   不分主題顏色固定（沿用 Apple/Google 官方 badge 視覺）。 */
.app-download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.app-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 1.25rem;
  background: #000;
  color: #fff;
  border: 1px solid #000;
  border-radius: 0.6rem;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.app-badge:hover,
.app-badge:focus-visible {
  color: #fff;
  opacity: 0.82;
  text-decoration: none;
}

.app-badge-logo {
  display: block;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.app-badge-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  line-height: 1;
}

.app-badge-caption {
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  opacity: 0.85;
}

.app-badge-text {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.brand-link img {
  display: inline-block;
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.theme-toggle {
  background: transparent;
  border: none;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  color: inherit;
  margin: 0;
}

.theme-toggle:hover {
  opacity: 0.7;
}

/* <details> 加可見的展開指示（Pico 預設會把原生三角形拿掉） */
details > summary {
  cursor: pointer;
  list-style: none;
  color: var(--pico-primary);
  background-color: var(--ck-primary-tint);
  padding: 0.6rem 0.8rem;
  border-radius: 0.35rem;
}
details > summary::-webkit-details-marker {
  display: none;
}
details > summary::before {
  content: "▶";
  display: inline-block;
  margin-right: 0.5em;
  font-size: 0.8em;
  color: var(--pico-primary);
  transition: transform 0.2s ease;
}
details[open] > summary::before {
  transform: rotate(90deg);
}
details[open] > summary {
  margin-bottom: 0.5rem;
}

/* 回到頂部按鈕（只出現在指南頁）
   用 !important 防止 Pico CSS button reset 蓋掉關鍵屬性 */
#back-to-top {
  position: fixed !important;
  bottom: 2rem;
  right: 1.5rem;
  width: 2.6rem !important;
  height: 2.6rem !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 50% !important;
  background: var(--pico-primary) !important;
  color: var(--pico-primary-inverse) !important;
  border: none !important;
  font-size: 1.1rem;
  line-height: 2.6rem;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, background 0.15s;
  z-index: 9999;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

#back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

#back-to-top:hover,
#back-to-top:focus {
  background: var(--pico-primary-hover) !important;
  outline: none;
}

@media (max-width: 480px) {
  #back-to-top {
    bottom: 1.25rem;
    right: 1rem;
    width: 2.2rem !important;
    height: 2.2rem !important;
    font-size: 1rem;
  }
}

/* ── 使用指南頁面共用樣式 ── */

/* TOC nav：pill 樣式，讓連結看起來可以點
   用 !important 防止 Pico nav a 樣式覆蓋 */
.guide-toc-nav {
  margin-top: 0.6rem;
  margin-bottom: 0;
}

.guide-toc-nav ul {
  display: flex !important;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.guide-toc-nav li {
  padding: 0 !important;
  margin: 0 !important;
}

.guide-toc-nav a,
.guide-toc-nav a:visited {
  display: inline-block !important;
  padding: 0.22rem 0.75rem !important;
  border: 1.5px solid var(--pico-primary) !important;
  border-radius: 2rem !important;
  font-size: 0.82rem !important;
  color: var(--pico-primary) !important;
  text-decoration: none !important;
  line-height: 1.6 !important;
  white-space: nowrap;
  transition: background 0.15s;
}

.guide-toc-nav a:hover {
  background: rgba(33, 150, 243, 0.1) !important;
  text-decoration: none !important;
}

/* 每個情境的 section：第一個不要 border-top */
.guide-section {
  border-top: 1px solid var(--pico-muted-border-color, #d0d0d0);
  padding-top: 1rem;
  margin-top: 1rem;
}

[data-theme="dark"] .guide-section {
  border-top-color: rgba(255, 255, 255, 0.15);
}


/* section 內的 h2 不套用全域 3rem margin */
.guide-section h2 {
  margin-top: 0 !important;
  margin-bottom: 0.5rem;
}

/* 情境 meta（適合誰看 / 你現在的狀況）：左色條 + 淡底色 */
.guide-meta {
  background: rgba(33, 150, 243, 0.07);
  border-left: 3px solid var(--pico-primary);
  border-radius: 0 0.4rem 0.4rem 0;
  padding: 0.65rem 1rem;
  margin-bottom: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.guide-meta p {
  margin: 0 !important;
  font-size: 0.9rem;
  line-height: 1.5;
}

.guide-meta strong {
  color: var(--pico-primary);
  margin-right: 0.5em;
}

/* 步驟圖片 placeholder */
.guide-placeholder {
  display: block;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 9 / 16;
  background: var(--pico-secondary-background, #e0e0e0);
  border-radius: 0.5rem;
  margin: 0.6rem 0 0.25rem;
  position: relative;
}

.guide-placeholder::after {
  content: attr(data-label);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  color: var(--pico-muted-color);
  padding: 1rem;
  text-align: center;
}

.step-img-wrap {
  margin: 0.4rem 0 0.75rem;
}

/* 第二排 nav（頁面選單）統一用主色 */
#site-header > nav:nth-of-type(2) a {
  color: var(--pico-primary);
}

#site-header > nav:nth-of-type(2) a:hover {
  color: var(--pico-primary-hover);
}

#site-header > nav:nth-of-type(2) a[aria-current="page"] {
  font-weight: 700;
}

/* 小螢幕 (iPhone 13 mini = 375pt) 防止 nav 跳行：
   - nav 改成 flex-wrap，讓兩排 ul 寬度不夠時自然垂直堆疊
   - 個別 link 標籤強制不換行（避免「自主紀錄」斷成兩行）
   - 縮小水平 padding 讓更多 item 擠得下 */
@media (max-width: 480px) {
  #site-header > nav {
    flex-wrap: wrap;
    row-gap: 0.25rem;
  }
  #site-header nav ul {
    flex-wrap: wrap;
  }
  #site-header nav li > a,
  #site-header nav li > button {
    white-space: nowrap;
    padding-inline: 0.4rem;
  }
  /* 品牌文字在窄螢幕隱藏，只保留 icon */
  .brand-link strong {
    display: none;
  }
  .lang-switch {
    font-size: 0.85rem;
  }
}
