/**
 * Mon Chai - Landing Page Styles
 * Based on the Canva reference design
 */

/* ================================================================
   CSS Variables
   ================================================================ */
:root {
  --color-bg: #471217;
  --color-card: #feefde;
  --color-text: #471217;
  --color-divider: #dfb780;
  --color-white: #ffffff;
  --radius-card: 24px;
  --radius-input: 24px;
  --radius-cta: 20px;
  --font: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

/* ================================================================
   Reset & Base
   ================================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #1a1a1a;
  font-family: var(--font);
}

body {
  min-width: 100vw;
  min-height: 100dvh;
  color: var(--color-text);
}

/* ================================================================
   Landing Container
   ================================================================ */
.landing {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding:
    max(12px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  isolation: isolate;
}

/* ================================================================
   Background
   ================================================================ */
.bg-wrapper {
  position: absolute;
  inset: 0;
  z-index: -1;
}

.bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.bg-overlay {
  display: none;
}

.landing::after {
  display: none;
}

.landing::before {
  display: none;
}

/* ================================================================
   Card
   ================================================================ */
.card {
  position: relative;
  width: min(94%, 540px);
  max-height: calc(100dvh - 24px);
  padding: 10px 40px 16px;
  border-radius: var(--radius-card);
  border: none;
  background: var(--color-card);
  box-shadow: 6px 8px 24px rgba(0, 0, 0, 0.42);
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.card::-webkit-scrollbar {
  display: none;
}

/* ================================================================
   Logo
   ================================================================ */
.logo-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
}

.logo {
  display: block;
  width: 44.5%;
  max-width: 240px;
  height: auto;
  object-fit: contain;
}

/* ================================================================
   Divider
   ================================================================ */
.divider {
  width: 33.7%;
  max-width: 180px;
  height: 32px;
  margin: 14px 0 2px;
  justify-self: center;
  overflow: visible;
}

.divider img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* ================================================================
   Hero Title
   ================================================================ */
.hero {
  margin: 0 0 16px;
  width: 85.3%;
  text-align: center;
  font-family: var(--font);
  font-size: clamp(1.8rem, 3.35vw, 2.86rem);
  line-height: 1.09;
  letter-spacing: -0.056em;
  font-weight: 400;
  color: var(--color-text);
  justify-self: center;
}

.nowrap {
  white-space: nowrap;
}

/* ================================================================
   Lead Text
   ================================================================ */
.lead {
  margin: 0 0 28px;
  width: 85.3%;
  text-align: center;
  color: var(--color-text);
  font-family: var(--font);
  font-size: clamp(0.92rem, 1.56vw, 1.33rem);
  line-height: 1.16;
  letter-spacing: -0.038em;
  font-weight: 400;
  justify-self: center;
}

/* ================================================================
   CTA Buttons
   ================================================================ */
.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80.7%;
  height: 47px;
  margin-bottom: 16px;
  border: 1px solid var(--color-text);
  border-radius: var(--radius-cta);
  cursor: pointer;
  color: var(--color-white);
  font-family: var(--font);
  font-size: clamp(0.88rem, 1.42vw, 1.21rem);
  font-weight: 500;
  letter-spacing: 0;
  background: var(--color-text);
  box-shadow: 4px 5px 14px rgba(0, 0, 0, 0.22);
  text-shadow: 0.4px 0.4px 0.3px rgba(0, 0, 0, 0.28);
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
  justify-self: center;
}

.cta:hover,
.cta:focus-visible {
  outline: none;
  transform: translateY(-1px);
  background: #5a1a20;
  box-shadow: 5px 7px 18px rgba(0, 0, 0, 0.30);
}

.cta:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Secondary CTA — white bg */
.cta--secondary {
  color: var(--color-text);
  font-weight: 400;
  font-size: clamp(0.76rem, 1.1vw, 0.95rem);
  background: var(--color-white);
  border-color: rgba(71, 18, 23, 0.25);
  box-shadow: 2px 3px 10px rgba(0, 0, 0, 0.08);
  text-shadow: none;
  height: 42px;
  margin-bottom: 4px;
}

.cta--secondary:hover,
.cta--secondary:focus-visible {
  background: #fdf5ec;
  box-shadow: 3px 5px 14px rgba(0, 0, 0, 0.14);
  border-color: rgba(71, 18, 23, 0.4);
}

/* CTA "Créer un compte" — espace avant le CTA accès gratuits */
.cta--signup {
  margin-bottom: 14px;
  text-decoration: none;
}

/* ================================================================
   Footer Links
   ================================================================ */
.footer-links {
  width: 85.3%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 40px;
  padding-bottom: 4px;
  font-family: var(--font);
  font-size: clamp(0.72rem, 1.07vw, 0.92rem);
  font-weight: 700;
  justify-self: center;
}

.footer-links button {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font);
  font-size: inherit;
  font-weight: inherit;
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.footer-links button:hover,
.footer-links button:focus-visible {
  outline: none;
  opacity: 0.65;
}

/* ================================================================
   Modal System
   ================================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal.open {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  width: min(100%, 560px);
  max-height: calc(100dvh - 40px);
  background: var(--color-card);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s ease;
}

.modal.open .modal-card {
  transform: scale(1) translateY(0);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(71, 18, 23, 0.1);
}

.modal-head h2 {
  margin: 0;
  font-family: var(--font);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
}

.close-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(71, 18, 23, 0.08);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--color-text);
  transition: background 0.15s ease;
}

.close-btn:hover {
  background: rgba(71, 18, 23, 0.15);
}

/* ================================================================
   Modal Body (access form)
   ================================================================ */
.modal-body {
  padding: 24px;
  overflow-y: auto;
  font-family: var(--font);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--color-text);
}

.modal-lead {
  text-align: center;
  margin: 0 0 20px;
  font-size: clamp(0.85rem, 1.2vw, 1rem);
  line-height: 1.4;
}

/* ================================================================
   Legal Content (modals)
   ================================================================ */
.legal-content {
  padding: 24px;
  overflow-y: auto;
  font-family: var(--font);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--color-text);
}

.legal-content h3 {
  margin: 20px 0 10px;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
}

.legal-content h3:first-child {
  margin-top: 0;
}

.legal-content p {
  margin: 0 0 12px;
}

.legal-content strong {
  color: var(--color-text);
}

/* ================================================================
   Form (inside modal)
   ================================================================ */
.form {
  width: 100%;
  display: grid;
  gap: 14px;
  margin: 0;
}

.hp-field {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

/* ================================================================
   Email Input
   ================================================================ */
.email-input {
  width: 100%;
  height: 47px;
  padding: 0 22px;
  border-radius: var(--radius-input);
  border: 1px solid var(--color-text);
  outline: none;
  background: var(--color-white);
  color: var(--color-text);
  font-family: var(--font);
  font-size: clamp(0.92rem, 1.56vw, 1.33rem);
  font-weight: 400;
  box-shadow: 4px 5px 14px rgba(0, 0, 0, 0.22);
}

.email-input::placeholder {
  color: var(--color-text);
  opacity: 1;
}

.email-input:focus {
  border-color: var(--color-text);
  box-shadow:
    0 0 0 3px rgba(71, 18, 23, 0.12),
    4px 5px 14px rgba(0, 0, 0, 0.22);
}

/* ================================================================
   Consent
   ================================================================ */
.consent {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 10px;
  align-items: start;
  color: var(--color-text);
  font-family: var(--font);
  font-size: clamp(0.72rem, 1.07vw, 0.92rem);
  line-height: 1.36;
  letter-spacing: -0.04em;
  font-weight: 400;
  text-align: justify;
  cursor: pointer;
}

.consent input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin-top: 1px;
  accent-color: var(--color-text);
  cursor: pointer;
  border: 1px solid var(--color-text);
  border-radius: 2px;
}

.consent a {
  color: var(--color-text);
  text-decoration: underline;
}

.consent a:hover {
  opacity: 0.7;
}

/* ================================================================
   Form CTA (inside modal — full width)
   ================================================================ */
.form .cta {
  width: 100%;
  margin-bottom: 0;
  justify-self: center;
}

/* ================================================================
   Form Feedback
   ================================================================ */
.form-feedback {
  padding: 12px 16px;
  border-radius: 4px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
}

.form-feedback--success {
  background: rgba(34, 139, 34, 0.12);
  color: #1a5c1a;
  border: 1px solid rgba(34, 139, 34, 0.25);
}

.form-feedback--error {
  background: rgba(180, 40, 40, 0.1);
  color: #8b1a1a;
  border: 1px solid rgba(180, 40, 40, 0.2);
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

/* Large Desktop (1200px+) */
@media (min-width: 1200px) {
  .card {
    width: min(42%, 560px);
    padding: 12px 44px 18px;
  }

  .hero {
    font-size: clamp(2.2rem, 3.35vw, 2.86rem);
  }

  .lead {
    font-size: clamp(1.1rem, 1.7vw, 1.5rem);
  }
}

@media (min-width: 1500px) {
  .lead {
    font-size: clamp(0.2rem, 1.2vw, 1.6rem);
  }
}

/* Tablet (max 900px) */
@media (max-width: 900px) {
  .card {
    width: min(88%, 520px);
    padding: 10px 32px 16px;
  }

  .hero {
    font-size: clamp(1.6rem, 4.8vw, 2.6rem);
  }

  .lead {
    font-size: clamp(0.88rem, 2.4vw, 1.18rem);
  }
}

/* Mobile (max 680px) */
@media (max-width: 680px) {
  .landing {
    padding:
      max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
  }

  .card {
    width: min(96%, 480px);
    max-height: calc(100dvh - 16px);
    padding: 8px 24px 14px;
    border-radius: 20px;
  }

  .logo {
    max-width: 200px;
  }

  .divider {
    max-width: 150px;
    height: 26px;
    margin: 10px 0 2px;
  }

  .hero {
    font-size: clamp(1.5rem, 5.8vw, 2.2rem);
    margin: 0 0 12px;
  }

  .lead {
    font-size: clamp(0.84rem, 3.2vw, 1.08rem);
    margin: 0 0 16px;
  }

  .cta { height: 44px; width: 85%; }
  .cta--secondary { height: 40px; width: 85%; }

  .email-input {
    height: 44px;
    font-size: 0.95rem;
    padding: 0 18px;
  }

  .footer-links {
    margin-top: 28px;
    font-size: 0.7rem;
    gap: 14px;
  }
}

/* Small Mobile (max 420px) or Short viewport (max-height 760px) */
@media (max-width: 420px), (max-height: 760px) {
  .card {
    width: min(97%, 420px);
    padding: 8px 20px 12px;
    border-radius: 18px;
  }

  .logo {
    max-width: 170px;
  }

  .divider {
    max-width: 130px;
    height: 22px;
    margin: 8px 0 2px;
  }

  .hero {
    font-size: clamp(1.35rem, 5.5vw, 1.9rem);
    margin: 0 0 10px;
  }

  .lead {
    font-size: clamp(0.78rem, 2.8vw, 0.95rem);
    margin: 0 0 12px;
  }

  .cta { height: 42px; font-size: 0.88rem; border-radius: 18px; width: 88%; }
  .cta--secondary { height: 38px; font-size: 0.78rem; border-radius: 18px; width: 88%; }

  .email-input {
    height: 42px;
    font-size: 0.88rem;
    padding: 0 16px;
    border-radius: 20px;
  }

  .form {
    gap: 10px;
  }

  .consent {
    font-size: 0.65rem;
  }

  .footer-links {
    margin-top: 22px;
    font-size: 0.65rem;
    gap: 12px;
  }
}

/* Very Short Screens (max-height 620px) */
@media (max-height: 620px) {
  .landing {
    padding: 6px;
  }

  .card {
    max-height: calc(100dvh - 12px);
    padding: 6px 18px 10px;
    gap: 0;
  }

  .logo {
    max-width: 140px;
  }

  .divider {
    max-width: 110px;
    height: 18px;
    margin: 6px 0 1px;
  }

  .hero {
    font-size: clamp(1.2rem, 3.8vh, 1.65rem);
    margin: 0 0 6px;
  }

  .lead {
    font-size: clamp(0.7rem, 1.8vh, 0.88rem);
    margin: 0 0 8px;
  }

  .cta { height: 38px; font-size: 0.82rem; border-radius: 16px; }
  .cta--secondary { height: 34px; font-size: 0.74rem; border-radius: 16px; }

  .email-input {
    height: 38px;
    font-size: 0.82rem;
    padding: 0 14px;
  }

  .form {
    gap: 6px;
  }

  .consent {
    font-size: 0.58rem;
  }

  .footer-links {
    margin-top: 14px;
    font-size: 0.58rem;
    gap: 10px;
  }
}

/* Wide but Short (Nest Hub, etc.) */
@media (min-width: 900px) and (max-height: 650px) {
  .card {
    width: min(46%, 480px);
    padding: 6px 28px 10px;
    gap: 0;
  }

  .logo {
    max-width: 130px;
  }

  .divider {
    max-width: 100px;
    height: 16px;
    margin: 6px 0 1px;
  }

  .hero {
    font-size: clamp(1.2rem, 3.5vh, 1.6rem);
    margin: 0 0 6px;
  }

  .lead {
    font-size: clamp(0.68rem, 1.7vh, 0.85rem);
    margin: 0 0 8px;
  }

  .cta { height: 36px; font-size: 0.8rem; }
  .cta--secondary { height: 34px; font-size: 0.74rem; }

  .email-input {
    height: 36px;
    font-size: 0.8rem;
    padding: 0 14px;
  }

  .consent {
    font-size: 0.56rem;
  }

  .footer-links {
    margin-top: 12px;
    font-size: 0.56rem;
    gap: 10px;
  }
}
