/* Guide 2D — demo prototype
   Design bar: legible at glasses scale. Large type, high contrast, no chrome. */

:root {
  --bg:        #0b0d0f;
  --bg-raise:  #141719;
  --ink:       #f2f4f6;
  --ink-dim:   #8a9299;
  --ink-faint: #4d545a;
  --accent:    #35c08a;
  --rule:      #23282c;
  --pad: clamp(14px, 3.2vmin, 28px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.screen {
  position: fixed; inset: 0;
  display: none;
  outline: none;
}
.screen.is-active { display: block; }

/* ---------------- boot / error ---------------- */

.boot-inner, .error-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 20px; padding: var(--pad);
  text-align: center;
}
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--rule);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot-text { color: var(--ink-dim); font-size: 1.05rem; letter-spacing: 0.02em; margin: 0; }

.error-title { font-size: 1.4rem; font-weight: 600; margin: 0; }
.error-body  { color: #e0806f; margin: 0; font-size: 0.95rem; max-width: 34rem; }
.error-hint  { color: var(--ink-dim); font-size: 0.92rem; line-height: 1.9; margin: 0; max-width: 34rem; }
code {
  background: var(--bg-raise); border: 1px solid var(--rule);
  border-radius: 5px; padding: 3px 8px;
  font-family: "Cascadia Mono", Consolas, monospace; font-size: 0.88em; color: var(--ink);
}

/* ---------------- landing ---------------- */

#landing { cursor: pointer; }
.landing-inner {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 34%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end;
  gap: clamp(12px, 2.4vmin, 22px);
  padding: var(--pad) calc(var(--pad) * 1.4);
  text-align: center;
}
.doc-tag {
  display: inline-flex; align-items: center; gap: 10px;
  border: 1px solid var(--rule); border-radius: 999px;
  padding: 7px 16px;
  font-size: clamp(0.7rem, 1.9vmin, 0.86rem);
  letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--ink-dim); white-space: nowrap;
}
.doc-tag b { color: var(--ink); font-weight: 600; }
.sop-title {
  margin: 0;
  font-size: clamp(1.6rem, 6.4vmin, 3.4rem);
  line-height: 1.14;
  font-weight: 650;
  letter-spacing: -0.015em;
  max-width: 20ch;
}
.step-count {
  color: var(--ink-dim);
  font-size: clamp(0.9rem, 2.4vmin, 1.15rem);
  letter-spacing: 0.03em;
}

.landing-cta {
  position: absolute; left: 0; right: 0; top: 66%;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.cta-pill {
  background: var(--accent); color: #06231a;
  font-weight: 700; letter-spacing: 0.05em;
  font-size: clamp(1.1rem, 3.4vmin, 1.6rem);
  padding: clamp(14px, 2.6vmin, 22px) clamp(48px, 12vmin, 96px);
  border-radius: 999px;
  animation: breathe 3.2s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.035); }
}
.cta-sub { color: var(--ink-faint); font-size: clamp(0.78rem, 2vmin, 0.95rem); letter-spacing: 0.04em; }

.landing-foot {
  position: absolute; left: 0; right: 0; bottom: var(--pad);
  text-align: center;
  color: var(--ink-faint);
  font-size: clamp(0.7rem, 1.8vmin, 0.84rem);
  letter-spacing: 0.05em;
  padding: 0 var(--pad);
}

/* ---------------- spotlight ---------------- */

#spotlight { background: var(--bg); cursor: pointer; overflow: hidden; }

/* Filmstrip. Each band is one step's crop, already rendered at the right size;
   only transform and opacity ever animate, so the scroll stays on the compositor. */
#strip { position: absolute; inset: 0; }

.band {
  position: absolute; top: 0;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
  background: #fff;
  /* the page is paper — give it an edge rather than letting it bleed into black */
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.band canvas { display: block; }

#flash {
  position: absolute; inset: 0;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
}
#flash.is-firing { animation: flash 260ms ease-out; }
@keyframes flash {
  0%   { opacity: 0.22; }
  100% { opacity: 0; }
}

/* Bottom-left corner, mirroring the progress readout — off the paper entirely,
   so the crop keeps the full width of the screen. */
#back-zone {
  position: absolute; left: 0; bottom: 0;
  width: clamp(72px, 22%, 140px);
  height: clamp(44px, 12vmin, 72px);
  display: flex; align-items: center;
  padding-left: max(10px, calc(var(--pad) - 8px));
  color: var(--ink-faint);
  cursor: pointer;
  outline: none;
  transition: opacity 200ms ease;
}
#back-zone svg { width: clamp(20px, 3.6vmin, 30px); height: auto; }
#back-zone.is-hidden { opacity: 0; pointer-events: none; }
#back-zone:active { color: var(--ink); }

#progress {
  position: absolute; right: var(--pad); bottom: var(--pad);
  display: flex; align-items: baseline; gap: 12px;
  font-size: clamp(0.85rem, 2.3vmin, 1.15rem);
  letter-spacing: 0.06em;
  pointer-events: none;
}
#prog-label { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
#prog-count { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }

#hint {
  position: absolute; left: 0; right: 0; bottom: var(--pad);
  text-align: center;
  color: var(--ink-faint);
  font-size: clamp(0.78rem, 2vmin, 0.95rem);
  letter-spacing: 0.08em;
  pointer-events: none;
  transition: opacity 400ms ease;
}
#hint.is-hidden { opacity: 0; }

#review-flag {
  position: absolute; left: 50%; top: var(--pad);
  transform: translateX(-50%);
  border: 1px solid var(--rule); border-radius: 999px;
  padding: 5px 14px;
  background: var(--bg-raise);
  color: var(--ink-dim);
  font-size: clamp(0.7rem, 1.8vmin, 0.84rem);
  letter-spacing: 0.07em;
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}
#review-flag.is-visible { opacity: 1; }

/* ---------------- complete ---------------- */

#complete { cursor: pointer; }
.complete-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: clamp(8px, 1.8vmin, 16px);
  padding: var(--pad) calc(var(--pad) * 1.2);
  text-align: center;
}
.check {
  width: clamp(44px, 9vmin, 72px); height: clamp(44px, 9vmin, 72px);
  border-radius: 50%;
  border: 2px solid var(--accent);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: clamp(4px, 1.4vmin, 12px);
}
.check svg { width: 78%; height: 78%; }
.complete-kicker {
  color: var(--accent);
  font-size: clamp(0.74rem, 2vmin, 0.9rem);
  letter-spacing: 0.18em; text-transform: uppercase; font-weight: 600;
}
.complete-title {
  margin: 0 0 clamp(10px, 2.4vmin, 22px);
  font-size: clamp(1.2rem, 4.2vmin, 2.1rem);
  font-weight: 620; line-height: 1.2; letter-spacing: -0.01em;
  max-width: 22ch;
}

.record {
  margin: 0;
  width: min(100%, 30rem);
  border-top: 1px solid var(--rule);
}
.record > div {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px;
  padding: clamp(8px, 1.7vmin, 14px) 2px;
  border-bottom: 1px solid var(--rule);
}
.record dt {
  color: var(--ink-dim);
  font-size: clamp(0.78rem, 2vmin, 0.95rem);
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.record dd {
  margin: 0;
  font-size: clamp(0.85rem, 2.2vmin, 1.05rem);
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.complete-foot {
  position: absolute; left: 0; right: 0; bottom: var(--pad);
  text-align: center;
  color: var(--ink-faint);
  font-size: clamp(0.78rem, 2vmin, 0.95rem);
  letter-spacing: 0.08em;
}

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