/* Cross-browser fallbacks — load after styles.css */

:root {
  --font: var(--font-text);
  --font-display: var(--font-stack-brand, "Cormorant Garamond", "Times New Roman", "Noto Serif SC", Georgia, serif);
  --font-text: var(--font-stack-sans, "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
  --anchor-offset: calc(var(--header-h, 56px) + var(--safe-top, 0px) + 8px);
}

html {
  scroll-padding-top: var(--anchor-offset);
}

[id] {
  scroll-margin-top: var(--anchor-offset);
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-synthesis: none;
}

body {
  overflow-x: hidden;
  min-height: 100vh;
  min-height: calc(var(--m-vh, 1vh) * 100);
}

@supports (overflow: clip) {
  body {
    overflow-x: clip;
  }
}

html.m-ios,
html.m-ios body {
  min-height: -webkit-fill-available;
}

.m-hero {
  min-height: calc(var(--m-vh, 1vh) * 100);
  min-height: 100vh;
  min-height: min(100svh, 820px);
}

html.m-android .m-hero,
html.m-edge-lite .m-hero {
  min-height: calc(var(--m-vh, 1vh) * 100);
  min-height: min(100svh, 820px);
}

.m-photo-band {
  min-height: min(76svh, 720px);
  min-height: min(calc(var(--m-vh, 1vh) * 76), 720px);
  height: min(76svh, 720px);
  height: min(calc(var(--m-vh, 1vh) * 76), 720px);
  max-height: 720px;
}

@supports (height: 100dvh) {
  .m-photo-band {
    min-height: min(calc(76 * 1dvh), 720px);
    height: min(calc(76 * 1dvh), 720px);
    max-height: 720px;
  }
}

html.m-wide-view .m-hero {
  min-height: min(72vh, 720px);
  min-height: min(calc(var(--m-vh, 1vh) * 72), 720px);
  min-height: min(72svh, 720px);
}

html.m-wide-view .m-photo-band {
  min-height: min(62vh, 640px);
  min-height: min(calc(var(--m-vh, 1vh) * 62), 640px);
  min-height: min(62svh, 640px);
}

html.m-wide-view .m-hero__bg {
  object-position: center 28%;
}

html.m-wide-view .m-photo-band img {
  object-position: center 36%;
}

.m-features .m-hscroll__track > .feature-panel {
  height: calc(var(--m-vh, 1vh) * 82);
  height: 82vh;
  height: min(600px, 82svh);
}

.m-header,
.m-header__bar {
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.m-hscroll__viewport,
.m-feature-tabs__viewport {
  -webkit-scroll-snap-type: x proximity;
  scroll-snap-type: x proximity;
}

.m-hscroll[data-hscroll="tariffs"] .m-hscroll__viewport,
.m-hscroll[data-hscroll="features"] .m-hscroll__viewport {
  -webkit-scroll-snap-type: x mandatory;
  scroll-snap-type: x mandatory;
}

.m-hscroll__track > *,
.m-features .feature-panel,
.m-feature-tabs__rail button {
  -webkit-scroll-snap-align: center;
  scroll-snap-align: center;
}

.m-hscroll[data-hscroll="tariffs"] .m-hscroll__track > *,
.m-hscroll[data-hscroll="features"] .m-hscroll__track > * {
  -webkit-scroll-snap-stop: always;
  scroll-snap-stop: always;
}

.m-hscroll__viewport,
.m-feature-tabs__viewport {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

@supports not (gap: 8px) {
  .m-hscroll__track > * + * {
    margin-left: var(--m-card-gap, 14px);
  }

  .m-devices-os > * + * {
    margin-top: 10px;
  }

  .m-hero__actions > * + * {
    margin-top: 10px;
  }
}

.m-no-backdrop .m-header__material {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  background: rgba(0, 0, 0, 0.78) !important;
}

.m-phone .m-header__material,
.m-edge-lite .m-header__material {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

.m-no-backdrop.m-header--over-hero:not(.is-scrolled) .m-header__material,
.m-no-backdrop .m-header.m-header--over-hero:not(.is-scrolled) .m-header__material {
  background: rgba(255, 255, 255, 0.22) !important;
}

.m-no-backdrop .m-brand-label,
.m-no-backdrop .m-tg-btn {
  background: rgba(0, 0, 0, 0.85) !important;
}

.m-no-backdrop .m-features .feature-panel .feature-glass {
  background: rgba(22, 18, 16, 0.78) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
}

.m-in-app .m-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
}

.m-firefox .m-hscroll__viewport,
.m-firefox .m-feature-tabs__viewport {
  scroll-behavior: auto;
}

.m-ios .m-hscroll__viewport,
.m-ios .m-feature-tabs__viewport {
  -webkit-overflow-scrolling: touch;
}

.m-ios img,
.m-android img {
  -webkit-user-drag: none;
  user-select: none;
}

.m-yandex .m-header__material,
.m-samsung .m-header__material,
.m-huawei .m-header__material,
.m-xiaomi .m-header__material,
.m-oppo .m-header__material,
.m-vivo .m-header__material {
  will-change: auto;
}

button,
.button,
a,
.m-tg-btn,
.m-hscroll__dot,
.term-filter button,
.m-auth-toggle__btn {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

input,
textarea,
select {
  font-size: 16px;
}

@supports (-webkit-touch-callout: none) {
  input,
  textarea,
  select {
    font-size: max(16px, 1em);
  }
}

dialog {
  border: none;
  padding: 0;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.52);
}

.m-no-io .m-edge-word {
  opacity: var(--edge-opacity, 1);
}

/* Tablet — same cross-browser stack as phones */
@media (min-width: 768px) and (max-width: 1024px) {
  .m-tablet .m-hero,
  .m-touch-view .m-hero {
    min-height: calc(var(--m-vh, 1vh) * 100);
    min-height: min(100svh, 900px);
  }

  .m-tablet .m-photo-band,
  .m-touch-view .m-photo-band {
    min-height: min(72vh, 680px);
    min-height: min(calc(var(--m-vh, 1vh) * 72), 680px);
    min-height: min(72svh, 680px);
  }

  .m-tablet .m-features .m-hscroll__track > .feature-panel,
  .m-touch-view .m-features .m-hscroll__track > .feature-panel {
    height: min(640px, 78svh);
  }

  .m-tablet .m-hscroll__viewport,
  .m-tablet .m-feature-tabs__viewport,
  .m-touch-view .m-hscroll__viewport,
  .m-touch-view .m-feature-tabs__viewport {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: auto;
  }

  .m-tablet.m-firefox .m-hscroll__viewport,
  .m-tablet.m-firefox .m-feature-tabs__viewport {
    scroll-behavior: auto;
  }

  .m-ipad .m-header__material,
  .m-tablet.m-safari .m-header__material {
    -webkit-backdrop-filter: blur(18px) saturate(160%) brightness(1.05);
    backdrop-filter: blur(18px) saturate(160%) brightness(1.05);
  }

  .m-tablet.m-edge-lite .m-header__material,
  .m-tablet.m-no-backdrop .m-header__material,
  .m-ipad.m-edge-lite .m-header__material {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  .m-tablet .m-edge-word,
  .m-touch-view .m-edge-word {
    text-shadow: 0 2px 22px rgba(0, 0, 0, 0.26);
  }

  .m-tablet .m-devices-panel,
  .m-touch-view .m-devices-panel {
    max-width: 720px;
    margin-inline: auto;
  }
}

html.m-tablet,
html.m-tablet body {
  min-height: -webkit-fill-available;
}

.m-ipad .m-header__bar {
  padding-top: calc(8px + var(--safe-top));
}

/* Responsive hardening for small phones, tablets, OEM Android browsers and WebViews. */
html,
body {
  width: 100%;
  max-width: 100%;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

.m-hero__bg,
.m-photo-band img,
.feature-panel__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.m-devices-store img,
.m-hero__payments img,
.site-footer__payments img {
  height: auto;
  object-fit: contain;
}

.m-devices-download__mark--happ {
  width: auto;
  height: clamp(26px, 8vw, 30px);
  max-width: min(156px, 42vw);
}

.m-devices-download__mark--incy {
  width: auto;
  height: clamp(18px, 5.8vw, 20px);
  max-width: min(126px, 36vw);
}

.m-devices-store img {
  width: min(135px, 42vw);
}

.m-hscroll,
.m-features {
  --m-card-w: min(88vw, calc(100vw - 32px), 360px);
  --m-feature-card-w: min(86vw, calc(100vw - 32px), 340px);
}

.m-hscroll__track,
.m-feature-tabs__track {
  max-width: none;
}

.m-features .feature-panel {
  height: min(600px, calc(var(--m-vh, 1vh) * 82));
  height: min(600px, 82svh);
}

@supports (height: 100dvh) {
  .m-hero {
    min-height: min(100dvh, 820px);
  }

  .m-photo-band {
    min-height: min(calc(76 * 1dvh), 720px);
    height: min(calc(76 * 1dvh), 720px);
    max-height: 720px;
  }

  .m-features .feature-panel {
    height: min(600px, 82dvh);
  }
}

@supports not (aspect-ratio: 1 / 1) {
  .m-hscroll .tariff-card-slide {
    height: min(600px, calc(var(--m-card-w) * 1.78));
  }
}

@media (max-width: 380px) {
  .page-wrap {
    width: min(100% - 24px, 640px);
  }

  .m-header__bar {
    padding-inline: 12px;
  }

  .m-hero__inner {
    padding-inline: max(14px, env(safe-area-inset-left, 0px)) max(14px, env(safe-area-inset-right, 0px));
  }

  .m-hero__copy,
  .m-hero__cta {
    max-width: min(100%, 328px);
  }

  .m-hero__lead br {
    display: none;
  }

  .m-devices-panel {
    padding: 10px;
    border-radius: 22px;
  }

  .m-devices-os {
    gap: 8px;
  }

  .m-device-card {
    min-height: 98px;
    padding: 14px 8px 12px;
    border-radius: 18px;
  }

  .m-device-card__glyph {
    width: 46px;
    height: 46px;
    border-radius: 15px;
  }

  .m-edge-word {
    font-size: clamp(30px, 13.4vw, 54px);
    letter-spacing: -0.052em;
  }
}

@media (max-width: 340px) {
  .m-hero__actions .button {
    white-space: normal;
  }

  .term-filter {
    gap: 4px;
    padding: 4px;
  }

  .term-filter button {
    padding-inline: 8px;
    font-size: 12px;
  }

  .m-hscroll,
  .m-features {
    --m-card-w: calc(100vw - 24px);
    --m-feature-card-w: calc(100vw - 24px);
  }
}

@media (orientation: landscape) and (max-height: 640px) {
  .m-hero {
    min-height: calc(var(--m-vh, 1vh) * 100) !important;
    min-height: 100svh !important;
  }

  .m-hero__inner {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: calc(var(--m-vh, 1vh) * 100) !important;
    min-height: 100svh !important;
    padding:
      calc(var(--header-h) + var(--safe-top) + 6px)
      max(var(--brand-inset-x), env(safe-area-inset-right, 0px))
      calc(14px + env(safe-area-inset-bottom, 0px))
      max(var(--brand-inset-x), env(safe-area-inset-left, 0px));
  }

  .m-hero__copy {
    max-width: min(38vw, 280px);
    align-items: flex-start;
  }

  .m-hero__title,
  .m-hero__promo,
  .m-hero__lead {
    transform: none !important;
  }

  .m-hero__title {
    font-size: clamp(28px, 5vw, 40px);
  }

  .m-hero__title-line--brand {
    font-size: 12px;
    margin-bottom: 4px;
  }

  .m-hero__promo {
    margin-top: 10px;
    padding: 6px 12px;
    font-size: 11px;
  }

  .m-hero__lead,
  .m-hero__cta {
    display: none;
  }

  .m-hero__bg--blur {
    display: block;
    inset: auto 0 0;
    width: 100%;
    height: 42%;
    min-width: 0;
    min-height: 0;
    object-fit: cover;
    object-position: 68% 80%;
    filter: blur(22px) saturate(1.04);
    transform: none;
  }

  .m-hero__frame picture,
  .m-hero__bg--sharp {
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    width: 100%;
    height: auto;
    min-width: 0;
    min-height: 0;
  }

  .m-hero__bg--sharp {
    object-fit: contain;
    object-position: 68% top;
    transform: none;
    -webkit-mask-image: linear-gradient(180deg, #000 0 82%, rgba(0, 0, 0, 0.45) 93%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 0 82%, rgba(0, 0, 0, 0.45) 93%, transparent 100%);
  }

  .m-hero__shade {
    background: linear-gradient(
      180deg,
      transparent 0%,
      transparent 70%,
      rgba(6, 6, 8, 0.16) 86%,
      rgba(4, 4, 6, 0.5) 100%
    );
  }

  .m-hero__veil {
    display: block;
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
      90deg,
      rgba(4, 4, 6, 0.42) 0%,
      rgba(4, 4, 6, 0.16) 38%,
      transparent 62%
    );
  }

  .m-footer__bar {
    flex-direction: row;
    justify-content: center;
    gap: 22px;
  }

  .m-footer__copy {
    width: auto;
  }
}

@media (orientation: landscape) and (max-height: 640px) and (min-width: 780px) {
  .m-footer-nav {
    grid-template-columns: repeat(7, minmax(0, auto));
    width: auto;
    max-width: none;
    gap: 8px 18px;
  }

  .m-footer-nav a:last-child {
    grid-column: auto;
  }

  .m-footer__bar {
    flex-direction: row;
    justify-content: center;
    gap: 22px;
  }

  .m-footer__copy {
    width: auto;
  }
}

@media (min-width: 600px) and (max-width: 767px) {
  .m-hscroll {
    --m-card-w: min(72vw, 390px);
  }

  .m-features {
    --m-feature-card-w: min(72vw, 390px);
  }
}

@media (min-width: 768px) and (max-width: 1180px) and (min-height: 600px) {
  .m-hero__bg {
    object-position: center 22%;
  }

  .m-photo-band img {
    object-position: center 38%;
  }

  .m-hscroll {
    --m-card-w: min(64vw, 420px);
  }

  .m-features {
    --m-feature-card-w: min(64vw, 420px);
  }

  .m-features .feature-panel {
    height: min(640px, 76svh);
  }
}

@media (min-width: 1025px) {
  html.m-wide-view body {
    overflow-x: hidden;
  }

  html.m-wide-view .m-hero__bg {
    object-position: center 26%;
  }

  html.m-wide-view .m-photo-band img {
    object-position: center 40%;
  }
}

/* Phone layout — stable hero stack, centered edge words, no section bleed */
@media (max-width: 767px) {
  .m-photo-band {
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    aspect-ratio: 100 / 112;
  }

  .m-hero__inner {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: min(100svh, 820px);
    min-height: min(calc(var(--m-vh, 1vh) * 100), 820px);
    padding-top: calc(var(--header-h) + var(--safe-top) + 8px);
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  }

  .m-hero__payments {
    width: min(100%, 220px);
    margin-inline: 0;
  }

  .m-photo-band img {
    inset: 0;
    width: 100%;
    height: 100%;
    transform: none;
    object-position: center center;
  }

  #flow.m-photo-band img,
  #cabinet-banner.m-photo-band img,
  .m-edge-lite #flow.m-photo-band img,
  .m-edge-lite #cabinet-banner.m-photo-band img {
    transform: scale3d(1.06, 1.06, 1);
    transform-origin: center center;
  }

  #flow.m-photo-band {
    aspect-ratio: 100 / 112;
  }

  #flow.m-photo-band img {
    object-position: center 53%;
  }

  #cabinet-banner.m-photo-band {
    aspect-ratio: 100 / 112;
  }

  #cabinet-banner.m-photo-band img {
    object-position: 64% 47%;
  }

  .m-edge-pair {
    width: 100%;
    padding-inline: clamp(10px, 3.5vw, 18px);
  }

  .m-photo-band + .m-pricing {
    padding-top: clamp(28px, 6vw, 40px);
  }

  .m-pricing-intro {
    padding-top: 4px;
  }

  .m-hscroll__dots {
    position: relative;
    z-index: 1;
  }
}

/* Win/Mac engines + mobile Safari/Firefox: lock to measured viewport. */
html.cl-firefox,
html.cl-safari,
html.m-firefox {
  overflow-x: hidden;
}

html.cl-firefox .m-hero,
html.cl-safari .m-hero,
html.m-firefox .m-hero,
html.m-ios .m-hero {
  min-height: calc(var(--m-vh, 1vh) * 100);
}

html.cl-safari .m-header__material,
html.m-ios .m-header__material {
  -webkit-backdrop-filter: blur(18px) saturate(160%) brightness(1.05);
  backdrop-filter: blur(18px) saturate(160%) brightness(1.05);
}

/* No cream gap between dark features and dark footer */
.m-features {
  margin-bottom: 0;
}

.m-footer {
  margin-top: 0;
  border-top: 0;
  background: #12100e;
}

@media (orientation: landscape) {
  .m-hscroll,
  .m-features {
    --m-card-w: min(46vw, 400px);
    --m-peek: max(14px, env(safe-area-inset-left, 0px));
    --m-feature-card-w: min(46vw, 400px);
    --m-feature-peek: max(14px, env(safe-area-inset-left, 0px));
  }
}
