/* ============================================================
   hub.css — หน้าเว็บสาธารณะ (ข่าว + ความรู้): index.html, digest.html
   ใช้คู่กับ md.css (สไตล์เนื้อหา Markdown) · โทนสีเดียวกับ blog.html
   ============================================================ */
:root {
  --accent: #3b82f6; --accent-2: #60a5fa; --accent-3: #93c5fd;
  --accent-soft: rgba(59,130,246,0.14); --accent-line: rgba(59,130,246,0.42); --accent-glow: rgba(59,130,246,0.55);
  --pos: #26a269; --pos-bright: #3fd07f; --pos-soft: rgba(38,162,105,0.14);
  --neg: #e5484d; --neg-bright: #ff6166;
  --warn: #d8a229; --warn-soft: rgba(216,162,41,0.14);
  --pink: #ec6aa0; --pink-soft: rgba(236,106,160,0.13); --pink-line: rgba(236,106,160,0.4);
  --bg: #080b11; --surface: #11151d; --surface-2: #161b25; --surface-3: #1d2430;
  --border: #232b39; --border-soft: #1a212c;
  --text: #e8ecf3; --text-dim: #97a2b3; --text-faint: #5e6a7d;
  --font-sans: 'IBM Plex Sans Thai','IBM Plex Sans',system-ui,sans-serif;
  --font-mono: 'IBM Plex Mono','SF Mono',ui-monospace,monospace;
  --radius: 16px; --radius-sm: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font-sans); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; line-height: 1.6; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.wrap.narrow { max-width: 820px; }
@keyframes hbpulse { 0%,100% { opacity: .55; } 50% { opacity: .25; } }

/* ---------- nav ---------- */
.site-nav { position: sticky; top: 0; z-index: 60; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); background: rgba(8,11,17,0.72); border-bottom: 1px solid transparent; transition: border-color .2s, background .2s; }
.site-nav.scrolled { border-bottom-color: var(--border-soft); background: rgba(8,11,17,0.92); }
.site-nav-inner { max-width: 1120px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 28px; height: 66px; }
.nav-brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 19px; letter-spacing: -.2px; }
.nav-brand .logo { width: 34px; height: 34px; border-radius: 9px; overflow: hidden; box-shadow: 0 4px 14px -4px var(--accent-glow); }
.nav-brand .logo svg { width: 100%; height: 100%; display: block; }
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-links a { font-size: 14.5px; color: var(--text-dim); font-weight: 500; white-space: nowrap; transition: color .14s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-login { font-size: 13px; font-weight: 600; color: var(--text-dim); padding: 7px 13px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; transition: color .14s, border-color .14s; }
.nav-login:hover { color: var(--text); border-color: var(--accent-line); }

/* ---------- buttons / chips ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--font-sans); font-size: 15px; font-weight: 600; border-radius: 11px; padding: 12px 20px; border: 1px solid transparent; cursor: pointer; white-space: nowrap; transition: transform .12s, box-shadow .2s, border-color .2s, background .2s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: #fff; box-shadow: 0 8px 24px -10px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.25); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 32px -8px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.3); }
.btn-ghost { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent-line); background: var(--surface-3); }
.btn-sm { font-size: 13px; padding: 8px 14px; border-radius: 9px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; letter-spacing: .8px; color: var(--accent-2); padding: 6px 14px; border-radius: 99px; background: var(--accent-soft); border: 1px solid var(--accent-line); }
.pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; color: var(--accent-2); background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 99px; padding: 3px 11px; white-space: nowrap; }
.new { font-size: 10.5px; font-weight: 700; letter-spacing: .4px; color: #0a0e14; background: var(--pos-bright); border-radius: 5px; padding: 2px 7px; white-space: nowrap; }
.badge { font-size: 11.5px; font-weight: 600; letter-spacing: .3px; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.badge.concept { color: var(--accent-2); background: var(--accent-soft); border: 1px solid var(--accent-line); }
.badge.tip { color: var(--pos-bright); background: var(--pos-soft); border: 1px solid rgba(38,162,105,.4); }
.badge.ibkr { color: var(--pink); background: var(--pink-soft); border: 1px solid var(--pink-line); }
.grad-text { background: linear-gradient(100deg, var(--accent-3), var(--accent-2) 45%, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.skel { height: 12px; border-radius: 6px; background: var(--surface-3); margin: 8px 0; animation: hbpulse 1.3s ease-in-out infinite; }

/* ---------- hero (index) ---------- */
.hero { position: relative; padding: 64px 0 56px; overflow: hidden; }
.hero-glow { position: absolute; inset: -20% -10% auto; height: 520px; pointer-events: none; background: radial-gradient(560px 320px at 72% 30%, rgba(59,130,246,.18), transparent 70%); }
.hero-grid { position: absolute; inset: 0; pointer-events: none; opacity: .45;
  background-image: linear-gradient(var(--border-soft) 1px, transparent 1px), linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 48px 48px; -webkit-mask: radial-gradient(700px 360px at 60% 0%, #000 0%, transparent 75%); mask: radial-gradient(700px 360px at 60% 0%, #000 0%, transparent 75%); }
.hero-inner { position: relative; display: grid; grid-template-columns: 1fr 1.05fr; gap: 48px; align-items: center; }
.h-hero { font-size: clamp(34px, 5.2vw, 56px); line-height: 1.18; letter-spacing: -1px; font-weight: 700; margin: 22px 0 0; }
.lead { color: var(--text-dim); font-size: 17.5px; line-height: 1.7; margin: 22px 0 0; max-width: 520px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.hero-note { margin-top: 18px; font-size: 13px; color: var(--text-faint); }

/* การ์ด Digest ล่าสุด (hero ขวา) */
.latest { position: relative; display: block; background: linear-gradient(150deg, rgba(59,130,246,.13), transparent 55%), var(--surface); border: 1px solid var(--accent-line); border-radius: 20px; padding: 26px 28px 24px; box-shadow: 0 40px 90px -50px rgba(0,0,0,.9), 0 20px 60px -40px var(--accent-glow); transition: transform .15s, box-shadow .2s; }
a.latest:hover { transform: translateY(-2px); box-shadow: 0 40px 90px -50px rgba(0,0,0,.9), 0 24px 70px -36px var(--accent-glow); }
.latest-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.latest-k { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; color: var(--accent-2); margin-right: 4px; }
.latest-t { font-size: 22px; font-weight: 700; line-height: 1.4; letter-spacing: -.3px; margin: 14px 0 0; }
.latest-sub { font-size: 12.5px; color: var(--text-faint); margin-top: 6px; }
.latest-x { font-size: 15px; color: var(--text-dim); line-height: 1.75; margin: 14px 0 0; }
.latest-go { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; font-weight: 600; font-size: 14.5px; color: var(--accent-2); }
.latest-msg { font-size: 14.5px; color: var(--text-dim); line-height: 1.7; margin-top: 14px; }

/* ---------- sections ---------- */
.sec { padding: 56px 0; border-top: 1px solid var(--border-soft); }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.sec-k { font-size: 12px; font-weight: 700; letter-spacing: 1.2px; color: var(--accent-2); }
.sec-t { font-size: clamp(24px, 3.2vw, 32px); font-weight: 700; letter-spacing: -.5px; line-height: 1.25; margin: 8px 0 0; }
.sec-s { color: var(--text-dim); font-size: 15px; margin: 8px 0 0; }
.sec-more { font-size: 14px; font-weight: 600; color: var(--accent-2); white-space: nowrap; }

/* รายการ Digest */
.dlist { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.dlist.one { grid-template-columns: 1fr; }
.drow { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 14px; transition: border-color .14s, transform .14s, background .14s; min-width: 0; }
.drow:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.drow.first { background: linear-gradient(90deg, var(--accent-soft), transparent 70%), var(--surface); border-color: var(--accent-line); }
.ddate { width: 52px; height: 54px; flex-shrink: 0; border-radius: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--border); }
.drow.first .ddate { border-color: var(--accent-line); background: var(--accent-soft); }
.ddate .d { font-family: var(--font-mono); font-size: 20px; font-weight: 700; line-height: 1; }
.drow.first .ddate .d { color: var(--accent-2); }
.ddate .m { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.dbody { min-width: 0; flex: 1; }
.dtitle { font-size: 15px; font-weight: 600; line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dsub { font-size: 12px; color: var(--text-faint); margin-top: 3px; }
.dchev { color: var(--text-faint); flex-shrink: 0; }

/* การ์ดบทความความรู้ */
.posts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.post { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; transition: border-color .15s, transform .15s, box-shadow .15s; }
.post:hover { border-color: var(--accent-line); transform: translateY(-2px); box-shadow: 0 18px 40px -24px var(--accent-glow); }
.post .meta { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.post .date { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }
.post h3 { margin: 0 0 8px; font-size: 18px; line-height: 1.4; letter-spacing: -.3px; }
.post p { margin: 0; color: var(--text-dim); font-size: 14px; line-height: 1.65; flex: 1; }
.post .more { margin-top: 14px; font-size: 13.5px; font-weight: 600; color: var(--accent-2); }


/* states */
.state { text-align: center; padding: 40px 24px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); color: var(--text-dim); font-size: 14.5px; line-height: 1.7; }
.state b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }
.state .btn { margin-top: 14px; }

/* ---------- digest.html ---------- */
.page-top { padding: 40px 0 26px; }
.page-top h1 { font-size: clamp(28px, 4.4vw, 40px); font-weight: 700; letter-spacing: -.7px; line-height: 1.2; margin: 18px 0 0; }
.page-top p { color: var(--text-dim); font-size: 16px; margin: 10px 0 0; }
.month { font-size: 13px; font-weight: 700; color: var(--text-dim); letter-spacing: .3px; margin: 26px 0 10px; }
.month:first-child { margin-top: 0; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--text-dim); margin: 26px 0 16px; }
.back:hover { color: var(--text); }
.article { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 20px; padding: 32px 38px 28px; }
.a-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.a-meta-s { font-size: 13px; color: var(--text-faint); }
.a-title { font-size: clamp(24px, 3.6vw, 30px); font-weight: 700; line-height: 1.35; letter-spacing: -.4px; margin: 14px 0 22px; padding-bottom: 20px; border-bottom: 1px solid var(--border-soft); }
.disclaimer-box { display: flex; align-items: center; gap: 9px; margin-top: 30px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px; color: var(--text-dim); background: var(--surface-2); border: 1px dashed var(--border); }
.disclaimer-box svg { color: var(--warn); flex-shrink: 0; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.pg { display: flex; flex-direction: column; gap: 4px; padding: 13px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border-soft); min-width: 0; transition: border-color .14s; }
.pg:hover { border-color: var(--accent-line); }
.pg.r { text-align: right; }
.pg .l { font-size: 12px; color: var(--accent-2); font-weight: 600; }
.pg .t { font-size: 13.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share { display: flex; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--border-soft); padding: 34px 0 40px; margin-top: 24px; }
.footer-in { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; font-size: 14px; color: var(--text-dim); }
.footer-links a:hover { color: var(--text); }
.footer-note { font-size: 12.5px; color: var(--text-faint); line-height: 1.7; margin-top: 18px; max-width: 640px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: 34px; }
  .hero { padding: 40px 0 44px; }
}
@media (max-width: 720px) {
  .nav-links { display: none; }
  .site-nav-inner { padding: 0 16px; gap: 12px; height: 60px; }
  .wrap { padding: 0 16px; }
  .dlist, .posts { grid-template-columns: 1fr; }
  .sec { padding: 42px 0; }
  .latest { padding: 22px 20px 20px; }
  .latest-t { font-size: 19.5px; }
  .lead { font-size: 16px; }
  .hero-cta .btn { flex: 1; }
  .article { padding: 22px 16px 20px; border-radius: 16px; }
  .a-title { margin-bottom: 18px; padding-bottom: 16px; }
  .pager { grid-template-columns: 1fr; }
  .pg.r { text-align: left; }
  .drow { padding: 12px 14px; gap: 12px; }
}
