/* ============================================================
   Agentic AI Agent 課程 — 提案 B (編輯式 / Hero banner)
   Tzu Chi 學思網 tokens: primary navy #30559F, ink #1b2a45,
   body #3a4a63, border #e4e8f0, teal accent, 4px buttons, Noto Sans TC.
   Light theme locked.
   ============================================================ */

:root {
  color-scheme: light;

  --primary: #30559f;
  --primary-dark: #274a86;
  --primary-tint: #eef2f9;
  --ink: #1b2a45;
  --teal: #2c8577;
  --teal-bg: #e6f4f1;

  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --border: #e4e8f0;

  --text: #1b2a45;
  --text-muted: #3a4a63;
  --text-faint: #7d879b;

  --accent: var(--primary);
  --accent-strong: var(--primary-dark);

  --shadow: 0 1px 2px rgba(27, 42, 69, 0.05), 0 10px 28px rgba(27, 42, 69, 0.07);

  --radius: 12px;
  --radius-sm: 8px;
  --btn-radius: 4px;
  --wrap: 1180px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Noto Sans TC", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1.1rem, 4vw, 3rem);
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 7px;
  background: var(--primary);
  color: #fff;
  flex: none;
}
.brand-mark svg { width: 16px; height: 16px; }
.brand-title { font-size: 1.05rem; font-weight: 700; letter-spacing: 0.01em; color: var(--text); line-height: 1.2; }
.brand-tag {
  font-size: 0.72rem; font-weight: 500;
  color: var(--teal); background: var(--teal-bg);
  padding: 0.12rem 0.5rem; border-radius: 999px;
}
.identity { display: inline-flex; align-items: center; gap: 0.6rem; font-size: 0.88rem; color: var(--text); }
.identity-avatar {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 0.82rem; font-weight: 700; flex: none;
}
.identity-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 26vw; }
.identity-logout {
  font-size: 0.82rem; font-weight: 500; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: var(--btn-radius);
  padding: 0.34rem 0.72rem;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease), background 0.18s var(--ease);
}
.identity-logout:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-tint); }

/* ---------- Hero banner (navy) ---------- */
.hero {
  background: linear-gradient(160deg, #1b2a45 0%, #30559f 100%);
  color: #fff;
}
.hero-inner { padding-block: clamp(2.6rem, 5vw, 3.6rem); max-width: 820px; }
.greeting { margin: 0 0 0.9rem; font-size: 0.98rem; color: rgba(255, 255, 255, 0.72); }
.greeting b { font-weight: 700; color: #fff; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  margin: 0 0 0.9rem; font-size: 0.82rem; font-weight: 700;
  letter-spacing: 0.04em; color: #a9d9d0;
}
.hero-eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #a9d9d0; }
.hero h1 {
  margin: 0 0 0.9rem;
  font-size: clamp(2rem, 4.6vw, 2.9rem);
  font-weight: 700; letter-spacing: -0.01em; line-height: 1.18; color: #fff;
}
.hero-lede { margin: 0 0 1.6rem; font-size: clamp(1rem, 2vw, 1.12rem); color: rgba(255, 255, 255, 0.85); max-width: 58ch; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.4rem; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin: 0; padding: 0; list-style: none; font-size: 0.9rem; color: rgba(255, 255, 255, 0.78); }
.hero-meta li { display: inline-flex; align-items: center; gap: 0.4rem; }
.hero-meta li strong { color: #fff; font-weight: 700; }

/* ---------- Buttons (學思網 Button) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  font: inherit; font-weight: 700; font-size: 1rem; line-height: 1.4;
  padding: 0.72rem 1.5rem; border-radius: var(--btn-radius);
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: background 0.18s var(--ease), transform 0.12s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-onnavy { background: #fff; color: var(--primary); }
.btn-onnavy:hover { background: #eaeef6; color: var(--primary); }

/* ---------- Course area (stacked) ---------- */
.course {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  padding-top: clamp(2rem, 4vw, 2.6rem);
  padding-bottom: clamp(3rem, 7vw, 5rem);
}
.player-frame {
  position: relative;
  padding-top: 56.25%;
  background: #0e1626;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.now-playing { padding-top: 0.2rem; }
.now-label { margin: 0 0 0.35rem; font-size: 0.8rem; font-weight: 700; color: var(--primary); }
.now-playing h2 { margin: 0 0 0.5rem; font-size: clamp(1.2rem, 3vw, 1.5rem); font-weight: 700; line-height: 1.3; color: var(--text); }
.now-desc { margin: 0; color: var(--text-muted); max-width: 62ch; }

/* ---------- Playlist (horizontal cards) ---------- */
.playlist-heading {
  display: flex; align-items: center; gap: 0.5rem;
  margin: 1rem 0 0.2rem; font-size: 1.05rem; font-weight: 700; color: var(--text);
}
.playlist-heading::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.playlist {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 720px) { .playlist { grid-template-columns: 1fr 1fr; } }
.lesson {
  display: grid;
  grid-template-columns: 2.8rem 1fr;
  gap: 0.9rem;
  align-items: center;
  width: 100%; text-align: start;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); cursor: pointer; font: inherit;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.lesson:hover:not(:disabled) { border-color: var(--primary); box-shadow: var(--shadow); }
.lesson:disabled { cursor: not-allowed; opacity: 0.6; }
.lesson[aria-current="true"] { border-color: var(--primary); background: var(--primary-tint); }
.lesson[aria-current="true"] .lesson-num { background: var(--primary); color: #fff; border-color: transparent; }
.lesson-num {
  display: grid; place-items: center;
  width: 2.8rem; height: 2.8rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  font-weight: 700; font-size: 1rem; color: var(--text-muted);
}
.lesson-body { min-width: 0; }
.lesson-title { margin: 0 0 0.15rem; font-weight: 500; font-size: 0.98rem; line-height: 1.4; }
.lesson-sub { margin: 0; font-size: 0.8rem; color: var(--text-faint); display: inline-flex; align-items: center; gap: 0.4rem; }
.badge-soon {
  display: inline-block; font-size: 0.72rem; font-weight: 500;
  color: var(--teal); background: var(--teal-bg);
  padding: 0.05rem 0.5rem; border-radius: 999px;
}

/* ---------- Panels (Q&A + participants) ---------- */
.panel { margin-top: 0.6rem; }
.panel-head { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 1rem; }
.panel-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.panel-head h2 { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--text); }

.qa-form { display: flex; flex-direction: column; gap: 0.7rem; margin-bottom: 1.4rem; }
.qa-form textarea {
  width: 100%; resize: vertical; min-height: 2.8rem;
  font: inherit; font-size: 0.95rem; color: var(--text);
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
}
.qa-form textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.qa-form .btn { align-self: flex-end; }

.qa-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.9rem; }
.qa-empty, .p-empty { color: var(--text-faint); font-size: 0.9rem; padding: 0.4rem 0; }
.qa-item { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); padding: 0.9rem 1rem; }
.qa-q { display: flex; align-items: baseline; gap: 0.6rem; margin-bottom: 0.35rem; }
.qa-q strong { font-size: 0.92rem; color: var(--text); }
.qa-time { font-size: 0.75rem; color: var(--text-faint); }
.qa-body { margin: 0; font-size: 0.95rem; color: var(--text-muted); line-height: 1.6; white-space: pre-wrap; }
.qa-ans { margin-top: 0.7rem; padding: 0.7rem 0.9rem; background: var(--primary-tint); border-radius: var(--radius-sm); border-left: 3px solid var(--primary); }
.qa-ans strong { font-size: 0.82rem; color: var(--primary); }
.qa-ans p { margin: 0.25rem 0 0; font-size: 0.92rem; color: var(--text-muted); line-height: 1.6; white-space: pre-wrap; }
.qa-answer-btn { margin-top: 0.6rem; font: inherit; font-size: 0.82rem; font-weight: 700; color: var(--primary); background: none; border: 1px solid var(--border); border-radius: var(--btn-radius); padding: 0.3rem 0.7rem; cursor: pointer; }
.qa-answer-btn:hover { border-color: var(--primary); background: var(--primary-tint); }

.participants-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; align-items: start; }
@media (max-width: 640px) { .participants-cols { grid-template-columns: 1fr; } }
.p-col-title { margin: 0 0 0.7rem; font-size: 0.85rem; font-weight: 700; color: var(--text-muted); letter-spacing: 0.02em; }
.participant-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.participant { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.8rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.p-avatar { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 0.82rem; font-weight: 700; }
.p-name { font-size: 0.9rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-badge { margin-left: auto; font-size: 0.7rem; font-weight: 700; color: var(--teal); background: var(--teal-bg); padding: 0.1rem 0.45rem; border-radius: 999px; }

/* ---------- Login page (/login) ---------- */
.login-page {
  min-height: 100dvh; display: grid; place-items: center; padding: 2rem 1.25rem;
  background: linear-gradient(180deg, #1b2a45 0%, #30559f 100%) no-repeat top / 100% 220px, var(--bg);
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(27, 42, 69, 0.22);
  padding: 2.6rem 2rem 2rem; text-align: center;
}
.login-mark {
  display: grid; place-items: center; width: 52px; height: 52px;
  margin: 0 auto 1.3rem; color: #fff; background: var(--primary); border-radius: 12px;
}
.login-mark svg { width: 26px; height: 26px; }
.login-card h1 { margin: 0 0 0.5rem; font-size: 1.35rem; font-weight: 700; line-height: 1.3; color: var(--text); }
.login-card .sub { margin: 0 0 1.9rem; color: var(--text-muted); font-size: 0.94rem; line-height: 1.6; }
.login-card .btn { width: 100%; }
.login-note { margin: 1.4rem 0 0; font-size: 0.8rem; color: var(--text-faint); }
.g-icon { width: 18px; height: 18px; flex: none; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); }
.footer-inner { padding-block: 1.6rem; font-size: 0.85rem; color: var(--text-faint); text-align: center; }
.footer-inner p { margin: 0.15rem 0; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
