/* ==========================================================================
   CLOSE — owned by Agent CLOSE. The page floods: paper-2 → flood → abyss.
   Scope every rule under .close

   .close            paper-2 ground (so the flood has something to rise over)
     .close-foam     pale band that leads the flood wave        (.is-tide only)
     .close-water    flood field, clipped by wave A             → #contact
       .close-end
         .close-deep deep-blue band that leads the abyss wave   (.is-tide only)
         footer      abyss field, clipped by wave B             → wordmark + footer

   Without JS the two fields use the foundation's static .crest edge. js/close.js
   adds .is-tide, hides those, and clips each field with a wave that rises with scroll.
   ========================================================================== */

.close {
  /* Rest amplitude of each wave; js/close.js computes the same values (keep the two in step). */
  --tide-a: clamp(3.5rem, 9vw, 8.75rem);
  --tide-b: clamp(2.75rem, 6.5vw, 6.25rem);
  position: relative;
  z-index: 1;
}

.close .close-band {
  display: none;
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 0;
  pointer-events: none;
}
.close.is-tide .close-band { display: block; }
.close .close-foam { height: min(100%, 130vh); background: var(--foam); }
.close .close-deep { height: 100%; background: var(--deep); }
.close.is-tide .crest::before { display: none; }

/* ---------- Flood: the closing line + CTAs ---------- */

.close .close-water {
  padding-top: clamp(3.5rem, 7vw, 6.5rem);
}
/* The wave lives inside the field's own top edge: 1.33 × amplitude at rest. */
.close.is-tide .close-water {
  padding-top: calc(var(--tide-a) * 1.33 + clamp(1.25rem, 3vw, 3rem));
}

.close .close-cta { padding-bottom: clamp(4.5rem, 8vw, 7rem); }

.close .close-title {
  margin-left: -0.035em;
  font-stretch: 125%;
  font-weight: 660;
  /* (unused in the Olsaar edition: the closing headline was removed) */
  font-size: min(20.5vw, 15rem);
  letter-spacing: -0.045em;
  line-height: 0.86;
  color: var(--fg);
}
/* Room for the "g" inside the line masks at this line-height. */
.close .close-title .line-mask { padding-bottom: 0.14em; margin-bottom: -0.14em; }

.close .close-row {
  margin-top: 0; /* the Olsaar edition has no closing headline above it */
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem 3rem;
  flex-wrap: wrap;
}
.close .close-lead {
  max-width: 23em;
  font-weight: 520;
  color: var(--fg-2);
}
/* Buttons hang off the container's right edge; the note sits under "Book a call". */
.close .close-actions {
  display: grid;
  grid-template-columns: auto auto;
  gap: 0.75rem;
  margin-left: auto;
}
.close .close-note {
  grid-column: 2;
  font-size: 0.8438rem;
  font-weight: 560;
  line-height: 1.3;
  text-align: center;
  color: var(--fg-3);
}

/* ---------- Abyss: wordmark + footer ---------- */

.close .close-end { position: relative; }

.close .close-foot {
  padding-top: clamp(3.5rem, 7vw, 6.5rem);
  padding-bottom: 1.75rem;
}
.close.is-tide .close-foot {
  padding-top: calc(var(--tide-b) * 1.33 + clamp(2rem, 4.4vw, 4.5rem));
}

/* Giant wordmark: the Olsaar logo at the container's width, flooded with its own colours by
   scroll (js/close.js clips the fill layer); the base layer is a ghost in the surface colour. */
.close .close-mark {
  position: relative;
  line-height: 0;
  user-select: none;
}
.close .close-word { display: block; width: 100%; height: auto; aspect-ratio: 1736.5 / 178; }
.close .close-mark-base { --lg-1: var(--surface); --lg-2: var(--surface); --lg-3: var(--surface); }
/* The fit reads sizes synchronously; base.css's reduced-motion rule would otherwise turn every
   font-size change into a 0.01ms "all" transition and the read would return the old size. */
.close .close-mark,
.close .close-mark * { transition-property: none; }
.close .close-mark-base,
.close .close-mark-fill { display: block; }
.close .close-mark-base { color: var(--surface); }
.close .close-mark-fill {
  position: absolute;
  inset: 0;
  color: var(--accent);
}

.close .cf { margin-top: clamp(2.25rem, 4.6vw, 4.25rem); }

.close .cf-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.25rem 2.5rem;
  flex-wrap: wrap;
}
.close .cf-index {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem clamp(1.125rem, 2.4vw, 2.25rem);
}
.close .cf-index a {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--fg);
  transition: color var(--dur-1) ease;
}
.close .cf-index a:hover { color: var(--link); }

.close .cf-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}
.close .cf-legal a {
  font-size: 0.9375rem;
  color: var(--fg-3);
  cursor: default;
}

.close .cf-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  flex-wrap: wrap;
  margin-top: clamp(1.5rem, 2.6vw, 2.25rem);
  padding-top: 1.25rem;
  box-shadow: inset 0 1px 0 var(--line);
}
.close .cf-copy { font-size: 0.9062rem; color: var(--fg-3); }
.close .cf-status {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.9062rem;
  font-weight: 560;
  color: var(--fg-2);
}
.close .cf-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--ok);
  flex: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
  .close .close-row { flex-direction: column; gap: 1.5rem; }
  .close .close-actions { width: 100%; margin-left: 0; grid-template-columns: 1fr 1fr; }
  .close .close-actions .btn { padding-inline: 0.75rem; }
  .close .close-note { grid-column: 1 / -1; text-align: right; }
  .close .cf-top { flex-direction: column; gap: 1.375rem; }
  .close .cf-index { display: grid; grid-template-columns: 1fr 1fr; gap: 0.875rem 1.5rem; }
}
