/* ==========================================================================
   VRDevAI — Site layout
   Zero dependency. Mobile-first. Uses tokens from brand.css only.
   ========================================================================== */

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* Thai glyphs are taller than Latin — give them room to breathe. */
html[lang="th"] body { line-height: 1.85; }
html[lang="th"] h1, html[lang="th"] h2, html[lang="th"] h3 { line-height: 1.35; }
html[lang="th"] .eyebrow, html[lang="th"] .status { letter-spacing: 0.06em; }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: var(--fw-bold);
}
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); font-weight: var(--fw-semibold); letter-spacing: -0.01em; }
p  { margin: 0; }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--sp-3);
}

/* Sticky header would otherwise cover the heading an anchor jumps to. */
section { padding-block: var(--sp-6); scroll-margin-top: 84px; }
.section-alt { background: var(--bg-alt); }

.section-head { max-width: 44rem; margin-bottom: var(--sp-4); }
/* "View all …" sits under the section intro, right-aligned on wide screens. */
.section-head__action {
  display: inline-flex; align-items: center; gap: 0.45em;
  margin-top: var(--sp-2);
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  color: var(--tech-blue);
}
.section-head__action svg { transition: transform 0.22s var(--ease); }
.section-head__action:hover svg { transform: translateX(4px); }
@media (min-width: 820px) {
  .section-head:has(.section-head__action) {
    max-width: none;
    display: grid;
    grid-template-columns: minmax(0, 44rem) auto;
    align-items: end;
    column-gap: var(--sp-3);
  }
  .section-head:has(.section-head__action) > .eyebrow,
  .section-head:has(.section-head__action) > h2,
  .section-head:has(.section-head__action) > p { grid-column: 1; }
  .section-head__action { grid-column: 2; grid-row: 3; justify-self: end; margin-top: 0; }
}
.section-head p { color: var(--text-muted); margin-top: var(--sp-2); }
.section-head h2 { margin-top: var(--sp-1); }

/* --- Skip link (a11y) ---------------------------------------------------- */
.skip {
  position: absolute; left: -9999px;
  background: var(--deep-navy); color: var(--white);
  padding: var(--sp-1) var(--sp-2); border-radius: var(--r-sm); z-index: 200;
}
.skip:focus { left: var(--sp-2); top: var(--sp-2); }

/* --- Header -------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.site-header.is-stuck { border-bottom-color: var(--border); box-shadow: var(--shadow-sm); }

.nav {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 84px;
}
.nav__logo { display: flex; align-items: center; flex-shrink: 0; }

/* Logo lockup assembled in markup rather than shipped as one PNG: the supplied
   lockup files carry a baked-in border box, and text stays crisp at any zoom. */
.lockup { display: flex; align-items: center; gap: 0.7rem; }
.lockup img { height: 46px; width: auto; }   /* mark stands taller than the text, as in the identity lockup */
.lockup__rule {
  width: 1px; height: 38px;
  background: var(--border);
  flex-shrink: 0;
}
.lockup__text { display: flex; flex-direction: column; gap: 4px; }
.lockup__word {
  font-size: 1.5rem;
  font-weight: var(--fw-bold);
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text);
  white-space: nowrap;
}
/* "AI" carries the pixel fragments that break upward off the I */
.lockup__word .ai { position: relative; }
.lockup__pixels {
  position: absolute;
  right: -0.62em;
  top: -0.46em;
  width: 0.86em;
  height: 0.73em;
  overflow: visible;
}
/* Strapline under the wordmark, matching the identity-sheet lockup. */
.lockup__tag {
  font-size: 0.56rem;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--text-muted);
  white-space: nowrap;
}
/* Below ~420px the strapline no longer fits beside the nav controls. */
@media (max-width: 420px) { .lockup__tag { display: none; } }
.lockup__word .ai {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lockup--onDark .lockup__word { color: var(--white); }
.lockup--onDark .lockup__tag { color: rgba(255, 255, 255, 0.60); }
.lockup--onDark .lockup__rule { background: rgba(255, 255, 255, 0.24); }
.lockup--onDark .lockup__word .ai {
  background: linear-gradient(96deg, var(--cyber-cyan) 0%, var(--tech-blue) 45%, var(--signal-magenta) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.nav__links {
  display: none;
  margin-left: auto;
  gap: var(--sp-3);
  align-items: center;
}
.nav__links a {
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  padding-block: 4px;
  border-bottom: 2px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.nav__links a:hover { color: var(--text); }
.nav__links a[aria-current="page"] { color: var(--tech-blue); border-bottom-color: var(--tech-blue); }

/* On desktop .nav__links carries margin-left:auto, so everything after it
   sits flush right. Below 900px the links are hidden and .lang takes over. */
.nav__cta { margin-left: 0; }

/* Language switch */
.lang {
  display: inline-flex; align-items: center; gap: 0.4em;
  padding: 0.44em 0.85em;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--white);
  color: var(--text-muted);
  font-family: inherit;
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.lang:hover { color: var(--tech-blue); border-color: rgba(8, 124, 255, 0.42); }
.lang svg { width: 15px; height: 15px; }
.nav__links + .lang { margin-left: 0; }
.lang + .nav__cta { margin-left: 0; }

@media (max-width: 899px) {
  .lang { margin-left: auto; }
  .nav__cta { display: none; }   /* the drawer already ends in Contact */
}

.nav__toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--white); cursor: pointer; color: var(--text);
}
.nav__toggle svg { width: 20px; height: 20px; }

.nav__drawer {
  display: none;
  border-top: 1px solid var(--border);
  padding-block: var(--sp-2);
}
.nav__drawer.is-open { display: block; }
.nav__drawer a {
  display: block; padding: var(--sp-1) 0;
  font-weight: var(--fw-medium); color: var(--text-muted);
}

@media (min-width: 900px) {
  .nav__links { display: flex; }
  .nav__toggle { display: none; }
  .nav__drawer { display: none !important; }
}

/* --- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5em;
  padding: 0.72em 1.4em;
  border-radius: var(--r-pill);
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--grad-accent); color: var(--white); box-shadow: var(--shadow-glow); }
.btn--primary:hover { box-shadow: 0 16px 44px rgba(8, 124, 255, 0.36); }
.btn--ghost { background: var(--white); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-sm); }
.btn--ghost:hover { border-color: var(--tech-blue); color: var(--tech-blue); }
.btn--onDark { background: rgba(255,255,255,0.10); color: var(--white); border-color: rgba(255,255,255,0.22); }
.btn--onDark:hover { background: rgba(255,255,255,0.18); }

/* --- Hero ---------------------------------------------------------------- */
.hero {
  position: relative;
  padding-block: var(--sp-6) var(--sp-6);
  overflow: hidden;
}
.hero::before {
  /* soft brand aurora behind the mark */
  content: "";
  position: absolute; inset: -20% -10% auto auto;
  width: 60rem; height: 40rem;
  background:
    radial-gradient(closest-side, rgba(33, 217, 237, 0.16), transparent 70%),
    radial-gradient(closest-side, rgba(122, 53, 255, 0.14), transparent 70%);
  background-position: 20% 30%, 70% 60%;
  background-repeat: no-repeat;
  background-size: 60% 60%, 55% 55%;
  filter: blur(6px);
  pointer-events: none;
}
.hero__grid {
  position: relative;
  display: grid;
  gap: var(--sp-5);
  align-items: center;
}
.hero h1 {
  font-size: var(--fs-display);
  margin-block: var(--sp-2) var(--sp-3);
}
.hero__lede { color: var(--text-muted); max-width: 34rem; font-size: 1.05em; }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }

.hero__art { position: relative; display: grid; place-items: center; }
.hero__art img { width: min(100%, 30rem); filter: drop-shadow(0 24px 60px rgba(8, 124, 255, 0.30)); }

/* Floating capability chips around the mark, laid out as in the identity mockup:
   a label-less code tile at the top, then two pairs flanking the VR symbol. */
.chip {
  position: absolute;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--white);
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  padding: 0.7rem 0.8rem;
  box-shadow: var(--shadow-md);
  font-size: 0.6rem;
  font-weight: var(--fw-bold);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--tech-blue);
  white-space: nowrap;
}
.chip svg { width: 26px; height: 26px; color: var(--tech-blue); }

/* The code tile is icon-only and sits square, like the mockup. */
.chip--top {
  top: -4%; left: 50%; transform: translateX(-50%);
  padding: 0.8rem;
  border-radius: 14px;
}
.chip--tl { top: 14%;   left: -7%; }
.chip--tr { top: 20%;   right: -7%; }
.chip--bl { bottom: 26%; left: -5%; }
.chip--br { bottom: 14%; right: -7%; }

@media (max-width: 720px) { .chip { display: none; } }

.pipeline {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem;
  margin-top: var(--sp-3);
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.10em;
  color: var(--text-muted);
}
.pipeline span:nth-child(even) { opacity: 0.9; }

@media (min-width: 960px) {
  .hero__grid { grid-template-columns: 1.05fr 1fr; }
}

/* --- Step flow (Consult / Design / Build / Deploy) ------------------------ */
.steps { display: grid; gap: var(--sp-2); grid-template-columns: 1fr; }
@media (min-width: 700px)  { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .steps { grid-template-columns: repeat(4, 1fr); } }

.step {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s var(--ease);
}
.step:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: rgba(8,124,255,0.35); }
.step__num {
  font-size: var(--fs-eyebrow); font-weight: var(--fw-bold);
  letter-spacing: 0.12em; color: var(--tech-blue);
  margin-bottom: 6px;
}
.step h3 { margin-bottom: 6px; }
.step p { color: var(--text-muted); font-size: var(--fs-small); }

.icon-badge {
  width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--grad-accent);
  color: var(--white);
  margin-bottom: var(--sp-2);
  box-shadow: 0 6px 18px rgba(8,124,255,0.28);
}
.icon-badge svg { width: 22px; height: 22px; }

/* --- Service cards ------------------------------------------------------- */
.cards { display: grid; gap: var(--sp-2); grid-template-columns: 1fr; }
@media (min-width: 700px)  { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .cards { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: rgba(122,53,255,0.32); }
.card h3 { margin-bottom: 6px; }
.card p { color: var(--text-muted); font-size: var(--fs-small); }
.card__icon { color: var(--tech-blue); margin-bottom: var(--sp-2); }
.card__icon svg { width: 28px; height: 28px; }

/* --- Case studies -------------------------------------------------------- */
.work { display: grid; gap: var(--sp-3); grid-template-columns: 1fr; }
@media (min-width: 820px) { .work { grid-template-columns: repeat(3, 1fr); } }

.work__item {
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--grad-deep);
  color: var(--text-invert);
  padding: var(--sp-3);
  display: flex; flex-direction: column; gap: var(--sp-2);
  min-height: 17rem;
  position: relative;
  isolation: isolate;
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease);
}
.work__item:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.work__item::after {
  content: ""; position: absolute; inset: auto -30% -40% auto;
  width: 24rem; height: 24rem; z-index: -1;
  background: radial-gradient(closest-side, rgba(33,217,237,0.22), transparent 72%);
}
/* Drawn artwork band at the top of each case-study card. */
.work__art {
  width: 100%;
  height: auto;
  aspect-ratio: 200 / 90;
  margin: calc(var(--sp-3) * -1) calc(var(--sp-3) * -1) 0;
  width: calc(100% + var(--sp-3) * 2);
  padding: var(--sp-2) var(--sp-3);
  background: linear-gradient(160deg, rgba(33,217,237,.10), rgba(122,53,255,.14));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.tag {
  align-self: flex-start;
  font-size: 0.66rem; font-weight: var(--fw-bold);
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.34em 0.8em; border-radius: var(--r-pill);
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.20);
}
.work__item h3 { color: var(--white); }
.work__item p { color: rgba(255,255,255,0.76); font-size: var(--fs-small); }
.work__meta { margin-top: auto; font-size: var(--fs-small); font-weight: var(--fw-semibold); color: var(--cyber-cyan); }

/* --- Capability strip ---------------------------------------------------- */
.capstrip { display: grid; gap: var(--sp-2); grid-template-columns: repeat(2, 1fr); }
@media (min-width: 900px) { .capstrip { grid-template-columns: repeat(4, 1fr); } }
.cap {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: var(--sp-3); text-align: left;
}
.cap strong { display: block; font-size: 1.5rem; letter-spacing: -0.02em; }
.cap span { color: var(--text-muted); font-size: var(--fs-small); }

/* --- Tech list ----------------------------------------------------------- */
.tech {
  display: flex; flex-wrap: wrap; gap: 0.6rem;
}
.tech li {
  list-style: none;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-muted);
  border-radius: var(--r-pill);
  padding: 0.44em 1em;
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
}

/* --- CTA band ------------------------------------------------------------ */
.cta-band {
  background: var(--grad-deep);
  color: var(--text-invert);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-4);
  text-align: center;
  position: relative; overflow: hidden;
}
.cta-band h2 { color: var(--white); }
.cta-band p { color: rgba(255,255,255,0.74); margin: var(--sp-2) auto 0; max-width: 38rem; }
.cta-band .hero__actions { justify-content: center; }

/* --- Contact: form + direct channels ------------------------------------- */
.contact {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: 1fr;
  margin-top: var(--sp-4);
}
@media (min-width: 900px) { .contact { grid-template-columns: 1.35fr 1fr; align-items: start; } }

.form, .channels {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
}
.form h3, .channels h3 { margin-bottom: 6px; }
.form__lede { color: var(--text-muted); font-size: var(--fs-small); margin-bottom: var(--sp-3); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-2); }
.field-row { display: grid; gap: var(--sp-2); grid-template-columns: 1fr; }
@media (min-width: 560px) { .field-row { grid-template-columns: 1fr 1fr; } }

.field label {
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  color: var(--text);
}
.field input, .field textarea {
  font-family: inherit;
  font-size: var(--fs-body);
  color: var(--text);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0.7em 0.85em;
  width: 100%;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease);
}
.field textarea { resize: vertical; min-height: 7rem; }
.field input:focus, .field textarea:focus {
  outline: none;
  background: var(--white);
  border-color: var(--tech-blue);
  box-shadow: 0 0 0 3px rgba(8, 124, 255, 0.16);
}
/* Only flag a field once it has actually been marked invalid by the script. */
.field.is-invalid input, .field.is-invalid textarea {
  border-color: #D93A5B;
  box-shadow: 0 0 0 3px rgba(217, 58, 91, 0.14);
}
.field__error { font-size: 0.78rem; color: #D93A5B; }

.form__consent { font-size: 0.78rem; color: var(--text-muted); margin: var(--sp-2) 0 var(--sp-3); }
.form__submit { width: 100%; justify-content: center; }
.form__submit[disabled] { opacity: 0.65; cursor: progress; transform: none; }

.form__status { font-size: var(--fs-small); margin-top: var(--sp-2); min-height: 1.4em; }
.form__status.is-ok   { color: #128A5E; font-weight: var(--fw-semibold); }
.form__status.is-fail { color: #D93A5B; font-weight: var(--fw-semibold); }

.channel {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) 0;
  border-top: 1px solid var(--line-soft);
}
.channel:first-of-type { border-top: 0; }
.channel > span:last-child { display: flex; flex-direction: column; }
.channel strong { font-size: var(--fs-small); }
.channel span span, .channel > span > span { color: var(--text-muted); font-size: var(--fs-small); }
.channel__icon {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 11px;
  display: grid; place-items: center;
  background: var(--grad-accent);
  color: var(--white);
}
.channel__icon svg { width: 20px; height: 20px; }
.channel__icon--line { background: #06C755; }   /* LINE brand green */
a.channel:hover strong { color: var(--tech-blue); }

.qr { margin: var(--sp-2) 0 0; text-align: center; }
.qr img {
  /* A QR must stay perfectly square — lock the ratio rather than trusting the
     intrinsic size, and never let a flex/grid parent stretch it. */
  width: min(100%, 190px);
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  align-self: center;
  margin-inline: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px;
  background: var(--white);
}
.qr figcaption { font-size: 0.78rem; color: var(--text-muted); margin-top: var(--sp-1); }

/* --- Footer -------------------------------------------------------------- */
.site-footer {
  background: var(--deep-navy);
  color: rgba(255,255,255,0.72);
  padding-block: var(--sp-5) var(--sp-3);
  margin-top: var(--sp-6);
}
.footer__grid { display: grid; gap: var(--sp-4); grid-template-columns: 1fr; }
@media (min-width: 760px)  { .footer__grid { grid-template-columns: 1.4fr 1fr 1fr; } }

.site-footer .lockup { margin-bottom: var(--sp-2); }
.site-footer h4 {
  color: var(--white); font-size: var(--fs-eyebrow); letter-spacing: 0.12em;
  text-transform: uppercase; margin-bottom: var(--sp-2); font-weight: var(--fw-semibold);
}
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.site-footer a { font-size: var(--fs-small); }
.site-footer a:hover { color: var(--cyber-cyan); }
.footer__bar {
  margin-top: var(--sp-4); padding-top: var(--sp-3);
  border-top: 1px solid rgba(255,255,255,0.12);
  display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: space-between;
  font-size: var(--fs-small);
}

/* --- Reveal on scroll ---------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn:hover, .card:hover, .step:hover, .work__item:hover { transform: none; }
}
