/* Landing page styles (CHQ-1120) */

/*
 * Kept from the previous version on purpose.
 * This file is also loaded by layouts/application.html.erb, so the :root, html and body
 * rules below apply to every page of the app. Changing them would change other pages.
 */
:root {
  --landing-color-bg: #FFFFFF;
  --landing-color-neutral-50: #F8FAFC;
  --landing-color-neutral-100: #F1F5F9;
  --landing-color-neutral-200: #E2E8F0;
  --landing-color-neutral-300: #CBD5E1;
  --landing-color-neutral-400: #94A3B8;
  --landing-color-neutral-500: #64748B;
  --landing-color-neutral-600: #475569;
  --landing-color-neutral-700: #334155;
  --landing-color-neutral-800: #1E293B;
  --landing-color-neutral-900: #0F172A;

  --landing-color-primary: #0EA5E9;
  /* Sky 500 */
  --landing-color-primary-dark: #0284C7;
  /* Sky 600 */

  --landing-font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html,
body {
  overflow-x: clip;
  scrollbar-gutter: stable;
}

body {
  font-family: var(--landing-font-sans);
  color: var(--landing-color-neutral-900);
  margin: 0;
  line-height: 1.5;
}

.landing-page {
  width: 100%;
  overflow-x: clip;
}

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

.landing-page h1,
.landing-page h2,
.landing-page h3,
.landing-page p,
.landing-page span {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Utilities */
.landing-container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
  box-sizing: border-box;
}

@media (min-width: 1024px) {
  .landing-container {
    padding: 0 2rem;
  }
}

/* Kept from the previous version: footer (unchanged by CHQ-1120) */
.landing-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--landing-color-neutral-900);
  min-width: 0;
}

.landing-logo-icon {
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background-color: var(--landing-color-neutral-900);
  color: white;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .landing-logo-icon {
    width: 2.5rem;
    height: 2.5rem;
  }
}

.landing-logo-text {
  font-size: 1.125rem;
  font-weight: 600;
}

@media (min-width: 640px) {
  .landing-logo-text {
    font-size: 1.25rem;
  }
}

/* Footer */
.landing-footer {
  border-top: 1px solid var(--landing-color-neutral-200);
  background-color: white;
  padding: 2rem 0;
}

@media (min-width: 640px) {
  .landing-footer {
    padding: 3rem 0;
  }
}

.landing-footer-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 640px) {
  .landing-footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .landing-footer-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.landing-footer-brand p {
  font-size: 0.875rem;
  color: var(--landing-color-neutral-500);
  margin-top: 1rem;
}

.landing-footer-col h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.landing-footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.landing-footer-links a {
  font-size: 0.875rem;
  color: var(--landing-color-neutral-500);
  text-decoration: none;
  transition: color 0.2s;
}

.landing-footer-links a:hover {
  color: var(--landing-color-neutral-900);
}

.landing-footer-bottom {
  border-top: 1px solid var(--landing-color-neutral-200);
  margin-top: 2rem;
  padding-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--landing-color-neutral-500);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
}

.landing-footer-bottom p {
  margin: 0;
}

@media (min-width: 768px) {
  .landing-footer-bottom {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
    flex-wrap: wrap;
    margin-top: 3rem;
  }
}

/* Kept from the previous version: demo video modal (unchanged) */
/* Demo Video Modal */
.demo-modal-close {
  position: absolute;
  top: max(1rem, env(safe-area-inset-top, 1rem));
  right: max(1.25rem, env(safe-area-inset-right, 1.25rem));
  color: var(--landing-color-neutral-100);
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.demo-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  color: var(--landing-color-neutral-white);
}

.demo-modal-video-wrapper {
  width: 90vw;
  max-width: 900px;
}

.demo-modal-video {
  width: 100%;
  border-radius: var(--radius-md);
  display: block;
}

/* Fade-in transition giữa list view ↔ video view trong demo modal */
@keyframes demoModalFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

[data-demo-video-modal-target="list"]:not(.hidden),
[data-demo-video-modal-target="videoView"]:not(.hidden) {
  animation: demoModalFadeIn 200ms ease-out;
}

/*
 * New landing page (approved prototype, CHQ-1099).
 * Layout, spacing and typography are Tailwind utilities in app/views/public/landing/*.
 * Colors use theme.extend.colors.landing (tailwind.config.js), backed by the tokens below.
 * This file keeps only: the tokens, a minimal reset (Tailwind preflight is disabled app-wide),
 * building blocks repeated across sections, and effects that are hard to write as utilities.
 * Everything is scoped under .landing-page so other pages are not affected.
 */
.landing-page {
  --lp-ink: #0b1220;
  --lp-text: #344054;
  --lp-muted: #667085;
  --lp-line: #e6ebf2;
  --lp-bg-soft: #f3f8fd;
  --lp-accent: #1d6fd8;
  --lp-accent-2: #2bb3c0;
  --lp-accent-soft: #e8f2fd;
  --lp-radius: 20px;
  --lp-shadow: 0 18px 50px rgba(15, 35, 70, 0.1);
  --lp-topbar-height: 68px;
  --lp-font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo,
    sans-serif;

  background: #ffffff;
  color: var(--lp-ink);
  font-family: var(--lp-font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: no-preference) {
  html:has(.landing-page) {
    scroll-behavior: smooth;
  }
}

/* Minimal reset. :where() keeps it at zero specificity so Tailwind utilities always win. */
:where(.landing-page main) :where(h1, h2, h3, p) {
  margin: 0;
}

:where(.landing-page main) :where(h1, h2, h3) {
  letter-spacing: -0.025em;
  line-height: 1.12;
  text-wrap: balance;
}

:where(.landing-page main) h2 {
  font-size: clamp(30px, 3.6vw, 44px);
  font-weight: 800;
}

/* Break Japanese headlines between phrases instead of inside words (where supported). */
.landing-page:lang(ja) main :is(h1, h2, h3, summary) {
  word-break: auto-phrase;
}

:where(.landing-page main) img {
  display: block;
  max-width: 100%;
  height: auto;
}

:where(.landing-topbar, .landing-page main) a {
  color: inherit;
  text-decoration: none;
}

:is(.landing-topbar, .landing-page main) :is(a, button, summary):focus-visible {
  outline: 2px solid var(--lp-accent);
  outline-offset: 3px;
}

.landing-page section[id] {
  scroll-margin-top: var(--lp-topbar-height);
}

/*
 * Building blocks repeated across sections.
 * This file loads after tailwind.css, so these use :where() (zero specificity): a utility on
 * the same element (e.g. pb-14, text-[10px]) always wins over the building block.
 */
:where(.landing-wrap) {
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: 24px;
}

:where(.landing-section) {
  padding: 96px 0;
}

:where(.landing-kicker) {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

:where(.landing-btn) {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: inherit;
  text-decoration: none;
}

.landing-page .landing-btn-primary {
  background: var(--lp-ink);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(11, 18, 32, 0.18);
}

.landing-page .landing-btn-ghost {
  background: #ffffff;
  color: var(--lp-ink);
  border-color: var(--lp-line);
}

.landing-page .landing-btn-light {
  background: var(--lp-accent-soft);
  color: var(--lp-ink);
}

/* Hero carousel dots (image_switcher_controller toggles .active): 24px hit area, dot via ::before */
.landing-carousel-dot {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: none;
}

.landing-carousel-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 0 0 1px rgba(11, 18, 32, 0.2);
}

.landing-carousel-dot.active::before {
  width: 20px;
  background: #ffffff;
}

/*
 * Face-scan thumbnail: a face crop of the stage photo with a scan overlay (no extra asset).
 * Crop = 240px square at (502, 205) of the 1254px original, kept as percentages so it
 * survives resizing: size = 1254 / 240 = 522.5%, x = 502 / 1014 = 49.5%, y = 205 / 1014 = 20.2%.
 */
.landing-face-scan {
  position: relative;
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border: 2px solid #ffffff;
  border-radius: 14px;
  background: #eef3ff url("/assets/landing-hero-stage-02f039e4.webp") 49.5% 20.2% / 522.5% no-repeat;
  box-shadow: 0 0 0 1px #d6e4f7, 0 4px 12px rgba(29, 111, 216, 0.22);
}

/* Corner brackets */
.landing-face-scan::after {
  --bracket: #ffffff;

  content: "";
  position: absolute;
  inset: 5px;
  background:
    linear-gradient(var(--bracket), var(--bracket)) top left / 10px 2px,
    linear-gradient(var(--bracket), var(--bracket)) top left / 2px 10px,
    linear-gradient(var(--bracket), var(--bracket)) top right / 10px 2px,
    linear-gradient(var(--bracket), var(--bracket)) top right / 2px 10px,
    linear-gradient(var(--bracket), var(--bracket)) bottom left / 10px 2px,
    linear-gradient(var(--bracket), var(--bracket)) bottom left / 2px 10px,
    linear-gradient(var(--bracket), var(--bracket)) bottom right / 10px 2px,
    linear-gradient(var(--bracket), var(--bracket)) bottom right / 2px 10px;
  background-repeat: no-repeat;
  filter: drop-shadow(0 0 2px rgba(11, 18, 32, 0.55));
}

/* Scan line; it only moves when the visitor has not asked for reduced motion. */
.landing-face-scan::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 5px;
  right: 5px;
  z-index: 1;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #8fc4ff 20%, #ffffff 50%, #8fc4ff 80%, transparent);
  box-shadow: 0 0 10px 2px rgba(110, 170, 255, 0.85);
}

@keyframes landing-face-scan-sweep {
  from {
    top: 5px;
  }

  to {
    top: calc(100% - 7px);
  }
}

/* Chevron between storyboard steps (desktop only) */
.landing-story-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 42%;
  right: -26px;
  width: 12px;
  height: 12px;
  border-top: 2px solid var(--lp-muted);
  border-right: 2px solid var(--lp-muted);
  transform: rotate(45deg);
}

/* FAQ: custom +/– marker instead of the native disclosure triangle */
.landing-faq summary {
  list-style: none;
}

.landing-faq summary::-webkit-details-marker {
  display: none;
}

.landing-faq summary::after {
  content: "+";
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  color: var(--lp-muted);
}

.landing-faq details[open] summary::after {
  content: "–";
}

/* CTA card glow */
.landing-cta-glow {
  background-image:
    radial-gradient(circle at 15% 0%, rgba(29, 111, 216, 0.35), transparent 45%),
    radial-gradient(circle at 90% 100%, rgba(43, 179, 192, 0.25), transparent 40%);
}

@media (prefers-reduced-motion: no-preference) {
  .landing-btn {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }

  .landing-btn:hover {
    transform: translateY(-1px);
  }

  .landing-face-scan::before {
    top: 5px;
    animation: landing-face-scan-sweep 2.2s ease-in-out infinite alternate;
  }

  .landing-carousel-dot::before {
    transition: width 0.2s ease, background-color 0.2s ease;
  }
}

@media (max-width: 960px) {
  :where(.landing-section) {
    padding: 72px 0;
  }

  .landing-story-step:not(:last-child)::after {
    display: none;
  }
}

@media (max-width: 640px) {
  :where(.landing-wrap) {
    padding-inline: 16px;
  }

  :where(.landing-section) {
    padding: 56px 0;
  }
}
