@font-face {
  font-family: "LINE Seed Sans TH";
  src: url("assets/fonts/LINESeedSansTH_A_Rg.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "LINE Seed Sans TH";
  src: url("assets/fonts/LINESeedSansTH_A_Bd.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Design tokens taken from Figma: sure-product / preproduct-v1 (node 4790:246) */
:root {
  --green: #00543e;
  --cream: #f4f2ec;
  --yellow: #f4e860;
  --navy: #01147b;
  --navy-ink: #06187e;
  --white: #feffff;

  --composer-w: 1067px;
  --composer-h: 80px;

  /* Logo is a square social avatar; these fractions crop it down to the wordmark. */
  --logo-w: 172px;
  --logo-img-w: calc(var(--logo-w) / 0.9);

  --font: "LINE Seed Sans TH", "LINE Seed Sans TH App", "Noto Sans Thai", system-ui, sans-serif;

  /* Green veil over the video — lowered by background.js as the user types */
  --veil-opacity: 0.94;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--green);
  color: var(--white);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

/* ---------- video background (lowest layer) ---------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Slight zoom so edges never show letterboxing on resize */
  transform: scale(1.04);
}

.bg__veil {
  position: absolute;
  inset: 0;
  background: var(--green);
  opacity: var(--veil-opacity);
  transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 34px 40px 40px;
  padding:
    max(34px, env(safe-area-inset-top))
    max(40px, env(safe-area-inset-right))
    max(40px, env(safe-area-inset-bottom))
    max(40px, env(safe-area-inset-left));
  overflow-x: clip;
}

/* Grid/flex items default to min-width:auto and refuse to shrink below
   the chip-train's max-content width — that blew the hero past the viewport. */
.page > * {
  min-width: 0;
}

/* Thai has no inter-word spaces, so long runs need an explicit break rule
   (the Figma text layers set the same thing). */
.hero__title,
.hero__sub,
.hero__link,
.footer {
  word-break: break-word;
}

/* ---------- top bar ---------- */

.topbar {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.logo {
  display: block;
  line-height: 0;
}

.logo img {
  display: block;
  width: min(157px, 42vw);
  height: auto;
  margin: 0 auto;
}

.lang {
  position: absolute;
  right: 0;
  top: 4px;
}

.lang__btn {
  width: 53px;
  height: 51px;
  border: none;
  border-radius: 28px;
  background: var(--cream);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.lang__btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.lang__btn img {
  width: 24px;
  height: 24px;
  display: block;
}

.lang__menu {
  position: absolute;
  right: 0;
  top: 60px;
  margin: 0;
  padding: 6px;
  list-style: none;
  min-width: 148px;
  background: var(--cream);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
  animation: menu-in 0.16s ease;
  z-index: 20;
}

.lang__menu[hidden] {
  display: none;
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

.lang__item {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 11px;
  background: none;
  font-family: inherit;
  font-size: 15px;
  color: #141b34;
  text-align: left;
  cursor: pointer;
}

.lang__item:hover {
  background: rgba(0, 84, 62, 0.1);
}

.lang__item[aria-current="true"] {
  background: var(--green);
  color: var(--white);
}

/* ---------- hero ---------- */

.hero {
  align-self: center;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
  width: 100%;
  max-width: var(--composer-w);
  margin: 0 auto;
  padding: 40px 0;
  min-width: 0;
  overflow: hidden;
}

.hero__copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(599px, 100%);
  text-align: center;
}

.hero__title {
  margin: 0;
  font-size: clamp(1.15rem, 2.4vw + 0.7rem, 1.5rem);
  font-weight: 700;
  line-height: 1.4;
}

.hero__sub {
  margin: 0.55rem 0 0;
  font-size: clamp(0.8125rem, 1.2vw + 0.6rem, 0.875rem);
  font-weight: 400;
  line-height: 1.55;
  max-width: 36em;
}

/* ---------- composer panel (Figma 4829:2346) ---------- */

.composer-panel {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 19px 12px 22px;
  background: #fefcfc;
  border: 1px solid var(--cream);
  border-radius: 60px;
  overflow: hidden;
}

.composer {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: var(--composer-h);
  height: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px 0 37px;
  background: var(--yellow);
  border-radius: 60px;
  box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.25s ease;
}

.composer.is-active {
  transform: translateY(-2px);
}

.composer__ripples {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: -1;
}

.ripple {
  position: absolute;
  top: 50%;
  left: var(--x, 50%);
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 1.5px solid rgba(244, 232, 96, 0.55);
  animation: ripple-out 1.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes ripple-out {
  from {
    opacity: 0.85;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(14);
  }
}

.composer__icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: block;
}

.composer__icon img {
  width: 100%;
  height: 100%;
  display: block;
}

.composer__field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: block;
}

.composer__field input {
  width: 100%;
  border: none;
  background: none;
  outline: none;
  font-family: inherit;
  font-size: 24px;
  color: var(--navy-ink);
  text-align: center;
}

.composer__placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 24px;
  color: var(--navy-ink);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.composer__placeholder.is-swapping {
  opacity: 0;
  transform: translateY(-6px);
}

.composer__placeholder.is-hidden {
  opacity: 0;
}

.composer__go {
  flex: 0 0 auto;
  min-width: 109px;
  height: 42px;
  padding: 0 20px;
  border: none;
  border-radius: 48px;
  background: var(--navy);
  color: #fff;
  font-family: inherit;
  font-size: 20px;
  white-space: nowrap;
  cursor: pointer;
  transition: filter 0.18s ease, transform 0.18s ease;
}

.composer__go:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

/*
  Idea-chip train: label sits on top of the rail; chips slide right → left and
  fade under the label like cars disappearing behind a station sign.
*/
.chip-rail {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 38px;
  min-width: 0;
  width: 100%;
  padding: 0 28px 0 40px;
}

.chip-rail__label {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  margin: 0;
  padding: 0 20px 0 0;
  font-size: 17.28px;
  font-weight: 700;
  color: var(--navy-ink);
  white-space: nowrap;
  background: #fefcfc;
  /* Soft white trail so chips look like they fade behind the text */
  box-shadow: 16px 0 24px 18px #fefcfc;
}

.chip-rail__viewport {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  mask-image: linear-gradient(
    90deg,
    transparent 0%,
    #000 14%,
    #000 88%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent 0%,
    #000 14%,
    #000 88%,
    transparent 100%
  );
}

.chip-rail__track {
  display: flex;
  width: max-content;
  gap: 12px;
  animation: chip-train 48s linear infinite;
  will-change: transform;
}

.chip-rail.is-paused .chip-rail__track,
.chip-rail__viewport:hover .chip-rail__track,
.chip-rail__viewport:focus-within .chip-rail__track {
  animation-play-state: paused;
}

@keyframes chip-train {
  from {
    transform: translateX(0);
  }
  to {
    /* Track is two identical halves — -50% loops seamlessly */
    transform: translateX(-50%);
  }
}

.trip-chip {
  flex: 0 0 auto;
  height: 38px;
  max-width: min(380px, 70vw);
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  background: rgba(3, 7, 18, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 38px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.trip-chip:hover {
  background: rgba(1, 20, 123, 0.85);
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}

.trip-chip:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .chip-rail__track {
    animation: none;
    flex-wrap: wrap;
    width: 100%;
  }

  .chip-rail__viewport {
    overflow: visible;
    mask-image: none;
    -webkit-mask-image: none;
  }

  .chip-rail__label {
    box-shadow: none;
  }
}

.hero__link {
  max-width: 100%;
  font-size: 13px;
  color: #fff;
  text-decoration: underline;
  text-underline-position: from-font;
  text-align: center;
}

.hero__link:hover {
  opacity: 0.82;
}

/* ---------- footer ---------- */

.footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 35px;
  font-size: 13px;
}

.footer__contact,
.footer__social a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #fff;
  text-decoration: none;
}

.footer__contact:hover {
  text-decoration: underline;
}

.footer__contact img {
  width: 16px;
  height: 16px;
  display: block;
}

.footer__social {
  display: inline-flex;
  align-items: center;
  gap: 6.75px;
}

.footer__social img {
  width: 15px;
  height: 15px;
  display: block;
  transition: transform 0.18s ease;
}

.footer__social a:hover img {
  transform: scale(1.15);
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  :root {
    --composer-h: 64px;
  }

  .page {
    padding:
      max(20px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }

  .logo img {
    width: min(132px, 46vw);
  }

  .lang__btn {
    width: 44px;
    height: 44px;
    border-radius: 22px;
  }

  .lang__btn img {
    width: 20px;
    height: 20px;
  }

  .lang__menu {
    top: 52px;
  }

  .hero {
    gap: 28px;
    padding: 24px 0 12px;
    align-self: center;
  }

  .hero__copy {
    width: 100%;
    padding: 0 4px;
  }

  .composer-panel {
    padding: 14px 10px 16px;
    border-radius: 28px;
    gap: 16px;
  }

  .composer {
    min-height: var(--composer-h);
    padding: 8px 10px 8px 16px;
    gap: 10px;
    border-radius: 999px;
  }

  .composer__icon {
    width: 22px;
    height: 22px;
  }

  /* 16px minimum: smaller text makes iOS Safari zoom the field on focus. */
  .composer__field input,
  .composer__placeholder {
    font-size: 16px;
  }

  .composer__placeholder {
    justify-items: start;
    padding-right: 4px;
  }

  .composer__field input {
    text-align: left;
  }

  .composer__go {
    min-width: 0;
    height: 40px;
    padding: 0 14px;
    font-size: 15px;
  }

  /* Stack label above the train so chips get the full width. */
  .chip-rail {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    min-height: 0;
    padding: 0 6px;
  }

  .chip-rail__label {
    padding: 0;
    font-size: 13px;
    box-shadow: none;
    background: transparent;
    white-space: normal;
  }

  .chip-rail__viewport {
    mask-image: linear-gradient(
      90deg,
      transparent 0%,
      #000 8%,
      #000 92%,
      transparent 100%
    );
    -webkit-mask-image: linear-gradient(
      90deg,
      transparent 0%,
      #000 8%,
      #000 92%,
      transparent 100%
    );
  }

  .trip-chip {
    height: 34px;
    line-height: 34px;
    font-size: 12px;
    padding: 0 14px;
    max-width: min(280px, 78vw);
  }

  .hero__link {
    font-size: 12.5px;
    line-height: 1.5;
    padding: 0 8px;
  }

  .footer {
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 18px;
    font-size: 12.5px;
    text-align: center;
  }
}

@media (max-width: 560px) {
  .composer {
    /* Keep one row, but reclaim space from the passport mark. */
    padding: 8px 8px 8px 12px;
  }

  .composer__icon {
    display: none;
  }

  .composer__go {
    height: 38px;
    padding: 0 12px;
    font-size: 14px;
  }
}

/* Very narrow phones: put CTA under the field so neither gets crushed. */
@media (max-width: 380px) {
  .composer {
    flex-wrap: wrap;
    border-radius: 22px;
    padding: 10px 10px 10px 12px;
    gap: 10px;
  }

  .composer__field {
    flex: 1 1 100%;
    min-height: 28px;
  }

  .composer__placeholder {
    justify-items: center;
  }

  .composer__field input {
    text-align: center;
  }

  .composer__go {
    width: 100%;
    height: 42px;
    font-size: 15px;
  }
}
