/* ==========================================================================
   MAXTECH INTERNATIONAL — the three portal forms (candidates, russian-corporates,
   indian-agencies), v2 "porcelain". Shared pieces: white field cards, large soft
   inputs, custom checkbox, choice tiles, scene card, success card, phone step flow.
   Page compositions live in css/candidates.css, css/corporates.css, css/agencies.css.
   Behaviour: js/form.js (class names below are its hooks).
   ========================================================================== */

/* no dock on form pages; the step bar (phones) reserves its own room */
body[data-shell="form"] { --bar-h: 0px; }
html.mx-steps body[data-shell="form"] { --bar-h: 88px; }

/* ----- page headline block ----- */
.pg-title { font-size: clamp(38px, 4.5vw, 68px); margin-top: 22px; }
html[lang="ru"] .pg-title { font-size: clamp(32px, 3.9vw, 58px); }
.pg-desc { margin-top: clamp(16px, 1.8vw, 24px); max-width: 46ch; font-size: clamp(16px, 1.2vw, 18px); }

/* ----- the 3D scene sits in a light rounded card with a fixed shape ----- */
.scn-card { position: relative; overflow: hidden; border-radius: var(--r-lg); background: linear-gradient(160deg, #FFFFFF 0%, var(--blush) 100%); box-shadow: 0 0 0 1px var(--line-2), var(--sh-2); }
.scn-card .glow { width: 80%; height: 80%; right: -26%; top: -32%; opacity: .5; }
.scn-card .scene { width: 100%; aspect-ratio: 5 / 4; }
.scn-card .scene-still { object-fit: cover; }
.scn-card[data-sc] { transform: translate3d(0, calc(var(--s, 0) * 14px), 0); will-change: transform; }

/* a thin bar that fills as the required fields are completed (--form-p is set by form.js) */
.meter { height: 8px; border-radius: 999px; background: rgba(29, 27, 32, .07); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--grad); transform-origin: 0 50%; transform: scaleX(var(--form-p, 0)); transition: transform .6s var(--ease); }

/* ----- form: one white card per fieldset ----- */
.mxf { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; min-width: 0; }
.fs, .f-end { min-width: 0; margin: 0; border: 0; padding: clamp(22px, 2.5vw, 34px); border-radius: var(--r-lg); background: var(--card); box-shadow: 0 0 0 1px var(--line-2), var(--sh-1); }
.fs-cap { float: left; width: 100%; padding: 0; margin: 0 0 clamp(18px, 2vw, 26px); }
.fs-cap-in { display: flex; align-items: center; gap: 14px; }
.fs-cap .ico { margin: 0; width: 48px; height: 48px; border-radius: 15px; flex: none; }
.fs-cap .ico svg { width: 24px; height: 24px; }
.fs-grid { clear: both; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; }
.fs-1 .fs-grid { grid-template-columns: minmax(0, 1fr); }

/* a field: label, control, error. Rows line up across the two columns where subgrid exists */
.f { min-width: 0; padding-bottom: 18px; }
.f-wide, .f-tiles, .f-plate { grid-column: 1 / -1; }
@supports (grid-template-rows: subgrid) {
  .fs-grid > .f:not(.f-tiles):not(.f-plate) { display: grid; grid-template-rows: subgrid; grid-row: span 3; }
  .fs-grid > .f:not(.f-tiles):not(.f-plate) > .f-l { align-self: end; }
}
.f-l { display: block; margin-bottom: 8px; font: 600 14px/1.35 var(--f-body); color: var(--ink); }
.req { color: var(--crimson); font-weight: 600; }
.f-c { position: relative; min-width: 0; }
.f-c input, .f-c select {
  display: block; width: 100%; height: 58px; margin: 0; padding: 0 18px; border-radius: 16px;
  border: 1.5px solid rgba(29, 27, 32, .13); background: #FDFCFB; color: var(--ink);
  font: 500 16px/1.2 var(--f-body); letter-spacing: 0; -webkit-appearance: none; appearance: none; outline: 0;
  transition: border-color .2s, box-shadow .25s var(--ease), background-color .2s;
}
.f-c input::placeholder { color: var(--ink-3); opacity: 1; font-weight: 400; }
.f-c input:hover, .f-c select:hover { border-color: rgba(29, 27, 32, .28); }
.f-c input:focus, .f-c select:focus { border-color: var(--crimson); background: #fff; box-shadow: 0 0 0 4px rgba(229, 28, 62, .14); }
.f-c input[type="number"] { -moz-appearance: textfield; }
.f-c input[type="number"]::-webkit-outer-spin-button, .f-c input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.f-c input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px #F6F8FA inset; -webkit-text-fill-color: var(--ink); }
.f-c input:-webkit-autofill:focus { -webkit-box-shadow: 0 0 0 40px #F6F8FA inset, 0 0 0 4px rgba(229, 28, 62, .14); }
.f-sel select { padding-right: 48px; cursor: pointer; text-overflow: ellipsis; }
.f-sel select[data-empty] { color: var(--ink-3); font-weight: 400; }
.f-sel select option { color: var(--ink); }
.f-sel::after { content: ""; position: absolute; right: 20px; top: 50%; width: 9px; height: 9px; margin-top: -7px; border-right: 1.8px solid var(--ink-2); border-bottom: 1.8px solid var(--ink-2); transform: rotate(45deg); pointer-events: none; transition: border-color .2s; }
.f-sel:focus-within::after { border-color: var(--crimson); }

/* inline errors */
.f-e { display: none; margin-top: 8px; padding-left: 26px; font: 500 13.5px/1.4 var(--f-body); color: var(--crimson-ink);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Ccircle cx='9' cy='9' r='8' fill='%23E51C3E'/%3E%3Cpath d='M9 4.8v5M9 12.6v.4' stroke='%23fff' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") 0 1px / 18px 18px no-repeat; }
.is-err .f-e { display: block; animation: fErr .35s var(--ease) both; }
.is-err .f-c input, .is-err .f-c select { border-color: var(--crimson); background: #FFF6F6; }
@keyframes fErr { from { opacity: 0; transform: translateY(-4px); } }

/* ----- declaration, alert, submit ----- */
.f-end { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.ck { display: flex; align-items: flex-start; gap: 16px; padding: 18px 20px; border-radius: 20px; background: var(--blush); box-shadow: 0 0 0 1px rgba(229, 28, 62, .09) inset; transition: box-shadow .2s, background-color .2s; }
.ck.is-err { box-shadow: 0 0 0 1.5px var(--crimson) inset; }
.ck-b { position: relative; flex: none; width: 32px; height: 32px; margin-top: 1px; }
.ck-b input { position: absolute; left: -8px; top: -8px; width: 48px; height: 48px; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.ck-box { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 11px; background: #fff; border: 1.5px solid rgba(29, 27, 32, .22); transition: background-color .2s, border-color .2s, box-shadow .25s var(--ease), transform .25s var(--ease); }
.ck-box svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .35s var(--ease) .05s; }
.ck-b input:hover + .ck-box { border-color: var(--crimson); }
.ck-b input:focus-visible + .ck-box { box-shadow: 0 0 0 4px rgba(229, 28, 62, .2); border-color: var(--crimson); }
.ck-b input:checked + .ck-box { background: var(--crimson); background-image: var(--grad); border-color: transparent; box-shadow: 0 8px 16px -8px rgba(229, 28, 62, .7); transform: scale(1.04); }
.ck-b input:checked + .ck-box svg { stroke-dashoffset: 0; }
.ck-t { min-width: 0; }
.ck-t label { display: block; font-size: 14.5px; line-height: 1.6; color: var(--ink-2); cursor: pointer; }
.ck-t label strong { color: var(--ink); }
.ck-t label a { color: var(--crimson-ink); font-weight: 500; text-underline-offset: 3px; }
.f-alert { padding: 16px 18px 16px 50px; border-radius: 16px; background: #FFF1F1 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Ccircle cx='9' cy='9' r='8' fill='%23E51C3E'/%3E%3Cpath d='M9 4.8v5M9 12.6v.4' stroke='%23fff' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") 18px 50% / 22px 22px no-repeat; box-shadow: 0 0 0 1px rgba(229, 28, 62, .25) inset; color: var(--crimson-deep); font-weight: 500; font-size: 15px; line-height: 1.45; animation: fErr .35s var(--ease) both; }
.f-submit { justify-self: start; min-height: 64px; padding-left: 30px; gap: 22px; font-size: 17px; font-weight: 600; }
.f-submit .arr { padding: 17px 14px; }

/* ----- choice tiles (drive a native <select>, which stays the real control) ----- */
.f-tiles { position: relative; }
.f-tiles.has-tiles .f-sel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; min-height: 136px; padding: 18px 18px 16px; text-align: left; border-radius: 20px; background: #FDFCFB; box-shadow: 0 0 0 1.5px rgba(29, 27, 32, .12) inset; transition: transform .35s var(--ease), box-shadow .3s var(--ease), background-color .3s; }
.tile:hover { transform: translateY(-3px); box-shadow: 0 0 0 1.5px rgba(229, 28, 62, .45) inset, var(--sh-1); }
.tile:active { transform: scale(.98); }
.tile:focus-visible { outline: 0; box-shadow: 0 0 0 2px var(--crimson) inset, 0 0 0 4px rgba(229, 28, 62, .16); border-radius: 20px; }
.tile[aria-checked="true"] { background: linear-gradient(160deg, #FFFFFF 0%, #FFE6E8 100%); box-shadow: 0 0 0 2px var(--crimson) inset, 0 18px 30px -18px rgba(229, 28, 62, .6); }
.tile::after { content: ""; position: absolute; right: 12px; top: 12px; width: 26px; height: 26px; border-radius: 50%; background: var(--crimson) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.5 12.5l3.800 3.800 7.200-8' fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 50% / 16px no-repeat; transform: scale(0); transition: transform .4s var(--ease); }
.tile[aria-checked="true"]::after { transform: none; }
/* little workers: one more per tile */
.tile-crew, .crew { display: flex; align-items: flex-end; gap: 3px; }
.tile-crew { height: 30px; margin-bottom: auto; padding-bottom: 14px; box-sizing: content-box; }
.tile-crew i, .crew i { display: block; width: 13px; height: 22px; background: rgba(29, 27, 32, .22); transition: background-color .3s, transform .4s var(--ease);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 13 22'%3E%3Ccircle cx='6.5' cy='4' r='3.7'/%3E%3Cpath d='M1 22v-7.5a5.5 5.5 0 0111 0V22z'/%3E%3C/svg%3E") 50% / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 13 22'%3E%3Ccircle cx='6.5' cy='4' r='3.7'/%3E%3Cpath d='M1 22v-7.5a5.5 5.5 0 0111 0V22z'/%3E%3C/svg%3E") 50% / contain no-repeat; }
.tile[aria-checked="true"] .tile-crew i { background: var(--crimson); }
.tile[aria-checked="true"] .tile-crew i:nth-child(2n) { transform: translateY(-3px); }
.tile-n { font: 600 clamp(20px, 1.9vw, 26px)/1.1 var(--f-display); letter-spacing: -.025em; color: var(--ink); white-space: nowrap; }
.tile-u { margin-top: 3px; font-size: 13.5px; line-height: 1.3; color: var(--ink-2); }
.is-err .tile { box-shadow: 0 0 0 1.5px rgba(229, 28, 62, .55) inset; }

/* ----- success: a soft celebratory card ----- */
.ok { position: fixed; z-index: 120; inset: 0; display: grid; place-items: center; padding: 20px; overflow: auto;
  background: rgba(246, 248, 250, .78); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  opacity: 0; transition: opacity .45s var(--ease); }
.ok.on { opacity: 1; }
.ok-sheet { position: relative; width: min(520px, 100%); padding: clamp(34px, 5vw, 52px) clamp(24px, 4vw, 44px) clamp(28px, 4vw, 40px); text-align: center; border-radius: var(--r-lg); outline: 0; overflow: hidden;
  background: radial-gradient(90% 60% at 50% 0%, #FFE3DD 0%, rgba(226, 233, 241, 0) 70%), #fff; box-shadow: 0 0 0 1px var(--line-2), var(--sh-2);
  transform: translateY(28px) scale(.95); transition: transform .7s var(--ease); }
.ok.on .ok-sheet { transform: none; }
.ok-badge { position: relative; width: 92px; height: 92px; margin: 0 auto 26px; }
.ok-ico { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 50%; background: var(--crimson); background-image: var(--grad); box-shadow: var(--sh-red), 0 0 0 10px rgba(229, 28, 62, .1); transform: scale(.4); opacity: 0; }
.ok.on .ok-ico { animation: okPop .7s var(--ease) .15s both, okRing 2.2s ease-out .8s infinite; }
.ok-ico svg { width: 46px; height: 46px; fill: none; stroke: #fff; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 34; stroke-dashoffset: 34; }
.ok.on .ok-ico svg { animation: okDraw .5s var(--ease) .55s forwards; }
.ok-burst { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.ok-burst i { position: absolute; left: -4px; top: -7px; width: 8px; height: 14px; border-radius: 4px; background: var(--c, var(--crimson)); opacity: 0; transform: rotate(var(--a)) translateY(-30px) scale(.4); }
.ok.on .ok-burst i { animation: okBurst 1.1s var(--ease) .45s both; }
.ok-burst i:nth-child(1) { --a: 0deg; --c: #5F7386; }
.ok-burst i:nth-child(2) { --a: 36deg; --c: #FFC94A; }
.ok-burst i:nth-child(3) { --a: 72deg; --c: #E51C3E; }
.ok-burst i:nth-child(4) { --a: 108deg; --c: #BECDDE; }
.ok-burst i:nth-child(5) { --a: 144deg; --c: #5F7386; }
.ok-burst i:nth-child(6) { --a: 180deg; --c: #FFC94A; }
.ok-burst i:nth-child(7) { --a: 216deg; --c: #E51C3E; }
.ok-burst i:nth-child(8) { --a: 252deg; --c: #BECDDE; }
.ok-burst i:nth-child(9) { --a: 288deg; --c: #5F7386; }
.ok-burst i:nth-child(10) { --a: 324deg; --c: #FFC94A; }
.ok-burst i:nth-child(2n) { height: 9px; top: -4px; }
.ok-title { margin-bottom: 14px; }
.ok-sub { max-width: 34ch; margin: 0 auto; font-size: 16.5px; line-height: 1.55; color: var(--ink-2); }
.ok-redirect { margin-top: 24px; font-size: 13.5px; color: var(--ink-3); }
.ok-line { height: 6px; margin: 12px auto 0; max-width: 240px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.ok-line i { display: block; height: 100%; border-radius: inherit; background: var(--grad); transform-origin: 0 50%; transform: scaleX(0); }
.ok.on .ok-line i { animation: okLine 3s linear forwards; }
@keyframes okPop { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes okRing { 0% { box-shadow: var(--sh-red), 0 0 0 0 rgba(229, 28, 62, .28); } 100% { box-shadow: var(--sh-red), 0 0 0 22px rgba(229, 28, 62, 0); } }
@keyframes okDraw { to { stroke-dashoffset: 0; } }
@keyframes okBurst { 0% { opacity: 0; transform: rotate(var(--a)) translateY(-30px) scale(.4); } 25% { opacity: 1; } 100% { opacity: 0; transform: rotate(var(--a)) translateY(-84px) scale(1); } }
@keyframes okLine { to { transform: none; } }

/* ----- tablet and down ----- */
@media (max-width: 760px) {
  .pg-title { font-size: clamp(34px, 9.4vw, 44px); margin-top: 18px; }
  html[lang="ru"] .pg-title { font-size: clamp(29px, 8.2vw, 38px); }
  .scn-card { border-radius: var(--r); }
  .scn-card[data-sc] { transform: none; }
  .mxf { gap: 14px; }
  .fs, .f-end { padding: 20px 18px; border-radius: var(--r); }
  .fs-grid { grid-template-columns: minmax(0, 1fr); }
  .fs-cap .ico { width: 44px; height: 44px; border-radius: 14px; }
  .f-c input, .f-c select { height: 60px; }
  .f-l { font-size: 14.5px; }
  .ck { padding: 16px; gap: 14px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { min-height: 124px; padding: 16px 14px 14px; }
  .tile-n { font-size: 21px; }
  .f-submit { justify-self: stretch; width: 100%; }
}

/* ==========================================================================
   Phone step flow (<=760px; classes set by js/form.js)
   ========================================================================== */
.steps-prog { display: none; }
html.mx-steps .steps-prog { display: flex; gap: 6px; padding: 7px; border-radius: 999px; background: rgba(255, 255, 255, .86); box-shadow: 0 0 0 1px var(--line-2), var(--sh-1); }
.steps-prog i { position: relative; flex: 1; height: 8px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.steps-prog i::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--grad); transform-origin: 0 50%; transform: scaleX(0); transition: transform .55s var(--ease); }
.steps-prog i.on::after { transform: none; }
/* inside the flow the cards do not wait for the scroll reveal; the step itself slides in */
html.mx-steps .mxf [data-rv] { opacity: 1; transform: none; transition: none; }
html.mx-steps .mxf[data-dir="fwd"] .fs.is-cur, html.mx-steps .mxf[data-dir="fwd"] .f-end { animation: stepFwd .5s var(--ease) both; }
html.mx-steps .mxf[data-dir="back"] .fs.is-cur, html.mx-steps .mxf[data-dir="back"] .f-end { animation: stepBack .5s var(--ease) both; }
html.mx-steps .mxf .f-end { animation-delay: .06s; }
@keyframes stepFwd { from { opacity: 0; transform: translate3d(0, 22px, 0); } }
@keyframes stepBack { from { opacity: 0; transform: translate3d(0, -18px, 0); } }
html.mx-steps .f-submit { display: none; }
html.mx-steps main { padding-bottom: 8px; }

.fbar { bottom: calc(12px + env(safe-area-inset-bottom, 0px) + var(--kb, 0px)); transition: transform .45s var(--ease), opacity .3s, bottom .25s var(--ease); }
.fbar-back { flex: 0 0 36%; color: var(--ink-2); }
.fbar-back:active { background: rgba(29, 27, 32, .06); }
.fbar-next { flex: 1; min-width: 0; justify-content: space-between; padding: 0 8px 0 24px; color: #fff; background: var(--crimson); background-image: var(--grad); box-shadow: var(--sh-red); text-align: left; line-height: 1.15; }
.fbar-next span { min-width: 0; }
.fbar-next .arr { box-sizing: content-box; width: 16px; height: 10px; padding: 13px 10px; border-radius: 50%; background: rgba(255, 255, 255, .22); flex: none; }
.fbar-next[disabled] { opacity: .65; }
.fbar.is-last .fbar-back { flex: 0 0 52px; }
.fbar.is-last .fbar-back span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.fbar.is-last .fbar-next { font-size: 15px; padding-left: 20px; }

@media (prefers-reduced-motion: reduce) {
  .scn-card[data-sc] { transform: none; }
  .meter i, .tile, .tile::after, .ck-box, .ck-box svg, .steps-prog i::after, .ok, .ok-sheet { transition: none; }
  .is-err .f-e, .f-alert, html.mx-steps .mxf .fs.is-cur, html.mx-steps .mxf .f-end { animation: none !important; }
  .ok.on .ok-ico { animation: none; transform: none; opacity: 1; }
  .ok.on .ok-ico svg { animation: none; stroke-dashoffset: 0; }
  .ok.on .ok-burst i { animation: none; }
}
