/* Premium mobile entrance refinements.
   Kept separate from the application bundle so the first viewport can be tuned
   independently without changing the desktop composition. */

@media (max-width: 767px) {
  /* Compact, polished navigation: the first screen should belong to Elena. */
  html body header.sticky {
    border-bottom-color: color-mix(in oklab, var(--gold) 18%, transparent) !important;
    background: color-mix(in oklab, var(--surface-solid) 86%, transparent) !important;
    box-shadow: 0 12px 34px -28px color-mix(in oklab, var(--noir) 42%, transparent) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.12);
    backdrop-filter: blur(18px) saturate(1.12);
  }

  html body header.sticky > div {
    min-height: 68px;
    gap: 10px !important;
    padding: 8px 14px !important;
  }

  html body header.sticky a[aria-label] > img {
    width: 46px !important;
    height: 46px !important;
    filter: saturate(1.08) contrast(1.04) drop-shadow(0 8px 14px rgba(53, 36, 91, 0.12)) !important;
  }

  html body header.sticky .main-menu-toggle {
    width: 44px !important;
    height: 44px !important;
    border: 1px solid color-mix(in oklab, var(--gold) 26%, var(--border)) !important;
    background: color-mix(in oklab, var(--surface-solid) 76%, transparent) !important;
    color: var(--ink) !important;
    box-shadow:
      0 12px 26px -20px color-mix(in oklab, var(--noir) 52%, transparent),
      inset 0 1px 0 color-mix(in oklab, var(--surface-solid) 92%, transparent) !important;
  }

  /* Remove the large empty decorative band and create one coherent hero card. */
  html body #top {
    min-height: auto !important;
    padding: 10px 12px 30px !important;
    background:
      radial-gradient(85% 34% at 50% 2%, color-mix(in oklab, var(--rose) 34%, transparent), transparent 72%),
      radial-gradient(70% 46% at 92% 42%, color-mix(in oklab, var(--gold) 15%, transparent), transparent 76%),
      linear-gradient(
        180deg,
        color-mix(in oklab, var(--surface-soft) 84%, #eee8ff) 0%,
        color-mix(in oklab, var(--rose) 38%, #7660a8) 32%,
        color-mix(in oklab, var(--noir-raised) 84%, #3e2d68) 68%,
        var(--noir) 100%
      ) !important;
  }

  html body #top::before {
    height: 72px !important;
    opacity: 0.42 !important;
    transform: translateY(-18px);
    background:
      linear-gradient(174deg, transparent 48%, color-mix(in oklab, var(--champagne) 42%, transparent) 49%, color-mix(in oklab, var(--rose) 35%, transparent) 52%, transparent 53%),
      linear-gradient(186deg, transparent 48%, color-mix(in oklab, var(--gold) 48%, transparent) 49%, transparent 51%) !important;
  }

  html body #top > div > div {
    padding: 6px 0 0 !important;
  }

  /* Identity typography and its reserved slots use rem so the existing
     accessibility font-scale control enlarges the visible mobile copy too. */
  html body #top figure {
    width: 100%;
    max-width: 560px;
    margin-inline: auto;
    padding-top: 12rem !important;
    isolation: isolate;
  }

  /* Identity and credentials receive separate, guaranteed vertical zones. */
  html body #top figure::before {
    top: 0 !important;
    inset-inline: 0 !important;
    box-sizing: border-box;
    min-height: 11.375rem;
    padding: 1rem 0.875rem 4.375rem !important;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    border: 1px solid color-mix(in oklab, var(--champagne) 26%, transparent);
    border-radius: 28px 28px 16px 16px;
    background:
      radial-gradient(90% 130% at 50% -20%, color-mix(in oklab, var(--surface-solid) 24%, transparent), transparent 62%),
      linear-gradient(150deg, color-mix(in oklab, var(--rose) 20%, transparent), color-mix(in oklab, var(--noir) 42%, transparent));
    color: var(--surface-solid) !important;
    font-size: clamp(1.9375rem, 9.3vw, 2.625rem) !important;
    font-weight: 560 !important;
    line-height: 1.05 !important;
    letter-spacing: -0.018em !important;
    text-wrap: balance;
    text-shadow:
      0 1px 0 color-mix(in oklab, var(--surface-solid) 16%, transparent),
      0 8px 24px color-mix(in oklab, var(--noir) 54%, transparent) !important;
    box-shadow:
      0 24px 48px -34px color-mix(in oklab, var(--noir) 76%, transparent),
      inset 0 1px 0 color-mix(in oklab, var(--surface-solid) 24%, transparent);
    -webkit-backdrop-filter: blur(15px) saturate(1.08);
    backdrop-filter: blur(15px) saturate(1.08);
  }

  html body #top figure::after {
    top: 7rem !important;
    inset-inline: 1.375rem !important;
    padding-top: 0.625rem !important;
    color: color-mix(in oklab, var(--champagne) 82%, var(--surface-solid)) !important;
    border-top: 1px solid color-mix(in oklab, var(--gold) 44%, transparent) !important;
    font-size: clamp(0.8125rem, 3.45vw, 0.9375rem) !important;
    font-weight: 500 !important;
    line-height: 1.55 !important;
    letter-spacing: 0.035em !important;
    text-shadow: 0 3px 12px color-mix(in oklab, var(--noir) 58%, transparent) !important;
  }

  html[lang="en"] body #top figure::before {
    font-size: clamp(1.8125rem, 8.5vw, 2.4375rem) !important;
    line-height: 1.06 !important;
  }

  /* Russian identity and credentials are longer, so they receive more room. */
  html[lang="ru"] body #top figure {
    padding-top: 15.375rem !important;
  }

  html[lang="ru"] body #top figure::before {
    min-height: 14.75rem;
    padding: 0.9375rem 0.8125rem 4.625rem !important;
    font-size: clamp(1.5rem, 7.1vw, 2rem) !important;
    line-height: 1.08 !important;
    letter-spacing: -0.012em !important;
  }

  html[lang="ru"] body #top figure::after {
    top: 9.625rem !important;
    inset-inline: 1rem !important;
    font-size: clamp(0.6875rem, 2.9vw, 0.8125rem) !important;
    line-height: 1.45 !important;
    letter-spacing: 0.012em !important;
  }

  /* Bring the portrait into the first viewport and give it a cinematic frame. */
  html body #top figure > div:nth-child(2) {
    inset: 11.375rem -2px -2px !important;
    border-radius: 28px !important;
    background: linear-gradient(145deg, color-mix(in oklab, var(--rose) 46%, transparent), transparent 48%, color-mix(in oklab, var(--gold) 35%, transparent)) !important;
    filter: blur(6px) !important;
  }

  html[lang="ru"] body #top figure > div:nth-child(2) {
    inset-block-start: 14.75rem !important;
  }

  html body #top figure > div:last-child {
    margin-top: -10px;
    aspect-ratio: 6 / 7 !important;
    border: 1px solid color-mix(in oklab, var(--champagne) 38%, transparent) !important;
    border-radius: 27px !important;
    background: var(--noir) !important;
    box-shadow:
      0 30px 64px -28px color-mix(in oklab, var(--noir) 88%, transparent),
      0 0 0 1px color-mix(in oklab, var(--gold) 14%, transparent),
      0 0 30px color-mix(in oklab, var(--rose) 18%, transparent) !important;
  }

  html body #top figure > div:last-child::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    border-radius: inherit;
    background:
      linear-gradient(180deg, color-mix(in oklab, var(--noir) 20%, transparent) 0%, transparent 24%, transparent 70%, color-mix(in oklab, var(--noir) 28%, transparent) 100%),
      linear-gradient(110deg, color-mix(in oklab, var(--surface-solid) 8%, transparent), transparent 32%);
    box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--surface-solid) 8%, transparent);
  }

  html body #top video,
  html body #top figure img {
    object-position: 50% 27% !important;
  }

  /* Small, deliberate video control instead of a large button covering Elena. */
  html body #top figure > div:last-child > div:last-child {
    z-index: 3;
    padding: 12px !important;
  }

  html body #top figure button {
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
    padding: 0 !important;
    border: 1px solid color-mix(in oklab, var(--champagne) 42%, transparent) !important;
    background: color-mix(in oklab, var(--noir) 74%, transparent) !important;
    color: var(--surface-solid) !important;
    box-shadow:
      0 12px 28px color-mix(in oklab, var(--noir) 44%, transparent),
      inset 0 1px 0 color-mix(in oklab, var(--surface-solid) 14%, transparent) !important;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }

  html body #top figure button span {
    display: none !important;
  }

  html body #top figure button svg {
    width: 18px !important;
    height: 18px !important;
  }

  /* Continue the story below the video in the same visual language. */
  html body #top .hero-mobile-resilience {
    margin: 18px 2px 0;
    padding: 20px 18px 22px;
    border: 1px solid color-mix(in oklab, var(--champagne) 18%, transparent);
    border-radius: 24px;
    background: linear-gradient(145deg, color-mix(in oklab, var(--surface-solid) 10%, transparent), color-mix(in oklab, var(--noir) 20%, transparent));
    text-align: center;
    box-shadow:
      0 24px 48px -38px color-mix(in oklab, var(--noir) 90%, transparent),
      inset 0 1px 0 color-mix(in oklab, var(--surface-solid) 12%, transparent);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }

  html body #top .hero-mobile-resilience-title {
    color: var(--surface-solid);
    font-family: var(--font-display);
    font-size: clamp(1.6875rem, 7.4vw, 2.125rem);
    font-weight: 520;
    line-height: 1.18;
    letter-spacing: -0.012em;
    text-wrap: balance;
    text-shadow: 0 8px 22px color-mix(in oklab, var(--noir) 42%, transparent);
  }

  html body #top .hero-mobile-resilience-line {
    display: block;
  }

  html body #top .hero-mobile-resilience-emphasis,
  html body #top .hero-resilience-word {
    color: color-mix(in oklab, var(--champagne) 80%, var(--gold));
  }

  html body #top .hero-mobile-resilience-lead {
    display: grid;
    gap: 4px;
    margin-top: 12px;
    color: color-mix(in oklab, var(--surface-solid) 76%, transparent);
    font-size: 0.9375rem;
    line-height: 1.62;
  }

  /* Keep the floating action useful without covering the portrait. */
  html body a.fixed[href*="wa.me"] {
    width: 44px !important;
    height: 44px !important;
    bottom: 14px !important;
    box-shadow:
      0 16px 32px -18px rgba(16, 185, 129, 0.72),
      0 0 0 4px color-mix(in oklab, var(--surface-solid) 58%, transparent) !important;
  }
}

@media (max-width: 390px) {
  html body #top figure {
    padding-top: 10.875rem !important;
  }

  html body #top figure::before {
    min-height: 10.25rem;
    padding: 0.9375rem 0.75rem 4rem !important;
    font-size: clamp(1.8125rem, 9.2vw, 2.25rem) !important;
    line-height: 1.06 !important;
  }

  html body #top figure::after {
    top: 6.25rem !important;
    inset-inline: 1rem !important;
    font-size: 0.75rem !important;
    line-height: 1.5 !important;
  }

  html body #top figure > div:nth-child(2) {
    inset-block-start: 10.25rem !important;
  }

  html[lang="en"] body #top figure {
    padding-top: 11.5rem !important;
  }

  html[lang="en"] body #top figure::before {
    min-height: 10.875rem;
    font-size: clamp(1.6875rem, 8.4vw, 2.125rem) !important;
  }

  html[lang="en"] body #top figure::after {
    top: 6.875rem !important;
  }

  html[lang="en"] body #top figure > div:nth-child(2) {
    inset-block-start: 10.875rem !important;
  }

  html[lang="ru"] body #top figure {
    padding-top: 15.375rem !important;
  }

  html[lang="ru"] body #top figure::before {
    min-height: 14.75rem;
    font-size: clamp(1.4375rem, 6.9vw, 1.8125rem) !important;
  }

  html[lang="ru"] body #top figure::after {
    top: 9.625rem !important;
    font-size: 0.6875rem !important;
  }

  html[lang="ru"] body #top figure > div:nth-child(2) {
    inset-block-start: 14.75rem !important;
  }

  html body #top figure > div:last-child {
    aspect-ratio: 5 / 6 !important;
  }
}

/* Enlarged text can wrap to additional lines, so accessibility mode receives
   a deliberately generous identity zone rather than relying on clipping. */
@media (max-width: 767px) {
  html[data-a11y-font-expanded="on"] body #top figure {
    padding-top: 16rem !important;
  }

  html[data-a11y-font-expanded="on"] body #top figure::before {
    min-height: 15.5rem;
    padding-block-end: 7rem !important;
  }

  html[data-a11y-font-expanded="on"] body #top figure::after {
    top: 9.25rem !important;
  }

  html[data-a11y-font-expanded="on"] body #top figure > div:nth-child(2) {
    inset-block-start: 15.5rem !important;
  }

  html[lang="ru"][data-a11y-font-expanded="on"] body #top figure {
    padding-top: 22rem !important;
  }

  html[lang="ru"][data-a11y-font-expanded="on"] body #top figure::before {
    min-height: 21.5rem;
    padding-block-end: 8rem !important;
  }

  html[lang="ru"][data-a11y-font-expanded="on"] body #top figure::after {
    top: 12.75rem !important;
  }

  html[lang="ru"][data-a11y-font-expanded="on"] body #top figure > div:nth-child(2) {
    inset-block-start: 21.5rem !important;
  }
}