:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --ink: #0f1f1a;
  --muted: #5a6b65;
  --line: #dfe7e4;
  --accent: #0f8a5f;
  --accent-ink: #ffffff;
  --accent-soft: #e3f4ec;
  --warn-bg: #fff6e5;
  --warn-ink: #7a4a00;
  --radius: 20px;
  --gutter: 20px;
  --shadow: 0 10px 30px rgba(15, 31, 26, 0.08);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, p { margin: 0; }

/* ---------- topo ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px var(--gutter);
  padding-top: max(14px, env(safe-area-inset-top));
}
.brand { font-weight: 700; letter-spacing: 0.02em; font-size: 1.05rem; }
.topbar__tag { font-size: 0.8rem; color: var(--muted); }

/* ---------- hero ---------- */
.hero {
  display: grid;
  gap: 16px;
  padding: 4px var(--gutter) 24px;
  max-width: 1080px;
  margin: 0 auto;
}
.eyebrow { color: var(--accent); font-weight: 600; font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; }
h1 { font-size: clamp(2rem, 8vw, 3.4rem); line-height: 1.05; letter-spacing: -0.02em; margin: 6px 0 10px; }
.lead { color: var(--muted); font-size: 1.02rem; max-width: 34em; }

.stage {
  position: relative;
  background: radial-gradient(120% 90% at 50% 0%, #ffffff 0%, #eaf2ef 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  height: clamp(340px, 58svh, 560px);
}

model-viewer {
  display: block;
  width: 100%;
  height: calc(100% - 58px); /* espaço para o seletor de produto */
  margin-top: 58px;
  --poster-color: transparent;
  background: transparent;
  outline: none;
}

.mv-native-ar { display: none !important; }

/* seletor de produto, sobre o visualizador */
.picker {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  gap: 4px;
  padding: 4px;
  max-width: calc(100% - 24px);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(15, 31, 26, 0.08);
}
.picker__tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s, color 0.2s;
}
.picker__tab[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.picker__tab:focus-visible { outline: 3px solid #7bd8b6; outline-offset: 2px; }

.stage__hint {
  position: absolute;
  left: 0; right: 0; bottom: 10px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  pointer-events: none;
  transition: opacity 0.4s;
}
.stage__hint.is-hidden { opacity: 0; }

[hidden] { display: none !important; }

.stage__error {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background: rgba(244, 247, 246, 0.94);
}

/* progresso */
.progress {
  position: absolute;
  left: 20%; right: 20%; top: 50%;
  height: 4px;
  border-radius: 4px;
  background: rgba(15, 31, 26, 0.12);
  overflow: hidden;
}
.progress__bar { height: 100%; width: 0; background: var(--accent); transition: width 0.15s linear; }

/* ---------- CTA ---------- */
.cta {
  display: grid;
  gap: 10px;
  justify-items: stretch;
}

.btn {
  appearance: none;
  border: 0;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 60px;
  padding: 16px 22px;
  border-radius: 16px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, box-shadow 0.2s, background 0.2s, opacity 0.2s;
}
.btn:active { transform: scale(0.985); }
.btn:focus-visible { outline: 3px solid #7bd8b6; outline-offset: 3px; }

.btn--ar {
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 1rem;
  box-shadow: 0 10px 24px rgba(15, 138, 95, 0.35);
}
.btn--ar:disabled {
  background: #cfdcd7;
  color: #6b7c76;
  box-shadow: none;
  cursor: default;
}
.btn--ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); min-height: 48px; font-weight: 600; letter-spacing: 0; }

.cta__note {
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}
.cta__note:empty { display: none; }
.cta__note.is-warn, .cta__note.is-error {
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-radius: 12px;
  padding: 10px 14px;
  text-align: left;
}
.cta__size { font-size: 0.82rem; color: var(--muted); text-align: center; }

/* ---------- passos ---------- */
.steps, .compat {
  max-width: 1080px;
  margin: 0 auto;
  padding: 8px var(--gutter) 28px;
}
h2 { font-size: 1.3rem; letter-spacing: -0.01em; margin-bottom: 14px; }

.steps ol {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
.steps li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}
.steps .n {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.steps li div { display: grid; gap: 2px; }
.steps li span:not(.n) { color: var(--muted); font-size: 0.92rem; }

.compat ul { margin: 0 0 10px; padding-left: 1.1em; color: var(--muted); display: grid; gap: 6px; }
.compat strong { color: var(--ink); }
.small { font-size: 0.85rem; color: var(--muted); }

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 20px var(--gutter) max(28px, env(safe-area-inset-bottom));
}

/* ---------- HUD dentro do AR (WebXR) ---------- */
.ar-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: #fff;
}
.ar-hud[hidden] { display: none; }
.ar-hud__step {
  position: absolute;
  left: 16px; right: 16px;
  bottom: max(28px, env(safe-area-inset-bottom));
  margin: 0 auto;
  max-width: 440px;
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(10, 20, 16, 0.78);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
}
.ar-hud__exit {
  pointer-events: auto;
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  z-index: 2;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 24px;
  background: rgba(10, 20, 16, 0.78);
  color: #fff;
  font: inherit;
  font-weight: 600;
}

/* ---------- telas maiores ---------- */
@media (min-width: 860px) {
  :root { --gutter: 32px; }
  .hero {
    grid-template-columns: 1fr 1.1fr;
    grid-template-areas: "copy stage" "cta stage";
    align-content: center;
    column-gap: 48px;
    row-gap: 20px;
    padding-top: 24px;
  }
  .hero__copy { grid-area: copy; align-self: end; }
  .stage { grid-area: stage; height: clamp(460px, 72vh, 680px); }
  .cta { grid-area: cta; align-self: start; max-width: 460px; }
  .cta__note { text-align: left; }
  .cta__size { text-align: left; }
  .steps ol { grid-template-columns: repeat(4, 1fr); }
  .steps li { flex-direction: column; }
}

/* ---------- celular: botão grande fixo na parte de baixo ---------- */
@media (max-width: 859px) {
  /* Os filhos de .cta viram itens do grid do hero para o botão poder "grudar" no rodapé */
  .cta { display: contents; }
  .btn--ar {
    position: sticky;
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 5;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
  }
  .lead { display: none; }
  h1 { font-size: clamp(1.8rem, 8vw, 2.4rem); margin-bottom: 0; }
  .stage { height: clamp(320px, calc(100svh - 300px), 560px); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
