/* 09 «Старт» — Figma node 49:480 (1800 × 1282): the call-to-action card and the offices.
   Interaction follows the notes «09–10 — інтерактив для верстки». On top of the design, as the page
   scrolls the card grows to the whole screen, stays there, and the offices drive up over it
   (start.js turns that on). */

/* registered, so start.js reads it back in px */
@property --side { syntax: "<length>"; inherits: true; initial-value: 0px; }

.start {
  --side: calc(64 * var(--u));     /* page margin of the card and of the offices */
  --card: calc(680 * var(--ui));   /* the card's height */
  padding: calc(40 * var(--ui)) 0 calc(120 * var(--ui));
}

/* ───────────── The card ─────────────
   It is laid out edge to edge (and, pinned, the full screen high) and clipped to the design's rounded
   frame, so growing it moves no text. */
.start__stage { view-timeline: --cta block; }
.cta {
  position: relative;
  height: var(--card);
  clip-path: inset(0 var(--side) round calc(28 * var(--ui)));
  background: var(--color-bg-strong);
  color: #fff;
}
.cta__media, .cta__drift, .cta__shade, .cta__dim, .cta__content { position: absolute; inset: 0; }
.cta__media { overflow: hidden; container-type: size; }
/* the 16:9 photo at the size that covers the whole box, so scaling it down never uncovers an edge */
.cta__media img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: max(100cqw, 100cqh * 16 / 9);
  max-width: none;
  height: auto;
  aspect-ratio: 16 / 9;
  translate: -50% -50%;
  transform: scale(var(--rest, 1)); /* the crop of the design while the card is a card */
}
/* darkens the photo once the offices arrive over it */
.cta__dim { background: rgb(20 18 15 / .55); opacity: 0; }
.cta__shade {
  background: linear-gradient(to right,
    rgb(28 27 25 / .86) var(--side),
    rgb(28 27 25 / .5) 50%,
    rgb(28 27 25 / .15) calc(var(--side) + (100% - 2 * var(--side)) * .78));
}
.cta__content { padding-inline: var(--side); }
.cta__index, .cta__title, .cta__lead, .cta__proof, .lead { position: absolute; }
.cta__index {
  top: calc(48 * var(--ui));
  left: calc(var(--side) + 48 * var(--ui));
  border-color: rgb(255 255 255 / .6);
  background: rgb(255 255 255 / .14);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.cta__title {
  top: calc(112 * var(--ui));
  left: calc(var(--side) + 46 * var(--ui));
  font-family: var(--font-display);
  font-weight: 500;
  font-size: min(calc(88 * var(--ui)), 5cqw); /* clear of the form on narrower desktops */
  line-height: .955;
  letter-spacing: -.035em;
  white-space: nowrap;
}
.cta__lead {
  top: calc(304 * var(--ui));
  left: calc(var(--side) + 48 * var(--ui));
  width: calc(560 * var(--ui));
  font-size: calc(18 * var(--ui));
  line-height: calc(24 * var(--ui));
  color: var(--color-text-on-photo-muted);
}
.cta__proof { top: calc(566 * var(--ui)); left: calc(var(--side) + 48 * var(--ui)); display: flex; gap: calc(48 * var(--ui)); white-space: nowrap; }
.cta__proof li { display: flex; flex-direction: column; gap: calc(4 * var(--ui)); }
.cta__proof strong { position: relative; top: calc(1 * var(--ui)); font-family: var(--font-display); font-weight: 500; font-size: calc(44 * var(--ui)); line-height: calc(46 * var(--ui)); letter-spacing: -.025em; color: var(--color-bg-accent); }
.cta__proof span { font-size: calc(13 * var(--ui)); line-height: calc(16 * var(--ui)); color: var(--color-text-on-photo-muted); }

/* ───────────── Lead form ───────────── */
.lead {
  top: calc(205 * var(--ui));
  right: calc(var(--side) + 48 * var(--ui));
  display: flex;
  flex-direction: column;
  gap: calc(16 * var(--ui));
  width: calc(480 * var(--ui));
  padding: calc(32 * var(--ui));
  border-radius: calc(22 * var(--ui));
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
}
.lead :focus-visible { outline: 2px solid var(--color-bg-strong); outline-offset: 2px; }
.lead__title { font-family: var(--font-display); font-weight: 500; font-size: calc(30 * var(--ui)); line-height: calc(32 * var(--ui)); letter-spacing: -.02em; }
.lead__segments { display: flex; gap: calc(4 * var(--ui)); padding: calc(4 * var(--ui)); border-radius: var(--radius-full); background: rgb(28 27 25 / .06); }
.lead__segments label { position: relative; flex: 1; cursor: pointer; }
.lead__segments input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.lead__segments span {
  display: flex;
  justify-content: center;
  align-items: center;
  height: calc(47 * var(--ui));
  border-radius: var(--radius-full);
  font-size: calc(15 * var(--ui));
  transition: background-color .25s ease, color .25s ease;
}
.lead__segments input:checked + span { background: var(--color-bg-strong); color: var(--color-text-inverse); }
.lead__segments input:focus-visible + span { outline: 2px solid var(--color-bg-strong); outline-offset: 2px; }
@media (hover: hover) { .lead__segments input:not(:checked):hover + span { background: rgb(28 27 25 / .06); } }
.lead__control {
  width: 100%;
  height: calc(55 * var(--ui));
  padding: 0 calc(20 * var(--ui) - 1px); /* the border is part of the design's 20 */
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  background: var(--color-bg-page);
  font: 500 calc(15 * var(--ui)) / 1.5 var(--font-ui);
  color: var(--color-text-primary);
  transition: border-color .2s ease;
}
.lead__control::placeholder { color: var(--color-text-secondary); opacity: 1; }
.lead__control.is-invalid { border-color: #b3261e; }
.lead__submit { width: 100%; border: 0; cursor: pointer; }
.lead__submit:disabled { cursor: progress; }
.lead__note { min-height: calc(30 * var(--ui)); font-size: calc(12 * var(--ui)); line-height: calc(15 * var(--ui)); color: var(--color-text-secondary); }
.lead__note.is-error { color: #b3261e; }

/* sent: the same card, now only saying thank you */
.lead__done {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(40 * var(--ui));
  font-family: var(--font-display);
  font-weight: 500;
  font-size: calc(30 * var(--ui));
  line-height: 1.15;
  letter-spacing: -.02em;
  text-align: center;
  text-wrap: balance;
  visibility: hidden;
  opacity: 0;
  translate: 0 8px;
}
.lead__done:focus { outline: 0; }
.lead > * { transition: opacity .25s ease, visibility .25s; }
.lead > .lead__done { transition: opacity .35s ease .2s, translate .5s cubic-bezier(.23, 1, .32, 1) .2s, visibility .35s .2s; }
.lead.is-sent > * { opacity: 0; visibility: hidden; }
.lead.is-sent > .lead__done { opacity: 1; visibility: visible; translate: none; }

/* ───────────── Offices ───────────── */
.offices { margin-top: calc(48 * var(--ui)); padding-inline: var(--side); scroll-margin-top: 24px; }
.offices__head { display: flex; align-items: flex-end; justify-content: space-between; gap: calc(24 * var(--ui)); }
.offices__title { position: relative; top: calc(1 * var(--ui)); /* Figma's baseline rounding */ font-family: var(--font-display); font-weight: 500; font-size: calc(44 * var(--ui)); line-height: calc(46 * var(--ui)); letter-spacing: -.025em; }
.offices__lead { font-size: calc(15 * var(--ui)); line-height: calc(23 * var(--ui)); color: var(--color-text-secondary); }
.offices__list { display: grid; grid-template-columns: minmax(0, 399fr) minmax(0, 399fr) minmax(0, 401fr) minmax(0, 401fr); gap: calc(24 * var(--ui)); margin-top: calc(48 * var(--ui)); }
.office {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: calc(24 * var(--ui));
  min-height: calc(300 * var(--ui));
  padding: calc(28 * var(--ui));
  border: 1px solid rgb(28 27 25 / .12);
  border-radius: calc(22 * var(--ui));
  background: var(--color-bg-surface);
  box-shadow: 0 0 0 rgb(38 26 13 / 0);
  transition: background-color .3s ease, border-color .3s ease, color .3s ease, box-shadow .4s ease;
}
.office--hotline { border: 0; background: var(--color-bg-accent); }
.office__head { position: relative; top: calc(1 * var(--ui)); display: flex; flex-direction: column; align-items: flex-start; gap: calc(10 * var(--ui)); }
.office__kind { font-weight: 600; font-size: calc(14 * var(--ui)); line-height: calc(17 * var(--ui)); letter-spacing: .04em; text-transform: uppercase; color: var(--color-text-secondary); transition: color .3s ease; }
.office--hotline .office__kind, .office--hotline .office__hours { color: var(--color-text-on-accent-muted); }
.office__city { margin: 0; font-family: var(--font-display); font-weight: 500; font-size: min(calc(44 * var(--ui)), 13.4cqw); line-height: calc(46 * var(--ui)); letter-spacing: -.025em; white-space: nowrap; }
.office__foot { display: flex; flex-direction: column; align-items: flex-start; gap: calc(6 * var(--ui)); }
.office__big { font-weight: 700; font-size: min(calc(20 * var(--ui)), 7cqw); line-height: calc(24 * var(--ui)); transition: color .3s ease; }
.office__hours { font-size: calc(12 * var(--ui)); line-height: calc(15 * var(--ui)); color: var(--color-text-secondary); transition: color .3s ease; }
.office__link { display: inline-flex; align-items: center; gap: calc(6 * var(--ui)); padding-top: calc(10 * var(--ui)); font-weight: 600; font-size: calc(13 * var(--ui)); line-height: calc(16 * var(--ui)); }
.office__link i { width: calc(16 * var(--ui)); height: calc(16 * var(--ui)); background: url("../assets/start/arrow-dark.svg") center / calc(8.47 * var(--ui)) no-repeat; transition: translate .3s cubic-bezier(.23, 1, .32, 1); }

/* an office under the pointer (the design shows it on Kyiv): the card goes dark, its phone yellow */
.office:not(.office--hotline):focus-within { border-color: var(--color-bg-strong); background: var(--color-bg-strong); box-shadow: 0 14px 36px rgb(38 26 13 / .14); color: var(--color-text-inverse); }
.office:not(.office--hotline):focus-within :is(.office__kind, .office__hours) { color: var(--color-text-inverse-muted); }
.office:not(.office--hotline):focus-within .office__big { color: var(--color-bg-accent); }
.office:not(.office--hotline):focus-within .office__link i { background-image: url("../assets/start/arrow-accent.svg"); }
.office:not(.office--hotline):focus-within :focus-visible { outline-color: var(--color-bg-accent); }
.office:focus-within :focus-visible { outline: 2px solid var(--color-bg-strong); outline-offset: 3px; }
@media (hover: hover) {
  .office:not(.office--hotline):hover { border-color: var(--color-bg-strong); background: var(--color-bg-strong); box-shadow: 0 14px 36px rgb(38 26 13 / .14); color: var(--color-text-inverse); }
  .office:not(.office--hotline):hover :is(.office__kind, .office__hours) { color: var(--color-text-inverse-muted); }
  .office:not(.office--hotline):hover .office__big { color: var(--color-bg-accent); }
  .office:not(.office--hotline):hover .office__link i { background-image: url("../assets/start/arrow-accent.svg"); }
  .office__link:hover i { translate: 2px -2px; }
}

/* ───────────── Motion (start.js adds --live, and --pin where the card fits the screen) ───────────── */
.start--live .cta__drift { animation: cta-drift 26s ease-in-out infinite alternate; animation-play-state: paused; }
.start--live.is-seen .cta__drift { animation-play-state: running; }
@keyframes cta-drift { to { transform: translate3d(-1%, -.8%, 0) scale(1.08); } }

/* Pinned: the card is a full screen high and sticks to the top for the rest of the section — first
   while it grows (--travel), then while the offices drive up over it. */
.start--pin {
  --travel: 120svh;
  --inset: calc((100svh - var(--card)) / 2);    /* screen above and below the card while it is a card */
  --offices: calc(394 * var(--ui));             /* height of the offices block */
  --rise: max(40px, (100svh - var(--offices)) / 2);
  --at: calc(100svh - var(--inset) + 40 * var(--ui)); /* scroll (of cover) at which the card sticks */
  padding-bottom: 0;
  view-timeline: --cta block;
}
.start--pin .start__stage { display: contents; view-timeline-name: none; } /* the card sticks within the section */
.start--pin .start__stage::after { content: ""; display: block; height: var(--travel); }
.start--pin .cta {
  position: sticky;
  top: 0;
  height: 100svh;
  margin-top: calc(-1 * var(--inset));
  clip-path: inset(var(--inset) var(--side) round calc(28 * var(--ui)));
}
.start--pin .cta__content { top: var(--inset); bottom: auto; height: var(--card); }
/* the offices end up in the middle of the screen, over the photo, before the footer comes */
.start--pin .offices { position: relative; z-index: 2; margin-top: 0; padding-bottom: var(--rise); scroll-margin-top: var(--rise); }
.start--pin .offices__title { color: #fff; }
.start--pin .offices__lead { color: var(--color-text-on-photo-muted); }
.start--pin .office { box-shadow: 0 18px 48px rgb(0 0 0 / .28); }
.start--pin .office:not(.office--hotline) { border-color: rgb(251 247 239 / .18); }

/* The card arrives as designed, on the page grid. cta-open then slowly takes its edges (and the photo)
   to the screen's; pinned, the card's text later gives way to the offices (cta-leave, cta-shade). */
@supports (animation-timeline: view()) {
  .start--live .cta, .start--live .cta__media img, .start--pin .cta__content, .start--pin .cta__dim {
    animation-duration: auto;
    animation-fill-mode: both;
    animation-timing-function: cubic-bezier(.45, 0, .55, 1);
    animation-timeline: --cta;
  }
  .start--live .cta { animation-name: cta-open; animation-range: cover 30% cover 70%; }
  .start--live .cta__media img { animation-name: cta-fill; animation-range: cover 30% cover 70%; }
  .start--pin .cta, .start--pin .cta__media img { animation-range: cover calc(var(--at) - 5svh) cover calc(var(--at) + var(--travel) * .75); }
  .start--pin .cta__content { animation-name: cta-leave; }
  .start--pin .cta__dim { animation-name: cta-shade; }
  .start--pin .cta__content, .start--pin .cta__dim { animation-range: cover calc(var(--at) + var(--travel) - 12svh) cover calc(var(--at) + var(--travel) + 26svh); }
  @keyframes cta-open { to { clip-path: inset(0 0 round 0); } }
  @keyframes cta-fill { to { transform: scale(1); } }
  @keyframes cta-leave { to { opacity: 0; translate: 0 -5svh; visibility: hidden; } }
  @keyframes cta-shade { to { opacity: 1; } }
}

/* ───────────── Narrower windows (Figma has only the 1800 frame) ───────────── */
@media (max-width: 1099px) {
  .start { --side: 20px; --card: auto; padding: 24px 0 72px; } /* the page grid of the narrow layout */
  .cta { height: auto; clip-path: inset(0 var(--side) round 22px); }
  .cta__content { position: relative; display: flex; flex-direction: column; align-items: flex-start; padding: 28px calc(var(--side) + 16px); }
  .cta__index, .cta__title, .cta__lead, .cta__proof, .lead { position: static; }
  .cta__title { margin-top: 20px; font-size: clamp(32px, 9.4cqw, 76px); line-height: 1; white-space: normal; }
  .cta__lead { width: auto; max-width: 520px; margin-top: 16px; font-size: 16px; line-height: 1.45; }
  .cta__proof { gap: 24px; margin-top: 28px; flex-wrap: wrap; row-gap: 16px; }
  .cta__proof strong { font-size: 32px; line-height: 36px; }
  .lead { position: relative; top: auto; right: auto; align-self: stretch; width: auto; max-width: 480px; margin-top: 28px; padding: 22px 18px; }
  .lead__title { font-size: 24px; line-height: 28px; }
  .lead__control { font-size: 16px; } /* 16px: phones don't zoom into the field */
  .cta__shade { background: linear-gradient(rgb(28 27 25 / .72), rgb(28 27 25 / .5) 60%, rgb(28 27 25 / .3)); }
  .offices { padding-inline: 20px; }
  .offices__head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .offices__title { font-size: 32px; line-height: 36px; }
  .offices__list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
  .office { min-height: 260px; padding: 22px; }
  .office__city { font-size: min(36px, 13cqw); }
  .office__big { font-size: min(20px, 7.6cqw); }
}
@media (max-width: 599px) {
  .offices__list { grid-template-columns: minmax(0, 1fr); }
  .office { min-height: 220px; }
}
@media (min-width: 600px) and (max-width: 1099px) {
  .start { --side: 40px; }
  .offices { padding-inline: 40px; }
  .cta__content { padding: 40px calc(var(--side) + 32px); }
}
