/* css/about.css */

.about {
  position: relative;
  min-height: 100svh;
  padding: clamp(120px, 16vh, 180px) 0 clamp(100px, 12vh, 150px);
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  background: var(--c-black);
}

.about__canvas-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.about__sequence-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* Затемнение слева под текст */
.about::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.82) 0%,
    rgba(0, 0, 0, 0.55) 40%,
    rgba(0, 0, 0, 0.05) 100%
  );
}

.about__inner {
  position: relative;
  z-index: 2;
}

.about__tabs {
  display: flex;
  gap: clamp(24px, 4vw, 56px);
  margin-bottom: clamp(32px, 4vh, 52px);
  flex-wrap: wrap;
  align-items: flex-end;
}

.about__tab {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 3.4vw, 2.8rem);
  line-height: 1.05;
  color: var(--c-body-dark);
  padding: 0 0 12px;
  background: none;
  border: none;
  cursor: pointer;
  appearance: none;
  transition: color var(--dur-ui) var(--ease-soft),
    text-shadow var(--dur-ui) var(--ease-soft);
}

.about__tab.is-active {
  color: var(--c-white);
  text-shadow: 0 0 32px rgba(255, 255, 255, 0.25),
    0 0 18px rgba(142, 43, 52, 0.15);
}

.about__tab:focus-visible {
  outline: 1px solid var(--c-accent-soft);
  outline-offset: 8px;
}

.about__body {
  position: relative;
  max-width: min(560px, 90%);
  min-height: clamp(360px, 42vh, 500px);
  transition: min-height var(--dur-ui) var(--ease-soft),
    opacity var(--dur-reveal) var(--ease-soft),
    transform var(--dur-reveal) var(--ease-soft),
    filter var(--dur-reveal) var(--ease-soft);
}

.about__panel {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity var(--dur-ui) var(--ease-soft),
    transform var(--dur-ui) var(--ease-soft);
}

.about__panel.is-active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.about__panel.is-leaving {
  opacity: 0;
  transform: translateY(-16px);
  pointer-events: none;
}

.about__panel p {
  font-family: var(--f-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 300;
  color: var(--c-body-dark);
  margin: 0 0 var(--space-4);
}

.about__panel p strong {
  color: var(--c-white);
  font-weight: 500;
}

.about__principles {
  margin: 0 0 var(--space-4);
  padding: 0;
  list-style: none;
  counter-reset: pr;
}

.about__principles li {
  position: relative;
  padding-left: 32px;
  margin-bottom: var(--space-4);
  font-family: var(--f-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 300;
  color: var(--c-body-dark);
  counter-increment: pr;
}

.about__principles li::before {
  content: counter(pr);
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--f-display);
  color: var(--c-accent-soft);
  font-weight: 700;
}

.about__principles li strong {
  color: var(--c-white);
  font-weight: 500;
}

.about__value {
  position: relative;
  padding-left: 0;
  margin-bottom: var(--space-6);
}

.about__value:last-child { margin-bottom: 0; }

.about__value h3 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: var(--fs-h3);
  color: var(--c-white);
  margin: 0 0 var(--space-2);
}

.about__value p {
  margin: 0;
  font-family: var(--f-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 300;
  color: var(--c-body-dark);
}

/* Лид — первый абзац панели крупной антиквой */
.about__panel > p:first-of-type {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: var(--fs-lead);
  line-height: 1.3;
  color: var(--c-white);
  margin-bottom: var(--space-6);
}

/* Акцент внутри лида */
.about__panel > p:first-of-type strong {
  color: var(--c-white);
  font-weight: 700;
}

@media (max-width: 767.98px) {
  /* .about__inner — flex-item без ширины, по умолчанию сжимается
     под самый широкий контент (табы), а margin:auto из .container
     центрирует получившийся узкий блок вместо растяжения на всю
     строку. Плюс .about__body сам ограничен max-width:560px/90%. */
  .about__inner {
    width: 100%;
  }

  .about__body {
    max-width: none;
  }

  /* Табы: равномерно по ширине, тап-таргет от 44px, активный — заметнее.
     Кегль и gap уменьшены с десктопных — на 320-375px три таба в исходном
     размере физически не влезали в одну строку (замерено, до 363px
     контента при ~265-320px доступной ширины) и переносились на вторую
     строку, ломая justify-content:space-between. */
  .about__tabs {
    justify-content: space-between;
    gap: 12px;
  }

  .about__tab {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 4px;
    font-size: 18px;
    border-bottom: 2px solid transparent;
  }

  .about__tab.is-active {
    border-bottom-color: var(--c-accent);
  }

  /* Три пункта read как отдельные смысловые единицы, не сплошным потоком */
  .about__principles {
    margin: var(--space-8) 0 var(--space-8);
  }

  .about__principles li {
    margin-bottom: var(--space-7);
  }

  .about__principles li:last-child {
    margin-bottom: 0;
  }

  .about__principles li strong {
    display: block;
    margin-bottom: var(--space-2);
    color: var(--c-accent);
    font-weight: 700;
  }

  .about {
    padding-top: clamp(64px, 9vh, 96px);
  }

  .about__body {
    min-height: 0 !important;
  }

  .about__panel {
    position: static;
    inset: auto;
    display: none;
  }

  .about__panel.is-active {
    display: block;
  }

  .about__panel.is-leaving {
    display: none;
  }

  /* ===== Заголовки стопкой: активный крупно по центру ===== */
  .about__tabs {
    position: relative;
    display: block;
    height: 22vh;
    min-height: 130px;
    margin-bottom: var(--space-6);
    gap: 0;
  }

  .about__tab {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    display: block;
    width: 100%;
    min-height: 0;
    padding: 0;
    text-align: center;
    white-space: nowrap;
    border-bottom: none;
    transform: translateY(-50%);
    transition: none;
  }

  .about__tab:not(.is-active) {
    font-size: 19px;
    font-weight: 300;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    text-shadow: none;
  }

  /* Видно только соседнее слово. Дальнее (дистанция 2) скрыто —
     иначе три слова не помещаются по ширине и накладываются. */
  .about__tab.is-before {
    transform: translate(-38vw, -50%);
    opacity: 0.85;
  }

  .about__tab.is-after {
    transform: translate(38vw, -50%);
    opacity: 0.85;
  }

  .about__tab:not(.is-active) {
    transition: transform 0.6s var(--ease-soft), opacity 0.6s var(--ease-soft);
  }

  .about__tab.is-far {
    opacity: 0;
    pointer-events: none;
  }

  .about__tab.is-active {
    z-index: 3;
    font-size: clamp(30px, 10vw, 48px);
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    color: var(--c-white);
    border-bottom: none;
    transform: translate(0, -50%);
    animation: aboutBubbleIn 0.72s cubic-bezier(0.34, 1.56, 0.44, 1) both;
  }

  @keyframes aboutBubbleIn {
    0%   { opacity: 0; transform: translate(var(--from, 40vw), -50%) scale(0.3); filter: blur(6px); }
    60%  { opacity: 1; filter: blur(0); }
    100% { opacity: 1; transform: translate(0, -50%) scale(1); filter: blur(0); }
  }

  /* ===== Каскад текста шторкой ===== */
  .about__panel.is-active > * {
    animation: aboutShutterIn 1.15s cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  .about__panel.is-active > *:nth-child(1) { animation-delay: 0.19s; }
  .about__panel.is-active > *:nth-child(2) { animation-delay: 0.38s; }
  .about__panel.is-active > *:nth-child(3) { animation-delay: 0.57s; }
  .about__panel.is-active > *:nth-child(4) { animation-delay: 0.76s; }
  .about__panel.is-active > *:nth-child(5) { animation-delay: 0.95s; }

  @keyframes aboutShutterIn {
    from { opacity: 0; clip-path: inset(0 0 100% 0); transform: translateY(16px); }
    to   { opacity: 1; clip-path: inset(0 0 0 0);   transform: translateY(0); }
  }

  .about__panel.is-leaving > * {
    animation: aboutShutterOut 0.5s cubic-bezier(0.32, 0, 0.67, 0) both;
  }
  .about__panel.is-leaving > *:nth-child(2) { animation-delay: 0.07s; }
  .about__panel.is-leaving > *:nth-child(3) { animation-delay: 0.14s; }
  .about__panel.is-leaving > *:nth-child(4) { animation-delay: 0.21s; }

  @keyframes aboutShutterOut {
    from { opacity: 1; clip-path: inset(0 0 0 0);   transform: translateY(0); }
    to   { opacity: 0; clip-path: inset(100% 0 0 0); transform: translateY(-16px); }
  }

  /* ===== Фон вместо секвенции: медленная дымка ===== */
  .about::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
      radial-gradient(60% 45% at 32% 30%, rgba(150, 175, 200, 0.16), transparent 70%),
      radial-gradient(50% 40% at 72% 70%, rgba(120, 140, 170, 0.13), transparent 70%);
    filter: blur(22px);
    animation: aboutDrift 28s ease-in-out infinite alternate;
  }

  @keyframes aboutDrift {
    from { transform: translate3d(-5%, -3%, 0) scale(1.05); }
    to   { transform: translate3d(5%, 4%, 0) scale(1.16); }
  }
}

/* Кадровая анимация canvas уже гасится флагом REDUCE в about.js —
   здесь только CSS-переходы переключения табов (цвет, кросс-фейд панели). */
@media (prefers-reduced-motion: reduce) {
  .about__tab,
  .about__body,
  .about__panel {
    transition: none;
  }

  .about__tab.is-active,
  .about__panel.is-active > *,
  .about__panel.is-leaving > *,
  .about::after {
    animation: none;
  }
}
