/* ==========================================================================
   Muay Thidarat — Minimal / White + Pastel Pink / Scroll-driven storytelling
   Mobile-first. Tested target: mobile browsers + FB/IG/LINE/Discord webviews.
   ========================================================================== */

:root {
  --pink-50: #fff6f9;
  --pink-100: #ffe9f0;
  --pink-200: #ffd3e2;
  --pink-300: #ffb3cf;
  --pink-500: #ff7fab;
  --pink-600: #f2578c;
  --pink-700: #d63f74;
  --ink: #2b2430;
  --ink-soft: #6f6270;
  --white: #ffffff;
  --cream: #fffaf8;
  --shadow: 0 20px 40px -20px rgba(214, 63, 116, 0.25);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Prompt", "Inter", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ol, ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, p { margin: 0; }

.skip-link {
  position: absolute; left: -999px; top: auto;
}

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0);
  transition: background 0.35s ease, box-shadow 0.35s ease, backdrop-filter 0.35s ease;
}
.topbar.is-scrolled {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px -16px rgba(214, 63, 116, 0.35);
}
.topbar-brand {
  font-weight: 600; font-size: 16px; letter-spacing: 0.02em; color: var(--white);
  transition: color 0.35s ease;
}
.topbar.is-scrolled .topbar-brand { color: var(--ink); }
.topbar-brand span { color: var(--pink-500); }
.topbar-cta {
  font-size: 13px; font-weight: 500; padding: 9px 16px;
  border-radius: 999px; background: var(--pink-500); color: var(--white);
  transition: transform 0.2s ease, background 0.2s ease;
}
.topbar-cta:active { transform: scale(0.96); }

/* ---------- Section tag ---------- */
.section-tag {
  font-size: 13px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--pink-600);
  position: absolute; top: 28px; left: 20px; z-index: 3;
}
.section-tag--light { color: var(--pink-100); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  min-height: 560px;
  height: 100vh;
  height: 100dvh;
}
.hero-media {
  position: absolute; inset: 0;
}
.hero-media img {
  width: 100%; height: 100%; object-fit: cover;
  transform: scale(0.95); opacity: 0;
  transition: transform 1.4s cubic-bezier(.2,.8,.2,1), opacity 1.2s ease;
  background: linear-gradient(160deg, var(--pink-100), var(--pink-300));
}
.hero-media img.is-loaded { transform: scale(1); opacity: 1; }
.hero-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(43,36,48,.05) 0%, rgba(43,36,48,.05) 45%, rgba(43,36,48,.75) 100%);
}
.hero-content {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 0 24px 64px; color: var(--white);
}
.hero-eyebrow {
  font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; opacity: 0.8;
  margin-bottom: 10px; font-weight: 500;
}
.hero-name {
  font-size: clamp(30px, 8vw, 52px); font-weight: 600; line-height: 1.1; margin-bottom: 10px;
}
.hero-nickname { font-weight: 300; opacity: 0.85; font-size: 0.6em; }
.hero-tagline { font-size: 14px; opacity: 0.9; max-width: 420px; line-height: 1.6; }
.hero-scroll {
  position: absolute; right: 24px; bottom: 64px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  color: var(--white); opacity: .85;
}
.hero-scroll span {
  width: 1px; height: 34px; background: currentColor; opacity: .6;
  animation: scrollpulse 1.8s ease-in-out infinite;
}
@keyframes scrollpulse { 0%,100%{opacity:.2;} 50%{opacity:.9;} }

/* ---------- Story sections (Sticky media + scrolling text) ---------- */
.story {
  position: relative;
  background: var(--cream);
}
.story--portfolio { background: var(--ink); }
.story-media {
  position: sticky; top: 0; overflow: hidden; z-index: 1;
  height: 100vh;
  height: 100dvh;
}
.story-media img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(1.04);
  transition: opacity 0.6s ease, transform 0.9s ease;
}
.story-media img.is-active { opacity: 1; transform: scale(1); }
.story-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20,15,20,.15) 0%, rgba(20,15,20,.55) 100%);
}
.story-captions {
  position: relative; z-index: 2;
  margin-top: -100vh;
  margin-top: -100dvh;
}
.story-caption {
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 0 24px 72px;
  color: var(--white);
  min-height: 100vh;
  min-height: 100dvh;
}
.story-caption-inner {
  opacity: 0; transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  max-width: 560px;
}
.story-caption.is-active .story-caption-inner { opacity: 1; transform: translateY(0); }
.story-caption-eyebrow {
  font-size: 12px; letter-spacing: .16em; text-transform: uppercase; opacity: .75; margin-bottom: 8px; font-weight: 500;
}
.story-caption-title {
  font-size: clamp(22px, 6vw, 36px); font-weight: 600; line-height: 1.25; margin-bottom: 10px;
}
.story-caption-text {
  font-size: 15px; line-height: 1.75; opacity: .92; margin-bottom: 16px;
}
.story-caption-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; padding: 10px 18px; border-radius: 999px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.5);
  backdrop-filter: blur(6px);
  pointer-events: auto;
}
.story-caption-link:active { transform: scale(0.97); }

/* about stat chips row */
.stat-row {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px;
}
.stat-chip {
  padding: 8px 14px; border-radius: 999px;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35);
  font-size: 13px; font-weight: 500; backdrop-filter: blur(6px);
}
.stat-chip b { font-weight: 700; }

/* ---------- Gallery ---------- */
.gallery {
  position: relative; padding: 96px 16px 64px; background: var(--white);
}
.gallery-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  margin-top: 56px;
}
.gallery-item {
  border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 3/4;
  background: var(--pink-100);
  opacity: 0; transform: scale(0.95);
  transition: opacity 0.7s ease, transform 0.7s ease;
  cursor: pointer;
}
.gallery-item.is-visible { opacity: 1; transform: scale(1); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.gallery-item:active img { transform: scale(1.05); }

/* ---------- Timeline ---------- */
.timeline {
  position: relative; padding: 96px 20px 64px; background: var(--pink-50);
}
.timeline-list {
  margin-top: 56px; display: flex; flex-direction: column; gap: 0;
  border-left: 2px solid var(--pink-200); padding-left: 24px; max-width: 640px;
}
.timeline-item {
  position: relative; padding-bottom: 40px;
  opacity: 0; transform: translateY(20px);
  transition: opacity .6s ease, transform .6s ease;
}
.timeline-item.is-visible { opacity: 1; transform: translateY(0); }
.timeline-item::before {
  content: ""; position: absolute; left: -30px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--pink-500); border: 3px solid var(--pink-50);
  box-shadow: 0 0 0 2px var(--pink-500);
}
.timeline-year { font-size: 13px; font-weight: 600; color: var(--pink-600); margin-bottom: 4px; }
.timeline-event { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.timeline-role { font-size: 14px; color: var(--ink-soft); }

/* ---------- Social ---------- */
.social {
  position: relative; padding: 96px 20px 64px; text-align: center; background: var(--white);
}
.social .section-tag { position: static; display: block; margin-bottom: 10px; }
.social-sub { color: var(--ink-soft); margin-bottom: 40px; font-size: 15px; }
.social-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; max-width: 520px; margin: 0 auto;
}
.social-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 24px 12px; border-radius: var(--radius-md);
  background: var(--pink-50); border: 1px solid var(--pink-100);
  transition: transform .2s ease, box-shadow .2s ease;
}
.social-card:active { transform: scale(0.97); }
.social-card svg { width: 28px; height: 28px; color: var(--pink-600); }
.social-card-name { font-weight: 600; font-size: 14px; }
.social-card-count { font-size: 12px; color: var(--ink-soft); }

/* ---------- Contact ---------- */
.contact {
  position: relative; padding: 100px 24px 56px; text-align: center;
  background: linear-gradient(160deg, var(--pink-600), var(--pink-700));
  color: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.contact .section-tag { position: static; display: block; margin-bottom: 14px; }
.contact-title { font-size: clamp(24px, 6vw, 34px); font-weight: 600; margin-bottom: 10px; }
.contact-sub { opacity: .9; margin-bottom: 32px; font-size: 15px; }
.contact-actions {
  display: flex; flex-direction: column; gap: 12px; max-width: 320px; margin: 0 auto;
}
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 16px 20px; border-radius: 999px; font-size: 15px; font-weight: 600;
  transition: transform .2s ease, box-shadow .2s ease;
}
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--white); color: var(--pink-700); box-shadow: var(--shadow); }
.btn--outline { background: transparent; color: var(--white); border: 1.5px solid rgba(255,255,255,.6); }
.social-mini {
  display: flex; gap: 18px; justify-content: center; margin-top: 40px; opacity: .9;
}
.social-mini a svg { width: 22px; height: 22px; }
.contact-footer { margin-top: 48px; font-size: 12px; opacity: .6; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; background: rgba(20,15,20,.92); z-index: 200;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: opacity .25s ease;
  padding: 24px;
}
.lightbox.is-open { opacity: 1; visibility: visible; }
.lightbox img { max-height: 90vh; border-radius: var(--radius-sm); }
.lightbox-close {
  position: absolute; top: 20px; right: 20px; width: 42px; height: 42px;
  border-radius: 50%; border: none; background: rgba(255,255,255,.12); color: var(--white);
  font-size: 24px; line-height: 1; cursor: pointer;
}

/* ---------- Responsive: tablet / desktop ---------- */
@media (min-width: 720px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
  .social-grid { grid-template-columns: repeat(4, 1fr); }
  .contact-actions { flex-direction: row; }
}

@media (min-width: 1024px) {
  .gallery, .timeline, .social { padding-left: 64px; padding-right: 64px; }
  .gallery-grid { grid-template-columns: repeat(4, 1fr); max-width: 1100px; margin-inline: auto; }
  .timeline-list { margin-inline: auto; }
  .story-caption { padding-left: 96px; max-width: 780px; }
  .story-caption-inner { max-width: 620px; }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-media img, .story-media img, .story-caption-inner, .gallery-item, .timeline-item {
    transition: none !important; animation: none !important;
  }
}
