/* ==========================================================================
   ระบบเทคโนโลยีสารสนเทศ (e-office) สำนักการศึกษา เทศบาลนครตรัง
   Design tokens shared in spirit with the หน่วยศึกษานิเทศก์ site one
   level up, so the two feel like one continuous municipal web presence.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Taviraj:wght@400;500;600;700&family=Sarabun:wght@300;400;500;600;700&display=swap');

:root{
  --navy-950:#060f24;
  --navy-900:#0b1a33;
  --navy-800:#122344;
  --navy-700:#1a2f52;
  --navy-600:#24406b;

  --gold-400:#d4af37;
  --gold-300:#e8c766;
  --gold-glow:rgba(212,175,55,0.18);

  --ivory-50:#f5f2ea;
  --slate-300:#b8c2d6;
  --slate-500:#8b98b3;

  --line:rgba(212,175,55,0.25);
  --line-soft:rgba(184,194,214,0.14);

  --font-display:'Taviraj','Sarabun',serif;
  --font-body:'Sarabun','Taviraj',sans-serif;

  --header-h:84px;
  --header-h-mobile:64px;
  --container:1240px;

  --ease:cubic-bezier(.16,1,.3,1);
}

/* ==========================================================================
   Reset
   ========================================================================== */
*,*::before,*::after{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
html{ scroll-behavior:smooth; }
body{
  background:var(--navy-950);
  color:var(--slate-300);
  font-family:var(--font-body);
  font-weight:400;
  line-height:1.75;
  overflow-x:hidden;
  -webkit-font-smoothing:antialiased;
}
body.no-scroll{ overflow:hidden; }
img,svg,video{ display:block; max-width:100%; }
a{ color:inherit; text-decoration:none; }
ul{ margin:0; padding:0; list-style:none; }
button{ font:inherit; color:inherit; background:none; border:none; cursor:pointer; }
h1,h2,h3,h4{ margin:0; font-family:var(--font-display); font-weight:600; color:var(--ivory-50); }
p{ margin:0; }

:focus-visible{ outline:2px solid var(--gold-400); outline-offset:3px; border-radius:2px; }
::selection{ background:var(--gold-glow); color:var(--ivory-50); }

::-webkit-scrollbar{ width:10px; }
::-webkit-scrollbar-track{ background:var(--navy-950); }
::-webkit-scrollbar-thumb{ background:var(--navy-700); border-radius:6px; }

.container{
  width:100%;
  max-width:var(--container);
  margin:0 auto;
  padding:0 clamp(20px,4vw,48px);
}

/* Reveal base — GSAP takes over opacity/transform once it initializes */
[data-anim]{ opacity:0; will-change:transform,opacity; }

/* ==========================================================================
   Header — sticky, solid, always in normal flow, never over the video
   ========================================================================== */
.site-header{
  position:sticky; top:0; left:0; right:0;
  z-index:100;
  height:var(--header-h);
  display:flex; align-items:center;
  background:var(--navy-950);
  border-bottom:1px solid var(--line-soft);
  transition:box-shadow .3s var(--ease), height .3s var(--ease);
}
.site-header.is-scrolled{ box-shadow:0 12px 32px -12px rgba(0,0,0,0.6); }

.header-inner{
  width:100%; height:100%;
  padding:0 clamp(20px,4vw,48px);
  display:flex; align-items:center; gap:20px;
}

.brand{ display:flex; align-items:center; gap:12px; margin-right:auto; min-width:0; }
.brand-mark{ width:44px; height:44px; flex:none; }
.brand-mark img{ width:100%; height:100%; object-fit:contain; }
.brand-text{ display:flex; flex-direction:column; line-height:1.25; min-width:0; }
.brand-th{
  font-family:var(--font-display); font-weight:600; font-size:1.02rem;
  color:var(--ivory-50); white-space:nowrap;
}
.brand-en{
  font-size:0.68rem; letter-spacing:0.08em; text-transform:uppercase;
  color:var(--slate-500); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

.main-nav ul{ display:flex; align-items:center; gap:clamp(14px,2vw,30px); }
.main-nav a{
  position:relative;
  font-size:0.92rem; font-weight:500;
  color:var(--slate-300);
  padding:8px 2px;
  transition:color .25s var(--ease);
  white-space:nowrap;
}
.main-nav a::after{
  content:""; position:absolute; left:0; right:100%; bottom:0; height:2px;
  background:var(--gold-400);
  transition:right .28s var(--ease);
}
.main-nav a:hover{ color:var(--ivory-50); }
.main-nav a:hover::after{ right:0; }
.main-nav a.active{
  color:var(--gold-300);
  text-underline-offset:6px; text-decoration:underline; text-decoration-thickness:2px; text-decoration-color:var(--gold-400);
}
.main-nav a.active::after{ right:0; }

.header-actions{ display:flex; align-items:center; gap:12px; flex:none; }

.lang-toggle{
  display:flex; border:1px solid var(--line); border-radius:999px; overflow:hidden;
}
.lang-btn{
  padding:7px 14px; font-size:0.78rem; font-weight:600; letter-spacing:0.04em;
  color:var(--slate-300);
  transition:background .25s var(--ease), color .25s var(--ease);
}
.lang-btn.is-active{ background:var(--gold-400); color:var(--navy-950); }
.lang-btn:not(.is-active):hover{ color:var(--ivory-50); }

.nav-toggle{ display:none; width:40px; height:40px; position:relative; flex:none; }
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after{
  content:""; position:absolute; left:8px; right:8px; height:2px; background:var(--ivory-50);
  transition:transform .25s var(--ease), opacity .25s var(--ease), top .25s var(--ease);
}
.nav-toggle span{ top:19px; }
.nav-toggle span::before{ top:-8px; }
.nav-toggle span::after{ top:8px; }
.nav-toggle.is-open span{ background:transparent; }
.nav-toggle.is-open span::before{ top:0; transform:rotate(45deg); }
.nav-toggle.is-open span::after{ top:0; transform:rotate(-45deg); }

/* ==========================================================================
   Hero intro — all text lives here, never on the video
   ========================================================================== */
.hero-intro{
  background:var(--navy-950);
  padding:clamp(56px,9vw,96px) 0 0;
  text-align:center;
}
.hero-eyebrow{
  display:inline-flex; align-items:center; gap:12px;
  font-size:0.76rem; font-weight:600; letter-spacing:0.24em; text-transform:uppercase;
  color:var(--gold-400);
  margin-bottom:22px;
}
.hero-eyebrow::before,.hero-eyebrow::after{ content:""; width:28px; height:1px; background:var(--gold-400); }
.hero-title{
  font-size:clamp(1rem, 3.6vw, 2.5rem);
  line-height:1.18;
  white-space:nowrap;
  margin:0 auto;
}
.hero-title .accent{ color:var(--gold-300); }
.hero-lede{
  max-width:640px; margin:24px auto 0;
  font-size:1.06rem; color:var(--slate-300);
}
.hero-actions{
  display:flex; align-items:center; justify-content:center; gap:14px; flex-wrap:wrap;
  margin-top:34px;
}

.hero-outro{
  text-align:center;
  background:var(--navy-900);
  padding:0 0 clamp(56px,8vw,88px);
}

.btn{
  display:inline-flex; align-items:center; gap:10px;
  padding:14px 28px; border-radius:999px;
  font-family:var(--font-display); font-weight:600; font-size:0.94rem;
  border:1px solid transparent;
  transition:transform .3s var(--ease), box-shadow .3s var(--ease), background .3s var(--ease), border-color .3s var(--ease), color .3s var(--ease);
}
.btn-primary{
  background:linear-gradient(100deg, var(--gold-400), var(--gold-300));
  color:var(--navy-950);
  box-shadow:0 14px 34px -14px rgba(212,175,55,0.55);
}
.btn-primary:hover{ transform:translateY(-2px); box-shadow:0 18px 40px -12px rgba(212,175,55,0.7); }
.btn-ghost{
  border-color:var(--line);
  color:var(--ivory-50);
  background:rgba(255,255,255,0.02);
}
.btn-ghost:hover{ border-color:var(--gold-400); color:var(--gold-300); transform:translateY(-2px); }

/* ==========================================================================
   Hero video stage — full-bleed, textless, blends into surrounding sections
   ========================================================================== */
.hero-stage{
  position:relative;
  width:100%;
  height:100vh;
  height:100dvh;
  min-height:100vh;
  min-height:100dvh;
  background:var(--navy-950);
  overflow:hidden;
}
.hero-stage video{
  position:absolute; top:50%; left:50%;
  transform:translate(-50%,-50%);
  width:80%; height:80%;
  object-fit:cover; object-position:center;
  opacity:0;
  transition:opacity 1.1s ease;
}
.hero-stage video.is-active{ opacity:1; }

.stage-veil{ position:absolute; inset:0; pointer-events:none; z-index:2; }
.stage-veil-top{
  position:absolute; top:0; left:0; right:0; height:22%;
  background:linear-gradient(to bottom, var(--navy-950) 0%, rgba(6,15,36,0) 100%);
}
.stage-veil-bottom{
  position:absolute; bottom:0; left:0; right:0; height:32%;
  background:linear-gradient(to top, var(--navy-900) 0%, rgba(11,26,51,0) 100%);
}

.stage-dots{
  position:absolute; bottom:22px; left:50%; transform:translateX(-50%);
  z-index:3;
  display:flex; gap:8px;
}
.stage-dots i{
  width:6px; height:6px; border-radius:50%;
  background:rgba(245,242,234,0.35);
  transition:background .3s ease, transform .3s ease;
}
.stage-dots i.is-active{ background:var(--gold-300); transform:scale(1.4); }

/* ==========================================================================
   Section rhythm — gradient bands so scroll reads as one continuous surface
   ========================================================================== */
.section{ position:relative; padding:clamp(64px,9vw,128px) 0; }
.section--900{ background:linear-gradient(180deg, var(--navy-900) 0%, var(--navy-900) 100%); }
.section--900-800{ background:linear-gradient(180deg, var(--navy-900) 0%, var(--navy-800) 100%); }
.section--800{ background:var(--navy-800); }
.section--800-700{ background:linear-gradient(180deg, var(--navy-800) 0%, var(--navy-700) 100%); position:relative; overflow:hidden; }
.section--700-950{ background:linear-gradient(180deg, var(--navy-700) 0%, var(--navy-950) 100%); }

.section-label{
  display:inline-flex; align-items:center; gap:10px;
  font-size:0.74rem; font-weight:600; letter-spacing:0.2em; text-transform:uppercase;
  color:var(--gold-400);
  margin-bottom:16px;
}
.section-label::before{ content:""; width:26px; height:1px; background:var(--gold-400); }
.section-heading{ font-size:clamp(1.8rem,3.4vw,2.7rem); line-height:1.2; }
.section-body{ color:var(--slate-300); font-size:1.02rem; max-width:60ch; }

/* ==========================================================================
   About / intro strip — split layout
   ========================================================================== */
.about-grid{
  display:grid; grid-template-columns:1.05fr 0.95fr; gap:64px; align-items:center;
}
.about-copy .section-heading{ margin-bottom:18px; }
.about-badges{ display:flex; flex-direction:column; gap:16px; }
.about-badge{
  display:flex; align-items:center; gap:16px;
  padding:18px 22px; border-radius:16px;
  border:1px solid var(--line-soft);
  background:rgba(255,255,255,0.015);
  transition:border-color .3s ease, transform .3s ease, background .3s ease;
}
.about-badge:hover{ border-color:var(--line); transform:translateX(6px); background:rgba(255,255,255,0.03); }
.about-badge .icon{
  width:44px; height:44px; flex:none; border-radius:12px;
  display:flex; align-items:center; justify-content:center;
  background:var(--gold-glow); color:var(--gold-300);
}
.about-badge .icon svg{ width:22px; height:22px; }
.about-badge strong{ display:block; color:var(--ivory-50); font-family:var(--font-display); font-size:0.98rem; margin-bottom:2px; }
.about-badge span{ font-size:0.86rem; color:var(--slate-500); }

/* ==========================================================================
   Services grid — 3 layout patterns for variety across the page
   ========================================================================== */
.service-head{ max-width:640px; margin-bottom:52px; text-align:center; margin-left:auto; margin-right:auto; }
.services-grid{ display:grid; grid-template-columns:repeat(3, 1fr); gap:24px; }
.service-tile{
  position:relative;
  padding:32px 28px; border-radius:20px;
  border:1px solid var(--line-soft);
  background:linear-gradient(165deg, rgba(255,255,255,0.03), rgba(255,255,255,0.005));
  overflow:hidden;
  transition:transform .4s var(--ease), border-color .4s var(--ease), box-shadow .4s var(--ease);
}
.service-tile::before{
  content:""; position:absolute; inset:0;
  background:radial-gradient(320px 160px at 100% 0%, var(--gold-glow), transparent 60%);
  opacity:0; transition:opacity .4s ease;
}
.service-tile:hover{ transform:translateY(-8px); border-color:var(--line); box-shadow:0 24px 50px -24px rgba(0,0,0,0.7); }
.service-tile:hover::before{ opacity:1; }
.service-icon{
  width:52px; height:52px; border-radius:14px;
  display:flex; align-items:center; justify-content:center;
  background:var(--navy-700); border:1px solid var(--line-soft);
  color:var(--gold-300);
  margin-bottom:22px;
}
.service-icon svg{ width:26px; height:26px; }
.service-tile .en-title{
  display:block; font-family:var(--font-body);
  font-size:0.72rem; letter-spacing:0.08em; text-transform:uppercase;
  color:var(--slate-500); margin-bottom:8px;
}
.service-tile h3{ font-size:1.14rem; margin-bottom:10px; }
.service-tile p{ font-size:0.9rem; color:var(--slate-300); margin:0 0 20px; }
.service-link{
  display:inline-flex; align-items:center; gap:8px;
  font-family:var(--font-display); font-weight:600; font-size:0.86rem;
  color:var(--gold-300);
}
.service-link svg{ width:16px; height:16px; transition:transform .3s var(--ease); }
.service-tile:hover .service-link svg{ transform:translateX(5px); }

/* ==========================================================================
   Unit bridge — spotlight on หน่วยศึกษานิเทศก์, links to the sister site
   ========================================================================== */
.unit-bridge::before{
  content:""; position:absolute; inset:-20% -10%;
  background:
    conic-gradient(from 200deg at 25% 20%, var(--gold-glow), transparent 30%),
    conic-gradient(from 30deg at 85% 80%, rgba(184,194,214,0.10), transparent 35%);
  filter:blur(22px);
  pointer-events:none;
}
.bridge-grid{
  position:relative;
  display:grid; grid-template-columns:1fr 0.85fr; gap:64px; align-items:center;
}
.bridge-copy .section-label{ color:var(--gold-300); }
.bridge-copy .section-label::before{ background:var(--gold-300); }
.bridge-art{
  position:relative; aspect-ratio:1/1; max-width:400px; margin:0 auto;
}
.bridge-art svg{ width:100%; height:100%; }
.bridge-art circle.node{ filter:drop-shadow(0 0 6px rgba(212,175,55,0.5)); }
.bridge-art .pulse{ animation:bridge-pulse 2.6s ease-in-out infinite; }
@keyframes bridge-pulse{ 0%,100%{ opacity:.35; r:3; } 50%{ opacity:1; r:5; } }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer{ padding-top:96px; border-top:1px solid var(--line-soft); }
.footer-grid{ display:grid; grid-template-columns:1.3fr 1fr 1fr 1fr; gap:48px; padding-bottom:56px; }
.footer-brand .brand{ margin-bottom:18px; }
.footer-brand p{ font-size:0.9rem; max-width:320px; color:var(--slate-500); }
.footer-col h4{ font-size:0.8rem; letter-spacing:0.1em; text-transform:uppercase; color:var(--slate-500); margin-bottom:18px; }
.footer-col ul{ display:flex; flex-direction:column; gap:12px; }
.footer-col a{ font-size:0.92rem; color:var(--slate-300); transition:color .25s ease; }
.footer-col a:hover{ color:var(--gold-300); }
.footer-col .contact-line{ display:flex; gap:10px; align-items:flex-start; font-size:0.9rem; color:var(--slate-300); }
.footer-col .contact-line svg{ width:16px; height:16px; flex:none; margin-top:3px; color:var(--gold-400); }
.footer-bottom{
  border-top:1px solid var(--line-soft); padding:24px 0;
  display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px;
  font-size:0.82rem; color:var(--slate-500);
}
.footer-socials{ display:flex; gap:10px; }
.footer-socials a{
  width:36px; height:36px; border-radius:50%; border:1px solid var(--line-soft);
  display:flex; align-items:center; justify-content:center;
  transition:border-color .25s ease, color .25s ease, transform .25s ease;
}
.footer-socials a:hover{ border-color:var(--gold-400); color:var(--gold-300); transform:translateY(-3px); }
.footer-socials svg{ width:16px; height:16px; }

/* ==========================================================================
   Sub-pages — breadcrumb, status pill, contact cards
   ========================================================================== */
.page-hero{ padding:calc(var(--header-h) + 56px) 0 100px; min-height:60vh; }
.breadcrumb{ display:flex; align-items:center; gap:8px; font-size:0.86rem; color:var(--slate-500); margin-bottom:26px; }
.breadcrumb a{ color:var(--gold-300); }
.status-pill{
  display:inline-flex; align-items:center; gap:8px;
  padding:8px 16px; border-radius:999px;
  border:1px solid var(--gold-glow); background:var(--gold-glow); color:var(--gold-300);
  font-family:var(--font-display); font-weight:600; font-size:0.8rem;
  margin-bottom:24px;
}
.status-pill i{ width:7px; height:7px; border-radius:50%; background:var(--gold-300); }

.contact-grid{ display:grid; grid-template-columns:1fr 1fr; gap:20px; margin-top:40px; }
.contact-card{
  padding:26px; border-radius:18px; border:1px solid var(--line-soft);
  background:rgba(255,255,255,0.02);
  display:flex; gap:16px; align-items:flex-start;
}
.contact-card .icon{
  width:44px; height:44px; flex:none; border-radius:12px;
  background:var(--gold-glow); color:var(--gold-300);
  display:flex; align-items:center; justify-content:center;
}
.contact-card .icon svg{ width:22px; height:22px; }
.contact-card h4{ font-size:1rem; margin-bottom:6px; }
.contact-card p{ font-size:0.88rem; margin:0; color:var(--slate-300); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width:1080px){
  .services-grid{ grid-template-columns:repeat(2, 1fr); }
  .footer-grid{ grid-template-columns:1.2fr 1fr 1fr; }
  .footer-col.col-lang{ display:none; }
}

@media (max-width:900px){
  .about-grid{ grid-template-columns:1fr; gap:40px; }
  .bridge-grid{ grid-template-columns:1fr; gap:40px; }
  .bridge-grid .bridge-art{ order:-1; max-width:260px; }
}

@media (max-width:840px){
  .main-nav{
    position:fixed; top:var(--header-h-mobile); left:0; right:0; bottom:0;
    background:var(--navy-950);
    display:flex; align-items:flex-start; justify-content:flex-start;
    padding:32px;
    transform:translateX(100%);
    transition:transform .4s var(--ease);
    z-index:99;
  }
  .main-nav.is-open{ transform:translateX(0); }
  .main-nav ul{ flex-direction:column; width:100%; gap:4px; }
  .main-nav a{ display:block; padding:16px 6px; font-size:1.1rem; border-bottom:1px solid var(--line-soft); }
  .nav-toggle{ display:block; }
  .site-header{ height:var(--header-h-mobile); }
  .page-hero{ padding-top:calc(var(--header-h-mobile) + 40px); }
}

@media (max-width:768px){
  .section{ padding:76px 0; }
  .services-grid{ grid-template-columns:1fr; }
  .footer-grid{ grid-template-columns:1fr 1fr; gap:32px; }
  .contact-grid{ grid-template-columns:1fr; }
  .hero-stage{
    height:auto;
    min-height:0;
    aspect-ratio:var(--hero-video-ratio, 16/9);
  }
}

@media (max-width:520px){
  .container{ padding:0 20px; }
  .brand-en{ display:none; }
  .footer-grid{ grid-template-columns:1fr; }
  .hero-actions{ flex-direction:column; width:100%; }
  .hero-actions .btn{ width:100%; justify-content:center; }
  .hero-title{ white-space:normal; font-size:clamp(1.5rem, 7vw, 2rem); }
}

@media (prefers-reduced-motion:reduce){
  *{ animation-duration:0.001ms !important; animation-iteration-count:1 !important; transition-duration:0.001ms !important; scroll-behavior:auto !important; }
}
