/* AI Innovation Hub ─ main stylesheet */

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/space-grotesk-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #040611;
  --bg-2: #0a0f26;
  --surface: rgba(14, 19, 44, 0.72);
  --surface-solid: #0d1230;
  --line: rgba(148, 163, 220, 0.16);
  --line-strong: rgba(148, 163, 220, 0.3);
  --text: #eef2ff;
  --text-2: #b4bdd9;
  --text-3: #8d97b8;
  --cyan: #1be5ff;
  --violet: #7c53ff;
  --violet-text: #a993ff;
  --magenta: #ff3dcb;
  --magenta-text: #ff7ad9;
  --focus: #7ff0ff;

  --font-sans: 'IBM Plex Sans Thai', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-brand: 'Space Grotesk', var(--font-sans);
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 18px;
  --radius-sm: 12px;
  --header-h: 68px;
  --gutter: 16px;
  --container: 1200px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 8px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
p { text-wrap: pretty; }
ul { margin: 0; padding: 0; list-style: none; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 8px; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: .02em; }

.skip-link {
  position: absolute; left: var(--gutter); top: -100px; z-index: 100;
  padding: 10px 16px; border-radius: 10px;
  background: var(--text); color: var(--bg); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: .75rem; font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase; color: var(--cyan);
}
.eyebrow::before { content: ''; width: 22px; height: 1px; background: currentColor; opacity: .8; }

/* ─── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 22px; border-radius: 999px;
  border: 1px solid transparent;
  font-size: 1rem; font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap;
  cursor: pointer;
  transition: transform .2s var(--ease), background-color .2s, border-color .2s, box-shadow .2s, color .2s;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  color: #03111a;
  background: linear-gradient(100deg, #39ecff 0%, #8fd8ff 48%, #b9a6ff 100%);
  box-shadow: 0 0 0 1px rgba(27, 229, 255, .35), 0 10px 30px -10px rgba(27, 229, 255, .6);
}
.btn--primary:hover { box-shadow: 0 0 0 1px rgba(27, 229, 255, .6), 0 14px 38px -10px rgba(27, 229, 255, .8); }
.btn--ghost {
  color: var(--text);
  background: rgba(10, 14, 34, .55);
  border-color: var(--line-strong);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.btn--ghost:hover { border-color: rgba(27, 229, 255, .6); background: rgba(16, 24, 56, .7); }
.btn--sm { min-height: 44px; padding: 10px 18px; font-size: .9375rem; }
.btn__icon { width: 18px; height: 18px; flex: none; }

/* ─── Header ──────────────────────────────────────────── */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--header-h);
  transition: background-color .3s, border-color .3s, -webkit-backdrop-filter .3s, backdrop-filter .3s;
  border-bottom: 1px solid transparent;
  background: linear-gradient(180deg, rgba(4, 6, 17, .7), rgba(4, 6, 17, 0));
}
.site-header.is-scrolled {
  background: rgba(6, 9, 24, .82);
  border-bottom-color: var(--line);
  -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
}
.site-header__inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; }
.brand__mark { width: 34px; height: 34px; flex: none; filter: drop-shadow(0 0 8px rgba(27, 229, 255, .35)); }
.brand__word { font-family: var(--font-brand); font-weight: 500; font-size: 1.125rem; letter-spacing: .04em; white-space: nowrap; }
.site-header__actions { display: flex; align-items: center; gap: 10px; }

.lang-switch {
  display: inline-flex; padding: 3px; gap: 2px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: rgba(10, 14, 34, .5);
}
.lang-switch__btn {
  min-width: 44px; min-height: 44px; padding: 0 10px;
  border: 0; border-radius: 999px; background: transparent; cursor: pointer;
  font-family: var(--font-mono); font-size: .8125rem; font-weight: 500; letter-spacing: .06em; color: var(--text-2);
}
.lang-switch__btn[aria-pressed="true"] { background: rgba(27, 229, 255, .16); color: var(--text); box-shadow: inset 0 0 0 1px rgba(27, 229, 255, .45); }
.lang-switch__btn:hover { color: var(--text); }

.only-narrow { display: none; }
@media (max-width: 559px) {
  .only-wide { display: none; }
  .only-narrow { display: inline; }
  .brand__word { font-size: 1rem; }
  .brand__mark { width: 30px; height: 30px; }
  .site-header__actions { gap: 8px; }
  .btn--sm { padding-inline: 14px; }
}
@media (max-width: 374px) {
  .brand__word { display: none; }
}

/* ─── Hero ────────────────────────────────────────────── */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: max(560px, 75svh);
  display: flex; flex-direction: column; justify-content: center;
  padding: calc(var(--header-h) + 32px) 0 88px;
  background:
    radial-gradient(ellipse at 66% 45%, #0a1028 0%, var(--bg) 70%);
}
@supports not (height: 1svh) { .hero { min-height: max(560px, 75vh); } }

.hero__stage { position: absolute; inset: 0; z-index: -3; overflow: hidden; }
.hero__poster, .hero__poster img, .hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero__poster img { object-fit: cover; object-position: 70% 50%; }
.hero__canvas { opacity: 0; transition: opacity 1.2s ease; touch-action: pan-y; }
.hero__stage.is-ready .hero__canvas { opacity: 1; }
.hero__labels { position: absolute; inset: 0; pointer-events: none; }
.hero__labels .lbl {
  position: absolute; left: 0; top: 0; opacity: 0; white-space: nowrap;
  display: flex; align-items: center; gap: 6px; will-change: transform, opacity;
  font: 400 10px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase;
}
.hero__labels .lbl i { display: block; width: 14px; height: 1px; background: currentColor; opacity: .7; }

.hero__overlay {
  position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(4, 6, 17, .95) 0%, rgba(4, 6, 17, .84) 34%, rgba(4, 6, 17, .38) 54%, rgba(4, 6, 17, 0) 72%, rgba(4, 6, 17, .3) 100%),
    linear-gradient(180deg, rgba(4, 6, 17, .25) 0%, rgba(4, 6, 17, 0) 22%, rgba(4, 6, 17, 0) 70%, var(--bg) 100%);
}

.hero__content { position: relative; display: grid; gap: 20px; justify-items: start; }
.hero__content > * { max-width: 600px; }
.hero__title {
  display: grid; gap: 4px;
  font-size: clamp(2rem, 1.2rem + 3.4vw, 3.75rem);
  font-weight: 700; line-height: 1.22; letter-spacing: -.005em;
  text-wrap: balance;
  text-shadow: 0 2px 24px rgba(4, 6, 17, .6);
}
.hero__title-accent {
  background: linear-gradient(95deg, #6ff1ff 0%, #a993ff 55%, #ff8fe0 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-size: .78em; font-weight: 600; line-height: 1.32;
}
.hero__lead { font-size: clamp(1rem, .95rem + .3vw, 1.1875rem); color: var(--text-2); max-width: 540px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

.scroll-cue {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 44px; padding: 4px 12px;
  font-size: .8125rem; color: var(--text-3); text-decoration: none;
}
.scroll-cue svg { width: 20px; height: 20px; animation: cue 2.4s var(--ease) infinite; }
.scroll-cue:hover { color: var(--text); }
@keyframes cue { 0%, 100% { transform: translateY(0); opacity: .6; } 50% { transform: translateY(4px); opacity: 1; } }

/* Portrait / mobile: the animation gets its own box at the top, copy flows below it */
@media (max-aspect-ratio: 1/1) {
  .hero {
    --stage-h: min(125vw, 72svh);
    justify-content: flex-start; min-height: 0;
    padding-top: calc(var(--stage-h) * 0.6); padding-bottom: 88px;
  }
  .hero__stage {
    bottom: auto; height: var(--stage-h);
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 62%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 0%, #000 62%, transparent 100%);
  }
  .hero__poster img { object-position: 50% 0%; }
  .hero__overlay {
    background:
      linear-gradient(180deg, rgba(4, 6, 17, .45) 0%, rgba(4, 6, 17, 0) 14%),
      linear-gradient(180deg, transparent 0, transparent calc(var(--stage-h) * 0.5), rgba(4, 6, 17, .85) calc(var(--stage-h) * 0.66), var(--bg) calc(var(--stage-h) * 0.9));
  }
  .hero__content { gap: 16px; }
}
@supports not (height: 1svh) {
  @media (max-aspect-ratio: 1/1) { .hero { --stage-h: min(125vw, 72vh); } }
}
@media (max-width: 479px) {
  .hero__actions { width: 100%; }
  .hero__actions .btn { flex: 1 1 100%; }
}

/* ─── Solutions grid ──────────────────────────────────── */
.solutions { position: relative; padding: 72px 0 96px; outline: none; }
.solutions::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 420px; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse 60% 100% at 50% 0%, rgba(124, 83, 255, .12), transparent 70%);
}
.section-head { display: grid; gap: 12px; max-width: 720px; margin-bottom: 40px; }
.section-head__title { font-size: clamp(1.625rem, 1.2rem + 1.8vw, 2.5rem); line-height: 1.3; font-weight: 700; text-wrap: balance; }
.section-head__lead { color: var(--text-2); font-size: 1.0625rem; }

.product-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .product-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; } }
@media (min-width: 1024px) { .product-grid { grid-template-columns: repeat(3, 1fr); gap: 24px; } }
.product-grid--plain { display: grid; gap: 8px; color: var(--text-2); }

.card {
  --accent: var(--cyan);
  --accent-text: var(--cyan);
  position: relative; display: flex; flex-direction: column; gap: 16px; height: 100%;
  padding: 24px; border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(18, 24, 54, .78), rgba(10, 14, 34, .78));
  border: 1px solid var(--line);
  transition: border-color .25s, transform .25s var(--ease), box-shadow .25s;
}
.card[data-accent="violet"] { --accent: var(--violet); --accent-text: var(--violet-text); }
.card[data-accent="magenta"] { --accent: var(--magenta); --accent-text: var(--magenta-text); }
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); transform: translateY(-2px); box-shadow: 0 18px 50px -24px color-mix(in srgb, var(--accent) 60%, transparent); }
.card__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card__icon {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: none;
  color: var(--accent-text);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent);
}
.card__icon svg { width: 24px; height: 24px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: .8125rem; font-weight: 500; line-height: 1.4; white-space: nowrap;
  border: 1px solid var(--line-strong); color: var(--text-2);
}
.badge--live { color: #8ff7c8; border-color: rgba(52, 211, 153, .45); background: rgba(16, 185, 129, .12); }
.badge--live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, .2); }
.badge--featured { color: var(--cyan); border-color: rgba(27, 229, 255, .45); background: rgba(27, 229, 255, .08); }
.card__badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.card__name { font-size: 1.3125rem; font-weight: 700; line-height: 1.35; }
.card__tagline { color: var(--text); font-weight: 500; line-height: 1.5; }
.card__desc { color: var(--text-2); font-size: .9375rem; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 3px 10px; border-radius: 8px; font-size: .8125rem; color: var(--text-2); background: rgba(148, 163, 220, .08); border: 1px solid var(--line); }
.card__footer { margin-top: auto; display: grid; gap: 14px; padding-top: 4px; }
.card__url { display: flex; align-items: center; gap: 8px; font-size: .8125rem; color: var(--text-3); overflow-wrap: anywhere; }
.card__url .mono { color: var(--text-2); }
.card__note { font-size: .8125rem; color: var(--text-3); }
.card .btn { justify-self: start; }
.card--soon .btn { color: var(--text); }

/* Featured card spans the full row */
.card--featured {
  padding: 28px;
  border-color: rgba(27, 229, 255, .32);
  background:
    radial-gradient(ellipse 70% 120% at 100% 0%, rgba(27, 229, 255, .14), transparent 60%),
    radial-gradient(ellipse 60% 100% at 0% 100%, rgba(124, 83, 255, .14), transparent 60%),
    linear-gradient(180deg, rgba(16, 24, 58, .9), rgba(9, 13, 34, .9));
}
.product-grid > li:has(.card--featured) { grid-column: 1 / -1; }
.card--featured .card__name { font-size: clamp(1.625rem, 1.3rem + 1.2vw, 2.125rem); }
.card--featured .card__tagline { font-size: 1.125rem; }
.card--featured .card__desc { font-size: 1rem; max-width: 620px; }
@media (min-width: 900px) {
  .card--featured { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px 48px; padding: 36px 40px; align-items: start; }
  .card--featured .card__top { grid-column: 1 / -1; }
  .card--featured .card__body { grid-column: 1; }
  .card--featured .card__footer { grid-column: 2; grid-row: 2; margin-top: 0; align-self: end; padding: 24px; border-radius: var(--radius-sm); background: rgba(4, 6, 17, .45); border: 1px solid var(--line); }
}
.card__body { display: grid; gap: 12px; }

/* ─── Footer ──────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--line); padding: 24px 0 calc(24px + env(safe-area-inset-bottom)); color: var(--text-3); font-size: .875rem; }
.site-footer__inner { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

/* ─── Toast ───────────────────────────────────────────── */
.toast-region {
  position: fixed; z-index: 80; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(440px, calc(100% - 2 * var(--gutter))); display: grid; gap: 8px; pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px;
  padding: 12px 8px 12px 16px; border-radius: 14px;
  background: rgba(13, 18, 48, .96); border: 1px solid rgba(27, 229, 255, .35);
  box-shadow: 0 18px 50px -12px rgba(0, 0, 0, .7);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  animation: toast-in .3s var(--ease);
}
.toast__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.toast__msg { flex: 1; font-size: .9375rem; }
.toast__close {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  border: 0; border-radius: 10px; background: transparent; color: var(--text-2); cursor: pointer;
}
.toast__close:hover { color: var(--text); background: rgba(148, 163, 220, .1); }
.toast__close svg { width: 18px; height: 18px; }
.toast.is-leaving { animation: toast-out .25s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ─── 404 page ───────────────────────────────────────── */
.nf { min-height: 100svh; display: grid; place-items: center; text-align: center; padding: 32px var(--gutter);
  background: radial-gradient(circle at 70% 30%, rgba(124, 83, 255, .22), transparent 40%), radial-gradient(circle at 30% 70%, rgba(27, 229, 255, .14), transparent 45%), var(--bg); }
.nf__box { display: grid; gap: 16px; justify-items: center; max-width: 520px; }
.nf h1 { font-size: clamp(1.75rem, 1.3rem + 2vw, 2.5rem); line-height: 1.3; }
.nf p { color: var(--text-2); }

/* ─── Reduced motion: static poster, no transitions ───── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .hero__canvas, .hero__labels { display: none; }
  .card:hover { transform: none; }
}
