/* =========================================================
   Delow — homepage
   ========================================================= */

/* ---------- Hero ---------- */
.hero { position: relative; padding: 32px 0 72px; overflow: clip; }
.hero__glow {
  /* Anchored to the content column (not the screen edge), so on wide monitors the colour stays behind the ring and tiles */
  position: absolute; z-index: -1; pointer-events: none; right: calc(max(0px, (100% - var(--wrap)) / 2) - min(240px, 12%)); top: -10%; width: 70vw; max-width: 980px; aspect-ratio: 1;
  background: radial-gradient(closest-side, rgba(203,169,197,.46), rgba(203,169,197,.15) 45%, transparent 72%);
}
@media (max-width: 767px) { .hero__glow { width: 150vw; right: -70vw; top: -12%; } }
.hero__grid { display: grid; gap: 28px; }
.hero__copy { display: flex; flex-direction: column; align-items: flex-start; }
.hero__intro { display: flex; flex-direction: column; align-items: flex-start; }
.hero__title { font-size: clamp(2.25rem, .6rem + 6.6vw, 6.75rem); line-height: .98; letter-spacing: -.04em; font-weight: 650; }
.hero__title .line { display: block; overflow: hidden; padding-bottom: .08em; margin-bottom: -.08em; }
.hero__title .line > span { display: inline-block; }
.hero__title .line--for { display: flex; flex-wrap: wrap; align-items: center; column-gap: .28em; row-gap: .1em; }
.hero__for { display: inline-flex !important; align-items: center; gap: .22em; font-size: .62em; letter-spacing: -.035em; }
.hero__for-word { color: var(--muted); font-weight: 500; }
.rotator {
  position: relative; display: inline-grid; align-items: center; height: 1.42em; padding: 0 .45em; border-radius: .3em;
  background: var(--ink); color: #fff; overflow: hidden; vertical-align: middle;
  transition: width .45s var(--ease-out);
}
.rotator__item { grid-area: 1 / 1; justify-self: start; white-space: nowrap; opacity: 0; transform: translateY(70%); filter: blur(4px); transition: opacity .35s ease, transform .5s var(--ease-out), filter .35s ease; }
.rotator__item.is-active { opacity: 1; transform: none; filter: none; }
.rotator__item.is-leaving { opacity: 0; transform: translateY(-70%); filter: blur(4px); }
.rotator::after { content: ""; position: absolute; right: .32em; top: 50%; width: 2px; height: .9em; translate: 0 -50%; background: var(--accent-light); border-radius: 2px; animation: caret 1s steps(1) infinite; display: none; }
@keyframes caret { 50% { opacity: 0; } }

.hero__lead { font-size: var(--fs-lead); color: var(--ink-2); max-width: 44ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
@media (max-width: 559px) {
  .hero__title .line--for { flex-direction: column; align-items: flex-start; }
  .hero__for { font-size: .78em; margin-top: .12em; }
  .hero__actions { width: 100%; display: grid; }
  .hero__actions .btn { width: 100%; justify-content: space-between; text-align: left; }
  .hero__trust-sep { display: none; }
  .hero__trust { margin-top: 28px; }
}
.hero__trust { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; margin-top: 40px; font-size: var(--fs-card); color: var(--ink-2); }
.hero__trust strong { font-family: var(--font-display); font-weight: 600; font-size: 1.375rem; letter-spacing: -.02em; color: var(--ink); margin-right: 4px; }
.hero__trust-sep { width: 1px; height: 28px; background: var(--line); }
.client-logos { display: flex; align-items: center; gap: 24px; }
.client-logos a { display: block; border-radius: 4px; }
.client-logos a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.client-logos a:focus-visible img { opacity: 1; filter: none; }
.client-logos img { height: 22px; width: auto; opacity: .55; filter: grayscale(1); transition: opacity .3s ease, filter .3s ease; }
@media (hover: hover) and (pointer: fine) { .client-logos img:hover { opacity: 1; filter: none; } }

/* Phone-only pieces: a static subtitle (instead of the rotator), the guarantee list, the "Работим с:" label */
.hero__title .line > .hero__for-static, .hero__checks, .hero__trust-label { display: none; }
.hero__checks { gap: 14px; font-size: 1.0625rem; font-weight: 500; line-height: 1.4; color: var(--ink); }
.hero__trust-label { font-size: .875rem; color: var(--muted); }

/* 3D Delow ring (pre-rendered image, echo of the "o" in the logo) */
.hero__ring { position: relative; pointer-events: none; --px: 0px; --py: 0px; --pr: 0deg; }
.hero__ring img { display: block; width: 100%; height: auto; filter: drop-shadow(0 30px 40px rgba(74, 37, 69, .28)); translate: var(--px) var(--py); rotate: var(--pr); transition: translate .6s var(--ease-out), rotate .6s var(--ease-out); }
.hero__ring { animation: ring-float 7s ease-in-out infinite; }
@keyframes ring-float { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-10px) rotate(-3deg); } }

/* Numbers: two tiles */
.hero__bento { position: relative; display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.tile { position: relative; border-radius: var(--r-tile); padding: 20px; overflow: hidden; isolation: isolate; }
.tile--dark { background: var(--dark); color: var(--on-dark); display: flex; flex-direction: column; justify-content: flex-end; min-height: 150px; }
.tile--accent { background: var(--accent); color: #fff; display: flex; flex-direction: column; justify-content: flex-end; min-height: 150px; }
.tile__num { font-variant-numeric: tabular-nums; font-family: var(--font-display); font-weight: 650; letter-spacing: -.04em; line-height: 1; font-size: clamp(2.5rem, 2rem + 2.4vw, 4.25rem); position: relative; z-index: 1; }
.tile__label { margin-top: 8px; font-size: var(--fs-card); line-height: 1.35; color: inherit; opacity: .88; max-width: 20ch; position: relative; z-index: 1; }

/* Phone: title → four guarantees → one button → client logos. Calm, nothing moves but the small ring. */
@media (max-width: 767px) {
  /* The hero fills the first screen (the marquee starts below the fold); spacing grows with the phone height */
  .hero { display: flex; flex-direction: column; min-height: calc(100svh - var(--header-h)); padding: clamp(16px, 3svh, 32px) 0 clamp(20px, 4svh, 44px); }
  /* Leftover height is shared evenly between the blocks below the title, so nothing bunches up and there is no single hole */
  .hero__grid { flex: 1; display: flex; flex-direction: column; gap: clamp(28px, 7svh, 64px); }
  .hero__intro { flex: 1; justify-content: space-evenly; }
  /* Title on three lines: "Маркетинг / агенция / в София"; sized so the content below has room to breathe */
  .hero__title { font-size: min(3rem, calc((100vw - 2 * var(--gutter)) / 7)); line-height: .96; }
  .hero__for, .hero__lead, .hero__more, .hero__bento, .hero__trust-num, .hero__trust-sep { display: none !important; }
  .hero__title .line > .hero__for-static { display: block; margin-top: .4em; font-size: .44em; font-weight: 500; letter-spacing: -.02em; line-height: 1.25; color: var(--ink-2); }
  .hero__checks { display: grid; gap: clamp(14px, 3svh, 28px); font-size: min(1.1875rem, 4.75vw); }
  .hero__checks .ico { width: 24px; height: 24px; margin-top: 0; }
  .hero__actions { margin-top: clamp(28px, 6svh, 56px); }
  .hero__actions .btn--lg { min-height: 62px; font-size: 1.0625rem; }
  .hero__actions .btn--lg .btn__icon { width: 50px; height: 50px; }
  .hero__trust { margin-top: clamp(22px, 4.5svh, 44px); gap: 10px 14px; }
  .hero__trust .client-logos { gap: 16px; }
  .hero__trust .client-logos img { height: 21px; }
  @media (max-width: 374px) { .hero__trust .client-logos img { height: 19px; } .hero__trust .client-logos { gap: 14px; } }
  .hero__trust-label { display: inline; font-size: .9375rem; }
  /* Ring to the right of the short lines "агенция / в София", clear of the text */
  .hero__ring { position: absolute; z-index: -1; top: calc(clamp(16px, 3svh, 32px) + .9 * min(3rem, calc((100vw - 2 * var(--gutter)) / 7))); right: calc(var(--gutter) - 14px); width: min(100px, 26vw); }
}

@media (min-width: 768px) {
  .hero__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "copy copy" "intro intro" "ring bento"; align-items: center; }
  .hero__copy { grid-area: copy; }
  .hero__intro { grid-area: intro; }
  .hero__ring { grid-area: ring; width: min(100%, 280px); justify-self: end; }
  .hero__bento { grid-area: bento; grid-template-columns: 1fr; }
  .tile--dark, .tile--accent { min-height: 150px; }
}
@media (min-width: 1024px) {
  .hero { padding: 48px 0 104px; }
  .hero__grid { grid-template-columns: minmax(0, .8fr) minmax(0, .6fr) minmax(0, .48fr); grid-template-areas: "copy copy copy" "intro ring bento"; column-gap: 40px; row-gap: 44px; align-items: start; }
  .hero__intro { padding-top: 8px; }
  /* The intro column is too narrow for two pills side by side: stack them at one width */
  .hero__actions { display: grid; width: max-content; max-width: 100%; }
  .hero__actions .btn { justify-content: space-between; }
  /* Ring sits next to the tiles (its image has transparent padding, hence the negative margin) */
  .hero__ring { width: min(100%, 360px); align-self: center; justify-self: end; margin: -32px -28px 0 0; }
  .tile--dark, .tile--accent { min-height: 176px; }
}
@media (min-width: 1024px) and (max-width: 1239px) {
  /* Narrow intro column: the logos drop to a second line, so the divider would dangle */
  .hero__trust-sep { display: none; }
}

/* Hero load choreography (JS only) */
html.js .hero__title .line > span { transform: translateY(105%); }
html.js .hero__for, html.js .hero__for-static, html.js .hero__lead, html.js .hero__checks, html.js .hero__actions, html.js .hero__trust { opacity: 0; transform: translateY(14px); }
html.js .hero__bento > * { opacity: 0; transform: translateY(18px) scale(.98); }
html.js .hero__ring img { opacity: 0; scale: .86; }
html.js.is-loaded .hero__title .line > span { transform: none; transition: transform .8s var(--ease-out); }
html.js.is-loaded .hero__title .line:nth-child(2) > span { transition-delay: .07s; }
html.js.is-loaded .hero__for, html.js.is-loaded .hero__for-static, html.js.is-loaded .hero__lead, html.js.is-loaded .hero__checks, html.js.is-loaded .hero__actions, html.js.is-loaded .hero__trust { opacity: 1; transform: none; transition: opacity .5s ease, transform .6s var(--ease-out); }
html.js.is-loaded .hero__for, html.js.is-loaded .hero__for-static { transition-delay: .18s; }
html.js.is-loaded .hero__lead, html.js.is-loaded .hero__checks { transition-delay: .24s; }
html.js.is-loaded .hero__actions { transition-delay: .3s; }
html.js.is-loaded .hero__trust { transition-delay: .36s; }
html.js.is-loaded .hero__bento > * { opacity: 1; transform: none; transition: opacity .55s ease, transform .7s var(--ease-out); }
html.js.is-loaded .hero__bento > .tile--dark { transition-delay: .3s; }
html.js.is-loaded .hero__bento > .tile--accent { transition-delay: .38s; }
html.js.is-loaded .hero__ring img { opacity: 1; scale: 1; transition: opacity .7s ease .15s, scale 1s var(--ease-out) .15s, translate .6s var(--ease-out), rotate .6s var(--ease-out); }

/* ---------- Marquee ---------- */
.marquee { overflow: hidden; padding: 28px 0; background: var(--surface); }
.marquee__track { display: flex; align-items: center; gap: 36px; width: max-content; animation: marquee 38s linear infinite; }
.marquee__track span { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.75rem, 1.2rem + 2vw, 3rem); letter-spacing: -.035em; white-space: nowrap; }
.marquee__track .ico { width: 28px; height: 28px; color: var(--accent); stroke-width: 2.4; }
.marquee:hover .marquee__track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .marquee__track { animation: none; } }

/* ---------- About ---------- */
.about { overflow-x: clip; }
.about__grid { display: grid; gap: 56px; }
.about__media { position: relative; }
.about__photo { aspect-ratio: 4 / 5; max-height: 640px; }
.about__card {
  position: absolute; left: 16px; right: 16px; bottom: 16px; z-index: 2;
  padding: 18px; border-radius: 18px; background: #fff; box-shadow: var(--shadow-float);
}
.about__card-title { font-family: var(--font-display); font-weight: 600; font-size: 1.125rem; letter-spacing: -.02em; margin-bottom: 12px; }
.orbits { position: absolute; z-index: -1; width: 130%; aspect-ratio: 1; left: 50%; top: 50%; translate: -50% -50%; pointer-events: none; }
.orbits span { position: absolute; inset: 0; border-radius: 50%; border: 1px solid var(--line); animation: ring-spin 60s linear infinite; }
.orbits span:nth-child(2) { inset: 12%; animation-duration: 45s; animation-direction: reverse; }
.orbits span:nth-child(3) { inset: 24%; animation-duration: 80s; }
.orbits span::after { content: ""; position: absolute; top: 50%; left: -5px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.orbits span:nth-child(2)::after { left: auto; right: -4px; top: 30%; width: 7px; height: 7px; background: var(--ink); }
.orbits span:nth-child(3)::after { top: -4px; left: 40%; width: 7px; height: 7px; background: var(--accent-light); }

.about__copy .h2 { max-width: 16ch; }
.about__copy .lead { margin-top: 24px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 36px 0; }
.stat { padding: 22px 20px; border-radius: var(--r-tile); background: var(--surface); transition: background-color .3s ease, transform .4s var(--ease-out); }
.stat dt { font-variant-numeric: tabular-nums; font-family: var(--font-display); font-weight: 650; font-size: clamp(2rem, 1.6rem + 1.4vw, 2.875rem); letter-spacing: -.04em; line-height: 1; }
.stat dd { margin-top: 10px; font-size: var(--fs-card); color: var(--ink-2); line-height: 1.4; }
@media (hover: hover) and (pointer: fine) { .stat:hover { background: var(--accent-soft); transform: translateY(-4px); } }
/* The specialist key point lives on the photo card on desktop; on phone it joins the list */
.stat--spec { display: none; }

@media (min-width: 960px) {
  .about__grid { grid-template-columns: 1fr 1fr; gap: 88px; align-items: center; }
  .about__card { left: auto; right: -40px; bottom: 40px; width: 340px; }
}
/* Phone/tablet: text and numbers only; the office photo adds nothing here */
@media (max-width: 959px) {
  .about__media { display: none; }
  /* One shared number column (subgrid), so "200+" never breaks and every row lines up */
  .about__copy, .about__media { min-width: 0; }
  .stats { grid-template-columns: minmax(7rem, max-content) minmax(0, 1fr); column-gap: 20px; row-gap: 8px; margin: 32px 0; }
  .stat { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; padding: 16px 18px; border-radius: 18px; }
  @supports not (grid-template-columns: subgrid) { .stat { grid-template-columns: 7rem 1fr; column-gap: 16px; } }
  .stat dt { font-size: clamp(1.875rem, 1.3rem + 2.4vw, 2.125rem); white-space: nowrap; }
  .stat dd { margin-top: 0; }
  .stat--spec { display: grid; }
  .stat--spec dt { display: contents; }
  .stat__mark { grid-row: 1 / 3; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--ink); color: #fff; }
  .stat__mark .ico { width: 22px; height: 22px; }
  .stat__term { grid-column: 2; white-space: normal; font-family: var(--font-display); font-size: 1.0625rem; font-weight: 600; letter-spacing: -.015em; line-height: 1.3; color: var(--ink); }
  .stat--spec dd { grid-column: 2; margin-top: 4px; }
}

/* ---------- Services: dark stacking cards ---------- */
.services .section-head { margin-bottom: 56px; }
.stack { display: grid; gap: 20px; }
.svc {
  --top: calc(var(--header-h) + 16px + var(--i) * 12px);
  position: relative;
  display: grid; gap: 24px; padding: 16px 16px 24px; border-radius: 28px;
  background: #1e1c22; color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), 0 -20px 40px -20px rgba(0, 0, 0, .7);
  transform-origin: 50% 0; will-change: transform;
}
.svc__shade { position: absolute; inset: 0; border-radius: inherit; background: #000; opacity: 0; pointer-events: none; z-index: 3; }
.svc__num { font-family: var(--font-display); font-weight: 600; color: var(--accent-light); font-size: 1.125rem; letter-spacing: .02em; margin-bottom: 12px; }
.svc__title { font-size: clamp(2rem, 1.55rem + 1.2vw, 2.75rem); letter-spacing: -.035em; line-height: 1.05; color: #fff; }
.svc__text { margin-top: 14px; color: #fff; font-size: 1.1875rem; line-height: 1.55; max-width: 38ch; }
.svc .check-list { margin: 22px 0 28px; font-size: 1.0625rem; font-weight: 500; line-height: 1.45; color: #fff; }
.svc .check-list .ico { background: var(--accent-light); color: var(--ink); }
.svc__visual { position: relative; border-radius: 20px; background: #2a2730; min-height: 280px; display: grid; place-items: center; padding: 44px 20px 28px; overflow: hidden; }
.svc .tile__tag--dark { color: rgba(255, 255, 255, .72); }
@media (min-width: 900px) and (min-height: 720px) {
  .svc { position: sticky; top: var(--top); }
}
/* JS measures each card: it pins only once its whole height has been on screen (tall cards on phones too) */
.stack.is-fit .svc { position: sticky; top: var(--fit-top, var(--top)); }
@media (min-width: 900px) {
  .stack { gap: 28px; }
  .svc { grid-template-columns: 1fr 1.05fr; gap: 40px; padding: 28px 28px 28px 40px; min-height: min(440px, calc(100vh - var(--header-h) - 64px)); }
  .svc__copy { align-self: center; padding-block: 8px; }
  .svc__visual { min-height: 340px; }
}
/* Phone: words first, then the picture that illustrates them, then the details and the button */
@media (max-width: 899px) {
  .stack { gap: 16px; margin-inline: -8px; }
  .svc { gap: 0; padding: 24px 18px 22px; border-radius: 24px; }
  .svc__copy { display: contents; }
  .svc__visual { order: 1; margin-top: 22px; min-height: 0; padding: 40px 14px 20px; }
  .svc .check-list { order: 2; margin: 22px 0 24px; font-size: 1.125rem; line-height: 1.5; gap: 14px; }
  .svc__copy > .btn { order: 3; justify-self: start; }
}

/* ---------- Why ---------- */
.why__grid { display: grid; gap: 16px; }
.why__col { display: grid; gap: 16px; }
.card { padding: 26px; border-radius: var(--r-card); background: var(--surface); transition: transform .45s var(--ease-out), box-shadow .45s var(--ease-out), background-color .3s ease; }
.feature { display: grid; grid-template-columns: auto 1fr; column-gap: 16px; align-items: center; }
.feature h3 { font-size: 1.25rem; line-height: 1.2; }
.feature .icon-box { width: 48px; height: 48px; border-radius: 50%; }
/* Each card appears when reached; its icon pops in a beat later */
html.js .feature[data-reveal]:not(.is-in) .icon-box { transform: scale(.6); }
html.js .feature[data-reveal]:not(.is-settled) .icon-box { transition: transform .6s cubic-bezier(.34, 1.56, .64, 1) calc(var(--d, 0ms) + 140ms), background-color .3s ease, color .3s ease; }
.feature p { grid-column: 1 / -1; margin-top: 16px; color: var(--ink-2); font-size: var(--fs-card); line-height: 1.55; }
@media (hover: hover) and (pointer: fine) {
  .card:hover { transform: translateY(-6px); background: #fff; box-shadow: var(--shadow-lift), 0 0 0 1px var(--line); }
  .card:hover .icon-box { background: var(--accent); color: #fff; transform: rotate(-8deg); }
}
.why__photo { aspect-ratio: 3 / 4; }
.why__badge {
  position: absolute; left: 14px; right: 14px; bottom: 14px; z-index: 2;
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: rgba(14,13,16,.86); color: var(--on-dark-2); font-size: .875rem; line-height: 1.35;
}
.why__badge strong { display: block; color: #fff; font-family: var(--font-display); font-weight: 600; font-size: 1.0625rem; }
.ring3d--badge { position: relative; flex: none; width: 46px; filter: none; }
/* Below desktop the photo comes after the words it illustrates */
@media (max-width: 1099px) { .why__photo { order: 2; } }
@media (max-width: 767px) {
  /* On phones the photo adds nothing; the "200+" badge repeats the hero */
  .why__photo { display: none; }
  .card { padding: 20px; }
}
@media (min-width: 768px) and (max-width: 1099px) {
  .why__grid { grid-template-columns: 1fr 1fr; }
  .why__photo { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
}
@media (min-width: 1100px) {
  .why__grid { grid-template-columns: 1fr minmax(320px, 400px) 1fr; gap: 20px; align-items: stretch; }
  .why__col { gap: 20px; }
  .why__col .card { align-content: center; }
  .why__photo { aspect-ratio: auto; height: 100%; }
}

/* ---------- Reduced motion (home) ---------- */
@media (prefers-reduced-motion: reduce) {
  .hero__ring, .orbits span { animation: none; }
  html.js .hero__title .line > span, html.js .hero__bento > *, html.js .hero__for, html.js .hero__for-static, html.js .hero__lead, html.js .hero__checks, html.js .hero__actions, html.js .hero__trust { transform: none; }
  .svc { position: relative; top: auto; }
}
