/* ==========================================================================
   theme.css — Design System | Alisa AI Bridge / PC Agent
   Fonts: Fraunces (display/headings) + Manrope (body/UI)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,600;0,9..144,700;1,9..144,400;1,9..144,600&family=Manrope:wght@300;400;500;600;700&display=swap');

/* ==========================================================================
   0. БАЗОВОЕ ПОВЕДЕНИЕ
   ========================================================================== */

/* Атрибут hidden обязан скрывать элемент — всегда.

   Браузер задаёт для него `display: none` в своей таблице стилей, у которой
   приоритет ниже любого нашего правила с классом. Поэтому блок с чем-то вроде
   `display: flex` при `hidden` НЕ исчезал: скрипт честно проставлял атрибут,
   а элемент оставался на экране. Так в кабинете навсегда зависала плашка
   «Загрузка…» поверх уже загруженных данных, и то же тихо ломалось ещё в
   четырёх местах. `!important` здесь уместен: это не оформление, а инвариант —
   скрытое не показывается. */
[hidden] {
  display: none !important;
}

/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */

:root {
  /* Colour palette */
  --bg:        #FAF7F2;
  --bg-warm:   #F2EAE0;
  --surface:   #FFFFFF;
  --ink:       #211E1A;
  --ink-soft:  #5C564E;
  --clay:      #D97757;
  --clay-deep: #C15F3C;
  --red:       #FC3F1D;
  --line:      #E7DFD3;
  --gold:      #E8C9A0;

  /* Typography */
  --font-display: "Fraunces", Georgia, serif;
  --font-body:    "Manrope", system-ui, sans-serif;

  /* Shape & depth */
  --r-sm:     10px;
  --r:        18px;
  --r-lg:     28px;
  --shadow:   0 10px 40px rgba(33, 30, 26, .08);
  --shadow-lg:0 24px 70px rgba(33, 30, 26, .14);

  /* Layout */
  --container: 1140px;

  /* Motion */
  --ease: cubic-bezier(.22, .61, .36, 1);

  /* Transition shorthand */
  --t: 240ms var(--ease);
}

/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  font: inherit;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
}

h1 { font-size: clamp(2.25rem, 5vw, 3.75rem); }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.75rem); }
h3 { font-size: clamp(1.35rem, 2.5vw, 1.875rem); }
h4 { font-size: clamp(1.125rem, 2vw, 1.375rem); }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
  color: var(--ink-soft);
  max-width: 68ch;
}

strong { font-weight: 700; color: var(--ink); }

/* Focus visible — global accessible outline */
:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ==========================================================================
   3. LAYOUT HELPERS
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1rem, 5vw, 3rem);
}

.section {
  padding-block: clamp(4rem, 8vw, 7rem);
}

.section--compact {
  padding-block: clamp(2.5rem, 5vw, 4rem);
}

.section--flush {
  padding-block: 0;
}

/* Grid utilities */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Flex utilities */
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.gap-sm      { gap: 0.75rem; }
.gap         { gap: 1.5rem; }
.gap-lg      { gap: 2.5rem; }

/* ==========================================================================
   4. BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75em 1.875em;
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  text-decoration: none;
  border: 2px solid transparent;
  transition:
    background-color var(--t),
    color var(--t),
    border-color var(--t),
    box-shadow var(--t),
    transform 120ms var(--ease);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

/* Primary — Clay */
.btn--primary {
  background-color: var(--clay);
  color: #fff;
  border-color: var(--clay);
}

.btn--primary:hover,
.btn--primary:focus-visible {
  background-color: var(--clay-deep);
  border-color: var(--clay-deep);
  box-shadow: 0 6px 24px rgba(217, 119, 87, .35);
}

/* Red — main CTA */
.btn--red {
  background-color: var(--red);
  color: #fff;
  border-color: var(--red);
}

.btn--red:hover,
.btn--red:focus-visible {
  background-color: #e03518;
  border-color: #e03518;
  box-shadow: 0 6px 24px rgba(252, 63, 29, .35);
}

/* Ghost */
.btn--ghost {
  background-color: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
  background-color: var(--bg-warm);
  border-color: var(--gold);
}

/* Block */
.btn--block {
  width: 100%;
}

/* Size variants */
.btn--sm {
  padding: 0.55em 1.25em;
  font-size: 0.875rem;
}

.btn--lg {
  padding: 0.875em 2.25em;
  font-size: 1.0625rem;
}

/* ==========================================================================
   5. CARD
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: clamp(1.5rem, 3vw, 2.5rem);
  box-shadow: var(--shadow);
  transition: box-shadow var(--t), transform var(--t);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.card--warm {
  background: var(--bg-warm);
  border-color: var(--gold);
}

.card--flat {
  box-shadow: none;
}

.card--flat:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

/* ==========================================================================
   6. BADGE / TAG / EYEBROW
   ========================================================================== */

.badge,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3em 0.85em;
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  background-color: rgba(217, 119, 87, .12);
  color: var(--clay-deep);
  border: 1px solid rgba(217, 119, 87, .25);
}

.badge--red {
  background-color: rgba(252, 63, 29, .10);
  color: var(--red);
  border-color: rgba(252, 63, 29, .22);
}

.badge--neutral {
  background-color: var(--bg-warm);
  color: var(--ink-soft);
  border-color: var(--line);
}

.eyebrow {
  display: block;
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--clay);
  margin-bottom: 0.625rem;
}

/* ==========================================================================
   7. FORMS
   ========================================================================== */

.field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.field label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 0.75em 1em;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--ink);
  transition: border-color var(--t), box-shadow var(--t);
  outline: none;
  appearance: none;
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--gold);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--clay);
  box-shadow: 0 0 0 3px rgba(217, 119, 87, .18);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.error {
  font-size: 0.8125rem;
  color: var(--red);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

input.is-error,
textarea.is-error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(252, 63, 29, .15);
}

/* ==========================================================================
   8. MODAL
   ========================================================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(33, 30, 26, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t), visibility var(--t);
}

.modal.is-open {
  opacity: 1;
  visibility: visible;
}

.modal__box {
  position: relative;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: clamp(1.75rem, 4vw, 3rem);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.98);
  transition: transform var(--t);
}

.modal.is-open .modal__box {
  transform: translateY(0) scale(1);
}

.modal__close {
  position: absolute;
  top: 1.125rem;
  right: 1.125rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-warm);
  color: var(--ink-soft);
  transition: background var(--t), color var(--t);
}

.modal__close:hover {
  background: var(--line);
  color: var(--ink);
}

/* ==========================================================================
   9. WAVE DIVIDER — Audio-equaliser decorative separator
   ========================================================================== */

.wave-divider {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 36px;
  padding-block: 0.5rem;
}

.wave-divider span {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: var(--clay);
  opacity: 0.45;
  animation: wave-pulse 1.4s ease-in-out infinite;
}

/* Staggered heights and delays for 12 bars */
.wave-divider span:nth-child(1)  { height: 40%; animation-delay: 0.00s; }
.wave-divider span:nth-child(2)  { height: 65%; animation-delay: 0.10s; }
.wave-divider span:nth-child(3)  { height: 85%; animation-delay: 0.20s; }
.wave-divider span:nth-child(4)  { height: 55%; animation-delay: 0.30s; }
.wave-divider span:nth-child(5)  { height: 95%; animation-delay: 0.15s; }
.wave-divider span:nth-child(6)  { height: 75%; animation-delay: 0.05s; }
.wave-divider span:nth-child(7)  { height: 90%; animation-delay: 0.25s; }
.wave-divider span:nth-child(8)  { height: 60%; animation-delay: 0.35s; }
.wave-divider span:nth-child(9)  { height: 45%; animation-delay: 0.12s; }
.wave-divider span:nth-child(10) { height: 80%; animation-delay: 0.22s; }
.wave-divider span:nth-child(11) { height: 55%; animation-delay: 0.08s; }
.wave-divider span:nth-child(12) { height: 35%; animation-delay: 0.18s; }

@keyframes wave-pulse {
  0%, 100% { transform: scaleY(0.45); opacity: 0.35; }
  50%       { transform: scaleY(1);    opacity: 0.65; }
}

/* ==========================================================================
   10. REVEAL ANIMATIONS
   ========================================================================== */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 550ms var(--ease),
    transform 550ms var(--ease);
}

.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

/* Variants */
.reveal--up    { transform: translateY(24px); }
.reveal--down  { transform: translateY(-24px); }
.reveal--left  { transform: translateX(-24px); }
.reveal--right { transform: translateX(24px); }
.reveal--scale { transform: scale(0.94); }

.reveal--up.in,
.reveal--down.in,
.reveal--left.in,
.reveal--right.in,
.reveal--scale.in {
  transform: none;
}

/* Stagger delays (set via data-delay or these utility classes) */
.reveal--d1 { transition-delay: 80ms; }
.reveal--d2 { transition-delay: 160ms; }
.reveal--d3 { transition-delay: 240ms; }
.reveal--d4 { transition-delay: 320ms; }
.reveal--d5 { transition-delay: 400ms; }

/* Respect user motion preference */
@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal--up,
  .reveal--down,
  .reveal--left,
  .reveal--right,
  .reveal--scale {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .wave-divider span {
    animation: none;
  }

  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   11. SITE HEADER
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 800;
  background: transparent;
  transition: background var(--t), box-shadow var(--t), backdrop-filter var(--t);
}

.site-header.is-scrolled {
  background: rgba(250, 247, 242, .88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 var(--line), 0 4px 20px rgba(33, 30, 26, .06);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: 68px;
}

/* Brand wordmark */
.brand {
  font-family: var(--font-display);
  font-size: 1.3125rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  text-decoration: none;
  flex-shrink: 0;
  transition: color var(--t);
}

.brand:hover {
  color: var(--clay);
}

.brand em {
  font-style: italic;
  color: var(--clay);
}

/* Navigation */
.nav {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  flex: 1;
}

/* Centered group of regular nav links */
.nav__links {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  margin-inline: auto;
}

/* Right-aligned action cluster: account CTA, buy CTA, language switch */
.nav__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.nav a {
  display: inline-block;
  padding: 0.45em 0.75em;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-soft);
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: color var(--t), background var(--t);
  position: relative;
}

.nav a::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 0.75em;
  right: 0.75em;
  height: 2px;
  border-radius: 2px;
  background: var(--clay);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t);
}

.nav a:hover {
  color: var(--ink);
  background: var(--bg-warm);
}

.nav a.is-active {
  color: var(--clay);
  font-weight: 600;
}

.nav a.is-active::after {
  transform: scaleX(1);
}

/* Accent account CTA (pulled out of the regular link row) */
.nav__account {
  flex-shrink: 0;
}

.nav__cta {
  flex-shrink: 0;
}

/* Language switcher */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  background: var(--bg-warm);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  flex-shrink: 0;
}

.lang-switch__btn {
  min-width: 2rem;
  padding: 0.28em 0.5em;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  border-radius: calc(var(--r-sm) - 2px);
  cursor: pointer;
  transition: color var(--t), background var(--t);
}

.lang-switch__btn:hover {
  color: var(--ink);
}

.lang-switch__btn.is-active {
  color: var(--clay);
  background: var(--surface, #fff);
  box-shadow: 0 1px 3px rgba(33, 30, 26, .12);
}

/* Burger button (mobile) */
.burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0.25rem;
  border-radius: var(--r-sm);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background var(--t);
  flex-shrink: 0;
}

.burger:hover {
  background: var(--bg-warm);
}

.burger__line {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform var(--t), opacity var(--t);
  transform-origin: center;
}

/* Burger open state */
.nav--open .burger__line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav--open .burger__line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.nav--open .burger__line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile nav */
@media (max-width: 768px) {
  .burger {
    display: flex;
  }

  .nav {
    position: fixed;
    top: 68px;
    left: 0;
    right: 0;
    background: rgba(250, 247, 242, .96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 1rem 1.5rem 1.5rem;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 30px rgba(33, 30, 26, .10);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t), transform var(--t);
  }

  .nav--open .nav {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav a {
    padding: 0.75em 1em;
    font-size: 1rem;
    border-radius: var(--r-sm);
  }

  .nav a::after {
    display: none;
  }

  .nav a.is-active {
    background: rgba(217, 119, 87, .08);
  }

  /* Stack the centered links and the action cluster in the mobile dropdown */
  .nav__links,
  .nav__actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin-inline: 0;
    width: 100%;
  }

  .nav__actions {
    gap: 0.5rem;
    margin-top: 0.75rem;
  }

  .nav__cta {
    margin-left: 0;
    margin-top: 0;
  }

  .nav__cta.btn--block {
    width: 100%;
    justify-content: center;
  }

  .lang-switch {
    margin-left: 0;
    margin-top: 0.75rem;
    align-self: center;
  }

  .lang-switch__btn {
    min-width: 2.5rem;
    padding: 0.45em 0.7em;
    font-size: 0.875rem;
  }
}

/* ==========================================================================
   12. SITE FOOTER
   ========================================================================== */

.site-footer {
  background: var(--ink);
  color: rgba(250, 247, 242, .7);
  padding-block: clamp(3rem, 6vw, 5rem);
  margin-top: auto;
}

.site-footer__cols {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem 2rem;
  margin-bottom: 3rem;
}

.site-footer__brand .brand {
  color: #FAF7F2;
  font-size: 1.4375rem;
}

.site-footer__brand .brand:hover {
  color: var(--clay);
}

.site-footer__brand p {
  margin-top: 0.875rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: rgba(250, 247, 242, .55);
  max-width: 28ch;
}

.site-footer__col-title {
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(250, 247, 242, .35);
  margin-bottom: 1rem;
}

.site-footer__links {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.site-footer__links a {
  font-size: 0.9rem;
  color: rgba(250, 247, 242, .65);
  text-decoration: none;
  transition: color var(--t);
}

.site-footer__links a:hover {
  color: var(--clay);
}

.site-footer__bottom {
  border-top: 1px solid rgba(250, 247, 242, .10);
  padding-top: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-footer__copyright {
  font-size: 0.8125rem;
  color: rgba(250, 247, 242, .35);
}

.site-footer__attribution {
  font-size: 0.6875rem;
  line-height: 1.5;
  color: rgba(250, 247, 242, .28);
}

.site-footer__attribution a {
  color: rgba(250, 247, 242, .42);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.site-footer__attribution a:hover {
  color: var(--clay);
}

@media (max-width: 900px) {
  .site-footer__cols {
    grid-template-columns: 1fr 1fr;
  }
  .site-footer__brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 600px) {
  .site-footer__cols {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .site-footer__bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==========================================================================
   13. UTILITY CLASSES
   ========================================================================== */

.text-center   { text-align: center; }
.text-left     { text-align: left; }
.text-right    { text-align: right; }

.text-clay     { color: var(--clay); }
.text-red      { color: var(--red); }
.text-soft     { color: var(--ink-soft); }
.text-gold     { color: var(--gold); }

.bg-warm       { background-color: var(--bg-warm); }
.bg-surface    { background-color: var(--surface); }
.bg-ink        { background-color: var(--ink); }

.mt-0  { margin-top: 0; }
.mt-sm { margin-top: 0.5rem; }
.mt    { margin-top: 1.5rem; }
.mt-lg { margin-top: 3rem; }
.mb-0  { margin-bottom: 0; }
.mb-sm { margin-bottom: 0.5rem; }
.mb    { margin-bottom: 1.5rem; }
.mb-lg { margin-bottom: 3rem; }

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