/* Ducky Tower — store-like install landing.
   Ветка 2: Taste (вкус/дисциплина) → Impeccable (вёрстка/ритм) → Emil (микро-анимации).
   Vanilla CSS, mobile-first, single accent, system font stack (ТЗ §19). */

/* ---------- tokens ---------- */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --text: #1b1b1d;          /* near-black main */
  --text-2: #5f6368;        /* grey secondary */
  --text-3: #80868b;        /* tertiary */
  --border: #e7e8ec;        /* subtle */
  --accent: #0a9d54;        /* single green accent — store-like, нейтральный (не клон стора) */
  --accent-press: #087f44;
  --accent-tint: #e7f6ee;
  --star: #f2a20c;          /* rating gold */

  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  --shadow-1: 0 1px 2px rgba(20, 23, 28, 0.06), 0 1px 3px rgba(20, 23, 28, 0.05);
  --shadow-2: 0 6px 20px rgba(20, 23, 28, 0.10);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);   /* Emil: кастомный, не CSS-дефолт */
  --dur: 180ms;

  --maxw: 500px;            /* ТЗ §3: 480–520px */
  --gutter: 20px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface-2);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; }
a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---------- shell (mobile-first, centered on desktop) ---------- */
.shell {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  padding-bottom: calc(96px + env(safe-area-inset-bottom)); /* место под sticky CTA */
}

/* ---------- header ---------- */
.header {
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.1) blur(8px);
  z-index: 20;
}
.header__brand { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.header__brand span { color: var(--text-3); font-weight: 500; }

/* ---------- section rhythm ---------- */
.section { padding: 24px var(--gutter); border-top: 1px solid var(--border); }
.section:first-of-type { border-top: 0; }
.section__title { font-size: 17px; font-weight: 600; margin: 0 0 12px; letter-spacing: -0.01em; }

/* ---------- app hero ---------- */
.hero { display: flex; gap: 16px; padding: 20px var(--gutter) 16px; align-items: center; }
.hero__icon {
  width: 88px; height: 88px; flex: 0 0 88px;
  border-radius: 20px;
  box-shadow: var(--shadow-1);
  border: 1px solid var(--border);
  background: var(--surface-2);
  overflow: hidden;
}
.hero__meta { min-width: 0; }
.hero__name { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.hero__sub { color: var(--accent); font-size: 14px; font-weight: 600; margin: 2px 0 8px; }
.hero__facts { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 13px; flex-wrap: wrap; }
.hero__facts .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }
.hero__facts strong { color: var(--text); font-weight: 600; }

/* ---------- install button ---------- */
.btn-install {
  -webkit-appearance: none; appearance: none;
  width: 100%;
  height: 50px;                 /* ТЗ §3: 48–52px */
  border: 0;
  border-radius: 10px;          /* ТЗ §3: 8–12px */
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  box-shadow: 0 1px 2px rgba(10, 157, 84, 0.25);
}
.btn-install:hover { background: var(--accent-press); }
.btn-install:active { transform: translateY(1px) scale(0.995); background: var(--accent-press); }
.btn-install:disabled { opacity: 0.55; cursor: default; transform: none; }
.hero-cta { padding: 0 var(--gutter) 4px; }

/* ---------- meta row (3 cols) ---------- */
.metarow {
  display: grid; grid-template-columns: repeat(3, 1fr);
  text-align: center;
  padding: 4px var(--gutter) 20px;
}
.metarow__cell { padding: 4px 0; position: relative; }
.metarow__cell + .metarow__cell::before {
  content: ""; position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 1px; background: var(--border);
}
.metarow__v { font-size: 15px; font-weight: 700; display: inline-flex; align-items: center; gap: 3px; }
.metarow__l { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 3px; }
.star { color: var(--star); }

/* ---------- screenshots (horizontal scroll + snap) ---------- */
.shots { display: flex; gap: 12px; overflow-x: auto; padding: 4px var(--gutter) 8px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.shots::-webkit-scrollbar { display: none; }
.shot {
  flex: 0 0 auto; width: 180px; height: 320px;   /* ТЗ §3: ~180×320 */
  border-radius: 14px;                            /* 12–16 */
  border: 1px solid var(--border);
  background: var(--surface-2);
  scroll-snap-align: start;
  overflow: hidden;
  object-fit: cover;
}

/* ---------- about / what's new ---------- */
.prose { color: var(--text-2); font-size: 14px; margin: 0; }
.prose + .prose { margin-top: 8px; }
.whatsnew__ver { color: var(--text-3); font-size: 13px; margin: 0 0 4px; }

/* ---------- ratings ---------- */
.ratings { display: flex; gap: 18px; align-items: center; }
.ratings__big { font-size: 44px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.ratings__stars { color: var(--star); font-size: 14px; letter-spacing: 1px; margin-top: 4px; }
.ratings__bars { flex: 1; display: grid; gap: 5px; }
.bar { display: grid; grid-template-columns: 10px 1fr; align-items: center; gap: 8px; }
.bar__n { font-size: 11px; color: var(--text-2); text-align: right; }
.bar__track { height: 6px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; }
.bar__fill { display: block; height: 100%; background: var(--accent); border-radius: var(--radius-pill); }
.demo-note { color: var(--text-3); font-size: 11px; margin-top: 10px; }

/* ---------- reviews ---------- */
.review { padding: 14px 0; border-top: 1px solid var(--border); }
.review:first-child { border-top: 0; padding-top: 4px; }
.review__head { display: flex; align-items: center; gap: 10px; }
.review__ava { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-tint); color: var(--accent); font-weight: 700; font-size: 14px; display: grid; place-items: center; }
.review__name { font-size: 14px; font-weight: 600; }
.review__stars { color: var(--star); font-size: 12px; }
.review__text { color: var(--text-2); font-size: 14px; margin: 8px 0 0; }

/* ---------- security badge (честный, без марок сторов) ---------- */
.trust { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--accent-tint); border-radius: var(--radius); margin: 0 var(--gutter); }
.trust__i { flex: 0 0 20px; color: var(--accent); }
.trust__t { font-size: 13px; color: #14663b; }
.trust__t strong { font-weight: 600; }

/* ---------- sticky CTA ---------- */
.sticky {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  max-width: var(--maxw); margin: 0 auto;
  transform: translateY(120%);
  transition: transform 240ms var(--ease);
}
.sticky.is-visible { transform: translateY(0); }

/* ---------- modal / bottom sheet ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(20, 23, 28, 0.44);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 200ms var(--ease);
}
.overlay.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  width: 100%; max-width: var(--maxw);
  background: var(--bg);
  border-radius: 18px 18px 0 0;
  padding: 8px var(--gutter) calc(20px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 260ms var(--ease);
}
.overlay.is-open .sheet { transform: translateY(0); }
.sheet__grip { width: 40px; height: 4px; border-radius: 2px; background: var(--border); margin: 8px auto 12px; }
.sheet__title { font-size: 17px; font-weight: 600; margin: 0 0 4px; }
.sheet__close { position: absolute; }
.sheet__x {
  -webkit-appearance: none; appearance: none; border: 0; background: var(--surface-2);
  width: 32px; height: 32px; border-radius: 50%; font-size: 18px; color: var(--text-2);
  cursor: pointer; display: grid; place-items: center; margin-left: auto;
}
.steps { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 12px; }
.steps li { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.steps__num { flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--accent-tint); color: var(--accent); font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.steps__ico { flex: 0 0 20px; color: var(--text-2); }
.sheet__note { font-size: 12px; color: var(--text-3); margin: 14px 0 0; }

/* installed success */
.installed__ico { width: 56px; height: 56px; margin: 4px auto 10px; color: var(--accent); }
.installed__title { text-align: center; font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.installed__text { text-align: center; color: var(--text-2); font-size: 14px; margin: 0 0 16px; }

/* ---------- app.html launch screen ---------- */
.launch {
  min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px;
  background: var(--bg); padding: var(--gutter);
}
.launch__icon { width: 96px; height: 96px; border-radius: 22px; box-shadow: var(--shadow-1); border: 1px solid var(--border); overflow: hidden; }
.launch__name { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface-2); border-top-color: var(--accent); animation: spin 800ms linear infinite; }
.launch__hint { color: var(--text-3); font-size: 13px; }
.launch__fb { margin-top: 8px; text-align: center; }
.launch__fb .btn-install { width: auto; padding: 0 24px; }

/* ---------- animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.reveal { animation: rise 320ms var(--ease) both; }

/* ---------- desktop: просто центрируем (ТЗ §3) ---------- */
@media (min-width: 620px) {
  body { background: #eef0f3; }
  .shell { margin: 24px auto; min-height: auto; border: 1px solid var(--border); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-2); }
  .header { border-radius: 20px 20px 0 0; }
  .sticky { border-radius: 0 0 20px 20px; }
}

/* ---------- reduced motion (ТЗ §22) ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .spinner { animation: none; border-top-color: var(--accent); }
}
