/* G7 Experience Layer — mobile adaptation + motion
   Inspired by the reveal rhythm and soft interactions from Backup (2).
   Kept separate from the base stylesheet for a safe rollback. */

:root {
  --motion-ease: cubic-bezier(.16, 1, .3, 1);
  --motion-fast: .34s;
  --motion-medium: .72s;
  --motion-slow: .95s;
}

/* ---------- Header: lighter, smoother, persistent ---------- */
.site-header {
  position: fixed;
  transition:
    height var(--motion-fast) var(--motion-ease),
    background var(--motion-fast) ease,
    border-color var(--motion-fast) ease,
    box-shadow var(--motion-fast) ease,
    backdrop-filter var(--motion-fast) ease;
}
.site-header.is-scrolled {
  height: 78px;
  background: rgba(23, 22, 22, .88);
  border-color: rgba(255,255,255,.10);
  box-shadow: 0 12px 40px rgba(0,0,0,.12);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  backdrop-filter: blur(16px) saturate(120%);
}
.brand-mark,
.logo-link span,
.nav,
.header-actions {
  transition: transform var(--motion-fast) var(--motion-ease), opacity var(--motion-fast) ease;
}
.site-header.is-scrolled .brand-mark { transform: scale(.94); }

/* ---------- Motion V2 ---------- */
/* Scroll reveal is driven by the Web Animations API in experience.js.
   CSS remains responsible for hover states and mobile layout, so React
   hydration cannot wipe the animation state. */
.motion-v2 .hero-image { will-change: transform, opacity; }

/* ---------- Editorial interaction polish ---------- */
.project-card,
.feature-image,
.team-image {
  isolation: isolate;
}
.project-card { border-radius: 2px; }
.project-card img,
.feature-image img,
.team-image img {
  backface-visibility: hidden;
  transform-origin: center;
}
.project-card img {
  transition: transform .8s var(--motion-ease), filter .6s ease;
}
.project-card:hover img { transform: scale(1.055); }
.project-card:hover .project-overlay { opacity: .88; }
.project-overlay { transition: opacity .45s ease; }
.project-copy {
  transition: transform .55s var(--motion-ease);
}
.project-card:hover .project-copy { transform: translateY(-5px); }

.service-list article {
  overflow: visible;
  transition: none;
}
.service-list article::before { content: none; }
.service-list i { display: none; }

.feature-image img,
.team-image img {
  transition: transform 1s var(--motion-ease), filter .7s ease;
}
.feature:hover .feature-image img,
.team:hover .team-image img { transform: scale(1.025); }

.button,
.catalog-cta,
.contact-action a {
  position: relative;
  overflow: hidden;
}
.button::before,
.catalog-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.10);
  transform: translateX(-105%) skewX(-14deg);
  transition: transform .55s var(--motion-ease);
}
.button:hover::before,
.catalog-cta:hover::before { transform: translateX(105%) skewX(-14deg); }
.button > *, .catalog-cta > * { position: relative; z-index: 1; }

/* ---------- Better tablet layout ---------- */
@media (max-width: 1000px) {
  .section { padding: 112px 0; }
  h2 { font-size: clamp(44px, 7vw, 70px); }
  .hero h1 { font-size: clamp(66px, 10vw, 100px); }
  .work-head { gap: 36px; align-items: flex-start; }
  .project-card { min-height: 340px; }
  .feature { min-height: 620px; }
  .feature-image { min-height: 560px; }
  .team-image { height: 560px; }
}

/* ---------- Mobile: true mobile composition ---------- */
@media (max-width: 720px) {
  :root { --mobile-pad: 18px; }
  html { scroll-padding-top: 70px; }
  body { overflow-x: hidden; }
  .shell { width: calc(100% - 36px); }
  .section { padding: 78px 0; }

  .site-header {
    height: 70px;
    padding: 0 var(--mobile-pad);
    background: rgba(23,22,22,.94);
    border-bottom-color: rgba(255,255,255,.10);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
    backdrop-filter: blur(16px) saturate(120%);
  }
  .site-header.is-scrolled {
    height: 70px;
    background: rgba(23,22,22,.94);
    border-bottom-color: rgba(255,255,255,.10);
  }
  .brand-mark { width: 30px; height: 30px; }
  .logo-link { gap: 8px; min-width: 0; }
  .logo-link strong { font-size: 9px; }
  .logo-link small { font-size: 5px; }
  .header-actions { gap: 2px; }
  .lang { width: 42px; height: 34px; border-color: rgba(255,255,255,.25); }
  .menu-toggle { width: 40px; height: 40px; padding: 0; }
  .menu-toggle span {
    transition: transform .32s var(--motion-ease), opacity .2s ease;
  }
  .menu-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.5px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

  /* Keep nav in the DOM so opening/closing can animate instead of popping. */
  .nav {
    display: flex;
    top: 70px;
    min-height: calc(100svh - 70px);
    padding: 34px var(--mobile-pad) 42px;
    gap: 2px;
    background: rgba(23,22,22,.98);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate3d(0,-12px,0);
    transition: opacity .28s ease, transform .38s var(--motion-ease), visibility .28s;
  }
  .nav.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate3d(0,0,0);
  }
  .nav a {
    padding: 10px 0;
    font-size: clamp(25px, 8vw, 34px);
    line-height: 1.05;
  }
  .nav a::after { bottom: 3px; }
  .catalog-mobile {
    margin-top: 22px;
    padding: 16px !important;
    font-size: 12px !important;
    letter-spacing: .09em;
  }

  /* Immersive hero instead of desktop split composition. */
  .hero {
    height: auto;
    min-height: max(760px, 100svh);
  }
  .hero-image {
    inset: 0;
    background-position: 64% center;
    transform: scale(1.04);
  }
  .hero-shade {
    background:
      linear-gradient(180deg, rgba(20,19,19,.38) 0%, rgba(20,19,19,.34) 31%, rgba(20,19,19,.78) 65%, #211f1f 100%),
      linear-gradient(90deg, rgba(20,19,19,.50), rgba(20,19,19,.05));
  }
  .hero-content {
    min-height: max(760px, 100svh);
    justify-content: flex-end;
    padding-top: 118px;
    padding-bottom: 92px;
  }
  .hero .eyebrow { margin-bottom: 18px; font-size: 9px; line-height: 1.5; }
  .hero h1 {
    width: 100%;
    max-width: 100%;
    margin-bottom: 22px;
    font-size: clamp(52px, 15.2vw, 72px);
    line-height: .88;
    letter-spacing: -.045em;
  }
  .hero-copy {
    max-width: 100%;
    margin-bottom: 28px;
    font-size: 14px;
    line-height: 1.62;
    color: rgba(255,255,255,.76);
  }
  .hero-actions { width: 100%; gap: 10px; }
  .button { min-height: 52px; height: auto; padding: 0 17px; gap: 18px; }
  .hero-foot { bottom: 20px; font-size: 8px; }

  h2 {
    margin-bottom: 25px;
    font-size: clamp(39px, 12.5vw, 54px);
    line-height: .94;
  }
  .lead { font-size: 15px; line-height: 1.62; }
  .eyebrow { margin-bottom: 18px; }

  .metrics {
    margin-top: 48px;
    grid-template-columns: 1fr 1fr;
  }
  .metric {
    min-height: 134px;
    padding: 24px 14px 22px 0;
  }
  .metric:nth-child(even) { padding-left: 18px; border-right: 0; }
  .metric:nth-child(odd) { border-right: 1px solid var(--line); }
  .metric strong { margin-bottom: 19px; font-size: clamp(33px,10vw,44px); }
  .metric span { font-size: 9px; }

  .trust-grid { margin-top: 62px; }
  .trust-grid > h3 { max-width: 280px; font-size: 29px; }
  .trust-grid article { padding: 24px 0 24px 18px; }
  .trust-grid h4 { margin-top: 22px; font-size: 27px; }

  .work-head { margin-bottom: 40px; }
  .filters {
    width: calc(100vw - 18px);
    max-width: none;
    margin-top: 26px;
    margin-right: -18px;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding-right: 18px;
    padding-bottom: 5px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .filters::-webkit-scrollbar { display: none; }
  .filters button { flex: 0 0 auto; padding: 10px 13px; }
  .project-grid { gap: 10px; }
  .project-card {
    min-height: 0;
    aspect-ratio: 4 / 5;
    border-radius: 12px;
  }
  .project-copy { left: 20px; right: 20px; bottom: 20px; }
  .project-copy h3 { font-size: clamp(27px,8vw,34px); }

  .section-head.split .lead { margin-top: 22px; }
  .service-list { margin-top: 46px; }
  .service-list article {
    grid-template-columns: 38px 1fr;
    column-gap: 14px;
    min-height: 0;
    padding: 24px 0;
  }
  .service-list article:hover { padding: 24px 0; background: transparent; }
  .service-list h3 { font-size: 29px; }
  .service-list p { font-size: 13px; line-height: 1.55; }

  .feature { min-height: 0; }
  .feature-image {
    min-height: 0;
    height: auto;
    aspect-ratio: 4 / 5;
  }
  .feature-copy {
    min-height: 0;
    padding: 68px var(--mobile-pad) 76px;
  }
  .feature-copy h2 { font-size: clamp(39px,11.8vw,52px); }
  .feature-copy > p:not(.eyebrow) { font-size: 14px; }
  .feature-index { position: static; margin-top: 42px; }
  .production-stat { margin-top: 30px; }
  .production-stat strong { font-size: 58px; }

  .team { gap: 48px; }
  .team-image {
    height: auto;
    aspect-ratio: 4 / 5;
    overflow: hidden;
  }
  .team-copy .lead { font-size: 14px; }

  .contact { min-height: 720px; }
  .contact-inner {
    min-height: 720px;
    padding-top: 110px;
    padding-bottom: 72px;
  }
  .contact h2 { font-size: clamp(43px,13vw,58px); }
  .contact-bg {
    background-position: 62% center;
    opacity: .55;
  }
  .contact-action { margin-top: 54px; width: 100%; }
  .contact-action a { font-size: 27px; }

  footer { padding-top: 52px; }
  .footer-main { padding-bottom: 46px; }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.5;
  }

  /* On touch devices, don't leave hover-only shifts stuck. */
  .project-card:hover .project-copy,
  .service-list article:hover,
  .button:hover,
  .catalog-cta:hover { transform: none; }
}

@media (max-width: 390px) {
  .logo-link small { display: none; }
  .hero h1 { font-size: clamp(48px, 15vw, 59px); }
  .hero-copy { font-size: 13px; }
  .button { font-size: 11px; }
  .metric strong { font-size: 34px; }
  h2 { font-size: clamp(37px, 12vw, 47px); }
}

/* ---------- Accessibility ---------- */
/* The main stylesheet still respects reduced-motion for CSS transitions.
   Requested page-enter/scroll motion uses WAAPI so the G7 presentation does
   not silently become completely static. */


/* ---------- V4 viewport / scroll stability ---------- */
/* Keep horizontal overflow from breaking mobile without turning the document
   element into a locked scroll container on desktop. Vertical page scrolling
   must always remain native. */
html {
  width: 100%;
  max-width: 100%;
  height: auto;
  overflow-x: clip;
  overflow-y: auto;
}
body {
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  height: auto;
  overflow-x: clip;
  overflow-y: visible;
}
#root,
main {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: auto;
  overflow-x: clip;
  overflow-y: visible;
}
img, svg, video, canvas { max-width: 100%; }

@media (max-width: 720px) {
  .site-header,
  .hero,
  .section,
  .work,
  .feature,
  .team,
  .contact,
  footer {
    max-width: 100%;
    overflow-x: clip;
  }

  .shell,
  .section-head,
  .work-head,
  .project-grid,
  .project-card,
  .service-list,
  .service-list article,
  .feature,
  .feature-image,
  .feature-copy,
  .team,
  .team-image,
  .team-copy,
  .contact-inner,
  .footer-main,
  .footer-bottom {
    min-width: 0;
  }

  /* Do not use 100vw inside a padded shell: it creates horizontal scroll on mobile. */
  .filters {
    width: calc(100% + var(--mobile-pad));
    max-width: calc(100% + var(--mobile-pad));
    margin-right: calc(var(--mobile-pad) * -1);
    overscroll-behavior-x: contain;
  }

  .project-card,
  .feature-image,
  .team-image {
    contain: paint;
  }

  /* Mobile reveal motion stays vertical so animated elements never extend page width. */
  .motion-v2 [data-motion-direction="left"],
  .motion-v2 [data-motion-direction="right"] {
    max-width: 100%;
  }
}

/* ---------- V7 mobile metrics alignment ---------- */
/* Keep desktop metrics untouched. On phones, make the 2x2 statistic grid
   visually consistent: equal inner padding, aligned values/labels and no
   accidental wrapping of values such as “1 200 м²”. */
@media (max-width: 720px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric,
  .metric:not(:first-child),
  .metric:nth-child(odd),
  .metric:nth-child(even) {
    box-sizing: border-box;
    min-width: 0;
    min-height: 148px;
    padding: 24px 18px 22px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
  }

  .metric:nth-child(odd) {
    border-right: 1px solid var(--line);
  }

  .metric:nth-child(even) {
    border-right: 0;
  }

  .metric:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .metric strong {
    width: 100%;
    margin: 0;
    font-size: clamp(34px, 9.4vw, 42px);
    line-height: 1;
    white-space: nowrap;
  }

  .metric span {
    width: 100%;
    max-width: none;
    min-height: 28px;
    margin-top: 18px;
    font-size: 9px;
    line-height: 1.45;
  }
}

@media (max-width: 390px) {
  .metric,
  .metric:not(:first-child),
  .metric:nth-child(odd),
  .metric:nth-child(even) {
    padding-left: 15px;
    padding-right: 15px;
  }

  .metric strong {
    font-size: clamp(31px, 9vw, 36px);
  }
}

/* ---------- V8: mobile navigation interaction fix ---------- */
@media (max-width: 720px) {
  .site-header {
    overflow: visible;
    z-index: 10000;
  }

  .nav {
    z-index: 10001;
    touch-action: pan-y;
  }

  .nav.open {
    pointer-events: auto !important;
  }

  .nav.open a,
  .nav.open button,
  .header-actions,
  .header-actions button,
  .header-actions a {
    pointer-events: auto !important;
  }

  .nav.open a {
    position: relative;
    z-index: 2;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(255,255,255,.08);
  }

  .menu-toggle,
  .lang,
  .catalog-mobile {
    touch-action: manipulation;
  }
}

/* ---------- V11: lift mobile hero content higher ---------- */
@media (max-width: 720px) {
  .hero-content {
    padding-bottom: 292px;
  }
}

@media (max-width: 720px) and (max-height: 740px) {
  .hero-content {
    padding-bottom: 220px;
  }
}

@media (max-width: 390px) and (max-height: 700px) {
  .hero-content {
    padding-bottom: 190px;
  }
}
