:root {
  --canvas: #f3f2ed;
  --paper: #fffefa;
  --ink: #17171b;
  --muted: #68686f;
  --line: #d7d6cf;
  --line-dark: #b7b6ae;
  --violet: #5b4cf0;
  --violet-dark: #4036bd;
  --violet-soft: #ece9ff;
  --lime: #dffc7a;
  --cyan: #bdeff0;
  --amber: #ffd68d;
  --rose: #ffc9d4;
  --dark: #17181c;
  --dark-muted: #b9bac2;
  --white: #ffffff;
  --shadow: 0 28px 90px rgba(24, 24, 28, 0.12);
  --shadow-soft: 0 16px 48px rgba(24, 24, 28, 0.08);
  --ease: cubic-bezier(0.2, 0.75, 0.25, 1);
  --page-pad: clamp(20px, 5vw, 80px);
  --content-max: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--canvas);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 96% 1%, rgba(223, 252, 122, 0.28), transparent 22rem),
    radial-gradient(circle at 4% 40%, rgba(91, 76, 240, 0.08), transparent 18rem),
    var(--canvas);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 5000;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--white);
  background: var(--dark);
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.shell {
  position: relative;
  overflow: clip;
}

.section-inner {
  width: min(100%, var(--content-max));
  margin: 0 auto;
  padding-right: var(--page-pad);
  padding-left: var(--page-pad);
}

/* Topbar */
.topbar {
  position: sticky;
  z-index: 100;
  top: 0;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: max(12px, env(safe-area-inset-top)) var(--page-pad) 12px;
  border-bottom: 1px solid rgba(183, 182, 174, 0.48);
  background: rgba(243, 242, 237, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--white);
  border: 1px solid var(--line);
  overflow: hidden;
  padding: 5px;
}

.brand-mark__gerb {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-copy {
  display: grid;
  gap: 1px;
  font-size: 12px;
  font-weight: 780;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.brand-copy span:first-child {
  max-width: 22ch;
}

.brand-copy span:last-child {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.topnav a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: color 160ms ease;
}

.topnav a:hover {
  color: var(--ink);
}

.topnav .nav-cta {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  padding: 9px 16px;
  border: 1px solid var(--dark);
  border-radius: 999px;
  color: var(--white);
  background: var(--dark);
}

.topnav .nav-cta:hover {
  color: var(--white);
  background: #2a2b30;
}

/* Hero */
.hero {
  padding-top: clamp(48px, 8vw, 96px);
  padding-bottom: clamp(32px, 5vw, 56px);
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-title {
  max-width: 14ch;
  margin: 0 0 20px;
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.hero-lead {
  max-width: 52ch;
  margin: 0 0 28px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.55;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.pill-lime { background: var(--lime); border-color: transparent; }
.pill-cyan { background: var(--cyan); border-color: transparent; }
.pill-amber { background: var(--amber); border-color: transparent; }

/* Chat section */
.chat-section {
  position: relative;
  padding-bottom: clamp(48px, 8vw, 80px);
}

.chat-frame {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 0;
  max-width: 720px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chat-frame-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.chat-frame-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.chat-avatar {
  display: block;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(145deg, var(--violet), var(--violet-dark));
}

.chat-avatar__photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
}

.chat-frame-brand strong {
  display: block;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.chat-frame-brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.chat-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f2f2f4;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.chat-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b0b0b8;
}

.chat-body {
  min-height: 140px;
  padding: 24px;
}

.chat-message {
  max-width: 92%;
}

.chat-message p {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.55;
}

.chat-message p:last-child {
  margin-bottom: 0;
}

.chat-message .muted {
  color: var(--muted);
  font-size: 14px;
}

.chat-suggestions {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.suggestions-label {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.suggestion-list {
  display: grid;
  gap: 10px;
}

.suggestion-chip {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: var(--white);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 180ms var(--ease),
    background 180ms var(--ease),
    transform 180ms var(--ease),
    box-shadow 180ms var(--ease);
}

.suggestion-chip:hover {
  border-color: var(--violet);
  background: var(--violet-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.suggestion-chip:active {
  transform: translateY(0);
}

.suggestion-chip.is-selected {
  border-color: var(--violet);
  background: var(--violet-soft);
}

.chat-status.is-online {
  background: #eef9ee;
  color: #2d6b2d;
}

.chat-status.is-online i {
  background: #3cb33c;
  box-shadow: 0 0 0 4px rgba(60, 179, 60, 0.2);
}

.chat-status.is-offline {
  background: #fdeeee;
  color: #9b3030;
}

.chat-status.is-offline i {
  background: #d9534f;
  box-shadow: 0 0 0 4px rgba(217, 83, 79, 0.18);
}

.chat-status.is-busy {
  background: var(--violet-soft);
  color: var(--violet-dark);
}

.chat-status.is-busy i {
  background: var(--violet);
  box-shadow: 0 0 0 4px rgba(91, 76, 240, 0.16);
}

.chat-panel {
  display: flex;
  flex-direction: column;
  height: clamp(420px, 56vh, 520px);
  min-height: 420px;
  background: var(--paper);
}

.chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.chat-bubble {
  max-width: 88%;
}

.chat-bubble--user {
  align-self: flex-end;
}

.chat-bubble--bot {
  align-self: flex-start;
}

.chat-bubble__body {
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.55;
}

.chat-bubble--user .chat-bubble__body {
  color: var(--white);
  background: linear-gradient(145deg, var(--violet), var(--violet-dark));
  border-bottom-right-radius: 6px;
}

.chat-bubble--bot .chat-bubble__body {
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
}

.chat-bubble.is-error .chat-bubble__body {
  color: #9b3030;
  background: #fff5f5;
  border-color: #f0c8c8;
}

.chat-typing {
  color: var(--muted);
  font-style: italic;
}

.chat-error {
  display: block;
}

.chat-panel .chat-composer {
  flex: 0 0 auto;
}

.chat-composer {
  display: flex;
  gap: 10px;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.composer-field {
  flex: 1;
  min-width: 0;
}

.composer-field input {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--white);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.composer-field input:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 4px rgba(91, 76, 240, 0.12);
}

.composer-field input::placeholder {
  color: #9a9aa1;
}

.composer-send {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: none;
  border-radius: 14px;
  color: var(--white);
  background: var(--dark);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 160ms ease, transform 160ms ease;
}

.composer-send:hover {
  background: #2a2b30;
}

.composer-send:active {
  transform: scale(0.98);
}

.chat-note {
  margin: 0;
  padding: 0 24px 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.chat-widget-anchor {
  position: absolute;
  left: 50%;
  bottom: 120px;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

/* Features */
.features {
  padding-top: clamp(48px, 8vw, 88px);
  padding-bottom: clamp(48px, 8vw, 88px);
}

.section-head h2 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 36px;
}

.feature-card {
  padding: 28px 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
}

.feature-num {
  display: inline-flex;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.feature-card h3 {
  margin: 0 0 10px;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

/* Topics */
.topics {
  padding-bottom: clamp(48px, 8vw, 88px);
}

.topics-layout {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: clamp(24px, 5vw, 56px);
  align-items: start;
}

.topics-copy h2 {
  margin: 0 0 14px;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.topics-copy p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.topic-cards {
  display: grid;
  gap: 14px;
}

.topic-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
}

.topic-card-dark {
  color: var(--white);
  background: var(--dark);
  border-color: var(--dark);
}

.topic-card-dark .topic-tag {
  color: var(--dark-muted);
}

.topic-card-dark p {
  color: var(--dark-muted);
}

.topic-tag {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.topic-card h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.topic-card p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

/* Outcomes */
.outcomes {
  padding-bottom: clamp(48px, 8vw, 88px);
}

.outcomes-card {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: clamp(24px, 5vw, 48px);
  padding: clamp(28px, 5vw, 44px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    radial-gradient(circle at 100% 0%, rgba(223, 252, 122, 0.35), transparent 40%),
    var(--paper);
  box-shadow: var(--shadow-soft);
}

.outcomes-head h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.outcomes-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.outcomes-list li {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.5;
}

.outcomes-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.outcomes-list strong {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

/* Footer */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 24px;
  padding-bottom: max(32px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.footer a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* Reveal animation */
.reveal {
  animation: reveal-up 0.7s var(--ease) both;
  animation-delay: var(--d, 0s);
}

@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Timeweb widget positioning hint */
body.widget-open {
  overflow: hidden;
}

/* Udmurtia coat of arms */
.udmurtia-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  vertical-align: middle;
}

.coat-of-arms {
  flex-shrink: 0;
  object-fit: contain;
  vertical-align: middle;
}

.coat-of-arms--xs {
  width: 16px;
  height: 16px;
}

.coat-of-arms--sm {
  width: 18px;
  height: 18px;
}

.coat-of-arms--md {
  width: 22px;
  height: 22px;
}

.eyebrow .udmurtia-mark {
  gap: 0.45em;
}

.suggestion-chip .udmurtia-mark {
  display: inline-flex;
}

.suggestion-chip .coat-of-arms--xs {
  width: 15px;
  height: 15px;
}

.footer .udmurtia-mark {
  gap: 0.4em;
}

/* Responsive */
@media (max-width: 900px) {
  .feature-grid {
    grid-template-columns: 1fr;
  }

  .topics-layout,
  .outcomes-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  :root {
    --page-pad: 16px;
  }

  body {
    font-size: 16px;
  }

  .topbar {
    min-height: 64px;
    gap: 12px;
    padding-right: max(16px, env(safe-area-inset-right));
    padding-left: max(16px, env(safe-area-inset-left));
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand-copy {
    font-size: 11px;
  }

  .brand-copy span:first-child {
    max-width: 16ch;
  }

  .topnav a:not(.nav-cta) {
    display: none;
  }

  .topnav .nav-cta {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 12px;
  }

  .hero {
    padding-top: 28px;
    padding-bottom: 24px;
  }

  .hero-title {
    max-width: none;
    margin-bottom: 12px;
    font-size: clamp(1.85rem, 8vw, 2.4rem);
    line-height: 1.05;
  }

  .hero-title br {
    display: none;
  }

  .hero-lead {
    margin-bottom: 14px;
    font-size: 0.95rem;
    line-height: 1.45;
  }

  .hero-pills {
    gap: 8px;
  }

  .pill {
    min-height: 32px;
    padding: 5px 11px;
    font-size: 12px;
  }

  .chat-section {
    padding-bottom: 28px;
  }

  .chat-frame {
    border-radius: 22px;
  }

  .chat-frame-head {
    flex-wrap: nowrap;
    gap: 10px;
    padding: 12px 12px 10px;
  }

  .chat-frame-brand {
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
  }

  .chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .chat-frame-brand strong {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chat-frame-brand small {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chat-status {
    flex: 0 0 auto;
    padding: 8px;
    border-radius: 50%;
  }

  .chat-status__label {
    display: none;
  }

  .chat-panel {
    height: min(58dvh, 460px);
    min-height: 300px;
  }

  .chat-messages {
    padding: 12px;
    gap: 10px;
  }

  .chat-bubble {
    max-width: 94%;
  }

  .chat-bubble__body {
    padding: 11px 13px;
    font-size: 14px;
    line-height: 1.5;
  }

  .chat-composer {
    gap: 8px;
    padding: 10px 10px max(12px, env(safe-area-inset-bottom));
  }

  .composer-field input {
    min-height: 46px;
    padding: 0 14px;
    font-size: 16px;
    border-radius: 12px;
  }

  .composer-send {
    min-height: 46px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 13px;
  }

  .composer-send span {
    display: none;
  }

  .features,
  .topics,
  .outcomes {
    padding-top: 28px;
    padding-bottom: 28px;
  }

  .feature-grid {
    gap: 12px;
    margin-top: 20px;
  }

  .feature-card,
  .topic-card {
    padding: 18px 16px;
    border-radius: 18px;
  }

  .outcomes-card {
    gap: 16px;
    padding: 20px 16px;
    border-radius: 20px;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 420px) {
  .chat-composer {
    flex-wrap: wrap;
  }

  .composer-field {
    flex: 1 1 100%;
  }

  .composer-send {
    width: 100%;
    justify-content: center;
  }

  .composer-send span {
    display: inline;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    animation: none;
  }
}
