/* ─── Docex Landing — Viewport Windows ─── */

:root {
  --bg: #0c0c0b;
  --bg-raise: #141412;
  --bg-hover: #1a1a17;
  --ink: #e8e8e3;
  --ink-dim: #b0b0a8;
  --muted: #6b6b66;
  --rule: #242421;
  --rule-strong: #353530;
  --accent: #00c853;
  --accent-dim: #007a33;
  --accent-glow: rgba(0, 200, 83, 0.12);
  --warn: #f5a623;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --bar-h: 52px;
  --radius-sharp: 2px;
  --radius-soft: 4px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
  overflow-x: hidden;
}

::selection {
  background: var(--accent-glow);
  color: var(--accent);
}

/* ─── Boot Flash ─── */
#boot-flash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, var(--accent) 50%, transparent 100%);
  background-size: 100% 3px;
  background-repeat: no-repeat;
  animation: bootScan 420ms ease-out forwards;
  opacity: 0.9;
}

@keyframes bootScan {
  0% { background-position: 0 -3px; }
  100% { background-position: 0 100vh; opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  #boot-flash { animation: none; opacity: 0; }
}

/* ─── Status Bar ─── */
.status-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(16px, 3vw, 48px);
  height: var(--bar-h);
  background: rgba(12, 12, 11, 0.92);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: blur(8px);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.status-bar a {
  color: var(--ink-dim);
  text-decoration: none;
  transition: color 0.15s;
}

.status-bar a:hover,
.status-bar a:focus { color: var(--accent); outline: none; }

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.logo-pulse {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(0, 200, 83, 0.4);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 200, 83, 0.35); }
  50% { box-shadow: 0 0 0 5px rgba(0, 200, 83, 0); }
}

.status-nav {
  display: none;
  align-items: center;
  gap: 28px;
}

.status-nav a {
  position: relative;
  padding: 4px 0;
}

.status-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.2s ease;
}

.status-nav a:hover::after,
.status-nav a:focus::after { width: 100%; }

.status-right a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
}

/* ─── Scenes ─── */
.scene {
  position: sticky;
  top: var(--bar-h);
  height: calc(100dvh - var(--bar-h));
  min-height: 520px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  /* No background here — transparent so next scene shows through */
  /* No overflow:hidden — let the frame scale freely */
}

/* Explicit z-index: later scenes cover earlier ones */
#scene-1 { z-index: 1; }
#scene-2 { z-index: 2; }
#scene-3 { z-index: 3; }
#scene-4 { z-index: 4; }
#scene-5 { z-index: 5; }

.scene-inner {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* Transparent — the frame inside carries the background */
  transform-origin: center center;
  will-change: transform;
  position: relative;
}

.scene-frame {
  width: 100%;
  height: 100%;
  max-width: 1440px;
  background: var(--bg);
  padding: clamp(20px, 4vw, 48px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow-y: auto;
}

/* Frame border visible when scaled */
.scene-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--rule);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.scene.is-scaled .scene-frame::after { opacity: 1; }

/* ─── Module Label ─── */
.module-label {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.module-label::before {
  content: "//";
  color: var(--accent-dim);
}

/* ─── Typography ─── */
h1 {
  font-size: clamp(34px, 5.5vw, 64px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
}

h2 {
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
}

.text-muted { color: var(--muted); }

.lead {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-dim);
  max-width: 44ch;
  margin: 0 0 32px;
}

/* ─── Buttons ─── */
.key-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: var(--radius-sharp);
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.2s ease-out;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}

.key-button {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.key-button:hover,
.key-button:focus {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  outline: none;
}

.key-button .kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid currentColor;
  border-radius: var(--radius-sharp);
  font-size: 10px;
  opacity: 0.7;
}

.ghost-button {
  background: transparent;
  color: var(--ink-dim);
  border-color: var(--rule);
}

.ghost-button:hover,
.ghost-button:focus {
  background: var(--bg-hover);
  border-color: var(--rule-strong);
  color: var(--ink);
  outline: none;
}

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

/* ─── Scene 1: Overview Grid ─── */
.scene-grid {
  display: grid;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}

.scene-grid > * {
  background: var(--bg);
  padding: clamp(20px, 3vw, 36px);
  min-width: 0;
}

/* ─── Steps ─── */
.steps-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}

.step-panel {
  background: var(--bg);
  padding: 18px;
  min-width: 0;
  transition: background 0.2s;
  cursor: pointer;
}

.step-panel:hover { background: var(--bg-hover); }

.step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}

.step-num {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.step-status {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rule-strong);
  transition: background 0.3s;
}

.step-status.done {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}

.step-terminal {
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-dim);
  min-height: 76px;
}

.step-terminal .line {
  display: block;
  min-height: 1.7em;
  white-space: pre-wrap;
  word-break: break-word;
}

.step-terminal .prompt { color: var(--muted); }
.step-terminal .cmd { color: var(--ink); }
.step-terminal .flag { color: var(--accent); }
.step-terminal .str { color: var(--warn); }
.step-terminal .ok { color: var(--accent); }
.step-terminal .out { color: var(--muted); }

.step-terminal .cursor {
  display: inline-block;
  width: 7px;
  height: 13px;
  background: var(--accent);
  vertical-align: -2px;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink { 50% { background: transparent; } }

/* ─── Scene 2: Extraction ─── */
.extraction-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
}

.extraction-grid > * {
  background: var(--bg);
  padding: 28px;
  min-width: 0;
}

.photo-mock {
  aspect-ratio: 4 / 5;
  background: linear-gradient(135deg, #2a2a2a 0%, #4a4438 50%, #1f1f1f 100%);
  position: relative;
  overflow: hidden;
  transform: rotate(-1.4deg);
  box-shadow: 0 1px 0 rgba(0,0,0,0.05), 0 8px 30px rgba(0,0,0,0.12);
}

.photo-mock::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 35% 30%, rgba(255,220,180,0.18), transparent 55%);
}

.photo-mock .doc-paper {
  position: absolute;
  left: 8%;
  right: 12%;
  top: 12%;
  bottom: 18%;
  background: #f4ece0;
  transform: perspective(600px) rotateY(-7deg) rotateX(2deg);
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.55;
  color: #2a261f;
  box-shadow: -8px 12px 30px rgba(0,0,0,0.4);
}

.doc-paper .dt {
  font-weight: 600;
  letter-spacing: 0.05em;
  font-size: 8.5px;
  border-bottom: 1px solid #b9af96;
  padding-bottom: 4px;
  margin-bottom: 6px;
}

.doc-paper .dr {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 4px;
  padding: 1.5px 0;
  border-bottom: 1px dotted #d6cdb6;
}

.doc-paper .dr span:first-child {
  color: #8a8270;
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 1px;
}

.doc-paper .hl {
  background: rgba(255, 79, 23, 0.20);
  padding: 0 1px;
}

.photo-mock .glare {
  position: absolute;
  top: -10%;
  left: -20%;
  width: 60%;
  height: 60%;
  background: radial-gradient(ellipse, rgba(255,255,255,0.16) 0%, transparent 60%);
  pointer-events: none;
}

.photo-mock .meta {
  position: absolute;
  bottom: 12px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 9.5px;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.04em;
}

.code-block {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-dim);
  white-space: pre-wrap;
  margin: 0;
}

/* ─── Scene 3: Inputs ─── */
.inputs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

.input-card {
  background: var(--bg);
  padding: 28px 24px;
  transition: background 0.2s;
}

.input-card:hover { background: var(--bg-hover); }

.input-card .abbr {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.input-card h4 {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 8px;
}

.input-card p {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

/* ─── Scene 4: Pricing ─── */
.pricing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

.pricing-grid > * {
  background: var(--bg);
  padding: 32px;
  min-width: 0;
}

.pricing-grid h2 { margin-bottom: 16px; }
.pricing-grid .lead { margin-bottom: 24px; }

.pricing-list {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pricing-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-dim);
}

.pricing-list li::before {
  content: "✓";
  color: var(--accent);
  font-size: 11px;
}

.wallet-card {
  background: var(--bg-raise);
  border: 1px solid var(--rule);
}

.wallet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--rule);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.wallet-body { padding: 32px 24px 24px; }

.wallet-balance {
  font-size: 64px;
  font-weight: 500;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 6px;
}

.wallet-balance .cur {
  font-size: 22px;
  color: var(--muted);
  font-weight: 400;
}

.wallet-balance .pages {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
}

.wallet-meta {
  display: flex;
  gap: 28px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  font-size: 11.5px;
  color: var(--muted);
}

.wallet-meta b {
  display: block;
  color: var(--ink);
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 4px;
}

/* ─── Scene 5: CTA ─── */
.cta-prompt {
  max-width: 680px;
  width: 100%;
  border: 1px solid var(--rule);
  background: var(--bg-raise);
  margin: 0 auto 32px;
}

.cta-prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--rule);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.cta-prompt-head span:last-child {
  color: var(--accent);
  cursor: pointer;
  transition: color 0.15s;
}

.cta-prompt-head span:last-child:hover { color: var(--ink); }

.cta-prompt pre {
  margin: 0;
  padding: 24px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--ink-dim);
}

/* ─── Spec Plate Footer ─── */
.spec-plate {
  background: var(--bg-raise);
  border-top: 1px solid var(--rule);
  padding: 0 clamp(16px, 3vw, 48px);
  overflow-x: auto;
  position: relative;
  z-index: 10;
}

.spec-row {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 48px;
  white-space: nowrap;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.spec-row span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.spec-row span::before {
  content: "·";
  color: var(--accent-dim);
}

.spec-row span:first-child::before { content: none; }

/* ─── Command Palette ─── */
#cmd-palette {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(12, 12, 11, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}

#cmd-palette[hidden] { display: none; }

.cmd-box {
  width: min(520px, 92vw);
  background: var(--bg-raise);
  border: 1px solid var(--rule);
  border-radius: var(--radius-soft);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.cmd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--rule);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cmd-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  max-height: 60vh;
  overflow-y: auto;
}

.cmd-list li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 13px;
  transition: background 0.1s, color 0.1s;
}

.cmd-list li a:hover,
.cmd-list li a:focus {
  background: var(--bg-hover);
  color: var(--ink);
  outline: none;
}

.cmd-list li a span:last-child {
  font-size: 11px;
  color: var(--muted);
}

/* ─── Responsive ─── */
@media (min-width: 768px) {
  .status-nav { display: flex; }
  .scene-grid { grid-template-columns: 1.4fr 1fr; }
  .extraction-grid { grid-template-columns: 1fr 1fr; }
  .pricing-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 767px) {
  .scene { min-height: auto; height: auto; position: relative; top: auto; }
  .scene-inner { height: auto; }
  .scene-frame { height: auto; min-height: calc(100dvh - var(--bar-h)); padding: 28px 20px; }
  .scene-frame::after { opacity: 1; }

  .scene-grid,
  .extraction-grid,
  .pricing-grid { grid-template-columns: 1fr; }

  .steps-grid { grid-template-columns: 1fr 1fr; }
  .inputs-grid { grid-template-columns: 1fr 1fr; }

  .step-panel { padding: 14px; }
  .step-terminal { font-size: 11px; min-height: 64px; }

  .photo-mock { max-width: 260px; margin: 0 auto; }

  .wallet-balance { font-size: 48px; }
  .wallet-meta { flex-direction: column; gap: 12px; }

  .spec-row { gap: 18px; font-size: 10px; }
}

@media (max-width: 480px) {
  .steps-grid { grid-template-columns: 1fr; }
  .inputs-grid { grid-template-columns: 1fr; }
}

/* Focus */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  #boot-flash { animation: none; opacity: 0; }
  .logo-pulse { animation: none; box-shadow: none; }
  .step-status.done { box-shadow: none; }
  .step-terminal .cursor { animation: none; background: var(--accent); }
}
