/* =========================================================
   FervoGear Measurement Studio
   Monochrome design system — black & white only.
   Apple-inspired: restraint, whitespace, hairlines, motion.
   ========================================================= */

:root {
  color-scheme: light;

  /* Ink + surfaces (pure black & white + neutral grays) */
  --black: #000000;
  --ink: #1d1d1f; /* primary text */
  --ink-2: #424245; /* secondary text */
  --gray: #6e6e73; /* tertiary text */
  --gray-2: #86868b; /* muted text */
  --gray-3: #a1a1a6; /* muted on dark */
  --surface: #ffffff;
  --surface-2: #f5f5f7; /* signature light gray */
  --surface-3: #fafafa;
  --line: #d2d2d7; /* hairline */
  --line-2: #e8e8ed; /* lighter hairline */

  --radius-s: 12px;
  --radius: 20px;
  --radius-l: 28px;
  --pill: 980px;

  --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
  --shadow-l: 0 30px 80px rgba(0, 0, 0, 0.16);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* ---------- Reset ---------- */
* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  background: var(--surface);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--surface);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
}

p {
  margin: 0;
}

.container {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
}

/* ---------- Shared section primitives ---------- */
.section {
  padding: clamp(72px, 10vw, 128px) 0;
}

.section--dark {
  background: var(--black);
  color: #fff;
}

.section-head {
  max-width: 760px;
  margin: 0 auto clamp(40px, 6vw, 72px);
  text-align: center;
}

.eyebrow {
  margin: 0 0 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gray-2);
}

.section-title {
  margin: 0;
  font-size: clamp(30px, 5vw, 52px);
  font-weight: 700;
  line-height: 1.07;
  letter-spacing: -0.022em;
  color: var(--ink);
}

.section-sub {
  margin: 18px auto 0;
  max-width: 620px;
  font-size: clamp(17px, 2.2vw, 21px);
  line-height: 1.45;
  color: var(--gray);
}

.section--dark .section-title {
  color: #fff;
}

.section--dark .eyebrow,
.section--dark .section-sub {
  color: var(--gray-3);
}

/* ---------- Buttons ---------- */
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  padding: 0 26px;
  border-radius: var(--pill);
  border: 1px solid transparent;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  transition:
    transform 0.22s var(--ease),
    background-color 0.22s var(--ease),
    border-color 0.22s var(--ease),
    color 0.22s var(--ease),
    opacity 0.22s var(--ease);
}

.primary-button {
  min-width: 160px;
  background: var(--ink);
  color: #fff;
}

.primary-button:hover:not(:disabled) {
  background: var(--black);
  transform: translateY(-1px);
}

.primary-button:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

.secondary-button {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--ink);
  background: var(--surface-3);
}

.secondary-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--pill);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s var(--ease);
}

.ghost-link:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Hero / dark-section call-to-action buttons */
.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  padding: 0 30px;
  border-radius: var(--pill);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition:
    transform 0.25s var(--ease),
    background-color 0.25s var(--ease),
    border-color 0.25s var(--ease),
    color 0.25s var(--ease);
}

.cta--solid {
  background: #fff;
  color: var(--black);
}

.cta--solid:hover {
  background: #ededed;
  transform: scale(1.03);
}

.cta--ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.cta--ghost:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

/* ---------- Status pill ---------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--pill);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--line-2);
}

.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
  flex: none;
}

.status-pill.error {
  color: var(--gray);
}

.status-pill.error::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--gray-2);
}

/* =========================================================
   NAV — fixed, frosted, hairline
   ========================================================= */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid transparent;
  transition:
    background-color 0.3s var(--ease),
    border-color 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
}

.nav.is-scrolled {
  background: rgba(255, 255, 255, 0.85);
  border-bottom-color: var(--line-2);
  box-shadow: 0 1px 24px rgba(0, 0, 0, 0.06);
}

.nav-inner {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
}

.nav-logo {
  height: 30px;
  width: auto;
  display: block;
  filter: brightness(0); /* render the brand mark pure black */
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* =========================================================
   HERO
   ========================================================= */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--black);
  color: #fff;
  padding: 128px 0 84px;
  text-align: center;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 60px 60px;
  -webkit-mask-image: radial-gradient(70% 60% at 50% 32%, #000, transparent 75%);
  mask-image: radial-gradient(70% 60% at 50% 32%, #000, transparent 75%);
  pointer-events: none;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(255, 255, 255, 0.12), transparent 60%),
    radial-gradient(70% 50% at 50% 110%, rgba(255, 255, 255, 0.06), transparent 70%);
}

.hero-inner {
  position: relative;
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
}

.hero-eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.hero-title {
  margin: 20px 0 0;
  font-size: clamp(40px, 8.4vw, 92px);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.hero-sub {
  margin: 26px auto 0;
  max-width: 640px;
  font-size: clamp(18px, 2.4vw, 23px);
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.66);
}

.hero-cta {
  margin: 36px 0 0;
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.window {
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  box-shadow:
    0 50px 130px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}

.window-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-2);
}

.window-bar span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--line);
}

.window img {
  display: block;
  width: 100%;
  height: auto;
}

/* =========================================================
   HOW IT WORKS
   ========================================================= */
.how-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.how-card {
  position: relative;
  padding: 36px 32px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-s);
  transition:
    transform 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
}

.how-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.how-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  margin-bottom: 22px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
}

.how-icon svg {
  width: 24px;
  height: 24px;
}

.how-num {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--gray-2);
}

.how-card h3 {
  margin: 14px 0 10px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.how-card p {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--gray);
}

/* =========================================================
   SHOWCASE (sample output, dark)
   ========================================================= */
.sample-tag {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 14px;
  margin-bottom: 18px;
  border-radius: var(--pill);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gray-3);
}

.showcase-figure {
  margin: 0 auto clamp(44px, 6vw, 68px);
  max-width: 900px;
}

.showcase-grid {
  max-width: 780px;
  margin: 0 auto;
}

.measure-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 56px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.measure {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.measure span {
  font-size: 16px;
  color: var(--gray-3);
}

.measure strong {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.showcase-cta {
  margin-top: 44px;
  text-align: center;
}

/* =========================================================
   WIZARD
   ========================================================= */
.wizard-section {
  background: var(--surface-2);
}

.spec-row {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: 34px auto 0;
  padding: 0;
  max-width: 760px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  overflow: hidden;
}

.spec-row li {
  flex: 1 1 0;
  min-width: 148px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: center;
}

.spec-row li + li {
  border-left: 1px solid var(--line-2);
}

.spec-row span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-2);
}

.spec-row strong {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.wizard-card {
  max-width: 920px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 48px);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
}

/* ----- Stepper ----- */
.stepper {
  list-style: none;
  display: flex;
  margin: 0 0 clamp(28px, 4vw, 40px);
  padding: 0;
}

.step {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 18px;
  left: calc(50% + 24px);
  right: calc(-50% + 24px);
  height: 2px;
  background: var(--line);
  z-index: 0;
}

.step.done:not(:last-child)::after {
  background: var(--ink);
}

.step-dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--gray-2);
  font-size: 15px;
  font-weight: 600;
  transition:
    background-color 0.25s var(--ease),
    border-color 0.25s var(--ease),
    color 0.25s var(--ease),
    box-shadow 0.25s var(--ease);
}

.step-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-2);
  transition: color 0.25s var(--ease);
}

.step.done .step-dot {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.step.active .step-dot {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  box-shadow: 0 0 0 6px rgba(0, 0, 0, 0.07);
}

.step.active .step-label,
.step.done .step-label {
  color: var(--ink);
}

/* ----- Wizard panels ----- */
.wizard-shell {
  min-height: 440px;
}

.wizard-step {
  display: none;
  animation: wizard-in 0.45s var(--ease);
}

.wizard-step.active {
  display: block;
}

@keyframes wizard-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.step-head {
  margin-bottom: 28px;
}

.step-head h3 {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.step-head p {
  margin: 10px 0 0;
  max-width: 560px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--gray);
}

.step-head--success {
  text-align: center;
}

.step-head--success p {
  margin-left: auto;
  margin-right: auto;
}

.success-badge {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  animation: pop 0.5s var(--ease);
}

.success-badge svg {
  width: 30px;
  height: 30px;
}

@keyframes pop {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  60% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ----- Drop zones (two panels: pose guide + actions) ----- */
.drop-zone {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 440px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  overflow: hidden;
  transition:
    border-color 0.2s var(--ease),
    background-color 0.2s var(--ease);
}

.drop-zone.drag-over {
  border-style: solid;
  border-color: var(--ink);
  background: #ececef;
}

.drop-zone input[type="file"] {
  display: none;
}

/* Empty state — left panel: the pose reference */
.drop-guide {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 22px;
  background: #fff;
  border-right: 1px solid var(--line-2);
}

.drop-guide img {
  max-width: 100%;
  max-height: 384px;
  object-fit: contain;
}

.drop-guide-label {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 5px 12px;
  border-radius: var(--pill);
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--line-2);
  color: var(--gray);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Empty state — right panel: the two actions */
.drop-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 32px 28px;
  text-align: center;
}

.drop-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-2);
}

.drop-title {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.drop-sub {
  font-size: 14px;
  color: var(--gray);
}

.drop-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 240px;
  margin-top: 20px;
}

.drop-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 48px;
  border-radius: var(--pill);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.18s var(--ease),
    background-color 0.18s var(--ease),
    border-color 0.18s var(--ease);
}

.drop-action svg {
  width: 18px;
  height: 18px;
}

.drop-action--primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.drop-action--primary:hover {
  background: var(--black);
  transform: translateY(-1px);
}

.drop-action:not(.drop-action--primary):hover {
  border-color: var(--ink);
  background: var(--surface-3);
}

.drop-hint {
  margin-top: 16px;
  font-size: 13px;
  color: var(--gray-2);
}

/* Filled state — the photo fills the card */
.preview-image {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--black);
}

.preview-caption {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 3;
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 30px 18px 16px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.82), transparent);
}

.preview-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.preview-caption .drop-meta {
  font-size: 14px;
  color: #fff;
}

.remove-button {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--pill);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background-color 0.2s var(--ease);
}

.remove-button:hover {
  background: rgba(0, 0, 0, 0.8);
}

/* When a photo is present: show it, hide the empty-state panels. */
.drop-zone:has(.preview-image:not([hidden])) {
  border-style: solid;
  border-color: var(--line-2);
}

.drop-zone:has(.preview-image:not([hidden])) .drop-guide,
.drop-zone:has(.preview-image:not([hidden])) .drop-actions {
  display: none;
}

.drop-zone:has(.preview-image:not([hidden])) .preview-caption {
  display: flex;
}

/* Stack the two panels on narrow screens */
@media (max-width: 640px) {
  .drop-zone {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .drop-guide {
    border-right: none;
    border-bottom: 1px solid var(--line-2);
    padding: 18px;
  }

  .drop-guide img {
    max-height: 240px;
  }

  .drop-actions {
    padding: 26px 20px;
  }
}

/* Camera capture modal */
.camera-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.camera-dialog {
  width: min(540px, 100%);
  background: #0a0a0a;
  border-radius: var(--radius-l);
  overflow: hidden;
  box-shadow: var(--shadow-l);
}

.camera-stage {
  position: relative;
  aspect-ratio: 3 / 4;
  max-height: 68vh;
  background: #000;
}

.camera-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.camera-hint {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  margin: 0;
  padding: 6px 14px;
  border-radius: var(--pill);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
}

.camera-message {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  color: #fff;
  font-size: 15px;
  line-height: 1.5;
}

.camera-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: #0a0a0a;
}

.camera-secondary {
  height: 44px;
  padding: 0 18px;
  border-radius: var(--pill);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background-color 0.2s var(--ease),
    border-color 0.2s var(--ease);
}

.camera-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #fff;
}

.camera-shutter {
  flex: none;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: transform 0.15s var(--ease);
}

.camera-shutter:hover {
  transform: scale(1.05);
}

.camera-shutter:active {
  transform: scale(0.95);
}

/* ----- Helper row ----- */
.helper-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
  font-size: 14px;
  color: var(--gray);
}

.helper-row .secondary-button {
  height: 40px;
}

/* ----- Wizard actions ----- */
.wizard-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.wizard-actions--center {
  justify-content: center;
}

/* ----- Review grid (step 3) ----- */
.review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}

.review-card {
  margin: 0;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
}

.review-card > span {
  display: block;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-2);
}

.review-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: var(--black);
  border-radius: var(--radius-s);
  display: block;
}

.review-card strong {
  display: block;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray);
}

/* ----- Controls (height / unit / analyze) ----- */
.controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  padding: 24px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field > span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-2);
}

.field input,
.field select {
  height: 50px;
  padding: 0 14px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  transition:
    border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.08);
}

.field input {
  width: 150px;
}

.unit-field select {
  width: 110px;
}

.controls-row .primary-button {
  margin-left: auto;
}

/* ----- Analysis progress ----- */
.analysis-progress {
  margin-top: 20px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.analysis-progress-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.analysis-progress strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.analysis-progress p {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--gray);
}

.progress-percent {
  flex: none;
  min-width: 56px;
  text-align: right;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.progress-track {
  position: relative;
  height: 8px;
  border-radius: var(--pill);
  background: var(--surface-2);
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: var(--pill);
  background: var(--ink);
  transition: width 0.35s var(--ease);
}

/* Indeterminate: server compute has no real progress signal,
   so sweep an honest "working" bar instead of a fabricated number. */
.analysis-progress.indeterminate .progress-fill {
  width: 40%;
  transition: none;
  animation: indeterminate 1.25s var(--ease) infinite;
}

.analysis-progress.failed .progress-fill {
  background: var(--gray-2);
  animation: none;
}

@keyframes indeterminate {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(320%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .analysis-progress.indeterminate .progress-fill {
    animation: none;
    width: 100%;
    opacity: 0.5;
  }
}

/* ----- Status line ----- */
.status-line {
  margin: 22px 0 0;
  min-height: 22px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
}

.status-line.error {
  color: var(--black);
  font-weight: 600;
}

/* =========================================================
   RESULT
   ========================================================= */
.result-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.result-toolbar .section-title {
  font-size: clamp(26px, 4vw, 40px);
}

.result-toolbar .section-sub {
  margin-top: 10px;
}

.result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 28px 0 0;
  padding: 5px;
  background: var(--surface-2);
  border-radius: var(--pill);
}

.tab-button {
  height: 40px;
  padding: 0 20px;
  border: none;
  border-radius: var(--pill);
  background: transparent;
  color: var(--gray);
  font-size: 15px;
  font-weight: 500;
  transition:
    background-color 0.2s var(--ease),
    color 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}

.tab-button:hover {
  color: var(--ink);
}

.tab-button.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-s);
}

.tab-panel {
  display: none;
  margin-top: 24px;
}

.tab-panel.active {
  display: block;
}

#resultFrame {
  display: block;
  width: 100%;
  min-height: 760px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: #fff;
}

.obj-viewer {
  min-height: 620px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--surface-2);
  overflow: hidden;
}

.measurement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.measurement-item {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-s);
}

.measurement-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.measurement-item span {
  font-size: 15px;
  color: var(--gray);
}

#rawJson {
  margin: 0;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--surface-2);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  max-height: 560px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* =========================================================
   FOOTER
   ========================================================= */
.footer {
  background: var(--black);
  color: #fff;
  padding: 64px 0;
  text-align: center;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.footer-logo {
  height: 40px;
  width: auto;
  filter: brightness(0) invert(1); /* pure white mark */
}

.footer-tag {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.footer-note {
  margin: 0;
  max-width: 520px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--gray-2);
}

.footer-top {
  margin-top: 6px;
  font-size: 14px;
  color: var(--gray-3);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

.footer-top:hover {
  color: #fff;
}

/* =========================================================
   MOTION — scroll reveal + hero entrance
   ========================================================= */
.reveal-ready [data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 0.7s var(--ease),
    transform 0.7s var(--ease);
  transition-delay: var(--reveal-delay, 0s);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: no-preference) {
  .hero-rise {
    opacity: 0;
    animation: rise 0.9s var(--ease) forwards;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 920px) {
  .how-grid {
    grid-template-columns: 1fr;
    max-width: 520px;
    margin: 0 auto;
  }

  .measure-list {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .result-toolbar {
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .nav-reset {
    display: none;
  }

  .hero {
    padding: 124px 0 72px;
  }

  .review-grid {
    grid-template-columns: 1fr;
  }

  .controls-row {
    align-items: stretch;
  }

  .field input,
  .unit-field select {
    width: 100%;
  }

  .controls-row .field {
    flex: 1 1 140px;
  }

  .controls-row .primary-button {
    margin-left: 0;
    width: 100%;
  }

  .spec-row li {
    flex-basis: 50%;
    min-width: 0;
  }

  .spec-row li:nth-child(2n) {
    border-left: 1px solid var(--line-2);
  }

  .spec-row li:nth-child(n + 3) {
    border-top: 1px solid var(--line-2);
  }

  .wizard-actions {
    justify-content: stretch;
  }

  .wizard-actions > * {
    flex: 1 1 auto;
    width: 100%;
  }
}

@media (max-width: 460px) {
  .container {
    width: calc(100% - 32px);
  }

  .nav-inner {
    width: calc(100% - 32px);
  }

  .hero-inner {
    width: calc(100% - 32px);
  }

  .step-label {
    display: none;
  }

  .ghost-link {
    display: none;
  }

  .status-pill {
    font-size: 13px;
  }

  .drop-zone {
    min-height: 340px;
  }
}
