/* DataProteins — scroll-driven site
   ทิศทาง: หน้าหนึ่งหนังสือพิมพ์การเงิน (กระดาษครีม เส้นบรรทัด serif หนัก)
   เปิดม่านเข้าสู่โลกข้อมูลกลางคืน (หมึกน้ำเงินดำ + ทองข้อมูล)               */

:root {
  --paper: #F7F2E9;
  --paper-deep: #EFE7D8;
  --ink: #14100A;
  --ink-soft: #4A4335;
  --night: #07090F;
  --gold: #C4952B;
  --gold-bright: #E8A33D;
  --teal: #56E0C8;
  --text-on-dark: #F0EAE0;
  --muted-on-dark: #9BA3B2;
  --font-display: 'Chonburi', serif;
  --font-body: 'Sarabun', sans-serif;
  --header-h: 72px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: auto; }
body {
  font-family: var(--font-body);
  background: var(--night);
  color: var(--ink);
  overflow-x: hidden;
}
::selection { background: var(--gold-bright); color: var(--night); }

/* ── Loader ─────────────────────────────────────────────────────────────── */
#loader {
  position: fixed; inset: 0; z-index: 60;
  background: var(--night);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px;
  transition: opacity .7s ease, visibility .7s;
}
#loader.done { opacity: 0; visibility: hidden; }
.loader-brand { font-family: var(--font-display); font-size: 2rem; color: var(--text-on-dark); letter-spacing: .02em; }
.loader-track { width: min(320px, 60vw); height: 2px; background: rgba(240,234,224,.14); }
#loader-bar { width: 0%; height: 100%; background: var(--gold-bright); transition: width .2s ease; }
#loader-percent { font-size: .75rem; letter-spacing: .2em; color: var(--muted-on-dark); }

/* ── Header ─────────────────────────────────────────────────────────────── */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4vw;
}
.brand {
  font-family: var(--font-display); font-size: 1.35rem; text-decoration: none;
  color: var(--text-on-dark);
}
.brand span { color: var(--gold-bright); }
.header-right { display: flex; align-items: center; gap: 28px; }
.header-link {
  font-size: .9rem; font-weight: 600; text-decoration: none;
  color: var(--muted-on-dark); letter-spacing: .04em;
  transition: color .2s ease;
}
.header-link:hover { color: var(--gold-bright); }
.header-cta {
  font-size: .9rem; font-weight: 600; text-decoration: none;
  color: var(--night); background: var(--gold-bright);
  padding: 10px 22px; border-radius: 999px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.header-cta:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(232,163,61,.25); }

/* ── Hero ───────────────────────────────────────────────────────────────── */
.hero-standalone {
  position: relative; z-index: 5;
  height: 100vh; height: 100svh;
  background:
    radial-gradient(circle at 1px 1px, rgba(232,163,61,.13) 1px, transparent 1.7px) 0 0 / 30px 30px,
    radial-gradient(120% 90% at 72% 8%, rgba(64,96,132,.20), transparent 55%),
    radial-gradient(95% 75% at 28% 100%, rgba(232,163,61,.17), transparent 60%),
    var(--night);
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  padding: 0 7vw;
}
.hero-rule { width: 100%; height: 1px; background: rgba(240,234,224,.18); position: relative; }
.hero-rule::after {
  content: ""; position: absolute; left: 0; top: -2px; width: 120px; height: 5px; background: var(--gold-bright);
}
.hero-rule-top { margin-bottom: 4.5vh; }
.hero-rule-bottom { margin-top: 5vh; }
.hero-label { margin-bottom: 2.2vh; }
.section-label {
  display: block; font-size: .72rem; font-weight: 600;
  letter-spacing: .22em; text-transform: uppercase; color: var(--gold-bright);
}
.hero-heading {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(3.4rem, 11.5vw, 9.5rem);
  line-height: 1.04; color: var(--text-on-dark);
  text-shadow: 0 0 60px rgba(232,163,61,.18);
}
.hero-heading .line { display: block; overflow: hidden; }
.hero-heading .word { display: inline-block; transform: translateY(110%); }
.hero-heading .accent .word {
  color: transparent; -webkit-text-stroke: 2px var(--gold-bright); text-shadow: none;
}
.hero-tagline {
  margin-top: 3.5vh; max-width: 34em;
  font-size: clamp(1rem, 1.45vw, 1.25rem); font-weight: 300; line-height: 1.75;
  color: var(--muted-on-dark); opacity: 0;
}
.hero-tagline strong { color: var(--text-on-dark); font-weight: 700; }
.scroll-indicator {
  position: absolute; bottom: 4.5vh; left: 7vw;
  display: flex; align-items: center; gap: 14px;
  font-size: .78rem; letter-spacing: .12em; color: var(--muted-on-dark); opacity: 0;
}
.scroll-indicator .arrow { display: inline-block; animation: dip 1.8s ease-in-out infinite; color: var(--gold-bright); font-size: 1rem; }
@keyframes dip { 0%,100% { transform: translateY(0); } 50% { transform: translateY(7px); } }

/* ── Canvas + overlay + marquee ─────────────────────────────────────────── */
.canvas-wrap {
  position: fixed; inset: 0; z-index: 1;
  background: var(--night);
  clip-path: circle(0% at 50% 62%);
}
#canvas { width: 100%; height: 100%; display: block; }
#dark-overlay {
  position: fixed; inset: 0; z-index: 2;
  background: rgba(4, 6, 10, .92); opacity: 0; pointer-events: none;
}
.marquee-wrap {
  position: fixed; top: 8vh; left: 0; z-index: 3;
  width: 100%; overflow: visible; pointer-events: none; opacity: 0;
}
.marquee-text {
  font-family: var(--font-display); font-size: 12vw; white-space: nowrap;
  color: transparent; -webkit-text-stroke: 1px rgba(240, 234, 224, .22);
  will-change: transform;
}

/* ── Scroll container + sections ────────────────────────────────────────── */
#scroll-container { position: relative; z-index: 4; height: 900vh; }
.scroll-section {
  position: absolute; left: 0; width: 100%;
  transform: translateY(-50%);
  visibility: hidden;
}
.align-left  { padding-left: 6vw;  padding-right: 55vw; }
.align-right { padding-left: 55vw; padding-right: 6vw; }
.align-left .section-inner, .align-right .section-inner { max-width: 32vw; }

.section-content .section-label { margin-bottom: 1.6rem; }
.section-heading {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2.1rem, 3.6vw, 3.6rem);
  line-height: 1.16; color: var(--text-on-dark);
  margin-bottom: 1.4rem;
}
.section-body {
  font-size: clamp(.98rem, 1.15vw, 1.12rem); font-weight: 300; line-height: 1.85;
  color: var(--muted-on-dark);
}
/* ตัวหนังสือที่ลอยบน canvas ต้องมีเงา กันชนฉากช่วงสว่าง */
.section-content .section-heading, .section-content .section-body,
.section-stats .section-heading, .section-stats .section-body {
  text-shadow: 0 1px 16px rgba(4, 6, 10, .95), 0 0 46px rgba(4, 6, 10, .75);
}
.section-body em { color: var(--gold-bright); font-style: normal; }
.section-body strong { color: var(--text-on-dark); }

/* ── Stats ──────────────────────────────────────────────────────────────── */
.section-stats { padding: 0 8vw; text-align: center; }
.stats-head .section-heading { margin: 1rem auto 4.5rem; }
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 3vw;
  max-width: 1200px; margin: 0 auto;
}
.stat { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.stat-row { display: flex; align-items: baseline; gap: .2rem; }
.stat-number {
  font-family: var(--font-display); font-size: clamp(2.6rem, 4.6vw, 4.6rem);
  color: var(--gold-bright); line-height: 1;
}
.stat-suffix { font-family: var(--font-display); font-size: clamp(1.3rem, 2vw, 2rem); color: var(--gold); }
.stat-label { font-size: .85rem; letter-spacing: .1em; color: var(--muted-on-dark); }

/* ── Uses list ──────────────────────────────────────────────────────────── */
.section-uses .section-inner { max-width: 34vw; }
.uses-list { list-style: none; margin: 0 0 1.6rem; }
.uses-list li {
  display: flex; flex-direction: column; gap: .15rem;
  padding: .8rem 0; border-bottom: 1px solid rgba(240, 234, 224, .14);
}
.uses-list li strong {
  color: var(--text-on-dark); font-weight: 600; font-size: 1.02rem;
  text-shadow: 0 1px 14px rgba(4, 6, 10, .95);
}
.uses-list li span {
  color: #C2C9D6; font-weight: 300; font-size: .9rem;
  text-shadow: 0 1px 14px rgba(4, 6, 10, .95), 0 0 34px rgba(4, 6, 10, .8);
}

/* ── CTA (แผ่นกระดาษครีมกลับมาปิดท้าย) ─────────────────────────────────── */
.section-cta {
  height: 100vh; top: auto !important; bottom: 0; transform: none !important;
  display: flex; align-items: center; justify-content: center;
  /* โปร่งเล็กน้อย ให้เมือง 3D เฟรมสุดท้ายเรืองทะลุมา — ต่อเนื่องกับฉากก่อนหน้า */
  background: linear-gradient(180deg, rgba(4,6,10,.84) 0%, rgba(4,6,10,.93) 55%, rgba(4,6,10,.97) 100%);
}
.cta-inner { text-align: center; max-width: 780px; padding: 0 6vw; }
.cta-heading {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2.6rem, 6vw, 5.4rem); line-height: 1.1;
  color: var(--text-on-dark); margin: 1.2rem 0 1.6rem;
  text-shadow: 0 0 60px rgba(232,163,61,.16);
}
.cta-body { color: var(--muted-on-dark); font-weight: 300; margin-bottom: 2.6rem; }
.cta-buttons { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.cta-button {
  font-size: 1.05rem; font-weight: 700; text-decoration: none;
  padding: 16px 38px; border-radius: 999px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.cta-button:hover { transform: translateY(-3px); box-shadow: 0 12px 34px rgba(232,163,61,.28); }
.cta-fb   { background: var(--gold-bright); color: var(--night); }
.cta-page { background: #1877F2; color: #fff; }
.cta-mail { margin-top: 1.8rem; font-size: .9rem; color: var(--muted-on-dark); }
.cta-mail a { color: var(--gold-bright); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--gold-bright); }
.site-footer {
  margin-top: 7vh; padding-top: 2.2vh;
  border-top: 1px solid rgba(240,234,224,.16);
  font-size: .74rem; letter-spacing: .06em; color: var(--muted-on-dark);
}

/* ── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #scroll-container { height: 600vh; }
  .section-heading br, .cta-heading br { display: none; }   /* ให้เบราว์เซอร์ตัดคำไทยเอง */
  .align-left, .align-right { padding: 0 7vw; }
  .align-left .section-inner, .align-right .section-inner,
  .section-uses .section-inner { max-width: 100%; }
  .section-content .section-inner {
    background: rgba(4, 6, 10, .78);
    padding: 1.6rem 1.4rem; border-radius: 4px;
  }
  .section-heading { font-size: 1.9rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8vw 4vw; }
  .stats-head .section-heading { font-size: 1.7rem; margin-bottom: 2.5rem; }
  .uses-list li { flex-direction: column; gap: .15rem; align-items: flex-start; }
  .uses-list li span { text-align: left; }
  .hero-heading { font-size: 17vw; }
  .marquee-text { font-size: 19vw; }
  .header-cta { padding: 8px 16px; font-size: .82rem; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-indicator .arrow { animation: none; }
}
