/* ════ DESIGNTERIOR — V3: โครง/การจัดหน้า = mockup Antigravity · ผิว (สี/ฟอนต์/mood&tone) = design-8 เดิม ════
   PALETTE : Smoky Black #0E0E0E · Warm Panel #1a1613 · White Sand #D9D5D1 · Warm Cream #F5F3F0 · Cola #372f27 · LINE #06C755
   FONT    : Playfair Display (หัวข้ออังกฤษ) · Outfit (label อังกฤษ) · Anuphan (ไทย)
   ═══════════════════════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Anuphan:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,600;0,700;0,800;1,400&display=swap');

:root {
  /* ชื่อตัวแปรตาม mockup — "ค่า" เป็น mood&tone ของเรา (ห้ามเปลี่ยนค่าโดยไม่เคาะกับเจ้าของงาน) */
  --bg-primary: #0E0E0E;        /* Smoky Black */
  --bg-secondary: #161310;      /* ดำอมน้ำตาลอุ่น */
  --bg-panel: #1a1613;          /* Warm Panel เดิม */
  --fg-primary: #D9D5D1;        /* White Sand */
  --fg-muted: #8f877b;          /* เทาอุ่นเดิม */
  --brand-cola: #372f27;        /* น้ำตาลไม้ */
  --brand-line: #06C755;        /* LINE */
  --cream: #F5F3F0; --ink: #17120e; /* แถบบริการครีม (V2) */
  --border-color: rgba(217, 213, 209, 0.16);

  --font-display: 'Playfair Display', 'Anuphan', Georgia, serif;
  --font-sans: 'Outfit', 'Anuphan', system-ui, sans-serif;
  --font-thai: 'Anuphan', sans-serif;

  --pad-section: clamp(4.5rem, 9vw, 9rem);
  --wrap-width: min(1320px, 90vw);
  --r: 4px;

  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.4s var(--ease-smooth);
}

/* ═══ RESET & BASE ═══ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  background-color: var(--bg-primary);
  color: var(--fg-primary);
  font-family: var(--font-thai);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video { max-width: 100%; display: block; object-fit: cover; }
a { color: inherit; text-decoration: none; transition: color var(--transition-normal); }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
ul, ol { list-style: none; }

/* ═══ TYPOGRAPHY (สเกล V2) ═══ */
h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; letter-spacing: 0; }
.en { font-family: var(--font-sans); }
h1 { font-size: clamp(2.2rem, 6vw, 4.6rem); }
h2 { font-size: clamp(2rem, 4.6vw, 3.4rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
.text-muted { color: var(--fg-muted); }
.text-cola { color: var(--brand-cola); }
.text-sand { color: var(--fg-primary); }

/* ═══ LAYOUT ═══ */
.wrap { width: var(--wrap-width); margin-inline: auto; }
.section { padding: var(--pad-section) 0; }
.border-top { border-top: 1px solid var(--border-color); }
.border-bottom { border-bottom: 1px solid var(--border-color); }

.reveal { opacity: 0; transform: translateY(34px); transition: 0.9s var(--ease-smooth); }
.reveal.in { opacity: 1; transform: none; }

/* ═══ BUTTONS (สไตล์ V2: pill ไม่มี uppercase) ═══ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55em;
  font-family: var(--font-sans); font-weight: 600; font-size: 0.82rem; letter-spacing: 0.02em;
  padding: 0.95em 1.8em; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--fg-primary);
  background: var(--fg-primary); color: var(--bg-primary);
  transition: all var(--transition-normal);
}
.btn:hover { background: transparent; color: var(--fg-primary); }
.btn-outline { background: transparent; color: var(--fg-primary); }
.btn-outline:hover { background: var(--fg-primary); color: var(--bg-primary); }
.btn-line { background: var(--brand-line); border-color: var(--brand-line); color: #fff; }
.btn-line:hover { background: var(--brand-line); color: #fff; filter: brightness(1.1); }

/* ═══ SECTION HEAD ═══ */
.shead {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; flex-wrap: wrap;
  border-top: 1px solid var(--border-color); padding-top: 1.5rem; margin-bottom: 3rem;
}
.shead .shead-left { max-width: 640px; }
.shead .idx {
  font-family: var(--font-sans); font-weight: 500; font-size: 0.72rem;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--fg-muted);
  display: block; margin-bottom: 1rem;
}
.shead h1, .shead h2 { font-family: var(--font-display); font-weight: 700; font-size: clamp(2rem, 4.6vw, 3.4rem); margin-bottom: 0.5rem; }
.shead .th { font-family: var(--font-thai); color: var(--fg-muted); font-size: 0.95rem; }

/* ═══ HEADER & NAV (โครง mockup: bar เดียวกันทุกหน้า) ═══ */
header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  background: rgba(14, 14, 14, 0.85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}
header .bar { display: flex; align-items: center; justify-content: space-between; padding: 1.2rem 0; }

.logo {
  font-family: var(--font-display); font-weight: 800; font-size: 1.1rem;
  color: var(--fg-primary); letter-spacing: 0.01em; line-height: 1;
  display: flex; flex-direction: column;
}
.logo small {
  font-family: var(--font-sans); font-weight: 500; font-size: 0.52rem;
  letter-spacing: 0.34em; color: var(--fg-muted); margin-top: 0.25rem;
}

header nav { display: flex; align-items: center; gap: 2rem; }
header nav a {
  font-family: var(--font-sans); font-weight: 500; font-size: 0.82rem;
  letter-spacing: 0.02em; color: var(--fg-primary); opacity: 0.8; transition: 0.3s;
}
header nav a:hover { opacity: 1; }
header nav a.active { opacity: 1; text-decoration: underline; text-underline-offset: 7px; text-decoration-thickness: 1px; }
header nav a.btn-line { opacity: 1; text-decoration: none; color: #fff; }

#menu-toggle { display: none; } /* checkbox เมนูมือถือ — ซ่อนทุกขนาดจอ */
.menu-btn { display: none; width: 28px; flex-direction: column; gap: 6px; z-index: 999; cursor: pointer; }
.menu-btn span { display: block; width: 100%; height: 2px; background: var(--fg-primary); transition: 0.35s var(--ease-smooth); }

@media (max-width: 900px) {
  .menu-btn { display: flex; }
  header nav {
    /* กำหนด height ตรงๆ (ห้ามใช้ bottom:0) — header มี backdrop-filter ทำให้ fixed ยึดกับกล่อง header ไม่ใช่จอ */
    position: fixed; top: 0; right: 0;
    height: 100vh; height: 100svh;
    width: 78vw;
    background: #0e0e0e;
    flex-direction: column; justify-content: center; gap: 2.2rem;
    transform: translateX(100%); visibility: hidden;
    transition: transform 0.5s var(--ease-smooth), visibility 0.5s;
    border-left: 1px solid var(--border-color);
  }
  #menu-toggle:checked ~ nav { transform: translateX(0); visibility: visible; }
  #menu-toggle:checked ~ .menu-btn span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  #menu-toggle:checked ~ .menu-btn span:nth-child(2) { opacity: 0; }
  #menu-toggle:checked ~ .menu-btn span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
  header nav a { font-size: 1.05rem; }
}

/* ═══ FOOTER ═══ */
footer { padding: 3.4rem 0 2rem; border-top: 1px solid var(--border-color); background: var(--bg-primary); }
footer .top { display: grid; grid-template-columns: 1.6fr 1fr 1.2fr; gap: 2.5rem; margin-bottom: 2.6rem; }
footer .logo { margin-bottom: 1rem; font-size: 1.3rem; }
footer p { color: #cbc6bf; max-width: 26rem; font-size: 0.95rem; font-family: var(--font-thai); }
footer h5 {
  font-family: var(--font-sans); font-weight: 500; font-size: 0.7rem;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--fg-muted); margin-bottom: 1rem;
}
footer ul { display: flex; flex-direction: column; gap: 0.55rem; }
footer ul a { color: #cbc6bf; font-size: 0.9rem; font-family: var(--font-thai); }
footer ul a:hover { color: #fff; }
footer .btm {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem;
  padding-top: 1.6rem; border-top: 1px solid var(--border-color);
  color: var(--fg-muted); font-size: 0.76rem; font-family: var(--font-sans);
}
@media (max-width: 768px) {
  footer .top { grid-template-columns: 1fr; gap: 2rem; }
  footer .btm { flex-direction: column; text-align: center; }
}

/* ═══ PROMO BANNER (V2: แถบเขียวล่างจอ — portfolio.js เติมเนื้อหา) ═══ */
#promo {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 800;
  background: var(--brand-line); color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap;
  padding: 0.7em 2.6em 0.7em 1.2em;
  font-family: var(--font-thai); font-size: 0.9rem;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3);
}
#promo .promo-go { color: #fff; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; white-space: nowrap; }
#promo .promo-x { position: absolute; right: 0.9rem; color: #fff; font-size: 1.1rem; line-height: 1; opacity: 0.85; }

/* ═══ LIGHTBOX ═══ */
#lb {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(8, 6, 5, 0.96);
  display: none; align-items: center; justify-content: center;
}
#lb.on { display: flex; } /* JS (portfolio.js) ใช้ class "on" */
#lbi { max-width: 92vw; max-height: 88vh; width: auto; height: auto; object-fit: contain; }
#lbx { position: absolute; top: 1.2rem; right: 1.5rem; color: var(--fg-primary); font-size: 2rem; cursor: pointer; }
#lbp, #lbn { position: absolute; top: 50%; transform: translateY(-50%); color: var(--fg-primary); font-size: 2rem; cursor: pointer; padding: 1rem; }
#lbp { left: 0.6rem; } #lbn { right: 0.6rem; }
@media (max-width: 640px) { #lbp, #lbn { display: none; } }

/* ═══ FILTER PILLS (V2) ═══ */
.pill {
  padding: 0.5em 1.2em;
  font-family: var(--font-thai); font-size: 0.88rem;
  border-radius: 999px; border: 1px solid var(--border-color);
  background: none; color: var(--fg-muted);
  transition: 0.25s;
}
.pill:hover { color: var(--fg-primary); }
.pill.active { background: var(--fg-primary); color: var(--bg-primary); border-color: var(--fg-primary); }

main { padding-top: 76px; }

/* ═══ HERO (โครง mockup + ผิว V2) ═══ */
.hero {
  position: relative; height: 100svh; min-height: 600px;
  display: flex; align-items: flex-end; overflow: hidden;
}
.hero-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(14,14,14,.5), rgba(14,14,14,.15) 38%, rgba(14,14,14,.92));
}
.hero-bg .hs { position: absolute; inset: 0; opacity: 0; animation: heroFade 24s linear infinite; }
.hero-bg .hs img { width: 100%; height: 100%; filter: brightness(.7) saturate(1.03) contrast(1.03); will-change: transform; animation: heroZoom 24s ease-in-out infinite; }
.hero-bg .hs:nth-child(2), .hero-bg .hs:nth-child(2) img { animation-delay: 8s; }
.hero-bg .hs:nth-child(3), .hero-bg .hs:nth-child(3) img { animation-delay: 16s; }
@keyframes heroFade { 0%, 36% { opacity: 0; } 3%, 30% { opacity: 1; } }
@keyframes heroZoom { 0% { transform: scale(1.05); } 36%, 100% { transform: scale(1.17); } }

.hero-content { position: relative; z-index: 2; padding-bottom: clamp(2.5rem, 6vw, 5rem); }
.hero .kick {
  font-family: var(--font-sans); font-weight: 500; font-size: 0.72rem;
  letter-spacing: 0.28em; text-transform: uppercase; color: var(--fg-primary); opacity: 0.85;
  margin-bottom: 1.3rem; display: flex; gap: 1rem; align-items: center;
}
.hero .kick::before { content: ""; width: 46px; height: 1px; background: var(--fg-primary); opacity: 0.6; }
.hero h1 { font-family: var(--font-thai); font-weight: 600; font-size: clamp(2.2rem, 6vw, 4.6rem); line-height: 1.12; }
.hero h1 em { font-style: normal; font-weight: 700; color: #fff; }
.hero .subline { font-family: var(--font-thai); font-size: 1rem; color: #cbc6bf; margin: 1.5rem 0 2.2rem; max-width: 30rem; }
.hero .cta-group { display: flex; gap: 0.8rem; flex-wrap: wrap; }

/* ═══ STATEMENT ═══ */
.st-grid { display: grid; grid-template-columns: 1fr 1.05fr; gap: clamp(2rem, 5vw, 5rem); align-items: center; }
@media (max-width: 768px) { .st-grid { grid-template-columns: 1fr; gap: 1.8rem; } }
.statement .big { font-family: var(--font-thai); font-weight: 600; font-size: clamp(1.9rem, 3.8vw, 3rem); line-height: 1.3; }
.statement .sub { font-family: var(--font-thai); color: var(--fg-muted); font-size: 1rem; max-width: 34rem; }
.st-img { position: relative; border-radius: var(--r); overflow: hidden; background: var(--bg-panel); aspect-ratio: 4/5; }
.st-img img { width: 100%; height: 100%; transition: transform 1.2s var(--ease-smooth); filter: saturate(1.04); }
.st-img:hover img { transform: scale(1.05); }
@media (max-width: 768px) { .st-img { aspect-ratio: 16/11; } }

/* ═══ CATEGORY / PROJECT CARDS (โครง mockup + ผิว V2) ═══ */
.cat-card {
  display: block; position: relative; border-radius: var(--r); overflow: hidden;
  aspect-ratio: 4/5; background: var(--bg-panel);
}
.cat-img { position: absolute; inset: 0; }
.cat-img img { width: 100%; height: 100%; transition: transform 1.1s var(--ease-smooth), filter 0.6s; filter: brightness(0.74) saturate(1.04); }
.cat-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 32%, rgba(8, 6, 5, 0.9)); }
.cat-card:hover .cat-img img { transform: scale(1.07); filter: brightness(0.88); }
.cat-info { position: absolute; bottom: 0; left: 0; right: 0; padding: clamp(1.3rem, 2vw, 1.8rem); z-index: 2; color: var(--fg-primary); }
.cat-info h3 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.5rem, 2.4vw, 2.1rem); line-height: 1.05; margin-bottom: 0.45rem; }
.cat-info p { font-family: var(--font-thai); color: #dcd9d2; font-size: 0.88rem; }

/* ═══ SERVICES (แถบครีม V2 — เอกลักษณ์ mood&tone) ═══ */
.services { background: var(--cream); color: var(--ink); }
.services .shead { border-color: rgba(20, 15, 10, 0.16); }
.services .shead .idx, .services .shead .th { color: #6b6258; }
.slead { font-family: var(--font-thai); max-width: 40rem; color: #5c5349; margin: -1.5rem 0 2.5rem; font-size: 1rem; }
.scols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: rgba(20, 15, 10, 0.14); border: 1px solid rgba(20, 15, 10, 0.14); }
.scell {
  background: var(--cream); padding: clamp(1.6rem, 2.6vw, 2.4rem); min-height: 13rem;
  display: flex; flex-direction: column; justify-content: space-between;
  transition: background 0.4s var(--ease-smooth);
}
.scell:hover { background: #ebe7e2; }
.scell .n { font-family: var(--font-sans); font-weight: 500; font-size: 0.74rem; letter-spacing: 0.14em; color: #8a7f70; }
.scell h4 { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.4rem, 2.1vw, 1.8rem); margin-top: auto; }
.scell p { font-family: var(--font-thai); color: #5c5349; font-size: 0.9rem; margin-top: 0.5rem; }
@media (max-width: 900px) { .scols { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .scols { grid-template-columns: 1fr; } }

/* ═══ PHILOSOPHY (V2 .pgrid/.pcard) ═══ */
.pgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.pcard { border-top: 1px solid var(--border-color); padding-top: 1.4rem; }
.pcard .pn { font-family: var(--font-sans); font-weight: 500; font-size: 0.72rem; letter-spacing: 0.16em; color: var(--fg-muted); }
.pcard h4 { font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; margin: 0.7rem 0 0.5rem; }
.pcard p { font-family: var(--font-thai); color: var(--fg-muted); font-size: 0.9rem; }
@media (max-width: 980px) { .pgrid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .pgrid { grid-template-columns: 1fr; } }

/* ═══ FACTORY ═══ */
.factory .lead { font-family: var(--font-thai); font-weight: 600; font-size: clamp(1.7rem, 3.4vw, 2.6rem); line-height: 1.32; }
.factory .copy p { font-family: var(--font-thai); color: #cbc6bf; }
.factory .stats { display: flex; gap: 2.4rem; flex-wrap: wrap; border-top: 1px solid var(--border-color); padding-top: 1.4rem; }
.factory .stats .n { font-family: var(--font-display); font-weight: 800; font-size: 2.6rem; line-height: 1; }
.factory .stats small { font-family: var(--font-thai); color: var(--fg-muted); font-size: 0.8rem; }
.fwrap { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 4vw, 4rem); align-items: center; }
@media (max-width: 768px) { .fwrap { grid-template-columns: 1fr; } }

/* ═══ PROCESS (V2 .psteps/.pstep) ═══ */
.psteps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.4rem; }
.pstep { border-top: 1px solid var(--border-color); padding-top: 1.3rem; }
.pstep .n { font-family: var(--font-display); font-weight: 800; color: var(--fg-muted); font-size: 1.4rem; }
.pstep h4 { font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; margin: 0.7rem 0 0.4rem; }
.pstep p { font-family: var(--font-thai); color: var(--fg-muted); font-size: 0.9rem; }
@media (max-width: 900px) { .psteps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .psteps { grid-template-columns: 1fr; } }

/* ═══ FAQ (V2) ═══ */
.qlist { max-width: 800px; margin: 0 auto; }
.qa { border-top: 1px solid var(--border-color); }
.qa:last-child { border-bottom: 1px solid var(--border-color); }
.qa q {
  display: flex; justify-content: space-between; gap: 1.5rem; align-items: center;
  cursor: pointer; padding: 1.4rem 0; quotes: none;
  font-family: var(--font-thai); font-weight: 500; font-size: 1.05rem; color: var(--fg-primary);
  transition: color 0.3s;
}
.qa q::after { content: "+"; font-family: var(--font-sans); font-weight: 300; font-size: 1.6rem; color: var(--fg-muted); transition: 0.3s var(--ease-smooth); flex: 0 0 auto; }
.qa.open q::after { transform: rotate(45deg); color: var(--fg-primary); }
.qa .a { max-height: 0; overflow: hidden; transition: max-height 0.45s var(--ease-smooth); }
.qa .a p { font-family: var(--font-thai); color: var(--fg-muted); padding: 0 0 1.4rem; max-width: 54rem; font-size: 0.95rem; }

/* ═══ CONTACT — การ์ดสาขา (V2) ═══ */
.branches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 3.5rem; }
.br {
  border: 1px solid var(--border-color); border-radius: var(--r); padding: 1.6rem 1.4rem;
  display: flex; flex-direction: column; gap: 0.5rem; transition: 0.35s var(--ease-smooth);
}
.br:hover { background: rgba(217, 213, 209, 0.04); border-color: rgba(217, 213, 209, 0.3); }
.br .bt { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; }
.br .badge { font-family: var(--font-sans); font-weight: 500; font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--brand-line); margin-bottom: 0.2rem; }
.br address { font-family: var(--font-thai); font-style: normal; color: var(--fg-muted); font-size: 0.86rem; line-height: 1.55; flex: 1; }
.br .ph { font-family: var(--font-sans); font-weight: 600; font-size: 1rem; color: var(--fg-primary); margin-top: 0.4rem; display: inline-flex; align-items: center; gap: 0.5em; }
.br a.map, .br span.map { font-family: var(--font-thai); font-size: 0.82rem; color: var(--fg-muted); display: inline-flex; align-items: center; gap: 0.4em; }
.br a.map:hover { color: var(--fg-primary); }
@media (max-width: 980px) { .branches { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .branches { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .hero-bg .hs:first-child { opacity: 1; }
}

/* ═══ ไอคอนเส้น (แบบ V2) + ลิงก์ footer มีไอคอน ═══ */
.ico { width: 1.05em; height: 1.05em; flex: none; display: inline-block; vertical-align: -0.16em; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
footer ul a { display: inline-flex; align-items: center; gap: 0.6em; }
