/* Shared frame, navigation and motion for the reference-led layout. */
:root {
  --gutter: clamp(20px, 4.6vw, 102px);
  --ease-out: cubic-bezier(.23, 1, .32, 1);
}
body { position: relative; max-width: 2240px; margin-inline: auto; }
.wrap {
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.header {
  height: auto;
  min-height: clamp(64px, 6vw, 98px);
  padding-top: env(safe-area-inset-top);
  gap: clamp(14px, 2vw, 30px);
}
.site-brand { display: inline-flex; align-items: center; gap: 9px; flex: none; }
.site-brand strong { font-size: clamp(22px, 2.15vw, 32px); line-height: 1; letter-spacing: -.055em; }
.site-mark {
  position: relative;
  flex: none;
  width: clamp(24px, 2.45vw, 34px);
  aspect-ratio: .9;
  clip-path: polygon(50% 0, 98% 25%, 98% 75%, 50% 100%, 2% 75%, 2% 25%);
  background: conic-gradient(from 30deg, #b784ff 0deg 60deg, #6920ee 60deg 120deg, #af71fc 120deg 180deg, #7028ee 180deg 240deg, #9145f4 240deg 300deg, #a468ff 300deg);
}
.site-mark::after {
  content: "";
  position: absolute;
  inset: 30% 29%;
  clip-path: inherit;
  background: #f4edff;
}
.site-tagline {
  margin-left: 4px;
  padding-left: 11px;
  border-left: 1px solid #cbc6df;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}
.header nav { gap: clamp(14px, 2.25vw, 36px); }
.header nav a, .site-footer nav a { font-size: clamp(12px, 1.05vw, 15px); white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.header-telegram { display: none; align-items: center; gap: 5px; font-size: 11px; white-space: nowrap; }
.header-telegram::before { content: ""; width: 6px; aspect-ratio: 1; border-radius: 50%; background: #7c36f3; }
.header-contact { min-height: 44px; gap: 8px; padding: 9px 16px; font-size: 13px; white-space: nowrap; }
.header-contact > span { font-size: 16px; }
.header .menu-button {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
}
.menu-lines {
  width: 14px;
  height: 11px;
  border-block: 2px solid currentColor;
  background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat;
}
.mobile-nav:not([hidden]) {
  display: grid;
  position: absolute;
  z-index: 6;
  top: calc(clamp(64px, 6vw, 98px) + env(safe-area-inset-top));
  right: var(--gutter);
  left: auto;
  width: min(280px, calc(100% - 2 * var(--gutter)));
  padding: 10px 18px;
  gap: 0;
  border-radius: 16px;
  background: #f9f7ff;
  color: var(--ink);
  box-shadow: 0 14px 32px #21164b28;
}
.mobile-nav a { display: flex; align-items: center; min-height: 44px; padding-inline: 5px; }
.mobile-nav a + a { border-top: 1px solid #e8e2f3; }
/* The burger repeats the header links, so it exists only where those links are hidden (900px and narrower). */
@media (min-width: 901px) {
  .header .menu-button, .mobile-nav:not([hidden]) { display: none; }
}

.hero {
  height: auto;
  min-height: clamp(460px, 44.6vw, 900px);
  padding-top: calc(clamp(106px, 10.3vw, 200px) + env(safe-area-inset-top));
  padding-bottom: clamp(62px, 6vw, 100px);
}
.hero-title { max-width: min(52%, 880px); }
.hero .hero-slogan {
  font-size: clamp(43px, 5.2vw, 110px);
  line-height: .92;
  text-wrap: initial;
}
.hero-bottom { margin-top: clamp(15px, 1.7vw, 30px); }
.hero-copy { max-width: min(45%, 560px); }
.hero-copy > p {
  max-width: 36ch;
  margin-bottom: clamp(13px, 1.5vw, 24px);
  font-size: clamp(15px, 1.33vw, 22px);
  line-height: 1.35;
}
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.hero-actions .button { min-height: 44px; gap: 12px; padding: 10px 18px; }
.hero-about { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; font-size: 14px; }
.hero-about span {
  display: grid;
  place-items: center;
  width: 36px;
  aspect-ratio: 1;
  border-radius: 50%;
  color: #7028ee;
  background: white;
  font-size: 13px;
}
.hero-art { inset: 0; height: auto; margin: 0; }
.hero-art picture { display: block; height: 100%; }
.hero-art img { object-position: center 28%; }
.hero-art::after { background: linear-gradient(90deg, #efeffafa, #efeffade 27%, #efeffa50 46%, transparent 65%); }
.hero-scroll {
  position: absolute;
  bottom: clamp(12px, 1.8vw, 30px);
  left: max(var(--gutter), env(safe-area-inset-left));
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: #5d5872;
  font-size: 12px;
}
.hero-scroll span { padding: 0 4px; border: 1px solid #817b98; border-radius: 8px; }

.site-footer { padding-top: 0; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
.footer-main, .site-footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
}
.footer-main { padding-block: 8px 18px; }
.site-footer nav, .footer-contact { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.site-footer nav a, .footer-contact a { display: inline-flex; align-items: center; min-height: 44px; }
.footer-contact { font-size: 14px; }
.footer-contact .footer-telegram {
  justify-content: center;
  width: 44px;
  border-radius: 50%;
  background: #e8e1fb;
  color: #5823bb;
  font-size: 22px;
}
.footer-telegram span {
  width: 17px;
  aspect-ratio: 1;
  background: currentColor;
  clip-path: polygon(0 43%, 100% 5%, 78% 93%, 54% 68%, 40% 83%, 42% 57%, 79% 28%, 32% 53%);
}
.direction-icon {
  position: absolute;
  z-index: 1;
  top: 12px;
  left: clamp(12px, 1.55vw, 26px);
  width: clamp(22px, 2.05vw, 31px);
  height: auto;
  color: #742cf5;
  pointer-events: none;
}
.site-footer-bottom { padding-top: 8px; border-top: 1px solid #ded9ec; color: #615975; font-size: 13px; }
.site-footer-bottom a { display: inline-flex; align-items: center; min-height: 44px; }
.site-footer a:hover, .hero-about:hover { text-decoration: underline; }
.direction-dialog::backdrop { backdrop-filter: none; }
.showcase-caption { backdrop-filter: none; }
.direction-dialog { overscroll-behavior: contain; }
body:has(dialog[open]) { overflow: hidden; }
#contact-panel .contact-grid > *, #contact-panel fieldset { min-width: 0; }
#contact-panel .contact-mail { overflow-wrap: anywhere; }
#contact-panel input, #contact-panel textarea { font-size: 16px; }
#contact-panel :focus-visible { outline-color: #e4d4ff; }
.direction-close { min-width: 44px; min-height: 44px; }
[hidden] { display: none !important; }

@media (min-width: 1001px) {
  .header-telegram { display: inline-flex; }
  .directions { padding-block: clamp(24px, 2.4vw, 46px); }
  .directions-layout { grid-template-columns: minmax(155px, 19.3%) minmax(0, 1fr); gap: clamp(14px, 2.4vw, 40px); }
  .directions-intro h2 { font-size: clamp(25px, 2.55vw, 46px); }
  .directions-intro p { margin-top: 14px; }
  .directions-kicker { display: none; }
  .directions-all { margin-top: 18px; }
  .directions-grid { gap: clamp(10px, 1vw, 17px); }
  .direction-card { height: clamp(94px, 9.3vw, 183px); border-radius: 12px; }
  .direction-card img { inset: 0 0 0 auto; width: 74%; object-position: center 43%; }
  .direction-card::after { background: linear-gradient(90deg, #f4f2fc 8%, #f4f2fcf7 33%, #f4f2fc90 55%, transparent 80%); }
  .direction-copy { left: clamp(12px, 1.55vw, 26px); right: auto; bottom: 14px; max-width: 56%; }
  .direction-title { font-size: clamp(13px, 1.25vw, 21px); }
  .direction-caption { display: none; }
  .direction-open { display: none; }
}
@media (max-width: 900px) {
  .header nav { display: none; }
  .hero-title { max-width: 65%; }
  .hero-copy { max-width: 56%; }
}
@media (min-width: 901px) and (max-width: 1120px) {
  .hero { padding-bottom: 47px; }
  .hero .hero-slogan { line-height: .89; }
  .hero-copy > p { max-width: 43ch; font-size: 14px; }
  .hero-actions .button, .hero-about { min-height: 38px; font-size: 13px; }
  .hero-scroll { bottom: 5px; }
  .stats-inner { grid-template-columns: minmax(0, 78%) auto; justify-content: space-between; gap: 0; padding-block: 25px; }
  .stats-award { padding: 9px 11px 9px 7px; border-radius: 15px; }
  .stats-award img { width: 47px; }
  .stats-award span { font-size: 9px; }
  .contact-banner { grid-template-columns: 34% max-content; padding-block: 17px; }
  .contact-banner-button:not([hidden]) { min-height: 38px; padding: 8px 16px; font-size: 12px; }
  .footer-main { padding-block: 2px 9px; }
  .site-footer-bottom { padding-top: 3px; font-size: 11px; }
}
@media (min-width: 1001px) and (max-width: 1120px) {
  .directions-intro { padding: 0; }
  .directions-intro p { max-width: 175px; font-size: 13px; line-height: 1.23; }
  .directions-all { padding-block: 3px; font-size: 13px; }
  .directions-all span { font-size: 17px; }
  .company-info { padding-block: 17px; }
  .company-copy a { margin-top: 9px; }
}
@media (max-width: 620px) {
  .header-contact { display: none; }
  .hero {
    min-height: 0;
    padding-top: calc(92px + env(safe-area-inset-top));
    padding-bottom: clamp(275px, 71vw, 390px);
  }
  .hero .hero-slogan { font-size: clamp(34px, 9.85vw, 57px); }
  .hero-title, .hero-copy { max-width: none; }
  .hero-art { inset: auto 0 0; height: clamp(300px, 77vw, 425px); }
  .hero-art img { object-position: center 45%; }
  .hero-art::after { background: linear-gradient(180deg, #f0f0f9, transparent 31%, transparent 75%, #f0f0f9d9); }
  .hero-scroll { color: #373249; bottom: 5px; }
  .hero-actions { gap: 9px 12px; }
  .hero-actions .button { width: auto; }
  .footer-main { gap: 10px; }
  .site-footer nav { column-gap: 12px; }
}
@media (max-width: 360px) {
  .stats-metrics dt { overflow-wrap: anywhere; }
  .direction-copy { left: 11px; }
  .direction-title { font-size: 15px; }
}
@media (min-width: 2100px) {
  html { background: #eae7f4; }
  body { box-shadow: 0 0 100px #4a366916; }
  .project-showcase .showcase-grid { grid-auto-rows: clamp(245px, 13vw, 295px); }
}
@supports (corner-shape: squircle) {
  .contact-banner, .showcase-card, .direction-card { corner-shape: squircle; }
}
@media (hover: none), (pointer: coarse) {
  .direction-card:hover, .direction-card:hover img, .primary:hover { transform: none; }
}
.hero .hero-slogan .hero-line { display: inline-block; color: inherit; }

@media (prefers-reduced-motion: no-preference) {
  .hero .hero-slogan .hero-line { animation: editorial-enter 520ms var(--ease-out) var(--intro-delay, 0ms) both; }
  .hero .hero-slogan .hero-line:nth-of-type(2) { animation-delay: calc(var(--intro-delay, 0ms) + 50ms); }
  .hero .hero-slogan .hero-line:nth-of-type(3) { animation-delay: calc(var(--intro-delay, 0ms) + 100ms); }
  .hero .hero-slogan .hero-line:nth-of-type(4) { animation-delay: calc(var(--intro-delay, 0ms) + 150ms); }
  .hero-copy { animation: editorial-enter 480ms var(--ease-out) calc(var(--intro-delay, 0ms) + 180ms) both; }
  .motion-enter:not(.stats) { animation: editorial-enter 450ms var(--ease-out) both; }
  .direction-dialog[open] { animation: editorial-dialog 200ms var(--ease-out) both; }
  .contact-banner-button:active, .showcase-arrow:active { transform: scale(.97); }
  .direction-card { transition-property: transform; }
  .direction-card img { transition-duration: 320ms; }
  .stats { position: relative; isolation: isolate; overflow: hidden; }
  .stats::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0 auto 0 12%;
    width: 24%;
    opacity: 0;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, #fdfaffb8 47%, #ba93ff63 57%, transparent);
  }
  .stats.motion-enter::before { animation: map-scan 850ms var(--ease-out) both; }
  #contact-panel:not([hidden]) {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
  }
  @starting-style {
    #contact-panel:not([hidden]) { opacity: .65; transform: translateY(8px); }
  }
}
@supports (timeline-trigger: --map-light view() contain) and (animation-trigger: --map-light play-once) {
  @media (prefers-reduced-motion: no-preference) {
    .stats { timeline-trigger: --map-light view() contain; }
    .stats::before {
      animation: map-scan 850ms var(--ease-out) both;
      animation-trigger: --map-light play-once;
    }
  }
}
@keyframes map-scan {
  0% { opacity: 0; transform: translateX(-90%) skewX(-19deg); }
  37% { opacity: .9; }
  100% { opacity: 0; transform: translateX(295%) skewX(-19deg); }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .showcase-card img { transition: transform 420ms var(--ease-out); }
  .showcase-card:hover img, .showcase-card:focus-within img { transform: scale(1.055); }
  .showcase-arrow { transition: translate 220ms var(--ease-out); }
  .showcase-card:hover .showcase-arrow, .showcase-card:focus-within .showcase-arrow { translate: 3px 0; }
  .contact-banner-button { position: relative; overflow: hidden; isolation: isolate; }
  .contact-banner-button::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0 auto 0 0;
    width: 42%;
    background: linear-gradient(90deg, transparent, #fff5, transparent);
    transform: translateX(-120%) skewX(-20deg);
    pointer-events: none;
  }
  .contact-banner-button:hover::before, .contact-banner-button:focus-visible::before {
    animation: button-glint 420ms var(--ease-out) both;
  }
}
@keyframes button-glint {
  to { transform: translateX(360%) skewX(-20deg); }
}
@media (min-width: 901px) and (prefers-reduced-motion: no-preference) {
  .hero-art::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 43%;
    width: 11%;
    background: linear-gradient(90deg, transparent, #e6d8ff38, transparent);
    animation: glass-glint 900ms var(--ease-out) 250ms both;
    pointer-events: none;
  }
}
@keyframes glass-glint {
  0% { opacity: 0; transform: translateX(0) skewX(-14deg); }
  30% { opacity: .85; }
  100% { opacity: 0; transform: translateX(440%) skewX(-14deg); }
}
@keyframes editorial-enter {
  from { opacity: .65; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes editorial-dialog {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@supports (animation-timeline: view()) and (animation-range: exit 0% exit 100%) {
  @media (min-width: 821px) and (prefers-reduced-motion: no-preference) {
    .hero { view-timeline: --hero-view block; }
    .hero-art img {
      animation: glass-drift linear both;
      animation-timeline: --hero-view;
      animation-range: exit 0% exit 100%;
    }
  }
}
@keyframes glass-drift {
  from { transform: scale(1.015); }
  to { transform: scale(1.065) translateY(1.2%); }
}

.site-loader { display: none; }
@media (prefers-reduced-motion: no-preference) {
  body:not(:has(main :target, :focus-visible)) { --intro-delay: 820ms; }
  .site-loader {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    overflow: hidden;
    pointer-events: none;
    color: #faf4ff;
    background: radial-gradient(ellipse at 50% 44%, #372069 0%, #17102d 34%, #0c0a17 73%);
    animation: loader-exit 1160ms var(--ease-out) both;
  }
  body:has(main :target, :focus-visible) .site-loader { display: none; }
  .loader-stage {
    position: relative;
    isolation: isolate;
    display: grid;
    justify-items: center;
    gap: 15px;
    width: min(72vw, 260px);
  }
  .loader-orbit {
    position: absolute;
    z-index: -1;
    top: 20%;
    width: 100%;
    aspect-ratio: 2.6;
    border: 1px solid #d4b4ff50;
    border-radius: 50%;
    box-shadow: inset 0 0 22px #a66bff35, 0 0 24px #8e47ef42;
    animation: loader-orbit 750ms var(--ease-out) both;
  }
  .loader-crystal { width: clamp(102px, 15vw, 150px); overflow: visible; }
  .loader-face {
    animation: loader-assemble 560ms var(--ease-out) var(--face-delay, 0ms) both;
  }
  .loader-face-left { --face-x: -46px; --face-y: 22px; }
  .loader-face-right { --face-x: 46px; --face-y: 22px; --face-delay: 45ms; }
  .loader-face-top { --face-x: 0px; --face-y: -40px; --face-delay: 90ms; }
  .loader-spark {
    transform-box: fill-box;
    transform-origin: center;
    animation: loader-spark 480ms var(--ease-out) 350ms both;
  }
  .loader-wordmark {
    margin-top: -4px;
    padding-left: .17em;
    font-size: clamp(21px, 3vw, 27px);
    font-weight: 650;
    letter-spacing: .17em;
    animation: editorial-enter 420ms var(--ease-out) 170ms both;
  }
  .loader-track {
    width: 64px;
    height: 2px;
    overflow: hidden;
    border-radius: 5px;
    background: #cba8ff35;
  }
  .loader-track::after {
    content: "";
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #8252ff, #efd9ff);
    transform-origin: left;
    animation: loader-track 740ms var(--ease-out) both;
  }
}
@keyframes loader-assemble {
  from { opacity: 0; transform: translate(var(--face-x), var(--face-y)); }
  to { opacity: 1; transform: translate(0); }
}
@keyframes loader-orbit {
  from { opacity: 0; transform: rotate(-18deg) scale(.7); }
  55% { opacity: .85; }
  to { opacity: .5; transform: rotate(-18deg) scale(1); }
}
@keyframes loader-spark {
  from { opacity: 0; transform: scale(.3); }
  34% { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(1.3); }
}
@keyframes loader-track { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes loader-exit {
  0%, 70% { opacity: 1; visibility: visible; }
  99% { visibility: visible; }
  100% { opacity: 0; visibility: hidden; }
}

/* Header over the hero photo: a frosted bar keeps the navigation readable on any part of the image */
.header {
  background: linear-gradient(180deg, #f7f5fdf0, #f7f5fdd6);
  border-bottom: 1px solid #e3dbf2;
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  backdrop-filter: blur(16px) saturate(1.25);
}
.header nav a { color: #241d3a; font-weight: 500; }
.header-telegram { color: #3b2f58; }

/* Directions: ten cards on the home page (all 15 on services.html); marked placeholders until the new pictures arrive (review/directions-image-prompts.md) */
.direction-placeholder {
  position: absolute;
  inset: 0;
  display: block;
  background:
    radial-gradient(ellipse at 74% 26%, #ffffffc4, transparent 46%),
    radial-gradient(ellipse at 60% 92%, #b893ff59, transparent 55%),
    linear-gradient(135deg, #f3edff, #dccdfb 55%, #c9b4f6);
}
.direction-placeholder::before {
  content: "";
  position: absolute;
  top: 22%;
  right: 18%;
  width: clamp(30px, 18%, 64px);
  aspect-ratio: 1;
  border: 1px solid #ffffffd9;
  border-radius: 22%;
  background: linear-gradient(140deg, #ffffff8c, #a77cff4d 60%, #6f2cf033);
  box-shadow: 0 14px 30px #6725d933, inset 0 0 18px #ffffff80;
  transform: rotate(18deg);
}
.direction-placeholder::after { content: ""; position: absolute; inset: 7px; border: 1.5px dashed #ffffffb3; border-radius: 10px; }
.direction-placeholder > span {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 12px;
  padding: 2px 8px;
  border-radius: 99px;
  background: #ffffffc2;
  color: #5f587a;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10px;
  white-space: nowrap;
  max-width: calc(100% - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (min-width: 1001px) {
  /* 5 × 2 on desktop: picture fills the card, title at the bottom */
  .directions-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .direction-card { height: clamp(168px, 14.5vw, 270px); border-radius: 16px; }
  .direction-card img { inset: 0; width: 100%; height: 100%; object-position: center 40%; }
  .direction-card::after { background: linear-gradient(0deg, #f4f2fc 0%, #f4f2fcf2 24%, #f4f2fc85 48%, transparent 72%); }
  .direction-copy { left: clamp(12px, 1.2vw, 20px); right: clamp(12px, 1.2vw, 20px); bottom: clamp(12px, 1.1vw, 18px); max-width: none; }
  .direction-title { font-size: clamp(14px, 1.15vw, 20px); }
}
@media (min-width: 601px) and (max-width: 1000px) {
  .directions-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .direction-placeholder > span { right: auto; left: 10px; max-width: calc(100% - 46px); }
}
.direction-dialog-noimage[open] { grid-template-columns: minmax(0, 1fr); }
.direction-dialog-noimage .direction-dialog-copy { padding: 52px clamp(24px, 4vw, 44px) 40px; }

/* Link from a direction dialog to its article */
.direction-more { display: flex; align-items: center; gap: 8px; width: max-content; min-height: 40px; margin: -12px 0 14px; color: #6425ce; font-size: 15px; font-weight: 600; }
.direction-more:hover { text-decoration: underline; text-underline-offset: 4px; }

/* Next.js wrapper of each page (stands in for <body>, which is shared by all routes) */
.kb-page { min-height: 100vh; background: var(--paper); }
