/* =============================================
   Landaways Website
   Modern CSS: layers, nesting, color-mix,
   scroll-driven animations, container queries
   ============================================= */

@layer reset, base, layout, components, animations;

/* ---- Reset ---- */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
  body { min-height: 100dvh; }
  img, svg { display: block; max-width: 100%; }
  a { text-decoration: none; color: inherit; }
  button, input { font: inherit; border: none; background: none; }
  ul, ol { list-style: none; }
}

/* ---- Base ---- */
@layer base {
  @property --glow-spread {
    syntax: '<length>';
    initial-value: 80px;
    inherits: false;
  }

  :root {
    --bg:            #000000;
    --bg-alt:        #0a0a0a;
    --surface:       #1C1C1E;
    --surface-hover: #262A34;
    --primary:       #FFC700;
    --primary-dim:   rgba(255, 199, 0, 0.10);
    --primary-glow:  rgba(255, 199, 0, 0.06);
    --accent:        #FFC700;
    --text:          #f0f0f0;
    --text-muted:    #8A8A8A;
    --border:        #2C2C2E;
    --radius:        12px;
    --radius-lg:     20px;
  }

  body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  h1, h2, h3 {
    line-height: 1.1;
    text-wrap: balance;
    font-weight: 700;
    letter-spacing: -0.02em;
  }

  h1 { font-size: clamp(2.5rem, 5vw + 1rem, 4.5rem); letter-spacing: -0.03em; }
  h2 { font-size: clamp(1.75rem, 3vw + 0.5rem, 2.75rem); }
  h3 { font-size: 1.2rem; }

  ::selection {
    background: color-mix(in srgb, var(--primary) 30%, transparent);
    color: var(--text);
  }
}

/* ---- Layout ---- */
@layer layout {
  .container {
    width: min(1200px, 100% - 2.5rem);
    margin-inline: auto;
  }

  section {
    padding-block: clamp(4rem, 8vw, 7rem);
  }

  .section-header {
    text-align: center;
    max-width: 580px;
    margin: 0 auto 3.5rem;

    & p {
      color: var(--text-muted);
      margin-top: 0.75rem;
      font-size: 1.05rem;
    }
  }
}

/* ---- Components ---- */
@layer components {

  /* ---- Nav ---- */
  .nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 1.1rem 0;
    transition: background 0.35s, padding 0.35s, border-color 0.35s;
    border-bottom: 1px solid transparent;

    &.scrolled {
      background: color-mix(in srgb, var(--bg) 80%, transparent);
      backdrop-filter: blur(20px) saturate(1.6);
      -webkit-backdrop-filter: blur(20px) saturate(1.6);
      border-bottom-color: color-mix(in srgb, white 6%, transparent);
      padding: 0.65rem 0;
    }
  }

  .nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .nav-logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.02em;

    & img { height: 32px; width: auto; }
  }

  .nav-links {
    display: flex;
    align-items: center;
    gap: 2.25rem;

    & a:not(.btn) {
      color: var(--text-muted);
      font-weight: 500;
      font-size: 0.9rem;
      transition: color 0.2s;
      &:hover { color: var(--text); }
    }
  }

  .nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 6px;

    & span {
      display: block;
      width: 20px;
      height: 2px;
      background: var(--text);
      border-radius: 2px;
      transition: transform 0.3s, opacity 0.3s;
    }

    &[aria-expanded="true"] {
      & span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
      & span:nth-child(2) { opacity: 0; }
      & span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
    }
  }

  /* ---- Buttons ---- */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.75rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
    white-space: nowrap;

    &:active { transform: scale(0.97); }
  }

  .btn-primary {
    background: var(--primary);
    color: #0a0a0a;

    &:hover {
      background: color-mix(in srgb, var(--primary) 88%, white);
      box-shadow: 0 0 28px var(--primary-dim), 0 4px 12px rgba(0,0,0,0.2);
    }
  }

  .btn-ghost {
    color: var(--text-muted);
    border: 1px solid var(--border);

    &:hover {
      color: var(--text);
      border-color: color-mix(in srgb, white 14%, transparent);
      background: color-mix(in srgb, white 3%, transparent);
    }
  }

  .btn-sm {
    padding: 0.5rem 1.2rem;
    font-size: 0.85rem;
  }

  /* ---- Hero ---- */
  .hero {
    padding-top: 5.5rem;
    padding-bottom: 0;
    overflow: hidden;
    background:
      radial-gradient(ellipse 70% 55% at 50% -5%, color-mix(in srgb, var(--primary) 7%, transparent), transparent 70%),
      var(--bg);
  }

  .hero-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
    min-height: auto;
    padding-block: 2rem 2.5rem;
  }

  .hero-content {
    & p {
      color: var(--text-muted);
      font-size: 1.15rem;
      max-width: 460px;
      margin-top: 1.25rem;
      line-height: 1.65;
    }
  }

  .badge {
    display: inline-block;
    padding: 0.35rem 1rem;
    background: var(--primary-dim);
    color: var(--primary);
    border-radius: 100px;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 1.75rem;
    border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
    letter-spacing: 0.02em;
  }

  .hero-actions {
    display: flex;
    gap: 0.85rem;
    margin-top: 2.5rem;
    flex-wrap: wrap;
  }

  /* ---- Phone Mockup ---- */
  .hero-visual {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 0;
  }

  .phone {
    width: 270px;
    aspect-ratio: 9 / 19.5;
    border: 2px solid color-mix(in srgb, white 10%, transparent);
    border-radius: 38px;
    background: #000;
    padding: 5px;
    position: relative;
    box-shadow:
      0 0 0 1px color-mix(in srgb, white 3%, transparent),
      0 40px 100px -30px rgba(0,0,0,0.7),
      0 0 var(--glow-spread) color-mix(in srgb, var(--primary) 6%, transparent);
    transform: perspective(1200px) rotateY(-5deg) rotateX(2deg);
    transition: --glow-spread 0.4s;

    &:hover { --glow-spread: 120px; }
  }

  .phone-screen {
    border-radius: 33px;
    overflow: hidden;
    height: 100%;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    position: relative;
  }

  .phone-notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 90px;
    height: 24px;
    background: #000;
    border-radius: 0 0 16px 16px;
    z-index: 2;
  }

  .screen-map {
    flex: 1;
    position: relative;
    background: linear-gradient(155deg, #1a1a1a, #111, #0d0d0d);
  }

  .map-grid {
    position: absolute;
    inset: 0;
    background:
      linear-gradient(color-mix(in srgb, white 3%, transparent) 1px, transparent 1px),
      linear-gradient(90deg, color-mix(in srgb, white 3%, transparent) 1px, transparent 1px);
    background-size: 36px 36px;
  }

  .marker {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: 7px;
    height: 7px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 6px color-mix(in srgb, var(--primary) 50%, transparent);
    transform: translate(-50%, -50%);
  }

  .marker.selected {
    width: 13px;
    height: 13px;
    box-shadow:
      0 0 12px color-mix(in srgb, var(--primary) 45%, transparent),
      0 0 4px var(--primary);
    animation: pulse-marker 2.5s ease-in-out infinite;
  }

  .screen-sheet {
    background: #1C1C1E;
    padding: 7px 12px 6px;
    border-radius: 10px 10px 0 0;
  }

  .sheet-handle {
    width: 28px;
    height: 3px;
    background: #3a3a3c;
    border-radius: 3px;
    margin: 0 auto 6px;
  }

  .sheet-card {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .sheet-dot {
    width: 7px;
    height: 7px;
    background: var(--primary);
    border-radius: 50%;
    flex-shrink: 0;
  }

  .sheet-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text);
  }

  .sheet-sub {
    font-size: 9px;
    color: var(--text-muted);
  }

  .sheet-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 8px;
    color: var(--text-muted);
    margin-top: 1px;
  }

  .vfr-badge {
    background: #14532d;
    color: #4ade80;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 700;
    font-size: 7px;
    letter-spacing: 0.04em;
  }

  .screen-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 6px 12px 14px;
    background: #1A1A1A;
    border-top: 1px solid var(--border);
  }

  .tab-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: #8A8A8A;

    & svg { width: 14px; height: 14px; }
    & span { font-size: 5px; font-weight: 600; }
  }

  .tab-icon.active {
    color: var(--primary);
  }

  /* ---- Stats ---- */
  .stats {
    padding-block: 2.75rem;
    border-block: 1px solid var(--border);
    background: var(--bg-alt);
  }

  .stats-inner {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    text-align: center;
  }

  .stat {
    padding: 0.5rem 1rem;
    &:not(:last-child) { border-right: 1px solid var(--border); }
  }

  .stat-value {
    display: block;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    font-weight: 800;
    color: var(--primary);
  }

  .stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
  }

  /* ---- Features ---- */
  .features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.1rem;
  }

  .feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    transition: background 0.25s, border-color 0.25s, transform 0.25s, box-shadow 0.25s;
    container-type: inline-size;

    &:hover {
      background: var(--surface-hover);
      border-color: color-mix(in srgb, white 8%, transparent);
      transform: translateY(-3px);
      box-shadow: 0 12px 40px -12px rgba(0,0,0,0.3);
    }

    & h3 { margin-bottom: 0.6rem; }

    & p {
      color: var(--text-muted);
      font-size: 0.9rem;
      line-height: 1.6;
    }
  }

  .feature-primary {
    grid-column: span 2;
    grid-row: span 2;
    padding: 2.25rem;
    background:
      radial-gradient(ellipse at 85% 85%, color-mix(in srgb, var(--primary) 4%, transparent), transparent 60%),
      var(--surface);

    & h3 { font-size: 1.45rem; }

    & p {
      font-size: 0.95rem;
      max-width: 420px;
    }

    & .feature-icon {
      width: 54px;
      height: 54px;
      & svg { width: 26px; height: 26px; }
    }
  }

  .feature-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    background: var(--primary-dim);
    border-radius: 11px;
    margin-bottom: 1.1rem;
    color: var(--primary);

    & svg { width: 22px; height: 22px; }
  }

  /* ---- Partnership ---- */
  .partnership {
    text-align: center;
    background: var(--bg-alt);
    border-block: 1px solid var(--border);
  }

  .partnership-inner {
    max-width: 600px;
    margin-inline: auto;

    & h2 { margin-bottom: 1rem; }

    & p {
      color: var(--text-muted);
      font-size: 1.05rem;
      line-height: 1.7;
    }
  }

  .partnership-label {
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    font-weight: 600;
  }

  .partnership-logo {
    margin: 0 auto 2rem;
    height: 32px;
    width: auto;
    opacity: 0.9;
  }

  /* ---- How It Works ---- */
  .steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }

  .step {
    text-align: center;
    padding: 2rem 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    transition: border-color 0.25s, background 0.25s;

    &:hover {
      border-color: var(--border);
      background: color-mix(in srgb, var(--surface) 50%, transparent);
    }

    & p {
      color: var(--text-muted);
      font-size: 0.9rem;
      margin-top: 0.6rem;
    }
  }

  .step-number {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--primary-dim);
    color: var(--primary);
    font-weight: 800;
    font-size: 1.15rem;
    margin: 0 auto 1rem;
    border: 2px solid color-mix(in srgb, var(--primary) 25%, transparent);
  }

  /* ---- Waitlist ---- */
  .waitlist {
    text-align: center;
    background:
      radial-gradient(ellipse 55% 55% at 50% 100%, color-mix(in srgb, var(--primary) 5%, transparent), transparent 70%),
      var(--bg);
  }

  .waitlist-inner {
    max-width: 520px;
    margin-inline: auto;

    & h2 { margin-bottom: 0.75rem; }

    & > p {
      color: var(--text-muted);
      font-size: 1.05rem;
      margin-bottom: 2rem;
    }
  }

  .waitlist-form {
    display: flex;
    gap: 0.6rem;

    & input[type="email"] {
      flex: 1;
      padding: 0.8rem 1.2rem;
      border-radius: var(--radius);
      background: var(--surface);
      border: 1px solid var(--border);
      color: var(--text);
      font-size: 0.95rem;
      outline: none;
      transition: border-color 0.2s, box-shadow 0.2s;

      &:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-dim);
      }

      &::placeholder { color: var(--text-muted); }
    }
  }

  .form-note {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.9rem;
  }

  .form-success {
    display: none;
    color: #4ade80;
    font-weight: 600;
    font-size: 1.05rem;
    margin-top: 1rem;
  }

  /* ---- Footer ---- */
  .footer {
    padding: 2.5rem 0;
    border-top: 1px solid var(--border);
  }

  .footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.25rem;
  }

  .footer-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;

    & img { height: 26px; width: auto; }
  }

  .footer-links {
    display: flex;
    gap: 1.75rem;

    & a {
      color: var(--text-muted);
      font-size: 0.85rem;
      transition: color 0.2s;
      &:hover { color: var(--text); }
    }
  }

  .footer-copy {
    width: 100%;
    text-align: center;
    font-size: 0.78rem;
    color: color-mix(in srgb, var(--text-muted) 70%, transparent);
    margin-top: 0.75rem;
  }

  /* ---- Legal Pages ---- */
  .legal-page {
    padding-top: 6rem;
  }

  .legal-inner {
    max-width: 720px;
    margin-inline: auto;

    & h1 {
      margin-bottom: 0.5rem;
    }

    & section {
      padding-block: 0;
      margin-bottom: 2rem;
    }

    & h2 {
      font-size: 1.25rem;
      margin-bottom: 0.6rem;
    }

    & h3 {
      font-size: 1.05rem;
      margin-top: 1rem;
      margin-bottom: 0.4rem;
    }

    & p {
      color: var(--text-muted);
      font-size: 0.95rem;
      line-height: 1.75;
      margin-bottom: 0.5rem;
    }

    & ul {
      color: var(--text-muted);
      font-size: 0.95rem;
      line-height: 1.75;
      padding-left: 1.25rem;
      list-style: disc;
      margin-bottom: 0.5rem;
    }

    & a {
      color: var(--primary);
      text-decoration: underline;
      text-underline-offset: 2px;
      &:hover { text-decoration-color: transparent; }
    }
  }

  /* ---- Contact Page ---- */
  .contact-email-box {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
  }

  .contact-email {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
  }

  .contact-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    background: var(--primary-dim);
    color: var(--primary);
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;

    &:hover { background: color-mix(in srgb, var(--primary) 20%, transparent); }
    & svg { flex-shrink: 0; }
  }

  .legal-updated {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 2.5rem;
  }

  /* ---- Responsive ---- */
  @media (max-width: 900px) {
    .hero-inner {
      grid-template-columns: 1fr;
      text-align: center;
      min-height: auto;
      gap: 3rem;
    }

    .hero-content p { margin-inline: auto; }
    .hero-actions { justify-content: center; }

    .hero-visual { order: -1; }

    .phone {
      transform: none;
      width: 220px;
    }

    .features-grid { grid-template-columns: 1fr 1fr; }
    .feature-primary { grid-column: span 2; grid-row: span 1; }

    .steps { grid-template-columns: 1fr; gap: 0.5rem; }
  }

  @media (max-width: 640px) {
    .nav-links {
      display: none;
      position: absolute;
      top: 100%;
      left: 0;
      right: 0;
      flex-direction: column;
      background: color-mix(in srgb, var(--bg) 95%, transparent);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      padding: 1.25rem;
      border-bottom: 1px solid var(--border);
      gap: 0.75rem;
      text-align: center;

      &.open { display: flex; }
    }

    .nav-toggle { display: flex; }

    .stats-inner {
      grid-template-columns: repeat(2, 1fr);
      gap: 1rem;
    }
    .stat:not(:last-child) { border-right: none; }
    .stat:nth-child(odd) { border-right: 1px solid var(--border); }

    .features-grid { grid-template-columns: 1fr; }
    .feature-primary { grid-column: 1; }

    .waitlist-form { flex-direction: column; }

    .footer-inner {
      flex-direction: column;
      text-align: center;
    }
  }
}

/* ---- Animations ---- */
@layer animations {

  /* Scroll-driven entry animations (modern browsers) */
  @supports (animation-timeline: view()) {
    .feature-card,
    .step,
    .partnership-inner,
    .waitlist-inner {
      animation: scroll-fade-up linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 30%;
    }
  }

  @keyframes scroll-fade-up {
    from { opacity: 0; transform: translateY(2.5rem); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* Phone marker pulse */
  @keyframes pulse-marker {
    0%, 100% { opacity: 1; box-shadow: 0 0 12px color-mix(in srgb, var(--primary) 45%, transparent), 0 0 4px var(--primary); }
    50%      { opacity: 0.6; box-shadow: 0 0 20px color-mix(in srgb, var(--primary) 30%, transparent), 0 0 6px var(--primary); }
  }

  /* Fallback classes for IntersectionObserver (set via JS) */
  .animate-fallback {
    opacity: 0;
    transform: translateY(2rem);
    transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .animate-fallback.visible {
    opacity: 1;
    transform: translateY(0);
  }

  /* Hero entrance */
  .hero-content { animation: hero-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) both; }
  .hero-visual  { animation: hero-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both; }

  @keyframes hero-in {
    from { opacity: 0; transform: translateY(1.5rem); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* Reduced motion */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-delay: 0.01ms !important;
      transition-duration: 0.01ms !important;
    }
  }
}
