/* ============================================================
   Lumina Scan — Folha de estilos
   Tema: escuro editorial, âmbar quente, tipografia expressiva
   ============================================================ */

:root {
  --bg: #0c0d10;
  --bg-elev: #131418;
  --bg-panel: #17181d;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f2efe9;
  --text-soft: #b9b4aa;
  --text-mute: #7d786e;
  --accent: #e8a13a;
  --accent-deep: #c57f1e;
  --accent-soft: rgba(232, 161, 58, 0.12);
  --ok: #58c98a;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Textura de grão sutil — dá profundidade sem pesar */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.03 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--accent); color: #14100a; }

/* ============ Cabeçalho ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(20px, 5vw, 64px);
  background: rgba(12, 13, 16, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(232, 161, 58, 0.25);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.brand-name em {
  font-style: normal;
  color: var(--accent);
}

.header-nav { display: flex; gap: 8px; }

.header-nav a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
  transition: color 0.2s ease, background 0.2s ease;
}

.header-nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

/* ============ Layout principal ============ */
main {
  position: relative;
  z-index: 2;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 48px);
}

/* ============ Hero ============ */
.hero {
  text-align: center;
  padding: clamp(72px, 12vh, 130px) 0 clamp(56px, 8vh, 90px);
  position: relative;
}

/* Halo de luz atrás do título */
.hero::before {
  content: "";
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: min(760px, 90vw);
  height: 420px;
  background: radial-gradient(ellipse at center, rgba(232, 161, 58, 0.14), transparent 65%);
  pointer-events: none;
  z-index: -1;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-soft);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 18px;
  margin-bottom: 28px;
  background: rgba(255, 255, 255, 0.03);
}

.hero-eyebrow .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 10px var(--ok);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.82); }
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 6.2vw, 4.6rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin-bottom: 26px;
}

.hero-title .accent {
  font-style: italic;
  color: var(--accent);
  background: linear-gradient(120deg, #f0b45c, var(--accent) 55%, #d98a20);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  max-width: 560px;
  margin: 0 auto 38px;
  color: var(--text-soft);
  font-size: 1.05rem;
  font-weight: 300;
}

.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 44px;
}

.hero-badges {
  display: flex;
  gap: 28px;
  justify-content: center;
  flex-wrap: wrap;
  list-style: none;
  color: var(--text-mute);
  font-size: 0.86rem;
}

.hero-badges i { color: var(--accent); margin-right: 7px; }

/* ============ Botões ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-body);
  font-size: 0.93rem;
  font-weight: 600;
  padding: 13px 26px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.25s ease, background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.btn:active { transform: translateY(1px) scale(0.99); }

.btn-primary {
  background: linear-gradient(150deg, #f0b45c, var(--accent) 60%, var(--accent-deep));
  color: #181105;
  box-shadow: 0 10px 30px -10px rgba(232, 161, 58, 0.55);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 14px 38px -10px rgba(232, 161, 58, 0.7);
  transform: translateY(-2px);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-color: var(--line-strong);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.24);
}

.btn:disabled { opacity: 0.38; cursor: not-allowed; }

.btn-sm { padding: 9px 18px; font-size: 0.85rem; }

/* ============ Cabeçalhos de seção ============ */
.section-heading {
  text-align: center;
  margin-bottom: 44px;
}

.section-heading h2 {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3.6vw, 2.6rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.section-heading p { color: var(--text-mute); font-size: 0.97rem; }

/* ============ Scanner ============ */
.scanner-section { padding: 30px 0 80px; }

.scanner-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 26px;
}

.panel {
  background: linear-gradient(170deg, var(--bg-panel), var(--bg-elev));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.panel-head h3 {
  font-size: 1.02rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-head h3 i { color: var(--accent); }

.panel-status {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
}

.panel-status.live { color: var(--ok); border-color: rgba(88, 201, 138, 0.4); }

/* Viewport da câmera */
.viewport {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #08090b;
  border: 1px solid var(--line);
}

.viewport video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.viewport.active video { display: block; }

.viewport-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-mute);
  text-align: center;
  font-size: 0.9rem;
  padding: 20px;
}

.viewport-placeholder i { font-size: 2.1rem; opacity: 0.5; }
.viewport-placeholder strong { color: var(--text-soft); }

.viewport.active .viewport-placeholder { display: none; }

/* Moldura de escaneamento */
.scan-frame {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
}

.viewport.active .scan-frame { display: flex; }

.corner {
  position: absolute;
  width: 34px;
  height: 34px;
  border: 3px solid var(--accent);
}

.corner.tl { top: 18%; left: 22%; border-right: none; border-bottom: none; border-top-left-radius: 10px; }
.corner.tr { top: 18%; right: 22%; border-left: none; border-bottom: none; border-top-right-radius: 10px; }
.corner.bl { bottom: 18%; left: 22%; border-right: none; border-top: none; border-bottom-left-radius: 10px; }
.corner.br { bottom: 18%; right: 22%; border-left: none; border-top: none; border-bottom-right-radius: 10px; }

.scan-line {
  position: absolute;
  left: 24%;
  right: 24%;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 16px rgba(232, 161, 58, 0.8);
  animation: sweep 2.6s ease-in-out infinite;
}

@keyframes sweep {
  0%, 100% { top: 22%; }
  50% { top: 78%; }
}

.viewport.detected .corner { border-color: var(--ok); }
.viewport.detected .scan-line {
  background: linear-gradient(90deg, transparent, var(--ok), transparent);
  box-shadow: 0 0 16px rgba(88, 201, 138, 0.9);
  animation: none;
  top: 50%;
}

.panel-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.panel-note {
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--text-mute);
}

/* Dropzone */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 260px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  padding: 28px;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.2s ease;
}

.dropzone:hover, .dropzone:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.015);
}

.dropzone-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.dropzone-title { font-weight: 600; font-size: 0.98rem; }
.dropzone-sub { color: var(--text-mute); font-size: 0.85rem; }

.upload-preview {
  margin-top: 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.upload-preview img {
  max-width: 100%;
  max-height: 180px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
}

/* ============ Resultado ============ */
.result-panel {
  position: relative;
  margin-top: 26px;
  background: linear-gradient(170deg, #1a1b20, #121317);
  border: 1px solid rgba(232, 161, 58, 0.35);
  border-radius: var(--radius);
  padding: 30px;
  overflow: hidden;
  animation: reveal 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.result-glow {
  position: absolute;
  top: -120px;
  right: -80px;
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, rgba(232, 161, 58, 0.16), transparent 70%);
  pointer-events: none;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.result-format {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(232, 161, 58, 0.3);
  border-radius: 999px;
  padding: 6px 15px;
}

.result-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-mute);
}

.result-label {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 8px;
}

.result-content {
  font-family: var(--font-mono);
  font-size: 1.02rem;
  word-break: break-all;
  color: var(--text);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  margin-bottom: 22px;
  max-height: 180px;
  overflow-y: auto;
}

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

/* ============ Como funciona ============ */
.how-section { padding: 40px 0 80px; }

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.step-card {
  position: relative;
  background: linear-gradient(170deg, var(--bg-panel), var(--bg-elev));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 34px 26px 28px;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.step-card:hover { transform: translateY(-5px); border-color: rgba(232, 161, 58, 0.35); }

.step-num {
  position: absolute;
  top: 18px;
  right: 22px;
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.09);
}

.step-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.15rem;
  margin-bottom: 18px;
}

.step-card h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.step-card p { color: var(--text-mute); font-size: 0.9rem; }

/* Faixa de formatos */
.formats-strip {
  margin-top: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 26px;
  background: rgba(255, 255, 255, 0.02);
}

.formats-label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 14px;
}

.formats-strip ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.formats-strip li {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-soft);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 14px;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.formats-strip li:hover { border-color: var(--accent); color: var(--accent); }

/* ============ Histórico ============ */
.history-section { padding: 0 0 90px; }

.history-panel { max-width: 760px; margin: 0 auto; }

.history-empty {
  text-align: center;
  color: var(--text-mute);
  padding: 44px 20px;
  font-size: 0.92rem;
}

.history-empty i { font-size: 1.9rem; opacity: 0.45; display: block; margin-bottom: 14px; }

.history-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }

.history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  animation: reveal 0.35s ease;
}

.history-item .h-format {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
}

.history-item .h-body { flex: 1; min-width: 0; }

.history-item .h-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item .h-meta {
  font-size: 0.72rem;
  color: var(--text-mute);
  margin-top: 2px;
}

.history-item .h-actions { display: flex; gap: 6px; flex-shrink: 0; }

.history-item .h-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.82rem;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
}

.history-item .h-btn:hover { background: var(--accent-soft); color: var(--accent); border-color: rgba(232, 161, 58, 0.4); }

.history-foot { margin-top: 18px; display: flex; justify-content: flex-end; }
.history-foot:has(button:disabled) { display: none; }

/* ============ Rodapé ============ */
.site-footer {
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, rgba(232, 161, 58, 0.04));
  padding: 48px 24px 56px;
  text-align: center;
}

.footer-credit {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.footer-credit strong {
  font-weight: 600;
  background: linear-gradient(120deg, #f0b45c, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.footer-line {
  margin-top: 8px;
  color: var(--text-mute);
  font-size: 0.84rem;
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(90px);
  z-index: 100;
  background: #1e2025;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 13px 26px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
  pointer-events: none;
  max-width: calc(100vw - 40px);
  text-align: center;
}

.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

.toast.success { border-color: rgba(88, 201, 138, 0.5); }
.toast.error { border-color: rgba(224, 92, 92, 0.55); }

/* ============ Responsivo ============ */
@media (max-width: 860px) {
  .scanner-grid { grid-template-columns: 1fr; }
  .steps-grid { grid-template-columns: 1fr; }
  .header-nav { display: none; }
  .corner.tl { left: 12%; } .corner.bl { left: 12%; }
  .corner.tr { right: 12%; } .corner.br { right: 12%; }
  .scan-line { left: 15%; right: 15%; }
}

@media (max-width: 480px) {
  .hero-actions .btn { width: 100%; justify-content: center; }
  .panel { padding: 20px; }
  .result-panel { padding: 22px; }
  .result-actions .btn { flex: 1; justify-content: center; }
}

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