/* ==========================================================================
   series-shell.css — 教學頁共用外殼
   套用範圍：/ai-work-team/**、/threads/**（由 tools/sync-series-chrome.mjs 注入）
   尺寸與樣式對齊 src/components/layout/Header.astro / AnnouncementBar.astro：
     header 64px、容器 1280px、品牌頭像 44px、導覽 14px、CTA 6px 圓角
     primary oklch(0.7 0.2 50)、surface oklch(0.98 0.01 50)、border oklch(0.9 0 0)
   ========================================================================== */

:root {
  --sr-ink: oklch(0.15 0 0);
  --sr-ink-2: oklch(0.25 0 0);
  --sr-muted: oklch(0.45 0 0);
  --sr-line: oklch(0.9 0 0);
  --sr-line-soft: oklch(0.95 0 0);
  --sr-surface: oklch(0.98 0.01 50);
  --sr-primary: oklch(0.7 0.2 50);
  --sr-primary-dark: oklch(0.6 0.2 45);
  --sr-bg: #ffffff;
  --sr-radius: 6px;
  --sr-max: 1280px;
  --sr-header-h: 64px;
  /* 與 src/styles/global.css 的 body 字族逐字相同 */
  --sr-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  /* 蓋掉子站自己的變數，讓襯線體（Georgia / Noto Serif TC）不再出現 */
  --sans: var(--sr-sans);
  --serif: var(--sr-sans);
}

/* ---------- 公告條（同 AnnouncementBar primary） ---------- */

.sr-announce {
  position: relative;
  background: var(--sr-primary);
  color: #fff;
  padding: 8px 16px;
  text-align: center;
  font-family: var(--sr-sans);
}
.sr-announce p {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 32px;
  font-size: 12px;
  line-height: 16px; /* Tailwind text-xs 的預設行高，主站公告條高度 32px */
  font-weight: 500;
}
.sr-announce a {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: #fff;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.sr-announce a:hover {
  text-decoration: none;
}
.sr-announce a svg {
  width: 16px;
  height: 16px;
}
.sr-announce-x {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--sr-radius);
  background: transparent;
  color: #fff;
  opacity: 0.85;
  cursor: pointer;
}
.sr-announce-x:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.2);
}
.sr-announce-x svg {
  width: 16px;
  height: 16px;
}

/* ---------- 頁首 ---------- */

#sr-head {
  display: block;
  height: auto;
  padding: 6px 0 0;
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--sr-line);
  color: var(--sr-ink);
  font-family: var(--sr-sans);
  font-size: 12px;
  line-height: 16px;
}

.sr-head a,
.sr-foot-in a,
.sr-foot-bottom a {
  text-decoration: none;
}

.sr-head-in {
  max-width: var(--sr-max);
  margin: 0 auto;
  padding: 0 32px;
  height: var(--sr-header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-sizing: border-box;
}

/* 品牌：頭像 + 站名 + 標語，與主站頁首完全同構 */
.sr-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  min-width: 0;
}
.sr-brand img {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  object-fit: cover;
  border: 2px solid color-mix(in oklch, var(--sr-primary) 22%, transparent);
  flex: 0 0 auto;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.sr-brand-txt {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1;
  min-width: 0;
}
.sr-brand-txt b {
  font-size: 20px;
  line-height: 28px; /* 主站 text-xl 的 1.75rem 行高 */
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--sr-ink);
  white-space: nowrap;
}
.sr-brand-txt small {
  margin-top: 4px;
  font-size: 12px;
  line-height: 16px; /* 對齊主站 text-xs 的 1rem 行高 */
  font-weight: 500;
  color: var(--sr-muted);
  white-space: nowrap;
}

/* 主站導覽 */
.sr-main {
  display: flex;
  align-items: center;
  gap: 24px;
}
.sr-main a {
  padding: 4px 8px;
  line-height: 20px;
  border-radius: var(--sr-radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--sr-muted);
  transition: color 0.15s ease, background 0.15s ease;
}
.sr-main a:hover {
  color: var(--sr-ink);
}
.sr-main a[aria-current='page'],
.sr-main a.is-current {
  color: var(--sr-ink);
  background: var(--sr-surface);
}

/* 搜尋 / CTA */
.sr-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 0 0 auto;
}
.sr-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 8px;
  line-height: 20px;
  border-radius: var(--sr-radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--sr-muted);
  transition: background 0.15s ease, color 0.15s ease;
}
.sr-search:hover {
  background: var(--sr-surface);
  color: var(--sr-ink);
}
.sr-search svg {
  width: 16px;
  height: 16px;
}
/* 保留主站夜間模式按鈕的寬度，讓導覽與主站落在同一條垂直線上 */
.sr-theme-space {
  display: inline-block;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
}
.sr-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 8px 16px;
  line-height: 20px;
  border-radius: var(--sr-radius);
  background: var(--sr-primary);
  color: #fff !important;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease;
}
.sr-cta:hover {
  background: var(--sr-primary-dark);
}
.sr-burger {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--sr-radius);
  background: transparent;
  color: var(--sr-ink);
  cursor: pointer;
}
.sr-burger svg {
  width: 20px;
  height: 20px;
}
.sr-burger:hover {
  background: var(--sr-surface);
}

/* 教學章節列：教學名稱 + 章節 */
.sr-sub {
  border-top: 1px solid var(--sr-line-soft);
  background: rgba(255, 255, 255, 0.9);
}
.sr-sub-in {
  max-width: var(--sr-max);
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 44px;
  overflow-x: auto;
  scrollbar-width: none;
  box-sizing: border-box;
}
.sr-sub-in::-webkit-scrollbar {
  display: none;
}
.sr-sub-title {
  flex: 0 0 auto;
  margin-right: 10px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--sr-ink);
  white-space: nowrap;
  transition: color 0.15s ease;
}
.sr-sub-title:hover {
  color: var(--sr-primary);
}
.sr-sub a {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--sr-muted);
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}
.sr-sub a:hover {
  color: var(--sr-ink);
  background: var(--sr-surface);
}
.sr-sub a[aria-current='page'] {
  color: #fff;
  background: var(--sr-ink);
  font-weight: 600;
}
/* 教學名稱本身是當前頁時維持文字樣式，不要變成黑色藥丸 */
.sr-sub a.sr-sub-title[aria-current='page'] {
  color: var(--sr-ink);
  background: transparent;
  font-weight: 700;
}
.sr-sub-note {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 11.5px;
  color: var(--sr-muted);
  padding-left: 12px;
  white-space: nowrap;
}

/* ---------- 頁尾 ---------- */

#sr-foot {
  display: block;
  margin-top: 72px;
  padding: 0;
  border-top: 1px solid var(--sr-line);
  background: var(--sr-bg);
  color: var(--sr-muted);
  font-family: var(--sr-sans);
  font-size: 13px;
}
.sr-foot-in {
  max-width: var(--sr-max);
  margin: 0 auto;
  padding: 44px 32px 28px;
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 32px;
  box-sizing: border-box;
}
.sr-foot-brand b {
  display: block;
  font-size: 15px;
  color: var(--sr-ink);
  margin-bottom: 10px;
}
.sr-foot-brand p {
  margin: 0 0 16px;
  line-height: 1.75;
  font-size: 12.5px;
}
.sr-foot-col b {
  display: block;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--sr-ink);
  margin-bottom: 10px;
}
.sr-foot-col a {
  display: block;
  padding: 3px 0;
  font-size: 12.5px;
  color: var(--sr-muted);
}
.sr-foot-col a:hover {
  color: var(--sr-primary);
}
.sr-foot-bottom {
  max-width: var(--sr-max);
  margin: 0 auto;
  padding: 14px 32px 28px;
  border-top: 1px solid var(--sr-line-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  justify-content: space-between;
  font-size: 11.5px;
  box-sizing: border-box;
}
.sr-foot-bottom nav {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* ---------- 內文字族與底色統一 ---------- */
body {
  font-family: var(--sr-sans);
  background: var(--sr-bg);
  background-image: none;
}
body h1,
body h2,
body h3,
body h4,
body h5,
body h6 {
  font-family: var(--sr-sans) !important;
}
body h1 em,
body h2 em,
body h3 em {
  font-family: inherit !important;
  font-style: normal;
}
/* 字重與字距對齊主站：h1/h2 extrabold 800 + tracking-tight */
body h1 {
  font-weight: 800 !important;
  letter-spacing: -0.025em !important;
}
body h2 {
  font-weight: 800 !important;
  letter-spacing: -0.02em !important;
}
body h3 {
  font-weight: 700 !important;
  letter-spacing: 0 !important;
}
body h4,
body h5,
body h6 {
  font-weight: 700 !important;
  letter-spacing: 0 !important;
}

/* ---------- 響應式 ---------- */
@media (max-width: 1023px) {
  .sr-head-in,
  .sr-sub-in {
    padding-left: 24px;
    padding-right: 24px;
  }
}

@media (max-width: 767px) {
  .sr-main,
  .sr-search span {
    display: none;
  }
  .sr-sub-note {
    display: none;
  }
  .sr-burger {
    display: inline-flex;
  }
  .sr-head-in {
    padding: 0 16px;
    gap: 12px;
  }
  .sr-brand img {
    width: 40px;
    height: 40px;
  }
  .sr-brand-txt b {
    font-size: 18px;
  }
  .sr-sub-in {
    padding-left: 16px;
    padding-right: 16px;
  }
  .sr-search {
    padding: 0 4px;
  }
  .sr-foot-in {
    grid-template-columns: 1fr 1fr;
    gap: 26px;
    padding: 32px 16px 20px;
  }
  .sr-foot-bottom {
    padding: 14px 16px 24px;
  }
}

@media (max-width: 560px) {
  .sr-cta {
    display: none;
  }
  .sr-foot-in {
    grid-template-columns: 1fr;
  }
}

/* 手機展開的主站導覽 */
.sr-mobile {
  display: none;
  border-top: 1px solid var(--sr-line-soft);
  background: #fff;
}
.sr-mobile.is-open {
  display: block;
}
.sr-mobile-in {
  max-width: var(--sr-max);
  margin: 0 auto;
  padding: 8px 16px 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 8px;
  box-sizing: border-box;
}
.sr-mobile a {
  padding: 9px 10px;
  border-radius: var(--sr-radius);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--sr-ink);
}
.sr-mobile a:hover {
  background: var(--sr-surface);
}
