/* NeuroOCR — base.css
   Reset, base typography, layout helpers, animations, and the aurora background.
   Depends on tokens.css (loaded first).
*/

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter Tight', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'ss01', 'cv11';
  letter-spacing: -0.005em;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
  transition: background .4s ease, color .25s ease;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; padding: 0; }
input, select, textarea { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

/* ── Aurora background — static radial blobs behind all content ── */
body::before {
  content: '';
  position: fixed;
  inset: -20%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(42% 42% at 18% 12%,  var(--aurora-1) 0%, transparent 70%),
    radial-gradient(46% 46% at 86% 88%,  var(--aurora-2) 0%, transparent 72%),
    radial-gradient(40% 40% at 60% 40%,  var(--aurora-3) 0%, transparent 70%);
  background-repeat: no-repeat;
  animation: auroraDrift 32s ease-in-out infinite alternate;
}

@keyframes auroraDrift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(2%, -2%, 0) scale(1.06); }
  100% { transform: translate3d(-2%, 1%, 0) scale(1.02); }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); background-clip: padding-box; }

/* ── Typography helpers ── */
.serif {
  font-family: 'Instrument Serif', Georgia, serif;
  letter-spacing: -0.01em;
  font-weight: 400;
}
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

.label-kicker {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-3);
  font-family: 'Inter Tight', sans-serif;
}

/* gradient text — with a solid fallback color for contrast/no-clip browsers */
.gradient-text {
  color: var(--accent);
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Focus ring ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ── Layout helpers ── */
.page-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 32px;
}
.sidebar-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 61px);
}
.divider-h { height: 1px; background: var(--rule); }
.hidden { display: none !important; }

@media (max-width: 768px) {
  .sidebar-layout { grid-template-columns: 1fr; }
  .page-container { padding: 0 16px; }
}

/* ── Decorative patterns ── */
.hatch {
  background-image: repeating-linear-gradient(
    135deg, var(--rule) 0 1px, transparent 1px 7px);
}
.dropzone-grid {
  background-image:
    linear-gradient(var(--rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 20px 20px;
  background-position: -1px -1px;
}

/* ── Animations ── */
@keyframes scanline {
  0%   { transform: translateY(0%); opacity: 0; }
  5%   { opacity: 1; }
  95%  { opacity: 1; }
  100% { transform: translateY(100%); opacity: 0; }
}
.scanline {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--signal), transparent);
  box-shadow: 0 0 14px var(--signal);
  animation: scanline 3.5s cubic-bezier(.4,0,.2,1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }
.cursor-blink::after {
  content: '▍';
  animation: blink 1s step-end infinite;
  margin-left: 2px;
  color: var(--signal);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .6s cubic-bezier(.2,.8,.2,1) both; }

@keyframes bboxPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--signal-soft); }
  50%       { box-shadow: 0 0 0 4px var(--signal-soft); }
}
.bbox {
  position: absolute;
  border: 1.5px solid var(--signal);
  box-shadow: var(--glow-signal);
  animation: bboxPulse 2s infinite;
}
.bbox-tag {
  position: absolute;
  top: -20px; left: -1px;
  background: var(--signal);
  color: #04141a;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  padding: 2px 5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border-radius: 3px;
}

@keyframes stripeShift { to { background-position: 40px 0; } }
.stripes {
  background-image: repeating-linear-gradient(
    -45deg,
    var(--accent) 0 10px,
    color-mix(in oklab, var(--accent) 70%, transparent) 10px 20px);
  animation: stripeShift 1.2s linear infinite;
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  body::before { animation: none; }
}
