/* ============================================================
   1. Design Tokens & Base Reset
   ============================================================ */
:root {
  --bg: #0B0F19;
  --surface: #151C2E;
  --surface-alt: #141824;
  --text: #F8FAFC;
  --text-muted: #94A3B8;
  --accent: #C5A059;
  --border: rgba(197, 160, 89, 0.16);
  --border-soft: rgba(248, 250, 252, 0.08);

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, sans-serif;

  --max-width: 760px;
}

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

html { 
  scroll-behavior: smooth; 
  overflow-y: auto;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: clip; /* ป้องกัน overflow โดยไม่ฆ่า position: sticky */
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--text);
  text-decoration: none;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

p, h1, h2, h3, h4, li, span, div,
.timeline-role, .timeline-note, .timeline-details p {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* ============================================================
   2. Layout & Global Components
   ============================================================ */
section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 5rem 1.5rem;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--text);
  margin: 0 0 2rem;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: -10px;
  margin-bottom: 25px;
}

/* Navigation (Sticky Header) */
.site-nav {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(11, 15, 25, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
  transition: all 0.3s ease;
}

.site-nav__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-nav__mark {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.site-nav__links {
  display: flex;
  gap: 1.75rem;
}

.site-nav__links a {
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.site-nav__links a:hover {
  color: var(--accent);
}

/* ============================================================
   3. Hero Section
   ============================================================ */
.hero {
  padding-top: 6rem;
  padding-bottom: 4rem;
}

.hero__container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  max-width: 1100px;
  margin: 0 auto;
}

.hero__inner {
  flex: 1;
}

.hero__eyebrow {
  color: var(--accent);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.hero__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  line-height: 1.15;
  margin: 0 0 1.25rem;
}

.hero__lede {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 52ch;
  margin: 0 0 2.25rem;
}

.hero__cta {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.92rem;
  border-radius: 2px;
  transition: background 0.15s ease, color 0.15s ease;
}

.hero__cta:hover {
  background: var(--accent);
  color: var(--bg);
}

.hero__image-wrapper {
  flex-shrink: 0;
  width: 320px;
  height: 380px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(197, 160, 89, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.hero__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* ============================================================
   4. Timeline / Transition Journey Accordion
   ============================================================ */
.timeline-accordion {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.timeline-item {
  background: #1a1f2c;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.3s ease;
}

.timeline-item:hover {
  border-color: var(--accent);
}

.timeline-header {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
}

.timeline-year {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.4;
  flex-shrink: 0;
  width: 170px;
}

.timeline-title-group {
  flex-grow: 1;
  min-width: 0;
}

.timeline-role {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text);
}

.timeline-org {
  margin: 3px 0 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.expand-icon {
  font-size: 1.5rem;
  color: var(--accent);
  font-weight: bold;
  padding-left: 15px;
}

.timeline-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.3s ease;
  background: var(--surface-alt);
  padding: 0 20px;
}

.timeline-item.active .timeline-body {
  max-height: 1500px;
  padding: 20px;
}

.divider {
  border: 0;
  border-top: 1px solid var(--border-soft);
  margin: 12px 0;
}

.timeline-details p {
  margin: 8px 0;
  font-size: 0.92rem;
  line-height: 1.6;
  color: #cbd5e0;
}

.highlight-gold {
  color: var(--accent);
}

/* ============================================================
   5. Tech Stack & Project Showcase
   ============================================================ */
.stack__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.stack__grid li {
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 0.45rem 0.9rem;
  border-radius: 2px;
}

.showcase__card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 2.25rem;
  display: grid;
  gap: 1.75rem;
}

.showcase__card h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
  margin: 0 0 0.75rem;
}

.showcase__card p {
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.showcase__facts {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.showcase__facts li { 
  margin-bottom: 0.35rem; 
}

.showcase__meta {
  display: flex;
  gap: 1.5rem;
  border-top: 1px solid var(--border-soft);
  padding-top: 1.25rem;
}

.showcase__link {
  color: var(--accent);
  font-size: 0.9rem;
}

.showcase__link:hover { 
  text-decoration: underline; 
}

/* ============================================================
   6. Education Section
   ============================================================ */
.education__grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.education__card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  transition: border-color 0.3s ease;
}

.education__card:hover {
  border-color: var(--accent);
}

.education__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.education__degree {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.25rem 0;
}

.education__major {
  color: var(--text);
  font-weight: 500;
  font-size: 0.92rem;
  margin: 0 0 0.2rem 0;
}

.education__institution {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
}

.education__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  flex-shrink: 0;
}

.education__period {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.education__gpa {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
  background: rgba(197, 160, 89, 0.1);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  border: 1px solid rgba(197, 160, 89, 0.2);
}

/* ============================================================
   7. Contact & Footer
   ============================================================ */
.contact__container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  text-align: center;
}

.contact__item {
  color: var(--accent);
  text-decoration: none;
}

.site-footer {
  border-top: 1px solid var(--border-soft);
  margin-top: 2rem;
}

.site-footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
}

.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }

/* ============================================================
   8. Consolidated Responsive Rules (Mobile < 768px)
   ============================================================ */
@media (max-width: 768px) {
  /* Hero */
  .hero__container {
    flex-direction: column-reverse;
    text-align: center;
    gap: 24px;
  }

  .hero__image-wrapper {
    width: 220px;
    height: 260px;
  }

  .hero__lede {
    margin-left: auto;
    margin-right: auto;
  }

  /* Navigation */
  .site-nav__inner {
    flex-direction: column;
    gap: 12px;
  }

  .site-nav__links {
    gap: 15px;
    font-size: 0.9rem;
  }

  /* Timeline Accordion */
  .timeline-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 16px;
  }

  .timeline-year {
    width: 100%;
    font-size: 0.85rem;
  }

  .timeline-title-group {
    width: 100%;
  }

  .timeline-role {
    font-size: 1.05rem;
    line-height: 1.3;
  }

  .timeline-body {
    padding: 0 16px;
  }

  .timeline-item.active .timeline-body {
    padding: 16px;
  }

  /* Education */
  .education__header {
    flex-direction: column;
    gap: 0.75rem;
  }

  .education__meta {
    align-items: flex-start;
  }

  /* Contact */
  .contact__container {
    flex-direction: column;
    gap: 6px;
  }

  .contact__dot {
    display: none;
  }
}

/* ============================================================
   9. Accessibility
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}