/* ==========================================================================
   UPZ168 — Unique Visual Identity (Velvet Plum + Ember + Gold)
   Layout: Asymmetric Bento Scorecard (Home) & Editorial + Sticky TOC (Pages)
   Typography: Prompt (Display) + IBM Plex Sans Thai (Body)
   ========================================================================== */

:root {
  --bg-deep: #0e041c;
  --bg-canvas: #16072b;
  --bg-surface: #210c3e;
  --bg-surface-2: #2b124d;
  --bg-glass: rgba(33, 12, 62, 0.84);

  --border-subtle: rgba(255, 255, 255, 0.09);
  --border-gold: rgba(255, 184, 0, 0.28);
  --border-ember: rgba(249, 115, 22, 0.32);

  --text-main: #f6f3fb;
  --text-muted: #c2b6d9;
  --text-soft: #9c8db8;

  --gold: #ffb800;
  --gold-soft: #ffd45c;
  --ember: #e84c18;
  --ember-bright: #f97316;
  --emerald: #22c55e;
  --emerald-dark: #15803d;
  --rose: #fb7185;

  --font-display: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'IBM Plex Sans Thai', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 12px 32px rgba(6, 1, 14, 0.45);
  --container-max: 1180px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-main);
  background:
    radial-gradient(circle at 12% 0%, rgba(232, 76, 24, 0.16), transparent 36%),
    radial-gradient(circle at 88% 8%, rgba(139, 92, 246, 0.2), transparent 38%),
    var(--bg-deep);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--gold-soft);
  text-decoration: none;
  transition: color 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
}

a:hover {
  color: #ffffff;
}

img {
  max-width: 100%;
  height: auto;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------------- Single-Row Sticky Header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(90deg, rgba(22, 7, 43, 0.96) 0%, rgba(36, 11, 66, 0.96) 65%, rgba(68, 22, 34, 0.94) 100%);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid rgba(232, 76, 24, 0.55);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  height: 66px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  color: #fff;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  border: 1.5px solid var(--gold);
  display: block;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.brand-name span {
  color: var(--gold);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 3px;
}

.main-nav a {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 9px;
  border-radius: 8px;
  white-space: nowrap;
}

.main-nav a:hover,
.main-nav a.active {
  color: #fff;
  background: rgba(255, 184, 0, 0.14);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
}

.btn-login {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #052e16;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.35);
}

.btn-login:hover {
  color: #052e16;
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-register {
  background: linear-gradient(135deg, #f97316, #ffb800);
  color: #1f0a00;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.35);
}

.btn-register:hover {
  color: #1f0a00;
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-gold);
  color: var(--gold-soft);
}

.btn-outline:hover {
  background: rgba(255, 184, 0, 0.16);
  color: #fff;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  flex-shrink: 0;
}

/* Mobile Drawer */
.mobile-drawer {
  display: none;
  background: #1a0833;
  border-bottom: 1px solid var(--border-gold);
  padding: 12px 20px 18px;
}

.mobile-drawer.open {
  display: block;
}

.mobile-drawer a {
  display: block;
  padding: 10px 12px;
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--text-main);
  border-radius: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mobile-drawer a:hover,
.mobile-drawer a.active {
  background: rgba(255, 184, 0, 0.14);
  color: var(--gold);
}

/* ---------------- Breadcrumb ---------------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--text-soft);
  margin: 18px 0 12px;
}

.breadcrumb a {
  color: var(--text-muted);
}

.breadcrumb a:hover {
  color: var(--gold);
}

/* ---------------- Asymmetric Bento Hero (Homepage) ---------------- */
.bento-hero {
  padding: 28px 0 22px;
}

.bento-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 18px;
  align-items: stretch;
}

.bento-main {
  background: linear-gradient(155deg, #270e49 0%, #190733 70%, #2d1137 100%);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.bento-side {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 16px;
}

.score-tile {
  background: linear-gradient(135deg, #2c1052 0%, #3d1435 100%);
  border: 1px solid var(--border-ember);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
}

.score-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.score-big {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--gold);
}

.score-big small {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 500;
}

.score-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.meter-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.meter-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  font-size: 0.86rem;
}

.meter-bar {
  grid-column: 1 / -1;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ember-bright), var(--gold));
}

.metrics-tile {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.metric-item {
  background: rgba(14, 4, 28, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px;
}

.metric-val {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold-soft);
  display: block;
}

.metric-lbl {
  font-size: 0.8rem;
  color: var(--text-soft);
}

/* ---------------- Typography & Meta ---------------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold);
  background: rgba(255, 184, 0, 0.12);
  border: 1px solid rgba(255, 184, 0, 0.28);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
  width: fit-content;
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: #ffffff;
  line-height: 1.32;
  margin-top: 0;
}

h1 {
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  font-weight: 700;
  margin-bottom: 12px;
}

h2 {
  font-size: clamp(1.28rem, 2.1vw, 1.62rem);
  font-weight: 700;
  margin: 34px 0 12px;
  padding-left: 14px;
  border-left: 4px solid var(--gold);
}

h3 {
  font-size: 1.12rem;
  font-weight: 600;
  margin: 22px 0 8px;
  color: var(--gold-soft);
}

.lead {
  font-size: 1.03rem;
  color: var(--text-muted);
  margin: 0 0 18px;
}

.byline-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  font-size: 0.86rem;
  color: var(--text-soft);
  padding: 10px 14px;
  background: rgba(14, 4, 28, 0.55);
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  margin-bottom: 18px;
}

.byline-bar strong {
  color: var(--text-main);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

/* ---------------- Editorial + Sticky TOC Layout ---------------- */
.page-hero {
  background: linear-gradient(145deg, #250d47 0%, #17062f 75%, #301233 100%);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
}

.editorial-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 275px;
  gap: 28px;
  align-items: start;
  padding-bottom: 48px;
}

.article-body {
  min-width: 0;
}

.toc-sidebar {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 64px;
}

.toc-card,
.sidebar-cta-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.toc-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gold);
  margin: 0 0 10px;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toc-list a {
  display: block;
  font-size: 0.88rem;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 8px;
  border-left: 2px solid transparent;
}

.toc-list a:hover,
.toc-list a.active {
  color: #fff;
  background: rgba(255, 184, 0, 0.12);
  border-left-color: var(--gold);
}

.sidebar-cta-card {
  background: linear-gradient(160deg, #2b1050 0%, #3a142d 100%);
  border-color: var(--border-ember);
}

.sidebar-cta-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.sidebar-cta-card .btn {
  width: 100%;
  margin-bottom: 8px;
}

/* ---------------- Zero-CLS Media Frame ---------------- */
.media-frame {
  margin: 1.5rem 0;
  max-width: 100%;
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #140527;
  border: 1px solid var(--border-gold);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.48);
  text-align: center;
}

.content-media-img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.media-frame figcaption {
  padding: 10px 14px;
  font-size: 0.84rem;
  color: var(--text-muted);
  background: rgba(14, 4, 28, 0.92);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ---------------- Cards, Pros/Cons, Tables ---------------- */
.direct-answer {
  background: rgba(255, 184, 0, 0.07);
  border-left: 3px solid var(--ember-bright);
  padding: 14px 16px;
  border-radius: 0 10px 10px 0;
  margin: 0 0 16px;
  color: var(--text-main);
}

.pros-cons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 18px 0 24px;
}

.pros-box, .cons-box {
  border-radius: var(--radius-md);
  padding: 18px 20px;
  border: 1px solid var(--border-subtle);
}

.pros-box {
  background: linear-gradient(160deg, rgba(34, 197, 94, 0.12), rgba(21, 128, 61, 0.05));
  border-color: rgba(34, 197, 94, 0.32);
}

.cons-box {
  background: linear-gradient(160deg, rgba(251, 113, 133, 0.12), rgba(232, 76, 24, 0.05));
  border-color: rgba(251, 113, 133, 0.32);
}

.pros-box h3 { color: #86efac; margin-top: 0; }
.cons-box h3 { color: #fda4af; margin-top: 0; }

.pros-box ul, .cons-box ul {
  margin: 0;
  padding-left: 18px;
}

.pros-box li, .cons-box li {
  margin-bottom: 6px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 18px 0 22px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
  font-size: 0.93rem;
}

th, td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

th {
  font-family: var(--font-display);
  font-weight: 600;
  background: rgba(255, 184, 0, 0.12);
  color: var(--gold-soft);
}

tr:last-child td {
  border-bottom: none;
}

/* ---------------- Provider Logos Grid ---------------- */
.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 12px;
  margin: 18px 0 24px;
}

.provider-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.provider-logo-wrap {
  width: 100%;
  height: 54px;
  background: rgba(255, 255, 255, 0.93);
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.provider-logo-wrap img {
  max-height: 40px;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.provider-name {
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ---------------- Category / Hub Cards ---------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 18px 0 26px;
}

.hub-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.hub-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-gold);
}

.hub-card h3 {
  margin: 0 0 8px;
  font-size: 1.06rem;
}

.hub-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.hub-card .card-link {
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--gold);
}

/* ---------------- FAQ Accordion ---------------- */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0 26px;
}

.faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
}

.faq-q {
  width: 100%;
  background: transparent;
  border: none;
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
  text-align: left;
  padding: 15px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.faq-q::after {
  content: '+';
  font-size: 1.25rem;
  color: var(--gold);
  flex-shrink: 0;
}

.faq-item.open .faq-q::after {
  content: '−';
}

.faq-a {
  display: none;
  padding: 0 18px 16px;
  color: var(--text-muted);
  font-size: 0.94rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.faq-item.open .faq-a {
  display: block;
}

/* ---------------- Footer & Floating Contact ---------------- */
.site-footer {
  background: #0a0214;
  border-top: 1px solid var(--border-gold);
  padding: 40px 0 28px;
  margin-top: 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.footer-col h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--gold);
  margin: 0 0 10px;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col li {
  margin-bottom: 6px;
  font-size: 0.88rem;
}

.footer-col a {
  color: var(--text-muted);
}

.footer-col a:hover {
  color: var(--gold-soft);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 16px;
  font-size: 0.82rem;
  color: var(--text-soft);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
}

.floating-contact {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 95;
  background: linear-gradient(135deg, #e84c18, #ffb800);
  color: #1f0a00;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.86rem;
  padding: 11px 16px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(232, 76, 24, 0.45);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.floating-contact:hover {
  color: #1f0a00;
  transform: translateY(-2px);
}

/* ---------------- Responsive Breakpoints ---------------- */
@media (max-width: 980px) {
  .main-nav {
    display: none;
  }
  .menu-toggle {
    display: inline-flex;
  }
  .bento-grid,
  .editorial-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .toc-sidebar {
    position: static;
    order: -1;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 14px;
  }
  .header-inner {
    gap: 6px;
    height: 60px;
  }
  .brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }
  .brand-name {
    font-size: 0.96rem;
  }
  .header-actions {
    gap: 5px;
  }
  .header-actions .btn {
    font-size: 0.76rem;
    padding: 6px 10px;
  }
  .menu-toggle {
    width: 34px;
    height: 34px;
    font-size: 1.1rem;
  }
  .bento-main,
  .page-hero {
    padding: 18px;
  }
  .pros-cons-grid {
    grid-template-columns: 1fr;
  }
  .floating-contact {
    right: 12px;
    bottom: 12px;
    padding: 9px 13px;
    font-size: 0.8rem;
  }
}
