/* Landing — full-bleed video hero, then the underwater panel, then the footer.
   System light/dark via tokens; the video panels stay dark in both schemes. */

:root {
  --ldg-bg: #f4f3f0;
  --ldg-text: #0f0f0f;
  --ldg-muted: rgba(0, 0, 0, 0.55);
  --ldg-grid: rgba(0, 0, 0, 0.12);
  --ldg-surface: #fff;
  --ldg-orange: #ff6a00;
  --ldg-header-h: 52px;
  --ldg-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html.ldg-mistral {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  html.ldg-mistral {
    color-scheme: dark;
  }

  :root {
    --ldg-bg: #0c0c0c;
    --ldg-text: #ececec;
    --ldg-muted: rgba(255, 255, 255, 0.55);
    --ldg-grid: rgba(255, 255, 255, 0.12);
    --ldg-surface: #1a1a1a;
  }
}

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

html.ldg-mistral {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body.ldg-mistral {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font, 'Inter', system-ui, sans-serif);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ldg-text);
  background: var(--ldg-bg);
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------------------
   Header — solid bar above the video so it reads cleanly in both schemes
--------------------------------------------------------------------------- */

body.ldg-mistral > header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--ldg-header-h);
  margin: 0;
  padding: 0 max(clamp(20px, 2vw, 32px), env(safe-area-inset-right, 0px)) 0
    max(clamp(20px, 2vw, 32px), env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--ldg-grid);
  background: var(--ldg-bg);
  justify-content: center;
}

body.ldg-mistral > header .logo-block {
  flex: 1;
  max-width: none;
  width: 100%;
  margin: 0;
  justify-content: flex-start;
  gap: 0;
}

body.ldg-mistral > header .logo-block-lockup-row {
  margin-right: clamp(8px, 1.5vw, 16px);
}

/* Primary nav lives inside the Learn more dropdown. The <nav> landmark wrapper
   must not add a flex slot (or its gap) to the header row. */
.ldg-header-actions > nav {
  display: contents;
}

.ldg-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  margin-left: auto;
}

.ldg-learn-more {
  position: relative;
  display: block;
}

.ldg-learn-more summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  list-style: none;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ldg-text);
  padding: 6px 0;
  transition: opacity 0.15s ease;
}

.ldg-learn-more summary:hover {
  opacity: 0.65;
}

.ldg-learn-more summary::-webkit-details-marker {
  display: none;
}

/* Chevron rides the label so it disappears with it on mobile. */
.ldg-learn-more-label::after {
  content: ' ⌄';
  font-size: 0.75rem;
  opacity: 0.6;
}

.ldg-learn-more ul {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  border: 1px solid var(--ldg-grid);
  border-radius: 8px;
  background: var(--ldg-surface);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--ldg-text) 10%, transparent);
  z-index: 20;
}

.ldg-learn-more:not([open]) ul {
  display: none;
}

.ldg-learn-more a {
  display: block;
  padding: 8px 14px;
  font-size: 0.8125rem;
  color: var(--ldg-text);
  text-decoration: none;
}

.ldg-learn-more a:hover {
  background: color-mix(in srgb, var(--ldg-text) 6%, transparent);
}

.ldg-header-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-height: 34px;
  padding: 6px 16px;
  border-radius: 2px;
  border: none;
  background: var(--ldg-text);
  color: var(--ldg-bg);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.15s ease;
}

.ldg-header-cta:hover {
  opacity: 0.88;
}

.ldg-header-cta .cta-arrow {
  transition: transform 0.15s ease;
}

.ldg-header-cta:hover .cta-arrow {
  transform: translateX(2px);
}

/* 3×3 grid icon — the dropdown trigger on mobile; desktop shows the text label */
.ldg-menu-grid {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  width: 18px;
  height: 18px;
}

.ldg-menu-grid-dot {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  background: var(--ldg-text);
}

/* ---------------------------------------------------------------------------
   Scroll root + panels — normal document scroll, hero → underwater → footer
--------------------------------------------------------------------------- */

.ldg-scroll {
  overflow-x: hidden;
}

.ldg-panel {
  position: relative;
  overflow: hidden;
  min-height: 100dvh;
  /* Dark backing behind each video so there is no light flash before it paints. */
  background: #0c0c0c;
}

/* Panel content enter transition */
html.ldg-js .ldg-panel:not(.is-active) [data-panel-content] {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.75s var(--ldg-ease),
    transform 0.85s var(--ldg-ease);
}

html.ldg-js .ldg-panel.is-active [data-panel-content] {
  opacity: 1;
  transform: none;
}

html:not(.ldg-js) .ldg-panel [data-panel-content] {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html.ldg-js .ldg-panel [data-panel-content] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------------------------------------------------------------------------
   Hero — full-bleed video, centered headline + lede
--------------------------------------------------------------------------- */

.ldg-panel-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Stop just short of the viewport so the underwater panel peeks in below the
     ticker as a scroll hint (mobile widens this to a 15% peek). svh keeps the
     height stable while browser chrome collapses. */
  min-height: 92dvh;
  min-height: 92svh;
  padding: calc(var(--ldg-header-h) + clamp(1.5rem, 4vw, 3rem))
    max(var(--ppx-page-inset, 20px), env(safe-area-inset-right, 0px))
    clamp(4.5rem, 10vh, 7rem)
    max(var(--ppx-page-inset, 20px), env(safe-area-inset-left, 0px));
}

/* Video sits below the header bar so the bar stays a clean solid edge. */
.ldg-hero-video,
.ldg-deep-video {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  display: block;
  width: 100%;
  object-fit: cover;
  pointer-events: none;
}

.ldg-hero-video {
  top: var(--ldg-header-h);
  height: calc(100% - var(--ldg-header-h));
}

/* Decorative backgrounds — never show native play chrome if autoplay is delayed. */
.ldg-hero-video::-webkit-media-controls,
.ldg-deep-video::-webkit-media-controls {
  display: none !important;
}

.ldg-hero-video::-webkit-media-controls-enclosure,
.ldg-deep-video::-webkit-media-controls-enclosure {
  display: none !important;
}

.ldg-hero-video::-webkit-media-controls-start-playback-button,
.ldg-deep-video::-webkit-media-controls-start-playback-button {
  display: none !important;
  -webkit-appearance: none;
}

.ldg-hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1rem, 2.2vw, 1.5rem);
  width: 100%;
  max-width: 1040px;
  text-align: center;
}

.ldg-hero-title {
  margin: 0;
  font-family: var(--font-wordmark, 'DM Sans', sans-serif);
  font-size: clamp(2.25rem, 5.6vw, 4.5rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.04;
  color: #fff;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
}

.ldg-type-line {
  display: block;
  min-height: 1em;
}

.ldg-hero-title-char {
  display: inline-block;
  white-space: pre;
  will-change: transform, filter, opacity;
}

/* Pop-in reveal — lines stay hidden until JS splits them into per-char spans,
   then each glyph flips in with blur + overshoot on a staggered delay. */
html.ldg-js .ldg-type-line {
  visibility: hidden;
}

html.ldg-js .ldg-type-line.is-split {
  visibility: visible;
}

html.ldg-js .ldg-hero-title-char {
  opacity: 0;
}

html.ldg-js .ldg-hero-title-char.is-in {
  animation: ldg-pop-in 540ms cubic-bezier(0.2, 0.8, 0.2, 1.4) both;
}

@keyframes ldg-pop-in {
  from {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(0.4em) scale(0.9);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.ldg-js .ldg-type-line {
    visibility: visible;
  }

  html.ldg-js .ldg-hero-title-char {
    opacity: 1;
    filter: none;
    transform: none;
    animation: none;
  }
}

/* Mobile: show the headline immediately — no per-char stagger. */
@media (max-width: 899px) {
  html.ldg-js .ldg-type-line {
    visibility: visible;
  }

  html.ldg-js .ldg-hero-title-char {
    opacity: 1;
    filter: none;
    transform: none;
    animation: none;
  }
}

.ldg-hero-lede {
  margin: 0;
  max-width: 34ch;
  font-family: var(--font-wordmark);
  font-size: clamp(1rem, 1.5vw, 1.375rem);
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: rgba(255, 255, 255, 0.94);
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.5);
}

/* Hero CTA — sits under the lede; a touch larger than the header button so it
   holds its own beneath the headline. */
.ldg-hero-cta {
  display: inline-flex;
  margin-top: clamp(0.25rem, 1vw, 0.5rem);
  min-height: 42px;
  padding: 10px 22px;
  font-size: 0.875rem;
}

/* Balaji backing badge — dark status bar over the hero video */
.ldg-backed {
  position: absolute;
  left: max(clamp(12px, 2vw, 20px), env(safe-area-inset-left, 0px));
  /* +38px clears the live ticker strip pinned to the hero's bottom edge. */
  bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(12px, 2vw, 20px) + 38px);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(320px, calc(100% - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  padding: 8px 12px;
  background: #0f0f0f;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  font-family: var(--font, 'Inter', system-ui, sans-serif);
  line-height: 1.3;
  pointer-events: auto;
  transition:
    color 0.18s ease,
    background-color 0.18s ease;
}

.ldg-backed:hover {
  color: rgba(255, 255, 255, 0.92);
  background: #1c1c1c;
}

.ldg-backed:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
}

.ldg-backed-matrix {
  display: grid;
  grid-template-columns: repeat(4, 1.5px);
  grid-auto-rows: 1.5px;
  gap: 1.5px;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.85);
}

.ldg-backed-matrix i {
  background: currentColor;
  border-radius: 999px;
  opacity: 0.25;
  animation: ldg-backed-wave 2.4s ease-in-out infinite;
  animation-delay: calc(var(--backed-d, 0) * 0.22s);
}

@keyframes ldg-backed-wave {
  0%, 70%, 100% { opacity: 0.25; }
  28% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .ldg-backed-matrix i {
    animation: none;
    opacity: 0.5;
  }
}

.ldg-backed-text {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.ldg-backed-line {
  display: block;
  flex: 1;
  min-width: 0;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ldg-backed-icon {
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.52);
}

.ldg-backed:hover .ldg-backed-icon {
  color: rgba(255, 255, 255, 0.72);
}

/* ---------------------------------------------------------------------------
   Live price ticker — slim strip pinned to the bottom of the hero
--------------------------------------------------------------------------- */

.ldg-ticker {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  height: 38px;
  background: #0f0f0f;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  overflow: hidden;
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* display:flex above would defeat the hidden attribute — restore it. */
.ldg-ticker[hidden] {
  display: none;
}

.ldg-ticker:hover {
  color: #fff;
}

.ldg-ticker-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 0 14px;
  height: 100%;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  font-weight: 500;
}

.ldg-ticker-live i {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--ldg-orange);
  animation: ldg-live-pulse 2s ease-in-out infinite;
}

@keyframes ldg-live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.ldg-ticker-viewport {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  height: 100%;
  display: flex;
  align-items: center;
  /* Fade the run-off edges */
  mask-image: linear-gradient(to right, transparent, #000 24px, #000 calc(100% - 24px), transparent);
}

.ldg-ticker-track {
  display: inline-flex;
  gap: 28px;
  padding: 0 14px;
  width: max-content;
  white-space: nowrap;
  animation: ldg-tick 45s linear infinite;
  font-variant-numeric: tabular-nums;
}

.ldg-ticker:hover .ldg-ticker-track {
  animation-play-state: paused;
}

@keyframes ldg-tick {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.ldg-ticker-item {
  flex-shrink: 0;
}

.ldg-ticker-item--you {
  color: var(--ldg-orange);
}

@media (prefers-reduced-motion: reduce) {
  .ldg-ticker-track {
    animation: none;
  }

  .ldg-ticker-viewport {
    overflow-x: auto;
    mask-image: none;
  }

  .ldg-ticker-live i {
    animation: none;
  }
}

/* ---------------------------------------------------------------------------
   Underwater panel — the clip plus one line and a CTA into the app
--------------------------------------------------------------------------- */

.ldg-panel-deep {
  border-top: 1px solid var(--ldg-grid);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ldg-deep-video {
  top: 0;
  height: 100%;
}

.ldg-deep-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1rem, 2.2vw, 1.5rem);
  padding: 0 max(var(--ppx-page-inset, 20px), env(safe-area-inset-left, 0px));
  text-align: center;
}

.ldg-deep-line {
  margin: 0;
  font-family: var(--font-wordmark, 'DM Sans', sans-serif);
  font-size: clamp(1.5rem, 3.2vw, 2.5rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  color: #fff;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.55);
}

.ldg-deep-cta {
  min-height: 42px;
  padding: 10px 22px;
  font-size: 0.875rem;
}

/* ---------------------------------------------------------------------------
   Footer — shared .site-footer, scrolls in below the panels
--------------------------------------------------------------------------- */

body.ldg-mistral .site-footer {
  --bg: var(--ldg-bg);
  --text: var(--ldg-text);
  --border: var(--ldg-grid);
  --footer-rule: var(--ldg-grid);
  --footer-muted: color-mix(in srgb, var(--ldg-text) 48%, transparent);
  --footer-muted-hover: color-mix(in srgb, var(--ldg-text) 78%, transparent);
  position: relative;
  z-index: 1;
  margin: 0;
  background: var(--ldg-bg);
  border-top: 1px solid var(--ldg-grid);
  padding: clamp(2rem, 4vw, 3rem) max(clamp(20px, 2vw, 32px), env(safe-area-inset-right, 0px))
    clamp(2rem, 4vw, 3rem) max(clamp(20px, 2vw, 32px), env(safe-area-inset-left, 0px));
}

body.ldg-mistral .site-footer .footer-brand.site-wordmark {
  font-family: var(--font-wordmark, 'DM Sans', system-ui, sans-serif);
}

/* ---------------------------------------------------------------------------
   Responsive
--------------------------------------------------------------------------- */

@media (max-width: 899px) {
  .ldg-header-cta--desktop {
    display: none;
  }

  /* The grid icon replaces the "Learn more" text as the dropdown trigger. The
     label stays in the a11y tree (visually hidden) so the button keeps its name. */
  .ldg-learn-more-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  .ldg-menu-grid {
    display: grid;
  }

  .ldg-learn-more summary {
    min-width: 44px;
    min-height: 44px;
    padding: 0;
  }

  /* Stop the hero a little short of the screen so the underwater clip peeks in
     underneath as a scroll hint. svh (not dvh) keeps the height stable so it
     doesn't reflow when the phone's address bar collapses on scroll. */
  .ldg-panel-hero {
    min-height: 85dvh;
    min-height: 85svh;
  }

  /* Same height as the hero above it. */
  .ldg-panel-deep {
    min-height: 85dvh;
    min-height: 85svh;
  }

  .ldg-hero-video {
    object-position: center center;
  }
}

@media (max-width: 640px) {
  .ldg-hero-title {
    font-size: clamp(2.25rem, 10vw, 2.75rem);
  }

  .ldg-backed {
    left: max(10px, env(safe-area-inset-left, 0px));
    bottom: calc(env(safe-area-inset-bottom, 0px) + 16px + 38px);
    max-width: calc(100% - 20px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    gap: 8px;
    padding: 7px 10px;
  }

  .ldg-backed-line {
    font-size: 0.6875rem;
  }
}
