/* Native landing (spec 16): the hero of docs/mockups/landing-hero-a2-glass.html
   and the sections under it. Colours come from the tokens of app.css, so
   the night sky works here too; only the sun is the landing's own token.
   Motion is transform/opacity on cubic-bezier(0.23, 1, 0.32, 1) (--ease),
   plus the plane on its offset-path. Sections rise once (landing.js adds
   .js to <html> and .is-in to each .reveal). */

:root { --sun: #FFF6DC; --sun-opacity: .9; }

/* At night the sun is a faint pale glow. Keep the two copies identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --sun: #E6EDF7; --sun-opacity: .08; }
}
:root[data-theme="dark"] { --sun: #E6EDF7; --sun-opacity: .08; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

.landing { overflow-x: clip; }
.landing main, .landing .site-foot { position: relative; z-index: 1; }

/* The landing sky is livelier than the cabinets (mockup speeds). */
.landing .cloud.far { animation-duration: 90s; }
.landing .cloud.mid { animation-duration: 60s; }
.landing .cloud.near { animation-duration: 40s; }

/* ---------- Header: a glass capsule floating at the top ---------- */

.l-top {
  position: fixed;
  top: 16px;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 24px;
  width: fit-content;
  max-width: calc(100% - 2 * max(16px, env(safe-area-inset-left), env(safe-area-inset-right)));
  margin: 0 auto;
  padding: 8px 8px 8px 16px;
  border-radius: 9999px;
  box-shadow: var(--top-shadow);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  animation: l-drop 500ms var(--ease) both;
}
.l-anchors { display: flex; gap: 24px; }
.l-anchors a { color: var(--text); text-decoration: none; }
.l-switches { display: flex; align-items: center; gap: 8px; }
.l-switches form { margin: 0; }

.l-login {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 16px;
  border-radius: 9999px;
  background: var(--text);
  color: var(--sky);
  text-decoration: none;
  white-space: nowrap;
  transition: transform 160ms var(--ease);
}
.l-login:active, .ghost:active { transform: scale(0.97); }
/* The landing keeps its big round call to action. */
.landing .btn-primary { min-height: 44px; padding: 8px 24px; border-radius: 999px; font-size: 16px; transition: transform 160ms var(--ease); }
.landing .btn-primary:active { transform: scale(0.97); }

@media (hover: hover) and (pointer: fine) {
  .l-anchors a:hover { color: var(--link); }
  .l-login:hover { background: var(--muted); }
  .ghost:hover, .final-login a:hover { text-decoration: underline; }
}

@keyframes l-drop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes l-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* The preferences block in the footer is for phones only. */
.l-foot-prefs { display: none; }
.l-foot-prefs form { margin: 0; }

/* ---------- Hero ---------- */

.hero { position: relative; min-height: clamp(640px, 100svh, 880px); overflow: hidden; }

/* The sun is a flat blurred disc. */
.sun {
  position: absolute;
  top: -64px;
  right: 120px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: var(--sun);
  opacity: var(--sun-opacity);
  filter: blur(24px);
}

.hero-inner { position: relative; z-index: 3; max-width: 1200px; margin: 0 auto; padding: 128px max(24px, env(safe-area-inset-right)) 64px max(24px, env(safe-area-inset-left)); }
.hero-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; max-width: 560px; }

/* The one big glass surface: it materializes, then the lines rise 50ms apart. */
.hero-card { width: 100%; padding: 32px; border-radius: 24px; animation: materialize 700ms var(--ease) backwards; }
.hero h1 { max-width: 680px; margin: 0 0 16px; font-size: 48px; line-height: 48px; font-weight: 700; letter-spacing: -0.025em; color: var(--text); }
.hero-lead { max-width: 680px; margin: 0 0 24px; font-size: 18px; line-height: 28px; color: var(--muted); letter-spacing: -0.005em; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.hero-card .in { animation: l-rise 500ms var(--ease) both; }
.hero-card .in:nth-child(1) { animation-delay: 200ms; }
.hero-card .in:nth-child(2) { animation-delay: 250ms; }
.hero-card .in:nth-child(3) { animation-delay: 300ms; }

.ghost {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--link);
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 160ms var(--ease);
}

/* Chips sit on the sky, never on the card: no glass on glass. */
.chips { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; padding: 0; list-style: none; }
.chip { padding: 8px 12px; border-radius: 9999px; color: var(--text); font-size: 14px; line-height: 20px; font-weight: 600; letter-spacing: -0.01em; box-shadow: none; }
.hero .chip { animation: l-rise 500ms var(--ease) both; }
.hero .chip:nth-child(1) { animation-delay: 400ms; }
.hero .chip:nth-child(2) { animation-delay: 450ms; }
.hero .chip:nth-child(3) { animation-delay: 500ms; }

/* The scene has a fixed size so the plane's path matches the drawing; it
   scales down from the bottom right corner on smaller screens. */
.scene {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
  width: 760px;
  height: 440px;
  color: var(--text);
  transform-origin: 100% 100%;
  pointer-events: none;
}
.skyline { display: block; width: 760px; height: 440px; }
.plane {
  position: absolute;
  top: 0;
  left: 0;
  width: 32px;
  height: 32px;
  offset-path: path("M 0 330 C 180 250, 330 300, 470 190 S 690 80, 760 40");
  offset-rotate: auto;
  offset-anchor: center;
  animation: l-fly 12s cubic-bezier(0.77, 0, 0.175, 1) infinite;
}
@keyframes l-fly {
  0% { offset-distance: 0%; opacity: 0; }
  8% { opacity: 1; }
  85% { opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; }
}

/* ---------- Sections ---------- */

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 max(24px, env(safe-area-inset-right)) 0 max(24px, env(safe-area-inset-left)); }
.sec { padding: 96px 0; }
.sec[id] { scroll-margin-top: 64px; }
.sec-title { max-width: 680px; margin: 0 0 32px; font-size: 36px; line-height: 40px; font-weight: 700; letter-spacing: -0.025em; }
.sec-center .sec-title { margin-right: auto; margin-left: auto; text-align: center; }

.grid { display: grid; gap: 16px; margin: 0; padding: 0; list-style: none; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.l-card { min-width: 0; padding: 32px; border-radius: 24px; }
.l-card h3 { margin: 0 0 8px; font-size: 20px; line-height: 28px; font-weight: 700; letter-spacing: -0.02em; }
.l-card p { margin: 0; color: var(--muted); }
.l-ico { display: block; width: 32px; height: 32px; margin-bottom: 16px; color: var(--accent); }

/* Steps are numbered by a counter, so the template has no bare digits. */
.steps { counter-reset: step; }
.steps > li { counter-increment: step; }
.steps > li::before {
  content: counter(step);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: 16px;
  border-radius: 9999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 18px;
  line-height: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Tagline (skill B11): every word starts pale and lights up once, in
   reading order, as it crosses the trigger line. */
.tagline-sec { padding: 96px 0 64px; }
.tagline {
  max-width: 880px;
  margin: 0 auto;
  font-size: 48px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.025em;
  text-align: center;
  text-wrap: balance;
}
/* Dim before landing.js splits the words, so the first paint is never bright. */
.js .tagline:not(.split) { opacity: .3; }
.js .tagline .w { opacity: .3; transition: opacity 600ms var(--ease); }
.js .tagline .w.lit { opacity: 1; }

.price-card { max-width: 480px; margin: 0 auto; padding: 40px 32px; border-radius: 24px; }
.price-label { margin: 0 0 8px; color: var(--muted); font-size: 14px; line-height: 20px; font-weight: 600; }
.price-value { margin: 0 0 24px; font-size: 60px; line-height: 1; font-weight: 700; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }
.price-per { color: var(--muted); font-size: 18px; line-height: 28px; font-weight: 600; letter-spacing: 0; }
.checks { display: grid; gap: 12px; margin: 0 0 32px; padding: 0; list-style: none; }
.checks li { display: flex; align-items: flex-start; gap: 12px; }
.checks svg { flex: none; width: 20px; height: 20px; margin-top: 2px; color: var(--accent); }
.price-card .btn-primary { width: 100%; }
.price-note { margin: 16px 0 0; text-align: center; }

.goals { margin-top: 32px; }
.goals-label { margin: 0 0 12px; font-weight: 600; }

.faq { max-width: 760px; padding: 16px 32px; border-radius: 24px; }
.faq details + details { border-top: 1px solid var(--line); }
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  padding: 24px 0;
  border-radius: 8px;
  font-size: 18px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  list-style: none;
  cursor: pointer;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary svg { flex: none; width: 20px; height: 20px; color: var(--muted); transition: transform 300ms var(--ease); }
.faq details[open] summary svg { transform: rotate(180deg); }
.faq details p { max-width: 65ch; margin: 0 0 24px; color: var(--muted); }

.final-card { max-width: 760px; margin: 0 auto; padding: 48px 32px; border-radius: 24px; text-align: center; }
.final-card h2 { margin: 0 0 16px; font-size: 36px; line-height: 40px; font-weight: 700; letter-spacing: -0.025em; }
.final-lead { max-width: 560px; margin: 0 auto 32px; color: var(--muted); font-size: 18px; line-height: 28px; }
.final-login { margin: 24px 0 0; color: var(--muted); }
.final-login a { font-weight: 600; text-decoration: none; }

/* Scroll reveal: rise 32px and fade in, once. Without JS nothing hides. */
.js .reveal { opacity: 0; transform: translateY(32px); transition: opacity 700ms var(--ease), transform 700ms var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }
.grid > .reveal:nth-child(2) { transition-delay: 60ms; }
.grid > .reveal:nth-child(3) { transition-delay: 120ms; }
.grid > .reveal:nth-child(4) { transition-delay: 180ms; }

/* ---------- Smaller screens ---------- */

@media (max-width: 1199px) {
  .scene { transform: scale(0.8); }
}

@media (max-width: 959px) {
  .l-anchors { display: none; }
  .scene { transform: scale(0.64); } /* keeps Big Ben clear of the chips */
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 759px) {
  /* One row, 60px tall (8 + 44 + 8): logo left, "Войти" right. The switches
     live in the footer. It scrolls away with the page and clears the notch. */
  .l-top {
    position: absolute;
    top: max(12px, env(safe-area-inset-top));
    justify-content: space-between;
    gap: 12px;
    width: calc(100% - 2 * max(16px, env(safe-area-inset-left), env(safe-area-inset-right)));
    border-radius: 9999px;
  }
  .l-switches { display: none; }
  .l-login { min-height: 44px; padding: 10px 20px; }

  /* Weak phones: the clouds move at the calm cabinet speeds. */
  .landing .cloud.far { animation-duration: 240s; }
  .landing .cloud.mid { animation-duration: 180s; }
  .landing .cloud.near { animation-duration: 140s; }

  .hero { min-height: 0; }
  /* Clears the header: its top (12px or the notch) + 60px + 28px of air. */
  .hero-inner { padding: calc(max(12px, env(safe-area-inset-top)) + 88px) max(16px, env(safe-area-inset-right)) 232px max(16px, env(safe-area-inset-left)); }
  .hero-card { padding: 24px; }
  .hero h1 { font-size: 36px; line-height: 40px; }
  .hero-lead { font-size: 16px; line-height: 24px; }
  .scene { transform: scale(0.48); }

  .wrap { padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
  .sec { padding: 64px 0; }
  .tagline-sec { padding: 64px 0 32px; }
  .sec-title, .final-card h2 { font-size: 30px; line-height: 36px; }
  .tagline { font-size: 36px; line-height: 40px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .l-card { padding: 24px; }
  .price-card { padding: 32px 24px; }
  .price-value { font-size: 48px; }
  .faq { padding: 12px 24px; }
  .faq summary { padding: 16px 0; font-size: 16px; line-height: 24px; }
  .faq details p { margin-bottom: 16px; }
  .final-card { padding: 32px 24px; }
  .hero h1, .l-card h3, .sec-title { overflow-wrap: break-word; }

  /* The footer carries the switches and the links as 44px targets, clear of
     the home indicator. */
  .l-foot-prefs { display: flex; flex-basis: 100%; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px 16px; }
  .landing .site-foot { gap: 0 8px; padding: 16px max(16px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .landing .site-foot a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; }
}

/* The narrowest phones: the big phrase (B11) is 30px, no larger. */
@media (max-width: 380px) {
  .tagline { font-size: 30px; line-height: 36px; }
  .hero h1 { font-size: 32px; line-height: 36px; }
}

/* ---------- System preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  .l-top, .hero-card, .hero-card .in, .hero .chip { animation: fade 200ms var(--ease) both; }
  .plane { animation: none; offset-distance: 45%; }
  .js .reveal { transform: none; transition: opacity 200ms var(--ease); }
  .grid > .reveal:nth-child(n) { transition-delay: 0ms; }
  .js .tagline:not(.split), .js .tagline .w { opacity: 1; transition: none; }
  .l-login, .ghost, .landing .btn-primary, .faq summary svg { transition: none; }
  .l-login:active, .ghost:active, .landing .btn-primary:active { transform: none; }
}
