/* ============================================================
   NAVION 3D — modal, toast, motion & responsive (Apple system)
   ============================================================ */

/* ---------------- Print request modal ---------------- */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
}
.modal-root.open { display: block; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, .5);
  opacity: 0;
  transition: opacity .25s ease;
}
.modal-root.visible .modal-backdrop { opacity: 1; }
.modal-shell {
  position: relative;
  width: min(780px, calc(100% - 32px));
  max-height: calc(100dvh - 64px);
  margin: 32px auto;
  background: var(--canvas);
  border: none;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(14px) scale(.99);
  opacity: 0;
  transition: transform .28s var(--ease-out), opacity .28s var(--ease-out);
}
.modal-root.visible .modal-shell { transform: none; opacity: 1; }
@media (max-width: 640px) {
  .modal-shell {
    width: 100%;
    max-height: 100dvh;
    margin: 0;
    height: 100dvh;
    border-radius: 0;
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--md);
  padding: var(--lg) var(--xl);
  border-bottom: 1px solid var(--divider);
}
.modal-head h2 {
  font-size: var(--tagline);
  font-weight: var(--w-heavy);
  letter-spacing: var(--ls-tagline);
  color: var(--ink);
}
.modal-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--strong);
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  flex: none;
  transition: background .15s ease;
}
.modal-close:hover { background: var(--hairline-strong); }

/* Steps header — pill chips */
.steps-bar {
  display: flex;
  gap: var(--xs);
  padding: var(--md) var(--xl) 0;
  flex-wrap: wrap;
}
.step-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: var(--caption);
  font-weight: var(--w-heavy);
  letter-spacing: -0.12px;
  color: var(--muted-soft);
  padding: 6px 12px 6px 6px;
  border-radius: var(--pill);
  background: transparent;
}
.step-chip .n {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--strong);
  color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: var(--w-heavy);
  font-variant-numeric: tabular-nums;
}
.step-chip.current { color: var(--ink); background: var(--soft); }
.step-chip.current .n { background: var(--primary); color: var(--on-primary); }
.step-chip.done { color: var(--muted); }
.step-chip.done .n { background: var(--ink); color: var(--on-dark); }

.modal-body {
  overflow-y: auto;
  padding: var(--xl);
  display: grid;
  gap: var(--lg);
  align-content: start;
}
.pane { display: none; }
.pane.current { display: grid; gap: var(--lg); animation: pane-in .3s var(--ease-out); }
@keyframes pane-in {
  from { opacity: 0; transform: translateX(10px); }
  to   { opacity: 1; transform: none; }
}
.pane-title {
  font-size: var(--title-lg);
  font-weight: var(--w-heavy);
  letter-spacing: -0.01em;
  color: var(--ink);
}
.pane-hint { color: var(--muted); font-size: var(--body-sm); margin-top: -10px; }

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--md);
  padding: var(--md) var(--xl);
  border-top: 1px solid var(--divider);
  background: var(--canvas);
}
.modal-foot .spacer { margin-left: auto; display: flex; gap: var(--sm); }

/* Upload zone */
.upload-zone {
  position: relative;
  border: 2px dashed var(--hairline-strong);
  border-radius: var(--radius);
  background: var(--card);
  padding: var(--xxl) var(--md);
  text-align: center;
  transition: border-color .2s ease, background .2s ease;
}
.upload-zone.dragover { border-color: var(--primary); background: var(--canvas); }
.upload-zone h4 { font-size: var(--title-md); font-weight: var(--w-heavy); letter-spacing: -0.224px; color: var(--ink); margin-bottom: var(--xxs); }
.upload-zone p { color: var(--muted); font-size: var(--body-sm); margin-bottom: var(--md); }
.upload-zone input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* Part cards inside modal */
.part-card {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--canvas);
}
.part-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sm);
  padding: var(--xs) var(--md);
  border-bottom: 1px solid var(--divider);
  background: var(--soft);
  flex-wrap: wrap;
}
.part-title {
  font-size: var(--body-sm);
  font-weight: var(--w-heavy);
  letter-spacing: -0.224px;
  color: var(--ink);
}
.part-actions { display: flex; gap: var(--xs); flex-wrap: wrap; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px;
  font-size: var(--caption);
  font-weight: var(--w-heavy);
  letter-spacing: -0.12px;
  padding: 0 14px;
  border-radius: var(--pill);
  border: 1px solid var(--hairline-strong);
  background: var(--canvas);
  color: var(--ink);
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.chip-btn:hover { border-color: var(--muted-soft); }
.chip-btn:active { transform: scale(0.96); }
.chip-btn.danger { color: var(--error); border-color: rgba(215, 0, 21, .35); }
.chip-btn.danger:hover { background: rgba(215, 0, 21, .05); }
.part-form { padding: var(--lg) var(--md); display: grid; gap: var(--lg); }

.stl-status {
  display: flex; align-items: center; justify-content: center; gap: var(--sm);
  font-size: var(--body-sm);
  color: var(--muted);
  padding: var(--xs) var(--md);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: var(--canvas);
  word-break: break-all;
}
.stl-status.ok { color: var(--success); border-color: rgba(36, 138, 61, .4); }
.stl-status.err { color: var(--error); border-color: rgba(215, 0, 21, .4); }
.stl-status .spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--hairline-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Choice chips — configurator option grammar (pill) */
.choice-row { display: flex; gap: var(--xs); flex-wrap: wrap; }
.choice-btn {
  padding: 10px 18px;
  border-radius: var(--pill);
  border: 1px solid var(--hairline-strong);
  background: var(--canvas);
  color: var(--ink);
  font-size: var(--body-sm);
  font-weight: var(--w-regular);
  letter-spacing: -0.224px;
  display: inline-flex; align-items: center; gap: var(--xs);
  transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.choice-btn:hover { border-color: var(--muted-soft); }
.choice-btn:active { transform: scale(0.96); }
.choice-btn.selected { border: 2px solid var(--primary-focus); padding: 9px 17px; }
.choice-btn .swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(29, 29, 31, .25); }

/* Review pane */
.review-summary { border: 1px solid var(--hairline); border-radius: var(--radius-md); overflow: hidden; }
.review-line {
  display: flex; justify-content: space-between; gap: var(--md);
  padding: var(--sm) var(--md);
  font-size: var(--body-md);
  border-bottom: 1px solid var(--divider);
}
.review-line:last-child { border-bottom: none; }
.review-line .k { color: var(--muted); letter-spacing: -0.224px; }
.review-line .v { color: var(--ink); font-weight: var(--w-heavy); letter-spacing: -0.224px; font-variant-numeric: tabular-nums; }
.review-line.total .v { font-size: var(--title-lg); }
.review-line.discount .v { color: var(--primary); }
.review-part {
  padding: var(--sm) var(--md);
  border-bottom: 1px solid var(--divider);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 4px var(--sm);
  font-size: var(--body-sm);
}
.review-part:last-child { border-bottom: none; }
.review-part .pn { font-weight: var(--w-heavy); color: var(--ink); }
.review-part .pd { grid-column: 2 / -1; color: var(--muted); }
.review-part .pv { font-variant-numeric: tabular-nums; align-self: start; color: var(--ink); font-weight: var(--w-heavy); }

/* Success state */
.request-success {
  text-align: center;
  padding: var(--xxl) var(--xl);
  display: none;
}
.request-success.show { display: block; animation: pane-in .35s var(--ease-out); }
.request-success .ok-ring {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: var(--xl);
}
.request-success h3 { font-size: var(--display-md); font-weight: var(--w-heavy); letter-spacing: var(--ls-md); line-height: var(--lh-display-md); color: var(--ink); }
.request-success p { color: var(--muted); margin-top: var(--xs); }
.request-success .ref {
  display: inline-block;
  margin-top: var(--xl);
  padding: var(--xs) var(--lg);
  border: 3px solid var(--divider);
  border-radius: var(--radius-md);
  background: var(--card);
  font-size: var(--tagline);
  font-weight: var(--w-heavy);
  letter-spacing: .04em;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

/* Toast */
.toast-zone { position: fixed; bottom: var(--lg); left: 50%; transform: translateX(-50%); z-index: 300; display: grid; gap: var(--xs); width: min(440px, calc(100% - 32px)); }
.toast {
  background: var(--ink);
  color: var(--on-dark);
  border-radius: var(--pill);
  padding: var(--sm) var(--lg);
  font-size: var(--body-sm);
  text-align: center;
  animation: toast-in .3s var(--ease-out);
}
.toast.error { background: var(--error); color: #fff; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ---------------- Reveal on scroll ---------------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .6s var(--ease-out), transform .6s var(--ease-out);
}
.reveal.in { opacity: 1; transform: none; }
.reveal-d1 { transition-delay: .07s; }
.reveal-d2 { transition-delay: .14s; }
.reveal-d3 { transition-delay: .21s; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1023px) {
  :root { --section: 56px; }
  .showcase-grid, .caps-layout, .contact-split { grid-template-columns: 1fr; }
  .process-track { grid-template-columns: repeat(2, 1fr); row-gap: var(--xxl); }
  .process-track::before { display: none; }
  .benefits-grid { grid-template-columns: repeat(2, 1fr); }
  .benefit-card.span-3, .benefit-card.span-2 { grid-column: span 1; }
  .work-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 767px) {
  .nav-links { display: none; }
  .nav-burger { display: inline-flex; }
  .nav-pill .btn-outline { display: none; }
  .hero-stage { padding-block: var(--xl); }
  .form-row { grid-template-columns: 1fr; }
  .spec-grid { grid-template-columns: 1fr; }
  .hero-pitch { font-size: var(--lead); line-height: 1.35; }
}
@media (max-width: 560px) {
  :root { --section: 48px; }
  .well { width: calc(100% - 32px); }
  .benefits-grid { grid-template-columns: 1fr; }
  .process-track { grid-template-columns: 1fr; }
  .work-grid { grid-template-columns: 1fr; grid-auto-rows: 240px; }
  .work-item:first-child { grid-column: span 1; grid-row: span 1; }
  .footer-grid { grid-template-columns: 1fr; gap: var(--xl); }
  .hero-ctas .btn-swipe, .hero-ctas .link-swap { width: 100%; justify-content: center; }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .spacer { width: 100%; justify-content: stretch; }
  .modal-foot .spacer .btn { flex: 1; }
}

/* ---------------- Reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* Redesign responsive polish loaded last. */
@media (max-width: 1023px) {
  .hero-stage {
    grid-template-columns: 1fr;
    min-height: 100dvh;
    padding-top: 104px;
  }

  .hero-posters {
    min-height: 0;
    justify-content: flex-start;
  }

  .cycle-card.hero-cycle {
    width: min(360px, 88vw);
    transform: rotate(0);
  }

  .showcase-grid,
  .caps-layout,
  .contact-split {
    gap: 34px;
  }

  .spec-grid,
  .offers-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  body {
    background: linear-gradient(180deg, #07111f 0 760px, var(--canvas) 760px 100%);
  }

  .nav-wrap {
    top: 10px;
  }

  .nav-pill {
    width: calc(100% - 20px);
    padding-left: 9px;
  }

  .nav-brand span {
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-menu {
    inset: 78px 10px auto;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 20px;
  }

  .hero-stage {
    width: calc(100% - 32px);
    padding-top: 104px;
    padding-bottom: 48px;
  }

  .hero-title {
    font-size: clamp(42px, 15vw, 68px);
  }

  .hero-desc {
    font-size: 17px;
  }

  .hero-ctas {
    width: 100%;
  }

  .hero-ctas .btn-swipe,
  .hero-ctas .link-swap {
    width: 100%;
  }

  .hero-ctas .btn-swipe > span,
  .hero-ctas .link-swap {
    justify-content: center;
    text-align: center;
  }

  .hero-proof {
    width: 100%;
  }

  .hero-proof span {
    flex: 1 1 100%;
  }

  .spec-grid,
  .offers-row {
    grid-template-columns: 1fr;
  }

  .final-cta {
    min-height: 360px;
    border-radius: 18px;
  }
}
