/* ============================================================
   TEERAPOL-K.COM — Tesla-Inspired Design System
   ============================================================ */

/* --- Variables --- */
:root {
  --color-black: #000000;
  --color-white: #ffffff;
  --color-gray-100: #f4f4f4;
  --color-gray-200: #e4e4e4;
  --color-gray-400: #a0a0a0;
  --color-gray-600: #666666;
  --color-gray-800: #222222;
  --color-accent: #0066cc;
  --color-accent-hover: #0052a3;

  --font-primary: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-heading: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  --nav-height: 60px;
  --max-width: 1200px;
  --section-padding: 120px 0;

  --transition-fast: 0.2s ease;
  --transition-smooth: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-slow: 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* --- 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(--color-white);
  color: var(--color-black);
  line-height: 1.6;
  overflow-x: hidden;
}

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.03em; line-height: 1.1; }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.8rem); font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
h3 { font-size: clamp(1.2rem, 2vw, 1.6rem); font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
h4 { font-size: 1.1rem; font-weight: 600; }
p { font-size: 1rem; line-height: 1.7; color: var(--color-gray-600); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
  text-transform: uppercase;
}

.btn-primary {
  background: var(--color-black);
  color: var(--color-white);
}

.btn-primary:hover {
  background: var(--color-gray-800);
  transform: translateY(-1px);
}

.btn-outline {
  background: rgba(255,255,255,0.1);
  color: var(--color-white);
  border: 1px solid rgba(255,255,255,0.6);
  backdrop-filter: blur(10px);
}

.btn-outline:hover {
  background: rgba(255,255,255,0.2);
  border-color: var(--color-white);
}

.btn-outline-dark {
  background: transparent;
  color: var(--color-black);
  border: 1.5px solid var(--color-black);
}

.btn-outline-dark:hover {
  background: var(--color-black);
  color: var(--color-white);
}

/* ============================================================
   NAVIGATION
   ============================================================ */
.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(--transition-smooth), backdrop-filter var(--transition-smooth);
}

.nav.transparent {
  background: transparent;
}

.nav.scrolled {
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.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.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-white);
  text-transform: uppercase;
  transition: opacity var(--transition-fast);
}

.nav-logo:hover { opacity: 0.8; }

.nav-logo span {
  color: var(--color-accent);
}

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

.nav-links a {
  color: rgba(255,255,255,0.85);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color var(--transition-fast);
}

.nav-links a:hover {
  color: var(--color-white);
}

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

.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-white);
  border-radius: 2px;
  transition: all var(--transition-fast);
}

/* --- Nav light variant (for non-hero pages) --- */
.nav.light {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-gray-200);
}

.nav.light .nav-logo,
.nav.light .nav-links a {
  color: var(--color-black);
}

.nav.light .nav-links a:hover {
  color: var(--color-accent);
}

.nav.light .nav-hamburger span {
  background: var(--color-black);
}

/* ============================================================
   HERO — Full Viewport Sections (Tesla style)
   ============================================================ */
.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  background: var(--color-black);
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transform: scale(1.05);
  transition: transform 8s ease;
}

.hero-bg-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.15) 0%,
    rgba(0,0,0,0.05) 40%,
    rgba(0,0,0,0.5) 85%,
    rgba(0,0,0,0.75) 100%
  );
}

.hero.loaded .hero-bg {
  transform: scale(1);
}

.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.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
  margin-bottom: 16px;
}

.hero-title {
  color: var(--color-white);
  margin-bottom: 16px;
  text-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.hero-subtitle {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.8);
  max-width: 540px;
  margin: 0 auto 40px;
  text-shadow: 0 1px 8px rgba(0,0,0,0.3);
}

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

.hero-scroll-hint {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 0 32px;
  cursor: pointer;
  color: rgba(255,255,255,0.6);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: color var(--transition-fast);
}

.hero-scroll-hint:hover { color: var(--color-white); }

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

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

/* ============================================================
   SECTION PANELS (Tesla full-width sections)
   ============================================================ */
.section-panel {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  overflow: hidden;
  background: var(--color-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.55) 100%);
}

.panel-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 24px 60px;
  max-width: 600px;
}

.panel-content h2 { color: var(--color-white); margin-bottom: 10px; }
.panel-content p { color: rgba(255,255,255,0.75); margin-bottom: 28px; }

.panel-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Panel with light background */
.section-panel.light-panel {
  background: var(--color-white);
}

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

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

.section-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 64px;
}

.section-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 12px;
}

.section-header h2 { margin-bottom: 16px; }
.section-header p { font-size: 1.05rem; }

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

.topic-card {
  position: relative;
  aspect-ratio: 1 / 0.85;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 28px;
  overflow: hidden;
  cursor: pointer;
  background: var(--color-gray-800);
  transition: transform var(--transition-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(--transition-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.8) 0%, rgba(0,0,0,0.2) 60%, transparent 100%);
}

.topic-card-content {
  position: relative;
  z-index: 2;
}

.topic-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  display: block;
}

.topic-card h3 {
  color: var(--color-white);
  margin-bottom: 8px;
  font-size: 1.15rem;
}

.topic-card p {
  color: rgba(255,255,255,0.65);
  font-size: 0.85rem;
  line-height: 1.5;
}

.topic-tag {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(255,255,255,0.15);
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.8);
  margin-bottom: 10px;
}

/* ============================================================
   FEATURED ARTICLES
   ============================================================ */
.articles-section {
  padding: var(--section-padding);
  background: var(--color-gray-100);
}

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

.article-card {
  background: var(--color-white);
  border-radius: 4px;
  overflow: hidden;
  transition: box-shadow var(--transition-smooth), transform var(--transition-smooth);
  cursor: pointer;
}

.article-card:hover {
  box-shadow: 0 20px 60px rgba(0,0,0,0.12);
  transform: translateY(-4px);
}

.article-card-thumb {
  aspect-ratio: 16/9;
  background: var(--color-gray-200);
  overflow: hidden;
}

.article-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.article-card:hover .article-card-thumb img {
  transform: scale(1.05);
}

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

.article-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.article-category {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.article-date {
  font-size: 0.75rem;
  color: var(--color-gray-400);
}

.article-card h3 {
  font-size: 1.05rem;
  margin-bottom: 10px;
  color: var(--color-black);
  line-height: 1.4;
  transition: color var(--transition-fast);
}

.article-card:hover h3 { color: var(--color-accent); }

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

.article-read-more {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--color-black);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: gap var(--transition-fast), color var(--transition-fast);
}

.article-read-more:hover { gap: 10px; color: var(--color-accent); }

.article-read-more::after {
  content: "→";
  font-size: 1rem;
}

/* 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.35rem;
}

/* ============================================================
   STATS BAR
   ============================================================ */
.stats-bar {
  padding: 80px 24px;
  background: var(--color-black);
}

.stats-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 48px;
  max-width: var(--max-width);
  margin: 0 auto;
  text-align: center;
}

.stat-item {}

.stat-number {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  color: var(--color-white);
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 8px;
}

.stat-number span {
  color: var(--color-accent);
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
}

/* ============================================================
   NEWSLETTER / CTA SECTION
   ============================================================ */
.cta-section {
  padding: var(--section-padding);
  background: var(--color-white);
  text-align: center;
}

.cta-inner {
  max-width: 560px;
  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: 440px;
  margin: 0 auto;
  border: 1.5px solid var(--color-black);
  border-radius: 6px;
  overflow: hidden;
}

.newsletter-form input {
  flex: 1;
  padding: 14px 20px;
  border: none;
  outline: none;
  font-size: 0.9rem;
  font-family: var(--font-primary);
  background: transparent;
}

.newsletter-form button {
  padding: 14px 24px;
  background: var(--color-black);
  color: var(--color-white);
  border: none;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--transition-fast);
  white-space: nowrap;
}

.newsletter-form button:hover {
  background: var(--color-gray-800);
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: var(--color-black);
  color: rgba(255,255,255,0.5);
  padding: 60px 24px 32px;
}

.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: 48px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 32px;
}

.footer-brand .nav-logo {
  font-size: 1.1rem;
  display: inline-block;
  margin-bottom: 16px;
}

.footer-brand p {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.4);
  line-height: 1.7;
}

.footer-col h4 {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.9);
  margin-bottom: 20px;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-col ul a {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.45);
  transition: color var(--transition-fast);
}

.footer-col ul a:hover {
  color: var(--color-white);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-legal {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.3);
}

.footer-social {
  display: flex;
  gap: 20px;
}

.footer-social a {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.4);
  transition: color var(--transition-fast);
  text-transform: uppercase;
}

.footer-social a:hover { color: var(--color-white); }

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

.mobile-menu.open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-menu-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.mobile-menu-links a {
  color: var(--color-white);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  transition: opacity var(--transition-fast);
}

.mobile-menu-links a:hover { opacity: 0.6; }

.mobile-menu-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: var(--color-white);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
}

/* ============================================================
   PAGE HEADER (for inner pages)
   ============================================================ */
.page-header {
  padding: 140px 24px 80px;
  background: var(--color-black);
  text-align: center;
}

.page-header h1 { color: var(--color-white); margin-bottom: 16px; }
.page-header p { color: rgba(255,255,255,0.6); max-width: 560px; margin: 0 auto; font-size: 1.05rem; }

/* ============================================================
   UTILITY
   ============================================================ */
.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(28px);
  transition: opacity 0.7s ease, transform 0.7s 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.3s; }
.fade-delay-4 { transition-delay: 0.4s; }

/* ============================================================
   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-padding: 72px 0; }

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

  .topics-grid { grid-template-columns: 1fr; gap: 2px; }
  .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: 32px; }
  .footer-bottom { flex-direction: column; text-align: center; }

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

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