/* ══════════════════════════════════════════════
   Enshryned — Landing Page Styles
   Design tokens match Flutter app (AppColors, AppRadius)
   ══════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  /* Colors — from Flutter AppColors */
  --color-bg: #121319;
  --color-surface: #1E293B;
  --color-text: #F1F5F9;
  --color-text-hint: #B1A9D9;
  --color-text-secondary: #9CA3AF;
  --color-text-tertiary: #6B7280;
  --color-primary: #6F6CFF;
  --color-primary-hover: #5B58E0;
  --color-gold: #F0AD00;
  --color-success: #4EBE86;
  --color-error: #EF4444;
  --color-white: #ffffff;

  /* Glass */
  --glass-base: rgba(18, 19, 25, 0.5);
  --glass-tint: rgba(77, 0, 232, 0.1);
  --glass-border: rgba(255, 255, 255, 0.08);

  /* Form */
  --form-border: rgba(255, 255, 255, 0.25);
  --form-fill: rgba(255, 255, 255, 0.03);

  /* Radii — from Flutter AppRadius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;
  --space-5xl: 8rem;

  /* Responsive section spacing (overridden in breakpoints) */
  --section-pad-y: 3rem;
  --section-gap: 2.5rem;

  /* Layout */
  --max-width: 720px;
  --max-width-wide: 1120px;

  /* Font */
  --font-body: 'Montserrat', system-ui, -apple-system, sans-serif;
}

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

/* ── Base ── */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* Dot grid background */
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    radial-gradient(ellipse at 20% 50%, rgba(111, 108, 255, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(111, 108, 255, 0.04) 0%, transparent 40%);
  background-size:
    32px 32px,
    100% 100%,
    100% 100%;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── Layout ── */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container--wide {
  max-width: var(--max-width-wide);
}

/* ── Navigation ── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: var(--space-lg) 0;
  transition: background-color 0.3s, backdrop-filter 0.3s, border-color 0.3s;
  border-bottom: 1px solid transparent;
}

.nav.is-scrolled {
  background-color: var(--glass-base);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: var(--glass-border);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.nav__logo {
  display: flex;
  align-items: center;
}

.nav__logo:hover {
  text-decoration: none;
}

.nav__logo-img {
  height: 75px;
  width: auto;
}

.nav__cta {
  display: inline-block;
  padding: 0.75rem 2rem;
  background-color: var(--color-primary);
  color: var(--color-white);
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: 999px;
  transition: background-color 0.2s, transform 0.2s;
}

.nav__cta:hover {
  background-color: var(--color-primary-hover);
  color: var(--color-white);
  text-decoration: none;
  transform: translateY(-1px);
}

/* ── Hero ── */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

/* Full-bleed background image */
.hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero__bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center right;
}

/* Gradient overlay: dark at bottom for text readability, transparent at top to show image */
.hero__bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    var(--color-bg) 0%,
    rgba(18, 19, 25, 0.85) 30%,
    rgba(18, 19, 25, 0.4) 60%,
    rgba(18, 19, 25, 0.15) 100%
  );
}

/* Text content sits at bottom, overlapping image slightly */
.hero__content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding-bottom: var(--space-5xl);
  padding-top: var(--space-5xl);
  width: 100%;
}

.hero__slogan {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-gold);
  margin-bottom: var(--space-lg);
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

/* Line breaks only shown on mobile */
.hero__break {
  display: none;
}

.hero__subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--color-text);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.7;
  margin-bottom: var(--space-2xl);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}

/* CTA button with glow */
.hero__cta-wrap {
  position: relative;
  display: inline-block;
}

.hero__cta-wrap::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(111, 108, 255, 0.4), rgba(240, 173, 0, 0.2), rgba(111, 108, 255, 0.4));
  background-size: 200% 200%;
  animation: glow-shift 4s ease-in-out infinite;
  filter: blur(16px);
  z-index: -1;
  opacity: 0.7;
}

.hero__cta {
  display: inline-block;
  padding: 1rem 2.5rem;
  background-color: var(--color-primary);
  color: var(--color-white);
  font-size: 1.0625rem;
  font-weight: 700;
  border-radius: 999px;
  transition: background-color 0.2s, transform 0.2s;
  position: relative;
}

.hero__cta:hover {
  background-color: var(--color-primary-hover);
  color: var(--color-white);
  text-decoration: none;
  transform: translateY(-2px);
}

@keyframes glow-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ── Section Shared ── */
.section {
  padding: var(--section-pad-y) 0;
}

.section__label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-primary);
  margin-bottom: var(--space-sm);
}

.section__title {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  color: var(--color-white);
  line-height: 1.2;
  margin-bottom: var(--space-md);
}

.section__text {
  font-size: 1rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
  max-width: 480px;
}

/* ── Features ── */
.features {
  padding: var(--section-pad-y) 0;
  padding-top: var(--space-4xl);
}

.feature {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
  align-items: center;
  margin-bottom: var(--section-gap);
}

.feature:last-child {
  margin-bottom: 0;
}

.feature__content {
  order: 1;
}

.feature__phone {
  order: 2;
}

/* ── Phone Frame (CSS mockup) ── */
.phone-frame {
  position: relative;
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
  aspect-ratio: 9 / 19.5;
  border-radius: 36px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  background-color: var(--color-surface);
  overflow: hidden;
}

/* Notch */
.phone-frame::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40%;
  height: 24px;
  background-color: var(--color-bg);
  border-radius: 0 0 16px 16px;
  z-index: 2;
}

.phone-frame__screen {
  position: absolute;
  inset: 3px;
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(18, 19, 25, 0.8);
}

.phone-frame__screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.phone-frame__placeholder {
  color: var(--color-text-tertiary);
  font-size: 0.75rem;
  text-align: center;
  padding: var(--space-md);
}

/* ── Testimonial ── */
.testimonial {
  padding: var(--section-pad-y) 0;
}

.testimonial__card {
  background: var(--glass-base);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-2xl);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  max-width: 640px;
  margin: 0 auto;
}

.testimonial__card::before {
  content: '\201C';
  position: absolute;
  top: -0.1em;
  left: var(--space-lg);
  font-size: 6rem;
  line-height: 1;
  color: var(--color-primary);
  opacity: 0.2;
  font-family: Georgia, serif;
}

.testimonial__quote {
  font-size: 1.0625rem;
  color: var(--color-text);
  line-height: 1.8;
  font-style: italic;
  margin-bottom: var(--space-xl);
  position: relative;
  z-index: 1;
}

.testimonial__author {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}

.testimonial__role {
  font-size: 0.8125rem;
  color: var(--color-text-tertiary);
}

/* ── Signup Section ── */
.signup {
  padding: var(--section-pad-y) 0 var(--space-5xl);
}

.signup__box {
  background: var(--glass-base);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  text-align: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  max-width: 540px;
  margin: 0 auto;
}

.signup__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-white);
  margin-bottom: var(--space-sm);
}

.signup__subtitle {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xl);
}

.signup__privacy {
  font-size: 0.8125rem;
  color: var(--color-text-tertiary);
  margin-top: var(--space-lg);
}

.signup__privacy a {
  color: var(--color-text-hint);
}

/* ── Form ── */
.form {
  max-width: 400px;
  margin: 0 auto;
  text-align: left;
}

.form__group {
  margin-bottom: var(--space-lg);
}

.form__label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}

.form__input,
.form__select,
.form__textarea {
  width: 100%;
  padding: var(--space-md);
  background-color: var(--form-fill);
  border: 1px solid var(--form-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  transition: border-color 0.2s;
}

.form__input:focus,
.form__select:focus,
.form__textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

.form__input::placeholder,
.form__textarea::placeholder {
  color: var(--color-text-tertiary);
}

.form__select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239CA3AF' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-md) center;
  padding-right: var(--space-2xl);
  cursor: pointer;
}

.form__textarea {
  min-height: 80px;
  resize: vertical;
}

.form__error {
  color: var(--color-error);
  font-size: 0.8125rem;
  margin-top: var(--space-xs);
  display: none;
}

.form__error.is-visible {
  display: block;
}

/* Honeypot — visually hidden from humans */
.form__hp {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
  overflow: hidden;
  pointer-events: none;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-md) var(--space-xl);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.2s, opacity 0.2s;
}

.btn--primary {
  background-color: var(--color-primary);
  color: var(--color-white);
}

.btn--primary:hover {
  background-color: var(--color-primary-hover);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn__spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--color-white);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn.is-loading .btn__text {
  display: none;
}

.btn.is-loading .btn__spinner {
  display: block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Success Message ── */
.signup__success {
  display: none;
  text-align: center;
  padding: var(--space-xl) 0;
}

.signup__success.is-visible {
  display: block;
}

.signup__success-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

.signup__success-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-white);
  margin-bottom: var(--space-sm);
}

.signup__success-text {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
}

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--glass-border);
  padding: var(--space-xl) 0;
  text-align: center;
}

.footer__social {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-md);
}

.footer__links {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.footer__links a {
  color: var(--color-text-secondary);
  font-size: 0.8125rem;
}

.footer__links a:hover {
  color: var(--color-text);
  text-decoration: none;
}

.footer__copy {
  font-size: 0.75rem;
  color: var(--color-text-tertiary);
}

/* ── Legal Pages ── */
.legal {
  padding: var(--space-3xl) 0;
  padding-top: 6rem;
}

.legal h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-white);
  margin-bottom: var(--space-sm);
  letter-spacing: -0.02em;
}

.legal .legal__updated {
  font-size: 0.8125rem;
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-2xl);
}

.legal h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-white);
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
}

.legal p,
.legal li {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.7;
}

.legal ul,
.legal ol {
  padding-left: var(--space-xl);
  margin-bottom: var(--space-md);
}

.legal li {
  margin-bottom: var(--space-sm);
}

.legal a {
  color: var(--color-primary);
}

.legal table {
  width: 100%;
  margin-bottom: var(--space-xl);
  border-collapse: collapse;
}

.legal td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--glass-border);
  color: var(--color-text-secondary);
  vertical-align: top;
  line-height: 1.7;
}

/* ── Utilities ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Progressive Enhancement ──
   Elements start visible. Only hidden when JS loads
   and adds the .js-loaded class to <html>. */
html.js-loaded [data-animate] {
  opacity: 0;
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  html.js-loaded [data-animate] {
    opacity: 1;
  }

  .hero__cta-wrap::before {
    animation: none;
  }
}

/* ── Responsive ── */

/* Mobile (max-width: 639px) */
@media (max-width: 639px) {
  /* Nav */
  .nav {
    padding: var(--space-md) 0;
  }

  .nav__logo-img {
    height: 52px;
  }

  .nav__cta {
    padding: 0.5rem 1.25rem;
    font-size: 0.8125rem;
  }

  /* Hero slogan line breaks on mobile */
  .hero__break {
    display: initial;
  }

  /* Hero — don't consume full viewport */
  .hero {
    min-height: 85vh;
    min-height: 85svh;
  }

  .hero__bg-img {
    object-position: center center;
  }

  .hero__content {
    padding-bottom: var(--space-2xl);
    padding-top: var(--space-4xl);
  }

  /* Features */
  .feature {
    gap: var(--space-xl);
  }

  .feature__content {
    text-align: center;
  }

  .feature__content .section__text {
    margin-left: auto;
    margin-right: auto;
  }

  /* Phone frames — scale with viewport */
  .phone-frame {
    width: 75%;
    max-width: 280px;
    border-radius: 28px;
  }

  .phone-frame__screen {
    border-radius: 20px;
  }

  /* Testimonial */
  .testimonial__card {
    padding: var(--space-xl) var(--space-lg);
  }

  .testimonial__card::before {
    font-size: 4rem;
  }

  /* Form — prevent iOS Safari auto-zoom */
  .form__input,
  .form__select,
  .form__textarea {
    font-size: 1rem;
  }

  .signup__box {
    padding: var(--space-xl) var(--space-lg);
  }

  .form__group {
    margin-bottom: var(--space-xl);
  }

  /* Footer — stack links vertically */
  .footer__links {
    flex-direction: column;
    gap: 0;
  }

  .footer__links a {
    display: block;
    padding: 0.75rem 0;
    font-size: 0.875rem;
  }

  /* Legal tables — stack cells vertically */
  .legal table {
    display: block;
  }

  .legal tbody {
    display: block;
  }

  .legal tr {
    display: block;
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--glass-border);
  }

  .legal td {
    display: block;
    padding: var(--space-xs) 0;
    border-bottom: none;
  }

  .legal td:first-child {
    font-weight: 600;
    color: var(--color-text);
  }

  /* Legal page top spacing */
  .legal {
    padding-top: 5rem;
  }
}

/* Tablet (min-width: 640px) */
@media (min-width: 640px) {
  :root {
    --section-pad-y: 4rem;
    --section-gap: 3rem;
  }

  .container {
    padding: 0 var(--space-xl);
  }

  .phone-frame {
    max-width: 300px;
  }

  /* Two-column feature grid at tablet */
  .feature {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2xl);
  }

  .feature:nth-child(even) .feature__content {
    order: 2;
  }

  .feature:nth-child(even) .feature__phone {
    order: 1;
  }
}

/* Desktop (min-width: 1024px) */
@media (min-width: 1024px) {
  :root {
    --section-pad-y: 6rem;
    --section-gap: 6rem;
  }

  .hero__content {
    padding-bottom: 10rem;
  }

  .features {
    padding-top: 8rem;
  }

  .feature {
    gap: var(--space-3xl);
  }

  .hero__slogan {
    font-size: clamp(3rem, 6vw, 4.5rem);
  }
}

/* ── Progressive Enhancements ── */

/* Safe area insets for notched iPhones */
@supports (padding: env(safe-area-inset-top)) {
  .nav {
    padding-top: max(var(--space-lg), env(safe-area-inset-top));
  }

  @media (max-width: 639px) {
    .nav {
      padding-top: max(var(--space-md), env(safe-area-inset-top));
    }
  }

  .footer {
    padding-bottom: max(var(--space-xl), env(safe-area-inset-bottom));
  }
}

/* Remove tap highlight on touch devices */
@media (hover: none) {
  a,
  button {
    -webkit-tap-highlight-color: transparent;
  }
}

/* Overscroll containment */
html {
  overscroll-behavior-y: contain;
}

/* Touch active states */
@media (hover: none) {
  .hero__cta:active,
  .nav__cta:active,
  .btn:active:not(:disabled) {
    transform: scale(0.97);
  }

  .footer__links a:active {
    color: var(--color-text);
  }
}
