/* The fiane.com placeholder (index.html) in the 3.0 design (Фиане3.0/fiane.html), its opening screen without the
   scroll: on near-black with a soft light from above and film grain — the header with the logo; in the middle the glass
   mark (3D — js/mark.js; the flat picture without WebGL or with reduced motion) and «Fiat and exchange» — its letters
   come in, F·I·A and N·E flash green (fiat) and lime (crypto), the mark appears, then the other letters fold away and
   «FIANE» is left, green and lime; the tagline under it; at the bottom — the year and the name, «Be in touch».
   Values — the design's own (its final overrides). */

/* Corpta — the main font (the client's corpta.ttf, as in sites/fiane/src/fonts/corpta); Exo 2 — Google Fonts */
@font-face {
  font-family: Corpta;
  src: url("fonts/Corpta-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

/* --k: how far «Fiat and exchange» has folded into «Fiane», 0 → 1 */
@property --k {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

:root {
  --bg: #0b0c0b;
  --txt2: rgb(255 255 255 / 66%);
  --fiat: #7be34a;
  --crypto: #e2ff66;
  --gutter: clamp(16px, 4vw, 64px);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-move: cubic-bezier(.65, 0, .35, 1);

  color-scheme: dark;
}

html {
  background: var(--bg);
}

body {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: minmax(0, 1fr); /* the long line of letters never widens the page */
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: var(--bg);
  color: #fff;
  font-family: "Exo 2", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.c-fiat {
  color: var(--fiat);
}

.c-crypto {
  color: var(--crypto);
}

/* a soft white light from above, and film grain over everything */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient::before {
  content: "";
  position: absolute;
  left: -5vw;
  top: -38vh;
  width: 110vw;
  height: 70vh;
  border-radius: 50%;
  filter: blur(40px);
  background: radial-gradient(closest-side, rgb(255 255 255 / 10%) 0%, rgb(255 255 255 / 7.5%) 22%, rgb(255 255 255 / 4%) 45%, rgb(255 255 255 / 1.2%) 72%, transparent 100%);
}

.grain {
  position: fixed;
  inset: -50%;
  z-index: 60;
  pointer-events: none;
  opacity: .07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: f-grain .9s steps(4) infinite;
}

/* the header: the logo only */
.header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  height: 60px;
  padding: 0 var(--gutter);
  border-bottom: 1px solid rgb(255 255 255 / 14%);
  background: rgb(11 12 11 / 86%);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  animation: f-fade .5s ease .05s both;

  @media (width >= 900px) {
    height: 72px;
  }
}

.header__logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}

.brand-mark,
.header__logo img {
  display: block;
  width: auto;
  height: 20px;

  @media (width >= 900px) {
    height: 26px;
  }
}

/* the opening screen */
.intro {
  position: relative;
  z-index: 1;
  isolation: isolate;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: clamp(24px, 4svh, 48px) 16px;
  text-align: center;
}

/* the mark's green light */
.intro::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 42%;
  width: 80vmin;
  height: 80vmin;
  translate: -50% -50%;
  border-radius: 50%;
  filter: blur(60px);
  background: radial-gradient(closest-side, rgb(110 230 20 / 30%), rgb(63 203 16 / 10%) 55%, transparent);
  animation: f-show 1s ease 2.2s backwards;
}

.intro__mark {
  position: relative;
  height: min(46svh, 560px);
  aspect-ratio: 1 / .7;
  max-width: 92vw;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  animation: f-show .6s ease 2.3s backwards;

  @media (width <= 899px) {
    width: min(92vw, 520px);
    height: auto;
    aspect-ratio: 1 / .9;
  }
}

.intro__mark:active {
  cursor: grabbing;
}

.intro__mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.intro__mark.is-3d img {
  display: none;
}

.intro__mark canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* «Fiat and exchange» → «Fiane» */
.intro__name {
  margin: 1svh 0 0;
  font: 400 clamp(30px, min(5.6vw, 9svh), 104px) / 1 Corpta, "Exo 2", sans-serif;
  letter-spacing: .04em;
  text-transform: uppercase;
  animation: f-nm-down .9s var(--ease-move) 2.2s backwards, f-fold 1.3s var(--ease-move) 4.2s both;

  @media (width <= 480px) {
    font-size: min(30px, 7.2vw);
  }
}

.intro__letters {
  display: flex;
  justify-content: center;
  align-items: baseline;
  white-space: nowrap;
}

.nm {
  display: inline-block;
  vertical-align: bottom;
  animation: f-nm-in .5s var(--ease-out) calc(var(--i, 0) * 45ms + .15s) backwards;
}

/* the letters that fold away */
.nm--x {
  max-width: calc((1 - var(--k)) * 1.1em);
  overflow: hidden;
  color: #fff;
  opacity: calc(1 - min(1, var(--k) * 2.2));
  animation: f-nm-in .5s var(--ease-out) calc(var(--i, 0) * 45ms + .15s) backwards, f-nm-dim .6s ease 1.25s forwards;
}

.nm--sp {
  max-width: calc((1 - var(--k)) * .55em);
}

/* F·I·A — fiat, N·E — crypto: they flash, then, as the rest folds away, grow and take their colour */
.nm--on {
  font-size: calc(1em + var(--k) * .45em);
}

.nm--f {
  color: color-mix(in srgb, var(--fiat) calc(var(--k) * 100%), #fff);
  text-shadow: 0 0 calc(var(--k) * 24px) rgb(123 227 74 / 75%);
  animation: f-nm-in .5s var(--ease-out) calc(var(--i, 0) * 45ms + .15s) backwards, f-nm-f 1.9s ease 1.15s backwards;
}

.nm--c {
  color: color-mix(in srgb, var(--crypto) calc(var(--k) * 100%), #fff);
  text-shadow: 0 0 calc(var(--k) * 24px) rgb(226 255 102 / 70%);
  animation: f-nm-in .5s var(--ease-out) calc(var(--i, 0) * 45ms + .15s) backwards, f-nm-c 1.9s ease 1.3s backwards;
}

.nm:nth-child(2) { --i: 1; }
.nm:nth-child(3) { --i: 2; }
.nm:nth-child(4) { --i: 3; }
.nm:nth-child(6) { --i: 4; }
.nm:nth-child(7) { --i: 5; }
.nm:nth-child(8) { --i: 6; }
.nm:nth-child(10) { --i: 7; }
.nm:nth-child(11) { --i: 8; }
.nm:nth-child(12) { --i: 9; }
.nm:nth-child(13) { --i: 10; }
.nm:nth-child(14) { --i: 11; }
.nm:nth-child(15) { --i: 12; }
.nm:nth-child(16) { --i: 13; }
.nm:nth-child(17) { --i: 14; }

.intro__tagline {
  margin: clamp(16px, 3svh, 32px) 0 0;
  color: var(--txt2);
  font-size: clamp(15px, 1.4vw, 19px);
  line-height: 1.4;
  animation: f-rise .8s var(--ease-out) 5.3s backwards;
}

/* the footer: over a thin line lit in the middle — the year and the name, «Be in touch» */
.footer {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
  padding: 20px var(--gutter) max(20px, env(safe-area-inset-bottom));
  border-top: 1px solid rgb(255 255 255 / 14%);
  animation: f-fade .6s ease 1.5s both;
}

.footer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 50%;
  width: min(720px, 80%);
  height: 1px;
  translate: -50% 0;
  background: linear-gradient(90deg, transparent, #efff9a 50%, transparent);
  opacity: .5;
}

.footer__copy {
  margin: 0;
  color: rgb(255 255 255 / 40%);
  font-size: 13px;
  letter-spacing: .02em;
}

.footer__touch {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 999px;
  background: rgb(255 255 255 / 4%);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: color .25s, border-color .25s, background-color .25s, box-shadow .3s, transform .3s var(--ease-out);
}

.footer__touch:hover,
.footer__touch:focus-visible {
  border-color: var(--crypto);
  background: var(--crypto);
  color: var(--bg);
  box-shadow: 0 0 22px rgb(214 255 0 / 35%);
  transform: translateY(-2px);
}

.footer__touch:focus-visible {
  outline: 2px solid var(--crypto);
  outline-offset: 3px;
}

/* the request form — the design's pop-up (its final values) */
html.modal-open {
  overflow: hidden;
}

.fmodal {
  width: min(580px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  overflow: visible;
  background: transparent;
  color: #fff;
}

.fmodal::backdrop {
  background: rgb(0 0 0 / 62%);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.fmodal[open]::backdrop {
  animation: f-fade .35s ease both;
}

.fmodal__box {
  position: relative;
  box-sizing: border-box;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: clamp(24px, 4vw, 40px);
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 28px;
  background: linear-gradient(160deg, rgb(40 46 36 / 92%), rgb(12 14 11 / 95%) 60%, rgb(22 26 20 / 94%));
  box-shadow: inset 0 1px rgb(255 255 255 / 28%), inset 0 -1px rgb(255 255 255 / 5%), 0 30px 60px -30px rgb(0 0 0 / 90%), 0 40px 100px rgb(0 0 0 / 70%);
  overscroll-behavior: contain;
}

.fmodal[open] .fmodal__box {
  animation: f-modal .45s var(--ease-out) both;
}

.fmodal__x {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 12px;
  background: rgb(255 255 255 / 5%);
  color: #fff;
  cursor: pointer;
}

.fmodal__x::before,
.fmodal__x::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 19px;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(45deg);
}

.fmodal__x::after {
  transform: rotate(-45deg);
}

.fmodal__x:hover,
.fmodal__x:focus-visible {
  border-color: #8bea0a;
  color: #8bea0a;
}

.fmodal__mark {
  display: block;
  width: 64px;
  height: auto;
  margin: 0 0 16px;
}

.fmodal__t {
  margin: 0 0 8px;
  font: 400 clamp(26px, 3vw, 36px) / 1.05 Corpta, "Exo 2", sans-serif;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.fmodal__sub {
  margin: 0 0 24px;
  color: rgb(255 255 255 / 65%);
}

.offer__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;

  @media (width <= 899px) {
    grid-template-columns: minmax(0, 1fr);
  }
}

.f {
  display: grid;
  align-content: start;
  gap: 8px;
  margin: 0;
}

.f label,
.seg legend {
  color: rgb(255 255 255 / 70%);
  font-size: 14px;
}

.f input,
.f textarea {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 14px;
  background: rgb(255 255 255 / 5%);
  color: #fff;
  font: 500 16px / 1.45 "Exo 2", system-ui, sans-serif;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}

.f input {
  height: 52px;
  padding: 0 16px;

  @media (width <= 899px) {
    height: 44px;
    border-radius: 12px;
  }
}

.f textarea {
  min-height: 96px;
  padding: 12px 16px;
  resize: vertical;

  @media (width <= 899px) {
    min-height: 84px;
    border-radius: 12px;
  }
}

.f input::placeholder {
  color: rgb(255 255 255 / 62%);
}

.f textarea::placeholder {
  color: rgb(255 255 255 / 45%);
}

.f input:hover,
.f textarea:hover {
  border-color: rgb(255 255 255 / 30%);
}

.f input:focus,
.f textarea:focus {
  border-color: rgb(255 255 255 / 60%);
  background: rgb(255 255 255 / 7%);
  box-shadow: 0 0 0 3px rgb(255 255 255 / 10%);
}

.f input[aria-invalid="true"] {
  border-color: #ff7b6b;
  box-shadow: 0 0 0 3px rgb(255 123 107 / 14%);
}

.f__err {
  color: #ff9a8c;
  font-size: 13px;
}

.f__err:empty {
  display: none;
}

.f__opt {
  margin-left: 6px;
  color: rgb(255 255 255 / 45%);
  font-size: 12px;
}

.f--q {
  margin-top: 20px;

  @media (width <= 899px) {
    margin-top: 16px;
  }
}

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 0;
  padding: 0;
  border: 0;

  @media (width <= 899px) {
    gap: 6px;
    margin-top: 16px;
  }
}

.seg legend {
  margin-bottom: 10px;
  padding: 0;
}

.seg label {
  position: relative;
}

.seg input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.seg span {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 18px;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 12px;
  color: rgb(255 255 255 / 78%);
  font-size: 15px;
  transition: .2s;

  @media (width <= 899px) {
    height: 34px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 13px;
  }
}

.seg input:checked + span {
  border-color: #fff;
  background: rgb(255 255 255 / 8%);
  color: #fff;
}

.seg input:focus-visible + span {
  outline: 2px solid #8bea0a;
  outline-offset: 2px;
}

.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
}

/* Turnstile: invisible unless Cloudflare wants a click */
.offer__captcha:not(:empty) {
  margin-top: 16px;
}

.offer__send {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin: 24px 0 0;
}

.offer__note {
  color: rgb(255 255 255 / 62%);
  font-size: 13px;
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  padding: 0 32px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: linear-gradient(100deg, #3fcb10 0%, #8bea0a 55%, #d6ff00 100%) 0 0 / 140% 100%;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 45%), inset 0 -1px 0 rgb(0 0 0 / 18%), 0 10px 28px -12px rgb(110 230 20 / 55%);
  color: #061000;
  font: 600 15px "Exo 2", system-ui, sans-serif;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background-position .5s var(--ease-out), box-shadow .3s;

  @media (width <= 899px) {
    height: 44px;
    padding: 0 22px;
    font-size: 14px;
  }
}

.cta:hover,
.cta:focus-visible {
  background-position: 100% 0;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 50%), 0 14px 36px -12px rgb(150 240 20 / 70%);
}

.cta:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.cta:disabled {
  opacity: .6;
  pointer-events: none;
}

.offer__status {
  margin: 12px 0 0;
  color: #ff9a8c;
  font-size: 14px;
}

.offer__status:empty {
  display: none;
}

.offer__done {
  padding: 28px 8px 12px;
  outline: none;
  text-align: center;
  animation: f-rise .5s var(--ease-out) both;
}

.offer__check {
  position: relative;
  display: block;
  box-sizing: border-box;
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border: 2px solid #8bea0a;
  border-radius: 50%;
}

.offer__check::after {
  content: "";
  position: absolute;
  left: 21px;
  top: 16px;
  width: 14px;
  height: 24px;
  border: solid #8bea0a;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

.offer__done h3 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 600;

  @media (width <= 899px) {
    font-size: 22px;
  }
}

.offer__done p {
  margin: 0;
  color: rgb(255 255 255 / 72%);
  line-height: 1.5;
}

@keyframes f-modal { from { opacity: 0; transform: translateY(18px) scale(.98); } }
@keyframes f-fade { from { opacity: 0; } }
@keyframes f-show { from { opacity: 0; } }
@keyframes f-rise { from { opacity: 0; translate: 0 12px; } }
@keyframes f-grain { 0% { translate: 0 0; } 25% { translate: -3% 2%; } 50% { translate: 2% -3%; } 75% { translate: -2% -1%; } 100% { translate: 0 0; } }
@keyframes f-nm-in { from { opacity: 0; transform: translateY(.3em); filter: blur(8px); } }
@keyframes f-nm-dim { to { color: rgb(255 255 255 / 30%); } }
@keyframes f-nm-f { 0% { color: #fff; text-shadow: none; } 22%, 62% { color: #7be34a; text-shadow: 0 0 22px rgb(123 227 74 / 75%); } 100% { color: #fff; text-shadow: 0 0 14px rgb(255 255 255 / 18%); } }
@keyframes f-nm-c { 0% { color: #fff; text-shadow: none; } 22%, 62% { color: #e2ff66; text-shadow: 0 0 22px rgb(226 255 102 / 70%); } 100% { color: #fff; text-shadow: 0 0 14px rgb(255 255 255 / 18%); } }
@keyframes f-nm-down { from { translate: 0 calc(-1 * min(22svh, 290px)); } }
@keyframes f-fold { to { --k: 1; } }

/* no motion: straight to the end — «Fiane» in its colours, the flat mark */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before {
    animation: none !important;
  }

  .intro__name {
    --k: 1;
  }

  .footer__touch {
    transition: none;
  }

  .footer__touch:hover {
    transform: none;
  }
}
