@import url('/css/theme.css');

/* ── ฐาน ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { background: var(--bg); scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--orange); text-decoration: none; }
a:hover { color: #ff7043; }

.shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

/* ── หัวเว็บ ── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--orange);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-mark svg { width: 20px; height: 20px; }

.brand-name { font-size: 17px; font-weight: 700; line-height: 1.2; }
.brand-tag { font-size: 12px; color: var(--muted); }

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ok);
  background: var(--ok-soft);
  border: 1px solid var(--ok-line);
  padding: 8px 14px;
  border-radius: 100px;
}
.status-chip i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  flex-shrink: 0;
}

/* ── บทนำ ── */
.intro {
  padding: 28px 0 20px;
}

.intro h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 10px;
  color: var(--text);
}

.intro-lead {
  font-size: 15px;
  color: var(--text-2);
  max-width: 50ch;
  margin-bottom: 20px;
}

/* ── วิธีใช้ (3 ขั้น) ── */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--orange-soft);
  border: 1px solid var(--orange-line);
  color: var(--orange);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}

.step h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}

.step p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

/* ── กล่องเนื้อหา ── */
.block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.block-head h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.block-head span {
  font-size: 12px;
  color: var(--muted);
}

.block-body { padding: 18px; }

/* ── สถานะระบบ ── */
.stats-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
}

.stat-main {
  padding: 18px;
  border: 1px solid var(--orange-line);
  border-radius: var(--radius);
  background: var(--orange-soft);
  text-align: center;
}

.stat-main .num {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
  color: var(--orange);
  font-variant-numeric: tabular-nums;
}

.stat-main .lbl {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-top: 8px;
}

.stat-main .note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
  line-height: 1.5;
  text-align: left;
}

/* ── รายการ subscribe ── */
.feed-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 120px;
}

.feed-panel-hd {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.feed-stats-list {
  display: flex;
  flex-direction: column;
  max-height: 300px;
  overflow-y: auto;
}

.feed-stats-list::-webkit-scrollbar { width: 6px; }
.feed-stats-list::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 4px;
}

.feed-stat-row {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.feed-stat-row:last-child { border-bottom: none; }
.feed-stat-row:hover { background: var(--surface-2); }

.feed-stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.feed-stat-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
  word-break: break-word;
}

.feed-stat-files {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ok);
  font-family: var(--mono);
  background: var(--ok-soft);
  border: 1px solid var(--ok-line);
  padding: 3px 10px;
  border-radius: 100px;
}

.feed-stat-meta {
  font-size: 12px;
  color: var(--dim);
  margin-top: 4px;
}

.feed-stats-empty {
  padding: 28px 16px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  margin: 0;
}

/* ── โปรโมชัน ── */
.promo-section--nested {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.promo-section--nested:not(.has-promo) { display: none; }

.promo-block-header { margin-bottom: 16px; }

.promo-block-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.promo-block-title:empty { display: none; }

.promo-block-sub {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-2);
  margin: 8px 0 0;
  white-space: pre-line;
}
.promo-block-sub:empty { display: none; }
.promo-block-header--sub-only .promo-block-sub { margin-top: 0; }

.promo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 14px;
}

.promo-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--surface-2);
}

.promo-box-heading {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 8px;
}

.promo-box-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-2);
  margin: 0 0 12px;
}
.promo-box--txt .promo-box-body:last-child { margin-bottom: 0; }

.promo-video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
}
.promo-video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.promo-banner-wrap {
  display: block;
  line-height: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
}
.promo-banner-wrap img { width: 100%; height: auto; display: block; }

.promo-download-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.promo-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  background: var(--orange);
  border: 1px solid var(--orange);
  color: #fff;
  text-decoration: none;
  transition: background 0.15s;
}
.promo-download-btn:hover {
  background: var(--orange-dark);
  text-decoration: none;
}
.promo-download-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── จุดเด่น ── */
.trust-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.trust-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.trust-card h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--orange);
}

.trust-card p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

/* ── ท้ายเว็บ ── */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.foot-copy { font-size: 13px; color: var(--muted); }

.foot-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.foot-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.12s, background 0.12s;
}
.foot-btn:hover {
  border-color: var(--orange-line);
  background: var(--surface-2);
  text-decoration: none;
}
.foot-btn svg { width: 15px; height: 15px; }

.foot-note {
  font-size: 12px;
  color: var(--dim);
  display: flex;
  align-items: center;
  gap: 6px;
}
.foot-note svg { width: 14px; height: 14px; }

/* ── มือถือ ── */
@media (max-width: 720px) {
  .steps,
  .stats-layout,
  .trust-row { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .shell { padding: 0 16px 32px; }
  .site-header .status-chip { display: none; }
  .block-head,
  .block-body { padding-left: 14px; padding-right: 14px; }
  .site-footer { flex-direction: column; align-items: flex-start; }
}
