:root {
  --bg: #f7f5f2;
  --bg2: #efecea;
  --ink: #1a1814;
  --ink2: #5a5650;
  --ink3: #9a9690;
  --accent: #c8502a;
  --accent-light: #fdf1ed;
  --border: #e0ddd8;
  --card-bg: #ffffff;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Noise texture overlay ── */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 0;
}

/* ── Nav ── */
nav {
  position: fixed; top: 0; left: 0; right: 0;
  padding: 20px 40px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(247,245,242,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  animation: fadeDown 0.6s ease both;
}
.nav-logo {
  font-family: 'DM Serif Display', serif;
  font-size: 1.3rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.3px;
}
.nav-links { display: flex; gap: 28px; }
.nav-links a {
  font-size: 0.85rem; font-weight: 400;
  color: var(--ink2); text-decoration: none;
  letter-spacing: 0.3px;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--accent); }

/* ── Hero ── */
.hero {
  min-height: 100vh;
  display: flex; flex-direction: column;
  justify-content: center;
  padding: 120px 40px 80px;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
}
.hero-eyebrow {
  font-size: 0.75rem; font-weight: 500;
  letter-spacing: 3px; text-transform: uppercase;
  color: var(--accent); margin-bottom: 20px;
  animation: fadeUp 0.7s 0.1s ease both;
}
.hero h1 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 1.05;
  letter-spacing: -2px;
  color: var(--ink);
  animation: fadeUp 0.7s 0.2s ease both;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
}
.hero-desc {
  margin-top: 28px;
  font-size: 1.1rem;
  color: var(--ink2);
  max-width: 500px;
  line-height: 1.7;
  animation: fadeUp 0.7s 0.35s ease both;
}
.hero-tags {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 24px;
  animation: fadeUp 0.7s 0.45s ease both;
}
.tag {
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.78rem; font-weight: 400;
  color: var(--ink3);
  background: var(--card-bg);
}
.hero-scroll {
  margin-top: 60px;
  display: flex; align-items: center; gap: 10px;
  color: var(--ink3); font-size: 0.8rem;
  animation: fadeUp 0.7s 0.55s ease both;
}
.scroll-line {
  width: 40px; height: 1px; background: var(--border);
  animation: grow 1.2s 1s ease both;
  transform-origin: left;
}

/* ── Section ── */
section {
  max-width: 900px; margin: 0 auto;
  padding: 80px 40px;
}
.section-label {
  font-size: 0.72rem; font-weight: 500;
  letter-spacing: 3px; text-transform: uppercase;
  color: var(--ink3); margin-bottom: 40px;
  display: flex; align-items: center; gap: 16px;
}
.section-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── Project cards ── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.project-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  text-decoration: none;
  color: inherit;
  display: flex; flex-direction: column; gap: 16px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative; overflow: hidden;
}
.project-card::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--accent-light);
  opacity: 0; transition: opacity 0.25s ease;
  pointer-events: none;
}
.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.08);
  border-color: var(--accent);
}
.project-card:hover::before { opacity: 1; }

.project-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--bg2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  transition: background 0.2s;
}
.project-card:hover .project-icon { background: var(--accent-light); }

.project-name {
  font-family: 'DM Serif Display', serif;
  font-size: 1.3rem; letter-spacing: -0.3px;
  color: var(--ink);
}
.project-desc {
  font-size: 0.85rem; color: var(--ink2);
  line-height: 1.6; flex: 1;
}
.project-stack {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.stack-tag {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.72rem; font-weight: 500;
  background: var(--bg2);
  color: var(--ink3);
}
.project-arrow {
  position: absolute; top: 26px; right: 26px;
  font-size: 1rem; color: var(--border);
  transition: color 0.2s, transform 0.2s;
}
.project-card:hover .project-arrow { color: var(--accent); transform: translate(2px,-2px); }

/* ── Activities ── */
.activities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.activity-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.activity-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.08);
  border-color: var(--accent);
}

/* Carousel */
.activity-carousel {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg2);
}
.carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.35s ease;
}
.carousel-track img {
  min-width: 100%; height: 100%;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}
.carousel-track img[src=""],
.carousel-track img:not([src]) {
  background: var(--bg2);
}

/* placeholder เมื่อรูปโหลดไม่ได้ */
.carousel-track img.broken {
  min-width: 100%; height: 100%;
  background: var(--bg2);
  display: flex; align-items: center; justify-content: center;
}

/* ปุ่ม prev/next */
.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.85);
  border: none; border-radius: 50%;
  width: 32px; height: 32px;
  font-size: 1.2rem; line-height: 1;
  cursor: pointer; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, opacity 0.2s;
  opacity: 0;
  z-index: 2;
}
.carousel-btn.prev { left: 10px; }
.carousel-btn.next { right: 10px; }
.activity-carousel:hover .carousel-btn { opacity: 1; }
.carousel-btn:hover { background: #fff; }
.carousel-btn:disabled { opacity: 0.2 !important; cursor: default; }

/* dots */
.carousel-dots {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 5px; z-index: 2;
}
.carousel-dots .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.5);
  transition: background 0.2s, transform 0.2s;
  cursor: pointer;
}
.carousel-dots .dot.active {
  background: #fff;
  transform: scale(1.3);
}

/* caption */
.activity-caption {
  padding: 14px 18px;
  display: flex; flex-direction: column; gap: 6px;
}
.activity-title-row {
  display: flex; justify-content: space-between; align-items: center;
}
.activity-title {
  font-size: 0.88rem; font-weight: 500;
  color: var(--ink);
}
.activity-date {
  font-size: 0.75rem;
  color: var(--ink3);
}
.activity-desc {
  font-size: 0.8rem;
  color: var(--ink2);
  line-height: 1.5;
}

/* ── About ── */
.about-photo-wrap {
  width: 180px; height: 180px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--border);
  margin-bottom: 20px;
  flex-shrink: 0;
}
.about-photo {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px; align-items: start;
}
.about-text h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 2rem; letter-spacing: -0.5px;
  line-height: 1.2; margin-bottom: 16px;
}
.about-text p { color: var(--ink2); font-size: 0.95rem; line-height: 1.8; margin-bottom: 12px; }
.about-stats { display: flex; flex-direction: column; gap: 16px; }
.stat-item {
  padding: 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.stat-num {
  font-family: 'DM Serif Display', serif;
  font-size: 2rem; color: var(--accent);
}
.stat-label { font-size: 0.82rem; color: var(--ink3); margin-top: 4px; }

/* ── Contact ── */
.contact-box {
  background: var(--ink);
  border-radius: 20px;
  padding: 60px 48px;
  text-align: center;
}
.contact-box h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 2.4rem; color: #fff;
  letter-spacing: -0.5px; margin-bottom: 12px;
}
.contact-box p { color: #9a9690; font-size: 0.95rem; margin-bottom: 32px; }
.contact-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent);
  color: #fff; text-decoration: none;
  padding: 14px 32px; border-radius: 100px;
  font-size: 0.9rem; font-weight: 500;
  transition: background 0.2s, transform 0.2s;
}
.contact-btn:hover { background: #b84020; transform: translateY(-2px); }

/* ── Footer ── */
footer {
  text-align: center; padding: 32px 40px;
  font-size: 0.78rem; color: var(--ink3);
  border-top: 1px solid var(--border);
}

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes grow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* scroll reveal */
.reveal {
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible { opacity: 1; transform: none; }

/* ── Responsive ── */
@media (max-width: 640px) {
  nav { padding: 16px 20px; }
  .nav-links { display: none; }
  .hero { padding: 100px 20px 60px; }
  section { padding: 60px 20px; }
  .about-grid { grid-template-columns: 1fr; }
  .contact-box { padding: 40px 24px; }
}
