/* ============================================================
   Teerapol K. — Apple iOS Light-Minimal Design System
   Palette: White / #f5f5f7 Gray / #1d1d1f Near-black / #0071e3 Blue
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  /* Apple light-minimal palette */
  --black:   #1d1d1f;   /* Apple near-black (text + dark surfaces) */
  --white:   #ffffff;
  --gray-50: #fbfbfd;   /* hero/section off-white */
  --gray-100:#f5f5f7;   /* Apple section gray */
  --gray-150:#eef0f2;
  --gray-200:#e8e8ed;   /* hairline borders */
  --gray-300:#d2d2d7;   /* separators */
  --gray-400:#86868b;   /* tertiary text */
  --gray-600:#6e6e73;   /* secondary text */
  --gray-700:#424245;   /* strong secondary */
  --accent:  #0071e3;   /* Apple blue — primary CTA */
  --accent-h:#0077ed;   /* accent hover */
  --link:    #0071e3;   /* hyperlink blue (TEERAPOL accent) */
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  /* legacy aliases */
  --color-black:       var(--black);
  --color-white:       var(--white);
  --color-gray-100:    var(--gray-100);
  --color-gray-200:    var(--gray-200);
  --color-gray-400:    var(--gray-400);
  --color-gray-600:    var(--gray-600);
  --color-gray-800:    var(--gray-700);
  --color-accent:      var(--link);
  --color-accent-hover:var(--accent-h);

  /* SF Pro via system stack first, Inter as embeddable fallback */
  --font-primary: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --nav-height:   48px;   /* Apple nav */
  --max-width:    1200px;
  --section-pad:  112px 0;

  /* Apple radii */
  --radius:      18px;
  --radius-sm:   12px;
  --radius-pill: 980px;

  --ease-fast:   0.15s ease;
  --ease-smooth: 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-slow:   0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94);

  /* back-compat */
  --transition-fast:   var(--ease-fast);
  --transition-smooth: var(--ease-smooth);
  --transition-slow:   var(--ease-slow);
  --section-padding:   var(--section-pad);
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-primary);
  background: var(--white);
  color: var(--black);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a   { color: inherit; text-decoration: none; }

/* ── Typography ─────────────────────────────────────────────── */
h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
}
h2 {
  font-size: clamp(1.7rem, 3.2vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
}
h3 {
  font-size: clamp(1.1rem, 1.8vw, 1.45rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
}
h4  { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }
p   { font-size: 1rem; line-height: 1.75; color: var(--gray-600); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 24px;
  border-radius: var(--radius-pill);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: none;
  cursor: pointer;
  border: none;
  transition: all var(--ease-fast);
  white-space: nowrap;
}

/* Apple: solid blue primary CTA */
.btn-primary {
  background: var(--accent);
  color: var(--white);
  border: 1.5px solid var(--accent);
}
.btn-primary:hover {
  background: var(--accent-h);
  border-color: var(--accent-h);
}

/* Tesla: outline on dark bg (hero) */
.btn-outline {
  background: rgba(255,255,255,0.12);
  color: var(--white);
  border: 1.5px solid rgba(255,255,255,0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.btn-outline:hover {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.8);
}

/* Tesla: outline on light bg */
.btn-outline-dark {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}
.btn-outline-dark:hover {
  background: var(--accent);
  color: var(--white);
}

/* ============================================================
   NAVIGATION  —  Tesla frosted-white style
   ============================================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  padding: 0 24px;
  transition:
    background var(--ease-smooth),
    border-color var(--ease-smooth),
    backdrop-filter var(--ease-smooth);
}

/* Transparent variant — over hero (dark bg) */
.nav.transparent {
  background: transparent;
  border-bottom: 1px solid transparent;
}

/* When user scrolls on transparent nav */
.nav.scrolled {
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--gray-200);
}
.nav.scrolled .nav-logo    { color: var(--black); }
.nav.scrolled .nav-links a { color: var(--gray-700); }
.nav.scrolled .nav-links a:hover { color: var(--black); }
.nav.scrolled .nav-cta .btn-outline {
  background: transparent;
  color: var(--black);
  border-color: var(--black);
}
.nav.scrolled .nav-hamburger span { background: var(--black); }

/* Light variant — inner pages (not hero) */
.nav.light {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--gray-200);
}
.nav.light .nav-logo    { color: var(--black); }
.nav.light .nav-links a { color: var(--gray-700); }
.nav.light .nav-links a:hover { color: var(--black); }
.nav.light .nav-cta .btn-outline {
  background: transparent;
  color: var(--black);
  border-color: rgba(0,0,0,0.5);
}
.nav.light .nav-hamburger span { background: var(--black); }

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
}

.nav-logo {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--white);
  text-transform: none;
  transition: color var(--ease-fast), opacity var(--ease-fast);
}
.nav-logo:hover { opacity: 0.75; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}
.nav-links a {
  color: rgba(255,255,255,0.82);
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  text-transform: none;
  transition: color var(--ease-fast);
}
.nav-links a:hover { color: var(--white); }

.nav-cta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
}
.nav-hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: all var(--ease-fast);
}

/* ============================================================
   HERO  —  Full-viewport, dark background, Tesla style
   ============================================================ */
.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 620px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  background: var(--gray-50);
}

.hero-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1.04);
  transition: transform 7s ease;
}
.hero.loaded .hero-bg { transform: scale(1); }

.hero-bg-gradient {
  position: absolute; inset: 0;
  background: none;
}

.hero-content {
  position: relative; z-index: 2;
  text-align: center;
  padding: 0 24px;
  margin-top: auto;
  padding-top: var(--nav-height);
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  flex: 1;
}

.hero-eyebrow {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
}

.hero-title {
  color: var(--black);
  margin-bottom: 20px;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--gray-600);
  max-width: 520px;
  margin: 0 auto 44px;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 64px;
}

.hero-scroll-hint {
  position: relative; z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 0 28px;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: color var(--ease-fast);
}
.hero-scroll-hint:hover { color: var(--black); }

.scroll-arrow {
  width: 18px; height: 18px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  animation: scrollBounce 2s infinite;
}

@keyframes scrollBounce {
  0%, 100% { transform: rotate(45deg) translateY(0);   opacity: 0.5; }
  50%       { transform: rotate(45deg) translateY(5px); opacity: 1;   }
}

/* ============================================================
   SECTION PANELS
   ============================================================ */
.section-panel {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  overflow: hidden;
  background: var(--black);
}
.section-panel .panel-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
}
.section-panel .panel-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0) 50%, rgba(0,0,0,0.52) 100%);
}
.panel-content {
  position: relative; z-index: 2;
  text-align: center;
  padding: 0 24px 56px;
  max-width: 600px;
}
.panel-content h2 { color: var(--white); margin-bottom: 10px; }
.panel-content p  { color: rgba(255,255,255,0.7); margin-bottom: 28px; }
.panel-actions    { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.section-panel.light-panel { background: var(--white); }
.section-panel.light-panel .panel-content h2 { color: var(--black); }
.section-panel.light-panel .panel-content p  { color: var(--gray-600); }

/* ============================================================
   SECTION HEADER  (shared)
   ============================================================ */
.section-header {
  text-align: center;
  max-width: 620px;
  margin: 0 auto 60px;
}
.section-eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gray-400);   /* Tesla: muted label, no bright accent */
  margin-bottom: 14px;
}
.section-header h2   { margin-bottom: 16px; color: var(--black); }
.section-header p    { font-size: 1.05rem; color: var(--gray-600); }

/* ============================================================
   TOPICS GRID
   ============================================================ */
.topics-section {
  padding: var(--section-pad);
  background: var(--white);
}

.topics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--gray-200);   /* gap becomes border */
  max-width: var(--max-width);
  margin: 0 auto;
  border: 1px solid var(--gray-200);
  border-radius: 18px;
  overflow: hidden;
}

.topic-card {
  position: relative;
  aspect-ratio: 1 / 0.82;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 28px;
  overflow: hidden;
  cursor: pointer;
  background: var(--black);
  transition: transform var(--ease-smooth);
}
.topic-card:hover { transform: scale(1.01); z-index: 1; }

.topic-card-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform var(--ease-slow);
}
.topic-card:hover .topic-card-bg { transform: scale(1.06); }

.topic-card-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.2) 55%, transparent 100%);
}
.topic-card-content { position: relative; z-index: 2; }

.topic-icon  { font-size: 1.8rem; margin-bottom: 10px; display: block; }
.topic-card h3 { color: var(--white); margin-bottom: 6px; font-size: 1.1rem; }
.topic-card p  { color: rgba(255,255,255,0.6); font-size: 0.82rem; line-height: 1.55; }

.topic-tag {
  display: inline-block;
  padding: 2px 9px;
  background: rgba(255,255,255,0.13);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 100px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
  margin-bottom: 10px;
}

/* ============================================================
   ARTICLES SECTION  —  light gray bg (Tesla alternating)
   ============================================================ */
.articles-section {
  padding: var(--section-pad);
  background: var(--gray-100);
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.article-card {
  background: var(--white);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--gray-200);
  transition: box-shadow var(--ease-smooth), transform var(--ease-smooth), border-color var(--ease-smooth);
  cursor: pointer;
}
.article-card:hover {
  box-shadow: 0 12px 40px rgba(23,26,32,0.1);
  transform: translateY(-3px);
  border-color: var(--gray-300);
}

.article-card-thumb {
  aspect-ratio: 16/9;
  background: var(--gray-150);
  overflow: hidden;
}
.article-card-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--ease-slow);
}
.article-card:hover .article-card-thumb img { transform: scale(1.04); }

.article-card-body  { padding: 22px; }

.article-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.article-category {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gray-400);   /* Tesla: no accent color on categories */
}
.article-date {
  font-size: 0.72rem;
  color: var(--gray-400);
}

.article-card h3 {
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--black);
  line-height: 1.4;
  transition: color var(--ease-fast);
}
.article-card:hover h3 { color: var(--link); }

.article-card p {
  font-size: 0.855rem;
  color: var(--gray-600);
  line-height: 1.65;
  margin-bottom: 18px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-read-more {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--black);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: gap var(--ease-fast), color var(--ease-fast);
}
.article-read-more::after { content: "→"; font-size: 0.95rem; }
.article-read-more:hover  { gap: 9px; color: var(--link); }

/* Featured large card */
.article-card.featured             { grid-column: span 2; }
.article-card.featured .article-card-thumb { aspect-ratio: 2/1; }
.article-card.featured h3          { font-size: 1.25rem; }

/* ============================================================
   STATS BAR  —  Tesla: light (not dark) with #171A20 numbers
   ============================================================ */
.stats-bar {
  padding: 72px 24px;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
}
.stats-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 48px;
  max-width: var(--max-width);
  margin: 0 auto;
  text-align: center;
}
.stat-number {
  font-size: clamp(2.4rem, 4.5vw, 3.6rem);
  font-weight: 800;
  color: var(--black);
  letter-spacing: -0.05em;
  line-height: 1;
  margin-bottom: 8px;
}
.stat-number span { color: var(--link); }

.stat-label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-400);
}

/* ============================================================
   CTA / NEWSLETTER  —  white, clean
   ============================================================ */
.cta-section {
  padding: var(--section-pad);
  background: var(--gray-100);
  text-align: center;
}
.cta-inner             { max-width: 540px; margin: 0 auto; }
.cta-inner h2          { margin-bottom: 16px; }
.cta-inner p           { margin-bottom: 40px; font-size: 1.05rem; }

.newsletter-form {
  display: flex;
  gap: 0;
  max-width: 420px;
  margin: 0 auto;
  border: 1px solid var(--gray-300);
  border-radius: 14px;
  overflow: hidden;
}
.newsletter-form input {
  flex: 1;
  padding: 13px 18px;
  border: none;
  outline: none;
  font-size: 0.875rem;
  font-family: var(--font-primary);
  background: var(--white);
  color: var(--black);
}
.newsletter-form button {
  padding: 13px 24px;
  background: var(--accent);
  color: var(--white);
  border: none;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: none;
  cursor: pointer;
  transition: background var(--ease-fast);
  white-space: nowrap;
  font-family: var(--font-primary);
}
.newsletter-form button:hover { background: var(--accent-h); }

/* ============================================================
   FOOTER  —  Tesla dark navy footer
   ============================================================ */
.footer {
  background: var(--gray-100);
  color: var(--gray-600);
  padding: 56px 24px 28px;
  border-top: 1px solid var(--gray-200);
}
.footer-inner { max-width: var(--max-width); margin: 0 auto; }

.footer-top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 44px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 28px;
}

.footer-brand .nav-logo {
  font-size: 1.05rem;
  display: inline-block;
  margin-bottom: 14px;
  color: var(--black);
}
.footer-brand p {
  font-size: 0.82rem;
  color: var(--gray-600);
  line-height: 1.75;
}

.footer-col h4 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--black);
  margin-bottom: 18px;
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.footer-col ul a {
  font-size: 0.82rem;
  color: var(--gray-600);
  transition: color var(--ease-fast);
}
.footer-col ul a:hover { color: var(--black); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-legal { font-size: 0.72rem; color: var(--gray-400); }
.footer-social { display: flex; gap: 18px; }
.footer-social a {
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--gray-600);
  transition: color var(--ease-fast);
  text-transform: none;
}
.footer-social a:hover { color: var(--black); }

/* ============================================================
   MOBILE MENU OVERLAY  —  dark (like Tesla)
   ============================================================ */
.mobile-menu {
  position: fixed; inset: 0; z-index: 999;
  background: var(--black);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ease-smooth);
}
.mobile-menu.open { opacity: 1; pointer-events: auto; }

.mobile-menu-links { list-style: none; display: flex; flex-direction: column; align-items: center; gap: 28px; }
.mobile-menu-links a {
  color: var(--white);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  transition: opacity var(--ease-fast);
}
.mobile-menu-links a:hover { opacity: 0.55; }

.mobile-menu-close {
  position: absolute; top: 18px; right: 22px;
  background: none; border: none;
  color: var(--white); font-size: 1.4rem;
  cursor: pointer; padding: 8px;
  opacity: 0.65;
  transition: opacity var(--ease-fast);
}
.mobile-menu-close:hover { opacity: 1; }

/* ============================================================
   PAGE HEADER  (inner pages without hero)
   ============================================================ */
.page-header {
  padding: 130px 24px 72px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  text-align: center;
}
.page-header h1 { color: var(--black); margin-bottom: 14px; }
.page-header p  { color: var(--gray-600); max-width: 540px; margin: 0 auto; font-size: 1.05rem; }

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

.text-center { text-align: center; }
.mt-8  { margin-top: 8px;  }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-40 { margin-top: 40px; }

/* ── Fade-in on scroll ──────────────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}
.fade-in.visible { opacity: 1; transform: translateY(0); }

.fade-delay-1 { transition-delay: 0.1s; }
.fade-delay-2 { transition-delay: 0.2s; }
.fade-delay-3 { transition-delay: 0.32s; }
.fade-delay-4 { transition-delay: 0.44s; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .topics-grid    { grid-template-columns: repeat(2, 1fr); }
  .articles-grid  { grid-template-columns: repeat(2, 1fr); }
  .article-card.featured { grid-column: span 2; }
  .stats-inner    { grid-template-columns: repeat(2, 1fr); gap: 32px; }
  .footer-top     { grid-template-columns: 1fr 1fr; gap: 32px; }
}

@media (max-width: 768px) {
  :root { --section-pad: 72px 0; }

  .nav-links, .nav-cta { display: none; }
  .nav-hamburger { display: flex; }

  .topics-grid  { grid-template-columns: 1fr; gap: 0; }
  .topic-card   { aspect-ratio: 4/3; }

  .articles-grid { grid-template-columns: 1fr; }
  .article-card.featured { grid-column: span 1; }
  .article-card.featured .article-card-thumb { aspect-ratio: 16/9; }

  .stats-inner { grid-template-columns: repeat(2, 1fr); gap: 24px; }

  .footer-top    { grid-template-columns: 1fr; gap: 28px; }
  .footer-bottom { flex-direction: column; text-align: center; }

  .hero-actions  { flex-direction: column; align-items: center; }
  .newsletter-form { flex-direction: column; }
  .newsletter-form input { border-bottom: 1px solid var(--gray-200); }
}

@media (max-width: 480px) {
  .stats-inner { grid-template-columns: 1fr; }
}
