/* Additions on top of style.css (compiled original styles).
   Replaces behaviour that the original React app provided. */

/* ---- scroll-reveal fallback -------------------------------------------------
   style.css animates .reveal-section with `animation-timeline: view()`, which
   only Chromium supports. main.js adds .no-view-timeline on other browsers and
   toggles .is-inview through IntersectionObserver instead. */
.no-view-timeline .reveal-section {
  animation: none;
  opacity: 0;
  transform: translateY(42px);
}

.no-view-timeline .reveal-section.is-inview {
  opacity: 1;
  transform: none;
  transition: opacity .8s ease-out, transform .8s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .no-view-timeline .reveal-section {
    opacity: 1;
    transform: none;
  }
}

/* ---- tabs: long labels ("For experienced traders") wrap instead of being clipped
   in the 2-column grid on narrow screens ------------------------------------ */
[data-tabs] [role="tab"] {
  white-space: normal;
  text-align: center;
  overflow-wrap: anywhere;
}

/* ---- mobile menu ---------------------------------------------------------- */
#mobile-nav:not([hidden]) {
  animation: readout-in .25s ease-out both;
}

/* ---- lead form ------------------------------------------------------------ */
.consent-checkbox {
  -webkit-appearance: none;
  appearance: none;
  display: grid;
  flex: none;
  place-content: center;
  width: 1rem;
  height: 1rem;
  margin: .125rem 0 0;
  border: 1px solid var(--primary);
  border-radius: calc(var(--radius) - 4px); /* same as the original .rounded-sm */
  background: transparent;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);
  cursor: pointer;
  transition: background-color .15s;
}

.consent-checkbox:checked {
  background: var(--primary);
}

.consent-checkbox:checked::after {
  content: "";
  width: .75rem;
  height: .75rem;
  background: var(--primary-foreground);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.consent-checkbox:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px var(--ring);
}

.signup_form .input-box input.is-error {
  border-color: var(--destructive);
}

.signup_form .form-status.is-error {
  color: var(--destructive);
  font-weight: 600;
}

.signup_form .custom_btn[aria-busy="true"] {
  cursor: progress;
}

/* ---- 320px safety net -------------------------------------------------------
   Long unbroken words / wide flex rows must never create horizontal scroll. */
html {
  overflow-x: clip;
}

@media (max-width: 380px) {
  .signup_form .custom_btn {
    white-space: normal;
    height: auto;
    min-height: 3.25rem;
    padding-block: .5rem;
    text-align: center;
  }
}

/* ---- responsive header -----------------------------------------------------
   The translated desktop navigation needs more room than the English version.
   Tablets use the compact menu; the CTA remains available inside that menu. */
.header-logo {
  flex: none;
  white-space: nowrap;
}

.mobile-nav-cta {
  display: none;
}

@media (max-width: 1023px) {
  header > nav {
    display: none !important;
  }

  header [data-nav-toggle] {
    display: inline-flex !important;
  }

  #mobile-nav:not([hidden]) {
    display: block !important;
  }

  .header-cta {
    display: none;
  }

  #mobile-nav nav {
    gap: .5rem;
  }

  .mobile-nav-cta {
    display: inline-flex;
    margin: .75rem .5rem .5rem;
  }
}

/* ---- page dimming while the mobile menu is open ---------------------------
   Sits under the header (z-30) and over the page content; click closes the menu. */
.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgb(0 0 0 / .65);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .25s ease, visibility 0s linear .25s;
}

.nav-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .25s ease;
}

@media (min-width: 1024px) {
  .nav-backdrop {
    display: none;
  }
}

@media (min-width: 640px) and (max-width: 1180px) {
  h1[class~="lg:text-[6.6rem]"] {
    font-size: clamp(3.6rem, 7.5vw, 5.25rem) !important;
    line-height: .9 !important;
  }

  h1[class~="lg:text-[6.6rem]"] .block {
    white-space: normal;
  }
}
/* Language navigation */
.language-dropdown {
  position: relative;
  z-index: 70;
  inline-size: max-content;
}

.language-dropdown summary {
  display: inline-flex;
  width: 100%;
  min-height: 2.25rem;
  align-items: center;
  gap: .4rem;
  padding: .35rem .55rem;
  border: 1px solid var(--border);
  background: color-mix(in oklab, var(--background) 88%, transparent);
  color: var(--foreground);
  font-size: .72rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.language-dropdown summary::-webkit-details-marker { display: none; }

.language-dropdown .flag {
  width: 1.25rem;
  height: auto;
  border: 1px solid color-mix(in oklab, var(--foreground) 20%, transparent);
  object-fit: cover;
}

.lang-menu {
  position: absolute;
  top: calc(100% + .4rem);
  left: 0;
  display: grid;
  width: 100%;
  min-width: 100%;
  border: 1px solid var(--border);
  background: var(--background);
  box-shadow: var(--shadow-glass);
}

.lang-menu a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .6rem .25rem;
  color: var(--muted-foreground);
  font-size: .75rem;
  font-weight: 700;
}

.lang-menu a:hover,
.lang-menu a[aria-current="page"] {
  background: var(--accent);
  color: var(--foreground);
}

/* Long translated headings must remain within narrow viewports. */
h1, h2, h3, .modal-content {
  overflow-wrap: anywhere;
  hyphens: auto;
}

.modal-content h2,
.modal-content h3 {
  max-width: 100%;
  line-height: 1.15;
}

@media (max-width: 639px) {
  h1 {
    width: 100%;
    max-width: 100% !important;
    font-size: clamp(2rem, 10vw, 3rem) !important;
    line-height: .95 !important;
  }
  h1 .block { white-space: normal; }
  .header-logo { min-width: 0; }
  .header-logo .text-lg { font-size: .9rem; }
  .header-cta { display: none; }
  .language-dropdown summary { min-height: 2.25rem; padding-inline: .45rem; }
  .modal-content { width: calc(100vw - 1.5rem); max-width: calc(100vw - 1.5rem); padding: 1.25rem; }
  .modal-content h2 {
    padding-right: 2rem;
    font-size: clamp(1.1rem, 4.8vw, 1.45rem) !important;
    word-break: normal;
  }
  .modal-content h3 { font-size: clamp(1.05rem, 5vw, 1.35rem); }
}
