@font-face {
  font-family: "BVP";
  src: url(fonts/be-vietnam-pro-400-latin.woff2) format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "BVP";
  src: url(fonts/be-vietnam-pro-600-latin.woff2) format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  --bg: #fbfaf6;
  --paper: #fffefa;
  --ink: #171611;
  --muted: #625e55;
  --line: #dedbd2;
  --accent: #ff4a1c;
  --accent-ink: #a83117;
  --gutter: max(24px, env(safe-area-inset-left), env(safe-area-inset-right));
  --ease: cubic-bezier(.22, 1, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, p { margin: 0; }
[hidden] { display: none !important; }
.project-loader { display: none; }

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

body {
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 "BVP", system-ui, sans-serif;
}

.head, .sheet {
  width: min(100% - var(--gutter) * 2, 1260px);
  margin-inline: auto;
}

.head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-block: calc(20px + env(safe-area-inset-top)) 20px;
  border-bottom: 1px solid var(--line);
}

.mark, .close, .direct a {
  display: inline-flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.mark, .project-loader__brand { gap: 8px; font-size: 24px; font-weight: 600; letter-spacing: -.06em; }

.close {
  min-height: 44px;
  gap: 10px;
  padding-inline: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.close i { font: 400 22px/1 system-ui, sans-serif; }
.close:hover { background: var(--paper); border-color: var(--ink); color: var(--ink); }

.sheet {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1fr);
  grid-template-areas: "intro form" "direct form";
  grid-template-rows: auto 1fr;
  align-items: start;
  gap: 56px clamp(32px, 6vw, 104px);
  padding-block: clamp(56px, 9.5vh, 118px) max(44px, env(safe-area-inset-bottom));
}

.intro { grid-area: intro; padding-block-start: 20px; }

.intro h1 {
  font-size: clamp(58px, 7.7vw, 110px);
  font-weight: 600;
  letter-spacing: -.085em;
  line-height: .96;
}

.intro h1 span { display: block; }
.intro h1 span + span { color: var(--accent-ink); }
.intro p { max-width: 35ch; margin-top: 24px; color: var(--muted); font-size: clamp(16px, 1.65vw, 20px); }

.direct {
  grid-area: direct;
  width: fit-content;
  max-width: 100%;
  border-top: 1px solid var(--line);
  padding-top: 13px;
}

.direct p { color: var(--muted); font-size: 13px; }
.direct a { gap: 13px; min-height: 44px; font-size: 15px; font-weight: 600; }
.direct a:hover, .privacy a:hover { color: var(--accent-ink); }
.direct a span { color: var(--accent-ink); }

.workspace {
  grid-area: form;
  min-width: 0;
  padding: clamp(24px, 3.2vw, 46px);
  border: 1px solid var(--line);
  border-top: 3px solid var(--ink);
  border-radius: 2px 2px 12px 12px;
  background: var(--paper);
  box-shadow: 0 16px 48px -44px rgb(34 22 17 / 55%);
}

.progress { margin-bottom: 30px; }

.progress__steps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.progress__steps li {
  --progress: 0;
  position: relative;
  padding-bottom: 9px;
  border-bottom: 2px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.progress__steps li::after {
  content: "";
  position: absolute;
  inset: auto 0 -2px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(var(--progress));
  transform-origin: left center;
}

.progress__steps li.is-past { --progress: 1; }
.progress__steps li[aria-current] { --progress: 1; color: var(--ink); }

.q { min-width: 0; margin: 0 0 32px; padding: 0; border: 0; }
.steps .q { margin-bottom: 0; }
.q > legend, .done h2 {
  max-width: 100%;
  padding: 0;
  font-size: clamp(28px, 3vw, 41px);
  font-weight: 600;
  letter-spacing: -.055em;
  line-height: 1.12;
}
.q > legend { margin-bottom: 24px; }

.field, .choices legend {
  display: block;
  margin-bottom: 8px;
  padding: 0;
  font-size: 14px;
  font-weight: 600;
}

input[type="text"], input[type="tel"], input[type="email"], textarea {
  display: block;
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid #d5d0c4;
  border-radius: 7px;
  background: var(--bg);
  color: inherit;
  font: inherit;
}

textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: #777065; }
input:focus, textarea:focus { border-color: var(--ink); background: #fff; }
input[aria-invalid="true"] { border-color: var(--accent-ink); }

.choices { min-width: 0; padding: 0; margin: 20px 0 0; border: 0; }
.opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.opts label { position: relative; cursor: pointer; }
.opts input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.opts span {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 100%;
  min-height: 48px;
  padding: 9px 11px;
  border: 1px solid #d5d0c4;
  border-radius: 7px;
  background: var(--paper);
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.opts span::before {
  content: "";
  flex: none;
  width: 15px;
  height: 15px;
  border: 1px solid #857e71;
  border-radius: 50%;
}

.opts input:checked + span { border-color: var(--accent-ink); background: #fff1e8; }
.opts input:checked + span::before { border: 4px solid var(--accent-ink); }
@media (hover: hover) { .opts label:hover span { border-color: var(--ink); } }

.brief { margin-top: 12px; }
.brief summary {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.brief summary::-webkit-details-marker { display: none; }
.brief summary::before { content: "+" / ""; font: 600 19px/1 system-ui, sans-serif; color: var(--accent-ink); }
.brief[open] summary::before { content: "−" / ""; }
.brief textarea { margin-top: 6px; min-height: 100px; }
.optional { color: var(--muted); font-size: 12px; font-weight: 400; }

.contact-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
.contact-fields__name, .contact-fields__help { grid-column: 1 / -1; }
.help { color: var(--muted); font-size: 13px; }
.privacy { margin-top: 20px; }
.privacy a { color: inherit; text-underline-offset: 3px; }

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.back, .ok {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border: 0;
  border-radius: 7px;
  font: 600 14px/1.3 "BVP", system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
}

.back { margin-right: auto; padding-left: 0; background: none; color: var(--muted); }
.back:hover { color: var(--ink); }
.ok { justify-content: space-between; min-width: 128px; background: var(--ink); color: #fff; }
.ok:hover { background: #422e23; }
.actions i, .done i { font: 400 18px/1 system-ui, sans-serif; }
.ok:disabled, .back:disabled { opacity: .65; cursor: wait; }

.msg, .field-error { color: #a22d12; font-size: 13px; font-weight: 600; }
.msg:not(:empty) { margin-top: 14px; }
.field-error:not(:empty) { margin-top: 7px; }

.done { padding-block: 16px 34px; }
.done__icon {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 18px;
  border-radius: 7px;
  background: #fff1e8;
  color: var(--accent-ink);
  font-size: 22px;
}
.done p { margin: 14px 0 24px; color: var(--muted); }

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible, .opts input:focus-visible + span {
  outline: 2px solid var(--accent-ink);
  outline-offset: 2px;
}

@media (max-width: 880px) {
  .sheet {
    max-width: 580px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "intro" "form" "direct";
    grid-template-rows: auto;
    gap: 24px;
    padding-top: 30px;
  }
  .intro { padding: 0; }
  .intro h1 { font-size: clamp(42px, 10.4vw, 72px); letter-spacing: -.075em; }
  .intro p { margin-top: 14px; font-size: 16px; }
  .direct { margin-inline: 2px; }
}

@media (max-width: 500px) {
  :root { --gutter: max(18px, env(safe-area-inset-left), env(safe-area-inset-right)); }
  .head { padding-block: calc(10px + env(safe-area-inset-top)) 10px; }
  .workspace { padding: 18px; }
  .progress { margin-bottom: 22px; }
  .q > legend { margin-bottom: 20px; }
  .contact-fields { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .opts span { padding-inline: 8px; gap: 6px; font-size: 13px; }
  .back, .ok { gap: 8px; }
}

@media (max-width: 355px) {
  .workspace { padding-inline: 14px; }
  .opts { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .close, .opts span, .ok, input, textarea { transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease; }
  .progress__steps li::after { transition: transform 340ms var(--ease); }
  .brief[open] textarea, .done { animation: step-in 360ms var(--ease) both; }
  .steps[data-direction] .q { animation: step-in 350ms var(--ease) both; }
  .steps[data-direction="back"] { --step-shift: -7px; }

  .project-opening { --intro-time: 470ms; }

  .project-opening .project-loader {
    position: fixed;
    z-index: 20;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 18px;
    background: var(--bg);
    pointer-events: none;
    animation: loader-out 340ms cubic-bezier(.72, 0, .25, 1) var(--intro-time) both;
  }

  .project-loader__brand { display: flex; align-items: center; font-size: 31px; animation: step-in 400ms var(--ease) both; }
  .project-loader__track { width: 120px; height: 2px; overflow: hidden; background: var(--line); }
  .project-loader__track::after {
    content: "";
    display: block;
    height: 100%;
    background: var(--accent);
    transform-origin: left center;
    animation: loader-progress var(--intro-time) cubic-bezier(.4, 0, .2, 1) both;
  }

  .project-opening .head { animation: reveal-in 400ms var(--ease) calc(var(--intro-time) + 60ms) both; }
  .project-opening .sheet { animation: reveal-in 470ms var(--ease) calc(var(--intro-time) + 80ms) both; }

  @keyframes step-in {
    from { opacity: 0; transform: translateY(var(--step-shift, 8px)); }
  }
  @keyframes loader-progress {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
  }
  @keyframes loader-out {
    from { clip-path: inset(0); }
    to { clip-path: inset(0 0 100%); visibility: hidden; }
  }
  @keyframes reveal-in {
    from { opacity: 0; visibility: hidden; transform: translateY(12px); }
    to { opacity: 1; visibility: visible; transform: translateY(0); }
  }
}
