/* MIRLY AI — mirlyai.uz
   Brand colours come from the logo: electric blue "M" and the lime growth arrow. */

:root {
  --paper: #f5f6fa;
  --surface: #ffffff;
  --ink: #0e1130;
  --ink-2: #4a5072;
  --line: #dde1ee;
  --blue: #2e45f0;
  --blue-ink: #1f33c9;
  --lime: #d6f24e;
  --tg-bg: #dbe6f0;
  --tg-out: #e9fbd8;
  --tg-link: #2a7fc4;

  --radius-s: 10px;
  --radius-m: 16px;
  --radius-l: 28px;
  --wrap: 1160px;
  --gutter: clamp(16px, 4vw, 40px);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue-ink); text-underline-offset: 3px; }
a:hover { color: var(--blue); }
h1, h2, h3, h4 { margin: 0; line-height: 1.12; letter-spacing: -0.02em; }
p { margin: 0; }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--radius-s);
}
.skip:focus { top: 12px; color: #fff; }

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(245, 246, 250, 0.88);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 72px; }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: none; }
.brand img { width: 32px; height: 34px; }
.brand span { font-weight: 800; font-size: 20px; letter-spacing: -0.01em; }
.brand b { color: var(--blue); font-weight: 800; }

.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a {
  color: var(--ink-2); text-decoration: none; font-size: 15px; font-weight: 600;
  padding: 8px 12px; border-radius: var(--radius-s);
}
.nav a:hover { color: var(--ink); background: rgba(14, 17, 48, 0.05); }

.header-end { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.lang { display: inline-flex; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; }
.lang button {
  font: 700 13px/1 var(--font); color: var(--ink-2); background: none; border: 0; cursor: pointer;
  padding: 8px 10px; border-radius: 999px; min-width: 38px;
}
.lang button[aria-pressed="true"] { background: var(--ink); color: #fff; }

.menu-btn {
  display: none; width: 44px; height: 44px; border-radius: var(--radius-s);
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; padding: 0;
}
.menu-btn span, .menu-btn span::before, .menu-btn span::after {
  display: block; width: 18px; height: 2px; background: var(--ink); margin: 0 auto; position: relative; content: "";
}
.menu-btn span::before { position: absolute; top: -6px; }
.menu-btn span::after { position: absolute; top: 6px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 24px; border-radius: 14px;
  font: 700 16px/1 var(--font); text-decoration: none; cursor: pointer;
  background: var(--blue); color: #fff; border: 2px solid var(--blue);
  transition: background .15s, border-color .15s, transform .15s;
}
.btn:hover { background: var(--blue-ink); border-color: var(--blue-ink); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { background: var(--surface); border-color: var(--ink); color: var(--ink); }
.btn-small { min-height: 42px; padding: 0 16px; font-size: 15px; border-radius: 12px; }

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

.hero { padding: clamp(40px, 7vw, 96px) 0 clamp(56px, 8vw, 112px); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: clamp(32px, 6vw, 88px); align-items: center; }

.hero h1 {
  font-size: clamp(2.6rem, 6.4vw, 5.25rem);
  font-weight: 800; letter-spacing: -0.045em; line-height: 0.98;
  max-width: 11ch;
}
.hero-lead { margin-top: 28px; font-size: clamp(1.06rem, 1.6vw, 1.25rem); color: var(--ink-2); max-width: 34em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.hero-note {
  display: flex; gap: 10px; align-items: flex-start; margin-top: 28px; max-width: 34em;
  font-size: 15px; color: var(--ink-2);
}
.hero-note svg { flex: none; width: 20px; height: 20px; margin-top: 2px; color: var(--blue); }

/* Telegram-style conversation: the one bold element of the page */
.chat {
  position: relative;
  background: var(--tg-bg);
  background-image:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,.55) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 60%, rgba(255,255,255,.45) 0 2px, transparent 3px);
  background-size: 46px 46px, 62px 62px;
  border-radius: var(--radius-l);
  box-shadow: 0 1px 0 rgba(14,17,48,.04), 0 30px 60px -30px rgba(14, 17, 48, 0.35);
  overflow: hidden;
  max-width: 440px; width: 100%; justify-self: end;
}
.chat-top {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.chat-top img { width: 40px; height: 40px; border-radius: 50%; background: var(--paper); padding: 6px; }
.chat-top b { display: block; font-size: 16px; }
.chat-top small { display: block; color: var(--tg-link); font-size: 13px; }
.chat-body { display: flex; flex-direction: column; gap: 8px; padding: 18px 14px 20px; min-height: 470px; }

.msg {
  max-width: 86%; padding: 9px 12px 8px; border-radius: 16px; font-size: 15px; line-height: 1.45;
  background: var(--surface); box-shadow: 0 1px 1px rgba(14, 17, 48, 0.08);
}
.msg time { display: block; text-align: right; font-size: 11px; color: #8a93a8; margin-top: 2px; }
.msg.out { align-self: flex-end; background: var(--tg-out); border-bottom-right-radius: 6px; }
.msg.out time { color: #5fa65a; }
.msg.in { align-self: flex-start; border-bottom-left-radius: 6px; }

.file { display: flex; align-items: center; gap: 10px; }
.file i {
  width: 40px; height: 40px; border-radius: 50%; background: #5fb85a; flex: none;
  display: grid; place-items: center; color: #fff; font-style: normal;
}
.file i svg { width: 18px; height: 18px; }
.file b { display: block; font-size: 14px; }
.file small { color: #5fa65a; font-size: 12px; }

.reel {
  position: relative; width: 150px; aspect-ratio: 9 / 16; border-radius: 12px; overflow: hidden; margin-bottom: 6px;
  background: linear-gradient(160deg, #3249f5 0%, #1a2486 55%, #0e1130 100%);
}
.reel::before {
  content: ""; position: absolute; right: -24px; top: 18%; width: 120px; height: 120px;
  background: var(--lime); clip-path: polygon(0 100%, 100% 0, 100% 100%); opacity: .9;
}
.reel span {
  position: absolute; left: 10px; right: 10px; bottom: 34px; color: #fff; font-weight: 800; font-size: 13px; line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.reel em {
  position: absolute; left: 10px; bottom: 10px; font-style: normal; font-size: 11px; font-weight: 700;
  color: var(--ink); background: var(--lime); padding: 2px 7px; border-radius: 6px;
}
.reel svg { position: absolute; left: 50%; top: 40%; width: 40px; height: 40px; transform: translate(-50%, -50%); color: #fff; opacity: .95; }

.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; max-width: 86%; }
.keys button {
  font: 600 14px/1.2 var(--font); color: #fff; background: rgba(66, 94, 120, 0.45);
  border: 0; border-radius: 10px; padding: 11px 8px; cursor: default;
  transition: background .2s, transform .2s;
}
.keys button.pressed { background: rgba(46, 69, 240, 0.85); transform: scale(0.97); }

.done { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.done i {
  width: 22px; height: 22px; border-radius: 50%; background: var(--lime); color: var(--ink);
  display: grid; place-items: center; flex: none; font-style: normal;
}
.done i svg { width: 14px; height: 14px; }

/* Played once when the conversation scrolls into view (site.js adds .play) */
.js .chat [data-step] { opacity: 0; transform: translateY(8px); transition: opacity .35s ease, transform .35s ease; }
.js .chat [data-step].on { opacity: 1; transform: none; }

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

.section { padding: clamp(64px, 9vw, 120px) 0; }
.section-head { max-width: 40em; margin-bottom: clamp(36px, 5vw, 56px); }
.section-head h2 { font-size: clamp(2rem, 4vw, 3.1rem); font-weight: 800; letter-spacing: -0.035em; }
.section-head p { margin-top: 16px; color: var(--ink-2); font-size: 1.1rem; }

/* Features: editorial rows, not a card grid */
.features { border-top: 1px solid var(--line); }
.feature {
  display: grid; grid-template-columns: 72px minmax(0, 1fr) minmax(0, 1.4fr); gap: 28px; align-items: center;
  padding: 28px 0; border-bottom: 1px solid var(--line);
}
.feature img { width: 64px; height: 64px; object-fit: contain; }
.feature h3 { font-size: 1.4rem; font-weight: 800; }
.feature p { color: var(--ink-2); }

/* Steps: a real sequence, so numbers carry meaning */
.steps-section { background: var(--surface); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; counter-reset: step; }
.steps li { position: relative; padding: 0 28px 0 0; counter-increment: step; }
.steps li::before {
  content: counter(step); display: grid; place-items: center;
  width: 48px; height: 48px; border-radius: 50%; margin-bottom: 22px;
  font-weight: 800; font-size: 18px; color: var(--ink); background: var(--lime);
}
.steps li:not(:last-child)::after {
  content: ""; position: absolute; top: 24px; left: 60px; right: 12px; height: 2px;
  background: repeating-linear-gradient(90deg, var(--line) 0 8px, transparent 8px 14px);
}
.steps h3 { font-size: 1.2rem; font-weight: 800; margin-bottom: 8px; }
.steps p { color: var(--ink-2); font-size: 16px; }

/* Instagram connection and data: the section reviewers and owners read most carefully */
.ig { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(32px, 6vw, 80px); align-items: start; }
.promises { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 18px; }
.promises li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; }
.promises svg { width: 24px; height: 24px; color: var(--blue); margin-top: 2px; }
.promises b { display: block; }
.promises span { color: var(--ink-2); font-size: 16px; }

.perms { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 8px 28px; }
.perms h3 { font-size: 1.05rem; font-weight: 800; padding: 22px 0 6px; }
.perms dl { margin: 0; }
.perm { padding: 18px 0; border-top: 1px solid var(--line); }
.perm:first-child { border-top: 0; }
.perm dt { font-weight: 700; }
.perm dd { margin: 4px 0 0; color: var(--ink-2); font-size: 16px; }
.perm code {
  display: inline-block; margin-top: 8px; font: 500 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink-2); background: var(--paper); border-radius: 6px; padding: 3px 8px;
}
.perms-foot { border-top: 1px solid var(--line); padding: 18px 0 22px; font-size: 15px; color: var(--ink-2); }

/* Plans */
.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; max-width: 900px; }
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 32px; display: flex; flex-direction: column; }
.plan.featured { border: 2px solid var(--ink); }
.plan h3 { font-size: 1.6rem; font-weight: 800; }
.plan .price { margin-top: 6px; color: var(--ink-2); font-weight: 600; }
.plan ul { list-style: none; padding: 0; margin: 24px 0 28px; display: grid; gap: 12px; }
.plan li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; }
.plan li svg { width: 20px; height: 20px; color: var(--blue); margin-top: 3px; }
.plan .btn { margin-top: auto; }
.plans-note { margin-top: 24px; color: var(--ink-2); font-size: 15px; max-width: 46em; }

/* Company details */
.company { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); align-items: start; }
.details { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 8px 28px; }
.details div { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.details div:first-child { border-top: 0; }
.details dt { color: var(--ink-2); font-size: 15px; }
.details dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* ---------- Footer ---------- */

.site-footer { background: var(--ink); color: #c9cde3; padding: 64px 0 40px; font-size: 15px; }
.site-footer a { color: #fff; }
.footer-top { display: grid; grid-template-columns: minmax(0, 1.2fr) repeat(2, minmax(0, 0.8fr)); gap: 40px; }
.site-footer .brand { color: #fff; }
.site-footer .brand b { color: var(--lime); }
.footer-about { margin-top: 16px; max-width: 30em; }
.site-footer h2 { font-size: 15px; font-weight: 700; color: #fff; letter-spacing: 0; margin-bottom: 14px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.site-footer ul a { text-decoration: none; color: #c9cde3; }
.site-footer ul a:hover { color: #fff; text-decoration: underline; }
.footer-legal { margin-top: 48px; padding-top: 28px; border-top: 1px solid rgba(255, 255, 255, 0.12); display: grid; gap: 8px; font-size: 13.5px; color: #9aa0bf; }

/* ---------- Legal pages ---------- */

.doc-hero { padding: clamp(40px, 6vw, 72px) 0 32px; }
.doc-hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 800; letter-spacing: -0.04em; }
.doc-hero p { margin-top: 14px; color: var(--ink-2); }
.doc { padding: clamp(32px, 5vw, 64px) 0 clamp(64px, 9vw, 112px); }
.doc .wrap { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.doc-aside { position: sticky; top: 96px; font-size: 15px; }
.doc-aside p { color: var(--ink-2); margin-bottom: 10px; }
.doc-aside ul { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 6px; }
.doc-aside a { text-decoration: none; color: var(--ink-2); }
.doc-aside a:hover, .doc-aside a[aria-current] { color: var(--ink); font-weight: 700; }

.prose { max-width: 46em; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: clamp(24px, 4vw, 56px); }
.prose + .prose { margin-top: 24px; }
.prose h1 { font-size: clamp(2rem, 4.4vw, 3rem); font-weight: 800; letter-spacing: -0.04em; margin-bottom: 10px; }
.prose .meta { color: var(--ink-2); font-size: 15px; margin-bottom: 8px; }
.prose h2 { font-size: 1.3rem; font-weight: 800; margin: 40px 0 12px; padding-top: 28px; border-top: 1px solid var(--line); }
.prose h3 { font-size: 1.05rem; font-weight: 700; margin: 22px 0 6px; letter-spacing: -0.01em; }
.prose p, .prose li { color: #2a2f52; }
.prose p + p { margin-top: 12px; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 10px 0; }
.prose li + li { margin-top: 6px; }
.prose table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 15.5px; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); }
.prose th { font-weight: 700; }
.prose code { font: 500 0.88em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--paper); padding: 1px 6px; border-radius: 5px; }
.prose .callout { background: var(--paper); border-left: 4px solid var(--blue); border-radius: 0 var(--radius-s) var(--radius-s) 0; padding: 14px 18px; margin: 18px 0; }

.js [data-lang-block][hidden] { display: none; }

/* ---------- 404 ---------- */

.notfound { min-height: 60vh; display: grid; place-items: center; text-align: center; padding: 80px 0; }
.notfound h1 { font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 800; letter-spacing: -0.04em; }
.notfound p { margin: 16px auto 32px; color: var(--ink-2); max-width: 30em; }

/* ---------- Responsive ---------- */

@media (max-width: 1020px) {
  .nav { display: none; }
  .menu-btn { display: inline-block; }
  .site-header.open .nav {
    display: flex; flex-direction: column; position: absolute; left: 0; right: 0; top: 72px;
    background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px var(--gutter) 16px; margin: 0;
  }
  .site-header.open .nav a { padding: 14px 4px; font-size: 17px; border-radius: 0; border-bottom: 1px solid var(--line); }
  .header-cta { display: none; }
  .hero .wrap { grid-template-columns: 1fr; }
  .chat { justify-self: start; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 40px; }
  .steps li:nth-child(2)::after { display: none; }
  .ig, .company { grid-template-columns: 1fr; }
  .footer-top { grid-template-columns: 1fr 1fr; }
  .footer-top > :first-child { grid-column: 1 / -1; }
  .doc .wrap { grid-template-columns: 1fr; }
  .doc-aside { position: static; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .site-header .wrap { gap: 12px; }
  .brand span { font-size: 18px; }
  .lang button { padding: 8px 7px; min-width: 32px; }
  .hero-actions .btn { width: 100%; }
  .chat-body { min-height: 0; }
  .feature { grid-template-columns: 56px minmax(0, 1fr); gap: 8px 18px; }
  .feature img { width: 52px; height: 52px; grid-row: span 2; align-self: start; }
  .steps { grid-template-columns: 1fr; }
  .steps li { padding: 0; }
  .steps li::after { display: none; }
  .perms, .details { padding: 4px 20px; }
  .details div { grid-template-columns: 1fr; gap: 2px; }
  .plans { grid-template-columns: 1fr; }
  .plan { padding: 24px; }
  .footer-top { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .js .chat [data-step] { opacity: 1; transform: none; }
}

@media print {
  .site-header, .site-footer, .doc-aside { display: none; }
  .prose { border: 0; padding: 0; }
  .js [data-lang-block][hidden] { display: block; }
}
