:root {
  --ink: #0a0908;
  --copper: #c9793f;
  --copper-soft: #d9a077;
  --paper: #efe9e2;
  --line: rgba(201, 121, 63, 0.45);
  --track: 0.28em;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper);
  font-family: "Jost", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 300;
  overscroll-behavior: none;
}

#mindar {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0;
  transition: opacity 700ms ease;
}
#mindar.is-live { opacity: 1; }
/* MindAR injects its own video and canvas here and sizes them itself; these
   rules only guarantee they fill the viewport on phones with a notch. */
#mindar video,
#mindar canvas {
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

#camera-feed,
#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#camera-feed {
  object-fit: cover;
  opacity: 0;
  transition: opacity 700ms ease;
  z-index: 0;
}
#camera-feed.is-live { opacity: 1; }

#gl { z-index: 1; pointer-events: none; opacity: 0; transition: opacity 700ms ease; }
#gl.is-live { opacity: 1; }

#ui {
  position: fixed;
  inset: 0;
  z-index: 2;
}

/* ---------- screens ---------- */

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: calc(40px + var(--safe-top)) 32px calc(40px + var(--safe-bottom));
  text-align: center;
  background: radial-gradient(120% 80% at 50% 40%, #16120f 0%, #070605 70%);
  animation: fade 600ms ease both;
}

.screen.is-active { display: flex; }

.screen.is-passthrough {
  background: none;
  pointer-events: none;
  justify-content: flex-end;
}
.screen.is-passthrough > * { pointer-events: auto; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- type ---------- */

.rule {
  width: 56px;
  height: 1px;
  background: var(--line);
  flex: none;
}

.eyebrow {
  margin: 0;
  font-size: 11px;
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--copper);
}

.display {
  margin: 4px 0;
  font-family: "Playfair Display", Didot, "Bodoni MT", Georgia, serif;
  font-weight: 400;
  font-size: clamp(56px, 19vw, 104px);
  line-height: 0.95;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(170deg, #f2c79c 0%, #c9793f 45%, #8a4f28 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.display.sm { font-size: clamp(40px, 13vw, 64px); }

.lede {
  margin: 0;
  max-width: 24ch;
  font-size: 14px;
  line-height: 1.8;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(239, 233, 226, 0.86);
}

.meta {
  margin: 0;
  font-size: 12px;
  line-height: 1.9;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(239, 233, 226, 0.6);
}

.name {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 26px;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--paper);
}

.hint {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(239, 233, 226, 0.35);
}

/* ---------- facts ---------- */

.facts {
  margin: 4px 0;
  display: grid;
  gap: 14px;
  text-align: left;
}
.facts > div {
  display: grid;
  grid-template-columns: 96px 1px auto;
  gap: 16px;
  align-items: start;
}
.facts > div::before {
  content: "";
  grid-column: 2;
  align-self: stretch;
  background: var(--line);
}
.facts dt {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--copper);
  padding-top: 2px;
}
.facts dd {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---------- controls ---------- */

.btn {
  appearance: none;
  display: inline-block;
  border: 1px solid var(--line);
  background: rgba(201, 121, 63, 0.08);
  color: var(--paper);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 16px 30px;
  border-radius: 2px;
  cursor: pointer;
  transition: background 240ms ease, border-color 240ms ease, transform 240ms ease;
}
.btn:active { transform: scale(0.97); background: rgba(201, 121, 63, 0.2); }
.btn-ghost { background: rgba(10, 9, 8, 0.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }

.actions { display: grid; gap: 10px; width: min(320px, 100%); }
.actions .btn { text-align: center; }

.link {
  appearance: none;
  background: none;
  border: 0;
  color: rgba(239, 233, 226, 0.45);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 6px;
  padding: 8px;
  cursor: pointer;
}

.chip {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(28px + var(--safe-bottom));
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(10, 9, 8, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--paper);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  padding: 13px 26px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 600ms ease;
}
.chip.is-shown { opacity: 1; }

/* ---------- placement coach ---------- */

.coach {
  display: flex;
  position: relative;
  z-index: 1;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-bottom: calc(44px + var(--safe-bottom));
}

.coach-frame {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(62vw, 300px);
  aspect-ratio: 105 / 148;
  transform: translate(-50%, -58%);
  pointer-events: none;
  animation: pulse 2.6s ease-in-out infinite;
}
.coach-frame::before,
.coach-frame::after {
  content: "";
  position: absolute;
  width: 34px;
  height: 34px;
  border: 2px solid var(--copper);
}
.coach-frame::before { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.coach-frame::after { bottom: 0; right: 0; border-left: 0; border-top: 0; }
@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.coach-text {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(239, 233, 226, 0.8);
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.9);
}

.spinner {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(201, 121, 63, 0.2);
  border-top-color: var(--copper);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

[hidden] { display: none !important; }
