/* ============================================================
   Vercel Design Tokens — joan-automation-showcase
   ============================================================ */
:root {
  --bg-white: #FFFFFF;
  --bg-gray-50: #FAFAFA;
  --border: #EAEAEA;
  --text-muted: #8F8F8F;
  --text-light: #666666;
  --text-main: #171717;
  --text-emphasis: #000000;
  --accent: #0070F3;
  --success: #0CCE6B;
  --warning: #F5A623;
  --dark-bg: #0A0A0A;
  --dark-card: #1A1A1A;
  --dark-border: #2A2A2A;
}

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

/* ============================================================
   Base
   ============================================================ */
body {
  font-family: 'Inter', 'Noto Sans TC', 'PingFang TC', sans-serif;
  color: var(--text-main);
  background: var(--bg-white);
  line-height: 1.6;
}

/* ============================================================
   Hero Section
   ============================================================ */
.hero { padding: 80px 60px; text-align: center; max-width: 800px; margin: 0 auto; }
.hero .kicker { font-size: 11px; letter-spacing: 0.15em; color: var(--text-muted); text-transform: uppercase; margin-bottom: 16px; }
.hero h1 { font-size: 56px; line-height: 1.1; letter-spacing: -0.03em; color: var(--text-emphasis); margin-bottom: 24px; font-weight: 700; }
.hero .lead { font-size: 20px; color: var(--text-light); margin-bottom: 48px; line-height: 1.5; }
.hero-stats { display: inline-flex; gap: 36px; font-size: 14px; color: var(--text-muted); margin-bottom: 48px; flex-wrap: wrap; justify-content: center; }
.hero-stats strong { color: var(--text-emphasis); font-size: 24px; display: block; }
.hero-status { font-size: 13px; color: var(--text-light); margin-bottom: 40px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot-green { background: var(--success); }
.cta-primary { background: var(--text-emphasis); color: white; padding: 12px 24px; border-radius: 8px; text-decoration: none; font-size: 14px; font-weight: 500; }

/* ============================================================
   Business Grid Section
   ============================================================ */
.bg-gray-50 { background: var(--bg-gray-50); }
.section-header { text-align: center; margin-bottom: 60px; padding-top: 80px; }
.section-header .kicker { font-size: 11px; letter-spacing: 0.15em; color: var(--text-muted); text-transform: uppercase; margin-bottom: 12px; }
.section-header h2 { font-size: 36px; letter-spacing: -0.02em; color: var(--text-emphasis); font-weight: 600; }
.grid-3col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; max-width: 1200px; margin: 0 auto; padding: 0 40px; }
.biz-card { background: var(--bg-white); border: 1px solid var(--border); border-radius: 12px; padding: 24px; text-decoration: none; color: inherit; transition: all 0.2s; display: block; }
.biz-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.06); transform: translateY(-2px); }
.biz-label { font-size: 11px; letter-spacing: 0.1em; color: var(--accent); text-transform: uppercase; font-weight: 600; margin-bottom: 10px; }
.biz-card h3 { font-size: 17px; color: var(--text-emphasis); margin-bottom: 10px; font-weight: 600; }
.biz-card p { font-size: 13px; color: var(--text-light); line-height: 1.55; margin-bottom: 16px; }
.biz-meta { font-size: 11px; color: var(--text-muted); }
.infra-callout { max-width: 800px; margin: 60px auto 80px auto; padding: 32px 48px; background: var(--bg-white); border: 1px solid var(--border); border-radius: 12px; text-align: center; }
.infra-callout .accent { color: var(--accent); }
.infra-callout h3 { font-size: 22px; margin: 12px 0; }
.infra-callout p { font-size: 14px; color: var(--text-light); }

/* ============================================================
   Ecosystem Map Section
   ============================================================ */
.ecosys-layer { max-width: 1100px; margin: 0 auto 8px auto; padding: 0 40px; }
.layer-label { font-size: 10px; letter-spacing: 0.1em; color: var(--accent); text-transform: uppercase; font-weight: 700; margin-bottom: 12px; }
.grid-5col { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.grid-6col { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.grid-4col { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.node { border-radius: 8px; padding: 14px; text-align: center; }
.node.light { background: var(--bg-gray-50); border: 1px solid var(--border); }
.node.dark { background: var(--dark-bg); color: white; }
.node.dashed { background: var(--bg-white); border: 1px dashed var(--accent); }
.node .icon { font-size: 22px; }
.node .name { font-size: 12px; font-weight: 600; margin-top: 6px; }
.node .desc { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.node.dark .desc { color: #999; }
.layer-arrow { text-align: center; color: #ccc; font-size: 18px; letter-spacing: 24px; margin: 8px 0; }
.example-callout { max-width: 900px; margin: 60px auto 80px auto; background: var(--bg-gray-50); border-left: 3px solid var(--accent); padding: 20px 24px; border-radius: 0 8px 8px 0; }
.example-callout .kicker { font-size: 11px; letter-spacing: 0.08em; color: var(--text-light); text-transform: uppercase; font-weight: 600; margin-bottom: 8px; }
.example-callout p { font-size: 14px; color: var(--text-main); line-height: 1.7; }
.section-sub { font-size: 15px; color: var(--text-light); margin-top: 8px; }

/* ============================================================
   Core Infra Section (Section 4) — 暗色底
   ============================================================ */

/* Section 容器 */
.core-infra {
  background: var(--dark-bg);
  color: #fff;
  padding: 80px 40px;
}

/* 標題區 */
.infra-section-header {
  text-align: center;
  margin-bottom: 60px;
}
.infra-kicker {
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.infra-title {
  font-size: 36px;
  letter-spacing: -0.02em;
  color: #fff;
  margin: 0 0 16px 0;
  font-weight: 600;
}
.infra-subtitle {
  font-size: 16px;
  color: #a0a0a0;
  max-width: 680px;
  margin: 0 auto;
}

/* 每個子區塊容器 */
.infra-block {
  max-width: 1100px;
  margin: 0 auto 80px auto;
}
.infra-block-last {
  margin-bottom: 0;
}
.infra-block-label {
  font-size: 11px;
  color: #a0a0a0;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 20px;
}

/* ① Worker Grid */
.worker-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
.worker-card {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
}
.worker-emoji {
  font-size: 32px;
  margin-bottom: 8px;
}
.worker-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}
.worker-role {
  font-size: 11px;
  color: #666;
  margin-bottom: 10px;
}
.worker-desc {
  font-size: 11px;
  color: #a0a0a0;
  line-height: 1.4;
}
.worker-status,
.heartbeat {
  margin-top: 12px;
  font-size: 11px;
  color: var(--success);
}
.worker-note {
  margin-top: 16px;
  font-size: 12px;
  color: #666;
  text-align: center;
}

/* ② Doctor Flow */
.doctor-flow {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: 12px;
  padding: 40px;
}
.doctor-flow-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.flow-step {
  text-align: center;
  min-width: 90px;
}
.flow-icon {
  font-size: 28px;
}
.flow-name {
  margin-top: 8px;
  font-size: 12px;
  color: #fff;
}
.flow-time {
  font-size: 10px;
  color: #666;
  margin-top: 2px;
}
.flow-arrow {
  color: #666;
  font-size: 20px;
}
.doctor-callout {
  background: var(--dark-bg);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
  font-size: 14px;
  color: #d0d0d0;
  line-height: 1.7;
}
.callout-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #999;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 8px;
}
.accent-text {
  color: var(--accent);
}
.expand-hint {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: #666;
  cursor: default;
}

/* ③ Hook Section */
.hook-section {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: 12px;
  padding: 32px;
}
.hook-section-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--dark-border);
  gap: 32px;
}
.hook-desc {
  font-size: 14px;
  color: #d0d0d0;
  line-height: 1.6;
  flex: 1;
}
.hook-count-box {
  text-align: right;
  white-space: nowrap;
}
.hook-count-num {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}
.hook-count-label {
  font-size: 13px;
  color: #d0d0d0;
}
.hook-count-sub {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}
.hook-list {
  font-size: 13px;
  color: #d0d0d0;
}
.hook-row {
  display: grid;
  grid-template-columns: 1fr 80px 80px;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--dark-border);
  align-items: center;
}
.hook-row-dim {
  color: #666;
}
.hook-name {
  /* flex-fill */
}
.hook-hits {
  text-align: right;
}
.hook-level {
  text-align: right;
  font-size: 11px;
  color: #666;
}
.hook-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  font-size: 12px;
  color: #666;
}
.hook-footer .expand-hint {
  margin-top: 0;
  text-align: right;
  color: var(--accent);
}
.hook-warning {
  margin-top: 24px;
  background: var(--dark-bg);
  border-left: 3px solid var(--warning);
  border-radius: 0 8px 8px 0;
  padding: 14px 18px;
  font-size: 13px;
  color: #d0d0d0;
  line-height: 1.6;
}
.warning-label {
  color: var(--warning);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}
.success-text { color: var(--success); }
.warning-text { color: var(--warning); }

/* ④ Heartbeat Section */
.heartbeat-section {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: 12px;
  padding: 32px;
}
.heartbeat-status-bar {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: #d0d0d0;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--dark-border);
  flex-wrap: wrap;
  align-items: center;
}
.muted-text { color: #999; }
.event-list {
  font-size: 13px;
  color: #d0d0d0;
}
.event-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--dark-border);
  display: flex;
  gap: 12px;
  align-items: baseline;
}
.event-row-last {
  border-bottom: none;
}
.event-time {
  width: 70px;
  flex-shrink: 0;
}
.event-source {
  width: 60px;
  flex-shrink: 0;
  color: #999;
}
.event-desc {
  flex: 1;
}

/* ============================================================
   Section 5: Timeline + Footer
   ============================================================ */
#timeline-footer { padding: 80px 40px; background: var(--bg-white); }
.timeline-wrap { max-width: 1100px; margin: 0 auto; }
.timeline-track { position: relative; padding: 40px 0; margin-bottom: 60px; }
.timeline-line { position: absolute; top: 50%; left: 0; right: 0; height: 2px; background: var(--border); z-index: 0; }
.timeline-nodes { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; position: relative; z-index: 1; }
.timeline-node { text-align: center; }
.timeline-date { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; letter-spacing: 0.05em; }
.timeline-dot { width: 10px; height: 10px; background: var(--text-emphasis); border-radius: 50%; margin: 0 auto 12px auto; }
.timeline-dot.start { width: 14px; height: 14px; background: var(--accent); border: 3px solid white; box-shadow: 0 0 0 2px var(--accent); }
.timeline-dot.today { width: 14px; height: 14px; background: var(--success); border: 3px solid white; box-shadow: 0 0 0 2px var(--success); }
.timeline-title { font-size: 12px; color: var(--text-emphasis); font-weight: 600; line-height: 1.4; }
.timeline-desc { font-size: 11px; color: var(--text-light); margin-top: 4px; line-height: 1.4; }
.next-callout { background: var(--bg-gray-50); border: 1px solid var(--border); border-radius: 12px; padding: 40px; text-align: center; }
.next-callout .accent { color: var(--accent); font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase; font-weight: 600; margin-bottom: 12px; }
.next-callout h3 { font-size: 22px; color: var(--text-emphasis); margin: 0 0 12px 0; font-weight: 600; }
.next-callout p { font-size: 14px; color: var(--text-light); line-height: 1.6; max-width: 600px; margin: 0 auto; }
.footer { text-align: center; margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }
.footer > div { margin-bottom: 8px; }

/* ============================================================
   Section 6: Detail Page
   ============================================================ */
.detail-page { max-width: 900px; margin: 0 auto; padding: 60px 40px; }
.breadcrumb { font-size: 13px; color: var(--text-light); margin-bottom: 32px; }
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb span { margin: 0 8px; }
.detail-header-section { margin-bottom: 40px; }
.detail-header-section .kicker { font-size: 11px; letter-spacing: 0.15em; color: var(--accent); text-transform: uppercase; font-weight: 600; margin-bottom: 12px; }
.detail-header-section h1 { font-size: 40px; letter-spacing: -0.03em; color: var(--text-emphasis); margin-bottom: 16px; font-weight: 700; }
.detail-header-section .lead { font-size: 18px; color: var(--text-light); line-height: 1.5; }
.detail-card { background: var(--bg-white); border: 1px solid var(--border); border-radius: 12px; padding: 32px; margin-bottom: 20px; }
.detail-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.detail-counter { font-size: 11px; color: var(--text-muted); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6px; }
.detail-card h2 { font-size: 24px; color: var(--text-emphasis); margin: 0; font-weight: 600; }
.detail-status { text-align: right; font-size: 12px; color: var(--text-muted); }
.detail-uptime { margin-top: 4px; }
.detail-stats { display: flex; gap: 24px; padding: 16px 20px; background: var(--bg-gray-50); border-radius: 8px; margin-bottom: 20px; font-size: 13px; }
.detail-stats strong { color: var(--text-emphasis); font-size: 20px; }
.detail-stats span { color: var(--text-muted); }
.detail-narrative-block { margin-bottom: 20px; }
.detail-narrative-block .kicker { font-size: 11px; color: var(--text-light); letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; margin-bottom: 8px; }
.detail-narrative-block p { font-size: 14px; color: var(--text-main); line-height: 1.7; }
.detail-links { display: flex; gap: 24px; font-size: 13px; padding-top: 16px; border-top: 1px solid var(--bg-gray-50); flex-wrap: wrap; }
.detail-links a { color: var(--accent); text-decoration: none; }
.detail-toggle { color: var(--text-light) !important; cursor: pointer; }

/* ── app.js dynamic event-row (from snapshot.json) ── */
.event-ago { width: 80px; flex-shrink: 0; }
.muted { color: var(--text-muted); font-size: 12px; }

/* ============================================================
   Onboarding Banner (Phase 3)
   ============================================================ */
.onboarding-banner {
  background: linear-gradient(180deg, #F0F7FF 0%, var(--bg-white) 100%);
  border-bottom: 1px solid var(--border);
  padding: 24px 40px;
  position: relative;
  font-size: 14px;
}
.onboarding-banner.hidden { display: none; }
.onboarding-content { max-width: 900px; margin: 0 auto; }
.onboarding-content strong {
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 12px;
}
.onboarding-content ol {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px 24px;
  margin: 0;
  padding: 0;
  counter-reset: step;
}
.onboarding-content ol li {
  font-size: 13px;
  color: var(--text-main);
  padding-left: 28px;
  position: relative;
  line-height: 1.5;
  counter-increment: step;
}
.onboarding-content ol li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 20px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.onboarding-dismiss {
  position: absolute;
  top: 20px;
  right: 40px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-light);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.onboarding-dismiss:hover { border-color: var(--text-emphasis); color: var(--text-emphasis); }

/* ============================================================
   Doctor expand-content (Phase 3)
   ============================================================ */
.expand-content {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: 8px;
  padding: 24px;
  margin-top: 16px;
}
.expand-content[hidden] { display: none; }
.expand-hint { cursor: pointer; padding: 10px 0; transition: color 0.2s; }
.expand-hint:hover { color: var(--accent); }

/* ============================================================
   Visual Polish (Phase 3)
   ============================================================ */

/* Hero CTA 浮起 */
.cta-primary { transition: transform 0.2s, box-shadow 0.2s; }
.cta-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,112,243,0.25); }

/* 生態地圖 node hover */
.ecosys-layer .node { transition: border-color 0.2s; }
.ecosys-layer .node.light { cursor: default; }
.ecosys-layer .node.light:hover { border-color: var(--accent); }
.ecosys-layer .node.dashed:hover { border-color: var(--accent); border-style: solid; }

/* worker-card hover (暗色區) */
.worker-card { transition: border-color 0.2s; }
.worker-card:hover { border-color: var(--accent); }

/* timeline-dot today pulse */
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--success); }
  50% { box-shadow: 0 0 0 6px rgba(12, 206, 107, 0.3); }
}
.timeline-dot.today { animation: pulse 2s infinite; }
