/* WhatoFlow 使用者操作手冊 — 共用樣式（品牌寫法 WhatoFlow） */
:root {
  --ink: #1a1d26;
  --muted: #5c6370;
  --line: #e2e6ef;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --surface: #f8fafc;
  --cover-fallback: #2e004f;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: #fff;
}

a {
  color: var(--brand);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  color: var(--brand-dark);
}

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

/* —— 封面（login_bg + 白字 + 白 logo PNG） —— */
.cover {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  /* 下移 logo／標題／副標，落在背景圖中央較無花紋區域，避開頂部粉紅波浪 */
  padding: clamp(9.5rem, 26vh, 15rem) 1.5rem 3rem;
  background-color: var(--cover-fallback);
  background-image: url("login_bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: #ffffff;
  page-break-after: always;
}

.cover > * {
  position: relative;
  z-index: 1;
}

.cover .logo-wrap {
  margin-bottom: 2rem;
}
.cover .logo-wrap img,
.cover .logo-wrap svg {
  width: min(420px, 92vw);
  height: auto;
  display: block;
  margin: 0 auto;
}

.cover h1 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 0 0.75rem;
  line-height: 1.3;
  color: #ffffff;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.35);
}

.cover .subtitle {
  font-size: 1.1rem;
  opacity: 0.95;
  max-width: 36em;
  margin: 0 auto 0;
  color: #ffffff;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
}

.cover .subtitle strong {
  color: #ffffff;
  font-weight: 700;
}

.cover .subtitle a {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.cover .subtitle a:hover {
  opacity: 0.9;
}

.cover .meta {
  font-size: 0.95rem;
  opacity: 0.88;
  color: rgba(255, 255, 255, 0.92);
  border-top: 1px solid rgba(255, 255, 255, 0.35);
  padding-top: 1.25rem;
  margin-top: auto;
}

.cover .meta time {
  color: inherit;
}

.cover .cta {
  margin-top: 2rem;
}
.cover .cta a {
  display: inline-block;
  background: transparent;
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.9);
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  text-shadow: none;
}
.cover .cta a:hover {
  background: rgba(255, 255, 255, 0.15);
  text-decoration: none;
}

/* —— 手冊語言切換（中文／English） —— */
.cover .cover-lang {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  z-index: 2;
}
.cover .cover-lang .lang-sep {
  margin: 0 0.4em;
  opacity: 0.75;
}
.cover .cover-lang .lang-current {
  font-weight: 700;
  color: #ffffff;
}
.cover .cover-lang a {
  color: #ffffff;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.cover .cover-lang a:hover {
  opacity: 0.92;
  text-decoration: underline;
}

/* —— 目錄頁 —— */
.toc-page {
  padding: 2.5rem 0 2rem;
  page-break-after: always;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2rem;
}

.toc-page h2 {
  font-size: 1.5rem;
  margin: 0 0 1.25rem;
  color: var(--ink);
}

.toc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.35rem 1.5rem;
}

.toc-grid a {
  display: block;
  padding: 0.35rem 0;
  border-bottom: 1px dotted var(--line);
}

/* —— 章節 —— */
article.chapter {
  margin-bottom: 3rem;
  page-break-inside: avoid;
}

article.chapter h2 {
  font-size: 1.35rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--brand);
  margin: 2.5rem 0 1rem;
  scroll-margin-top: 1rem;
}

.chapter-tutorial-label {
  display: inline;
  font-size: 0.72em;
  font-weight: 500;
  color: var(--muted);
  margin-left: 0.25rem;
}

article.chapter h3 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.65rem;
  color: #111827;
}

article.chapter h4 {
  font-size: 1rem;
  margin: 1.1rem 0 0.5rem;
  color: var(--muted);
}

.path-callout {
  background: var(--surface);
  border-left: 4px solid var(--brand);
  padding: 0.85rem 1rem;
  margin: 1rem 0;
  font-size: 0.95rem;
}

/* 章節開頭：給非技術背景讀者的用途與例子 */
.chapter-intro {
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 1.1rem 1.2rem;
  margin: 0 0 1.75rem;
  font-size: 0.98rem;
}
.chapter-intro h3 {
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
  color: var(--brand-dark);
}
.chapter-intro ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}
.chapter-intro li {
  margin: 0.35rem 0;
}

.path-callout strong {
  color: var(--ink);
}

ul.steps {
  margin: 0.5rem 0 1rem 1.2rem;
  padding: 0;
}
ul.steps li {
  margin: 0.35rem 0;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 1rem 0;
}
table.data th,
table.data td {
  border: 1px solid var(--line);
  padding: 0.5rem 0.65rem;
  text-align: left;
  vertical-align: top;
}
table.data th {
  background: var(--surface);
  font-weight: 600;
}

.faq {
  margin: 1rem 0;
}
.faq dt {
  font-weight: 600;
  margin-top: 1rem;
  color: #111827;
}
.faq dd {
  margin: 0.25rem 0 0 0;
  color: var(--muted);
}

.note {
  font-size: 0.92rem;
  color: var(--muted);
  font-style: italic;
}

.nav-top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}
.nav-top a {
  margin-right: 1rem;
}
.nav-top .nav-lang {
  margin-left: auto;
  margin-right: 0;
  font-size: 0.88rem;
  color: var(--muted);
  white-space: nowrap;
}
.nav-top .nav-lang .lang-current {
  font-weight: 600;
  color: var(--ink);
}
.nav-top .nav-lang .lang-sep {
  margin: 0 0.35em;
  opacity: 0.65;
}
.nav-top .nav-lang a {
  margin-right: 0;
  font-weight: 600;
}

body.manual-en {
  font-family: "Segoe UI", system-ui, -apple-system, "Roboto", "Helvetica Neue", Arial, sans-serif;
}

footer.manual-foot {
  margin-top: 3rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
  color: var(--muted);
}

/* —— Tutorial 教學範例區塊（各章末尾） —— */
.tutorial-box {
  margin-top: 2.75rem;
  padding: 1.35rem 1.4rem 1.25rem;
  border-radius: 12px;
  background: linear-gradient(145deg, #1e1b2e 0%, #2d2640 100%);
  color: #f1f5f9;
  border: 1px solid rgba(167, 139, 250, 0.35);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
}
/* 須高於 article.chapter h3 的深色字，否則標題在深色底上看不見 */
article.chapter .tutorial-box h3 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.02em;
}
article.chapter .tutorial-box h3 .tag {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.12rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 4px;
  background: rgba(167, 139, 250, 0.35);
  color: #faf5ff;
  vertical-align: middle;
}
.tutorial-box p {
  margin: 0.5rem 0;
  font-size: 0.95rem;
  line-height: 1.65;
  color: rgba(248, 250, 252, 0.92);
}
.tutorial-box ul {
  margin: 0.45rem 0 0;
  padding-left: 1.2rem;
}
.tutorial-box li {
  margin: 0.35rem 0;
  color: rgba(248, 250, 252, 0.88);
}
.tutorial-box .how-system {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.88rem;
  color: rgba(226, 232, 240, 0.78);
}
.tutorial-box .how-system strong {
  color: #c4b5fd;
}

@media print {
  .nav-top,
  .cover .cta,
  .cover .cover-lang,
  .nav-top .nav-lang {
    display: none;
  }
  .cover {
    min-height: auto;
    page-break-after: always;
    background-image: none;
    background-color: var(--cover-fallback);
    color: #fff;
    padding-top: clamp(6rem, 20vh, 10rem);
  }
  .cover .subtitle a {
    color: #fff;
  }
  a {
    color: #000;
    text-decoration: none;
  }
  .tutorial-box {
    background: #f8fafc;
    color: var(--ink);
    border: 1px solid var(--line);
    box-shadow: none;
  }
  .tutorial-box h3,
  .tutorial-box h3 .tag {
    color: var(--ink);
    background: #e2e8f0;
  }
  .tutorial-box p,
  .tutorial-box li {
    color: var(--ink);
  }
  .tutorial-box .how-system {
    color: var(--muted);
    border-top-color: var(--line);
  }
  .tutorial-box .how-system strong {
    color: var(--ink);
  }
}
