/* ============================================================
   CLOUDPANG V4 — global styles
   homepage: black-dominant magazine
   categories + articles: white reading canvas
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@300;400;500;600&family=Sarabun:wght@400;500;700&family=IBM+Plex+Sans+Thai:wght@400;500;600&family=Anuphan:wght@500;700;900&display=swap');

:root {
  --bg-canvas: #FFFFFF;
  --text-primary: #0A0A0B;
  --text-body: #1C1C1F;
  --text-secondary: #6B6B70;
  --text-muted: #A8A8AD;
  --hairline: #E8E8EA;
  --hover-mist: #F4F4F6;

  --bg-obsidian: #0F1115;
  --bg-steel: #1F232B;
  --bg-slate: #2A2F38;
  --border-pearl: #3D434E;
  --on-dark-primary: #FFFFFF;
  --on-dark-secondary: #B8BAC0;
  --on-dark-muted: #80848C;

  --accent: #FF2D2D;
  --accent-hover: #E61F1F;
  --accent-ent: #E5FF00;
  --accent-ent-hover: #CCE600;

  --score-positive: #00C896;
  --score-negative: #FF4757;

  --font-display: 'Fraunces', 'Sarabun', Georgia, serif;
  --font-body: 'Inter', 'IBM Plex Sans Thai', system-ui, sans-serif;
  --font-thai-display: 'Anuphan', 'Sarabun', sans-serif;
  --font-thai-body: 'IBM Plex Sans Thai', 'Sarabun', sans-serif;

  --max-content: 1280px;
  --gutter-desktop: 64px;
  --gutter-tablet: 40px;
  --gutter-mobile: 20px;
}

[data-accent="volt"] {
  --accent: var(--accent-ent);
  --accent-hover: var(--accent-ent-hover);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-body);
  background: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* dark body for homepage */
body.dark-home {
  background: var(--bg-obsidian);
  color: var(--on-dark-primary);
}

img { max-width: 100%; display: block; height: auto; }
a { color: inherit; text-decoration: none; transition: color 0.2s ease; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ===== HEADER / NAV — bilingual ===== */
.site-header {
  background: var(--bg-obsidian);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-pearl);
}

.nav-wrap {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 14px var(--gutter-desktop);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-mark {
  width: 44px;
  height: 32px;
  flex-shrink: 0;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-text .latin {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 19px;
  letter-spacing: -0.02em;
  color: #FFFFFF;
}

.brand-text .latin .pang-mark {
  color: var(--accent);
  margin-left: 1px;
}

.brand-text .thai {
  font-family: var(--font-thai-display);
  font-weight: 500;
  font-size: 11px;
  color: var(--on-dark-muted);
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.primary-nav {
  display: flex;
  list-style: none;
  gap: 24px;
  align-items: center;
}

.primary-nav > li > a {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: #FFFFFF;
  font-weight: 400;
  position: relative;
  padding: 4px 0;
  line-height: 1.1;
  transition: color 0.2s ease;
  text-decoration: none;
}

.primary-nav .nav-en {
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.primary-nav .nav-th {
  font-family: var(--font-thai-body);
  font-size: 10px;
  font-weight: 400;
  color: var(--on-dark-muted);
  margin-top: 2px;
  letter-spacing: 0.02em;
}

.primary-nav > li > a:hover .nav-en,
.primary-nav > li > a:hover .nav-th { color: var(--accent); }

.primary-nav a.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent);
}

.has-dropdown { position: relative; }

.has-dropdown > a .nav-en::after {
  content: '·';
  margin-left: 6px;
  color: var(--accent-ent);
  font-weight: 700;
}

.dropdown {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: var(--bg-steel);
  border: 1px solid var(--border-pearl);
  min-width: 200px;
  padding: 8px 0;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
  z-index: 110;
}

.has-dropdown:hover .dropdown,
.has-dropdown:focus-within .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.dropdown li { padding: 0; }

.dropdown a {
  display: flex;
  flex-direction: column;
  padding: 10px 18px;
  color: #FFFFFF;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.dropdown a .nav-en { font-size: 13px; font-weight: 500; }
.dropdown a .nav-th { font-size: 11px; color: var(--on-dark-muted); margin-top: 2px; }

.dropdown a:hover { background: var(--bg-slate); }
.dropdown a:hover .nav-en,
.dropdown a:hover .nav-th { color: var(--accent-ent); }

.menu-toggle {
  display: none;
  width: 32px;
  height: 32px;
  position: relative;
}

.menu-toggle span {
  position: absolute;
  left: 4px;
  right: 4px;
  height: 1.5px;
  background: #FFFFFF;
  transition: all 0.25s ease;
}

.menu-toggle span:nth-child(1) { top: 10px; }
.menu-toggle span:nth-child(2) { top: 50%; transform: translateY(-50%); }
.menu-toggle span:nth-child(3) { bottom: 10px; }

.menu-toggle.open span:nth-child(1) { top: 50%; transform: translateY(-50%) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { bottom: 50%; transform: translateY(50%) rotate(-45deg); }

/* ===== FOOTER ===== */
.site-footer {
  background: var(--bg-obsidian);
  color: #FFFFFF;
  padding: 64px var(--gutter-desktop) 32px;
  margin-top: 0;
}

body.dark-home .site-footer { margin-top: 0; }

.footer-wrap {
  max-width: var(--max-content);
  margin: 0 auto;
}

.footer-top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border-pearl);
}

.footer-brand-block {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.footer-brand-block .footer-mark {
  width: 56px;
  height: 42px;
  flex-shrink: 0;
}

.footer-brand-block .footer-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.footer-brand h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.footer-brand h3 .pang-mark { color: var(--accent); }

.footer-brand .footer-thai {
  font-family: var(--font-thai-display);
  font-size: 12px;
  color: var(--on-dark-muted);
  margin-top: 4px;
}

.footer-brand p {
  font-size: 13px;
  color: var(--on-dark-secondary);
  max-width: 360px;
  line-height: 1.7;
}

.footer-col h4 {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--on-dark-muted);
  font-weight: 500;
  margin-bottom: 14px;
}

.footer-col h4 .th {
  font-family: var(--font-thai-body);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--on-dark-muted);
  text-transform: none;
  font-weight: 400;
  margin-left: 6px;
}

.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 10px; }
.footer-col a {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: #FFFFFF;
  transition: color 0.2s ease;
  line-height: 1.2;
}
.footer-col a .th {
  font-family: var(--font-thai-body);
  font-size: 11px;
  color: var(--on-dark-muted);
  margin-top: 2px;
  font-weight: 400;
}
.footer-col a:hover { color: var(--accent); }
.footer-col a:hover .th { color: var(--accent); }

.footer-bottom {
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--on-dark-muted);
  letter-spacing: 0.04em;
  flex-wrap: wrap;
  gap: 8px;
}

/* ===== UTILITY ===== */
.container {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 0 var(--gutter-desktop);
}

.container-narrow {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 var(--gutter-desktop);
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
}

.eyebrow .th {
  font-family: var(--font-thai-body);
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0.02em;
  margin-left: 8px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .primary-nav { gap: 16px; }
  .primary-nav .nav-en { font-size: 11px; }
  .primary-nav .nav-th { font-size: 9px; }
}

@media (max-width: 1100px) {
  .nav-wrap { padding: 12px var(--gutter-tablet); }
  .container, .container-narrow { padding: 0 var(--gutter-tablet); }
  .site-footer { padding: 48px var(--gutter-tablet) 28px; }
  .footer-top { gap: 32px; }
}

@media (max-width: 980px) {
  .nav-wrap { padding: 10px var(--gutter-mobile); gap: 12px; }
  .menu-toggle { display: block; }
  .brand-mark { width: 38px; height: 28px; }
  .brand-text .latin { font-size: 17px; }
  .brand-text .thai { font-size: 10px; }

  .primary-nav {
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    background: var(--bg-obsidian);
    flex-direction: column;
    align-items: flex-start;
    padding: 16px var(--gutter-mobile) 28px;
    gap: 0;
    border-bottom: 1px solid var(--border-pearl);
    transform: translateY(-100%);
    visibility: hidden;
    transition: all 0.3s ease;
    max-height: calc(100vh - 52px);
    overflow-y: auto;
  }

  .primary-nav.open {
    transform: translateY(0);
    visibility: visible;
  }

  .primary-nav li {
    width: 100%;
    border-bottom: 1px solid var(--border-pearl);
  }

  .primary-nav > li > a {
    flex-direction: row;
    align-items: baseline;
    padding: 12px 0;
    gap: 10px;
  }

  .primary-nav .nav-en { font-size: 14px; }
  .primary-nav .nav-th { font-size: 12px; margin-top: 0; }

  .has-dropdown > a .nav-en::after { content: ' ↓'; color: var(--accent-ent); }

  .dropdown {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    background: transparent;
    border: none;
    padding: 0 0 8px 16px;
    display: none;
  }

  .has-dropdown.open .dropdown { display: block; }

  .dropdown a {
    flex-direction: row;
    align-items: baseline;
    gap: 10px;
    padding: 6px 0;
  }

  .dropdown a .nav-en { font-size: 13px; }
  .dropdown a .nav-th { font-size: 11px; margin-top: 0; }

  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 600px) {
  .container, .container-narrow { padding: 0 var(--gutter-mobile); }
  .footer-top { grid-template-columns: 1fr; gap: 28px; }
  .site-footer { padding: 40px var(--gutter-mobile) 20px; }
}
