/* ============ RESET & BASE ============ */
:root {
  --bg: #F5F1EA;
  --bg-alt: #ECE7DC;
  --ink: #0A0A0B;
  --fg: #1A1A1A;
  --muted: #6B6760;
  --border: #D9D3C5;
  --lime: #D4FF3D;
  --lime-dark: #9FCC1F;
  --coral: #FF5436;
  --cream: #F5F1EA;
  --cream-alt: #ECE7DC;
}

* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg);
  color: var(--fg);
  overflow-x: hidden;
}

/* ============ GRAIN OVERLAY ============ */
.grain::before {
  content: ""; position: fixed; inset: 0; pointer-events: none;
  z-index: 1; opacity: 0.35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============ TYPOGRAPHY ============ */
.display { font-family: 'Instrument Serif', serif; font-weight: 400; letter-spacing: -0.02em; line-height: 0.95; }
.display-italic { font-family: 'Instrument Serif', serif; font-style: italic; font-weight: 400; }

/* ============ NAV ============ */
.nav-blur {
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: rgba(245, 241, 234, 0.78);
  border-bottom: 1px solid rgba(217, 211, 197, 0.6);
}

/* ============ BUTTONS ============ */
.btn-primary {
  background: var(--ink); color: var(--cream); border-radius: 999px;
  padding: 14px 28px; font-weight: 500; transition: all 0.2s ease;
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--ink);
}
.btn-primary:hover { background: var(--lime); color: var(--ink); border-color: var(--lime); transform: translateY(-1px); }

.btn-secondary {
  background: transparent; color: var(--ink); border-radius: 999px;
  padding: 14px 28px; font-weight: 500; transition: all 0.2s ease;
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--ink);
}
.btn-secondary:hover { background: var(--ink); color: var(--cream); }

.btn-ghost { color: var(--ink); padding: 10px 18px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; transition: gap 0.2s ease; }
.btn-ghost:hover { gap: 10px; }

/* ============ DROPZONE ============ */
.dropzone {
  border: 2px dashed var(--border); border-radius: 24px;
  background: rgba(255,255,255,0.4); transition: all 0.3s ease;
  position: relative; overflow: hidden;
}
.dropzone::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(212,255,61,0.18), transparent 40%);
  opacity: 0; transition: opacity 0.3s ease; pointer-events: none;
}
.dropzone:hover::before, .dropzone.dragover::before { opacity: 1; }
.dropzone.dragover { border-color: var(--ink); background: rgba(212,255,61,0.08); transform: scale(1.005); }

/* ============ WORKSPACE ============ */
.workspace-shell {
  background: #fff; border: 1px solid var(--border); border-radius: 24px;
  box-shadow: 0 1px 2px rgba(10,10,11,0.04), 0 24px 60px -24px rgba(10,10,11,0.12);
  overflow: hidden;
}
.workspace-tab {
  padding: 10px 16px; border-radius: 10px; font-size: 13px; font-weight: 500;
  color: var(--muted); cursor: pointer; transition: all 0.2s ease;
  display: inline-flex; align-items: center; gap: 6px;
}
.workspace-tab.active { background: var(--ink); color: var(--lime); }
.workspace-tab:not(.active):hover { background: var(--cream-alt); color: var(--ink); }

/* ============ PAGE THUMBNAILS ============ */
.page-thumb {
  aspect-ratio: 3/4; background: #fff; border: 1px solid var(--border);
  border-radius: 6px; position: relative; cursor: pointer;
  transition: all 0.2s ease; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.page-thumb:hover { border-color: var(--ink); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(10,10,11,0.1); }
.page-thumb.selected { border-color: var(--lime-dark); box-shadow: 0 0 0 2px var(--lime-dark); }
.page-thumb.split-after::after {
  content: ""; position: absolute; bottom: -2px; left: 0; right: 0; height: 4px;
  background: var(--coral); z-index: 2;
}
.page-thumb canvas {
  display: block; max-width: 100%; max-height: 100%;
  width: auto; height: auto; pointer-events: none;
}
.page-thumb .thumb-num {
  position: absolute; top: 4px; left: 4px; font-size: 10px; font-family: 'JetBrains Mono', monospace;
  background: rgba(10,10,11,0.85); color: var(--lime); padding: 2px 6px; border-radius: 4px;
  z-index: 3;
}
.page-thumb .split-marker {
  position: absolute; bottom: 4px; right: 4px; width: 20px; height: 20px;
  background: var(--coral); border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; line-height: 1; z-index: 3; font-weight: 700;
}
.thumb-placeholder {
  position: absolute; inset: 0; padding: 10px;
  display: flex; flex-direction: column; gap: 6px; justify-content: center;
  background: #faf9f7;
}
.thumb-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #faf9f7;
}
.thumb-spinner {
  width: 16px; height: 16px; border: 2px solid var(--border);
  border-top-color: var(--ink); border-radius: 50%; animation: thumbSpin 0.7s linear infinite;
}
@keyframes thumbSpin { to { transform: rotate(360deg); } }

/* ============ FEATURE CARDS ============ */
.feat-card {
  background: #fff; border: 1px solid var(--border); border-radius: 20px;
  padding: 28px; transition: all 0.3s ease; position: relative; overflow: hidden;
}
.feat-card:hover { transform: translateY(-2px); border-color: var(--ink); box-shadow: 0 24px 48px -16px rgba(10,10,11,0.12); }
.feat-icon {
  width: 44px; height: 44px; border-radius: 12px; background: var(--ink);
  color: var(--lime); display: flex; align-items: center; justify-content: center; margin-bottom: 20px;
}

/* ============ INK SECTION ============ */
.ink-section { background: var(--ink); color: var(--cream); position: relative; overflow: hidden; }
.ink-section::before {
  content: ""; position: absolute; width: 600px; height: 600px; border-radius: 50%;
  background: radial-gradient(circle, rgba(212,255,61,0.08), transparent 70%);
  top: -200px; right: -200px; pointer-events: none;
}

/* ============ SCROLL REVEAL ============ */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1); }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ============ FAQ ============ */
.faq-item summary { list-style: none; cursor: pointer; position: relative; padding-right: 48px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; position: absolute; right: 0; top: 0; font-size: 24px; font-weight: 300; transition: transform 0.3s ease; color: var(--muted); }
.faq-item[open] summary::after { content: "−"; color: var(--ink); }
.faq-item[open] summary { color: var(--ink); }

/* ============ BADGES & PILLS ============ */
.badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: #fff; font-size: 13px; font-weight: 500; color: var(--ink);
}

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: rgba(255,255,255,0.5); font-size: 12px;
  font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em;
}
.pill-dark { background: rgba(212,255,61,0.1); border-color: rgba(212,255,61,0.3); color: var(--lime); }

/* ============ MOBILE MENU ============ */
.mobile-menu { transform: translateX(100%); transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1); }
.mobile-menu.open { transform: translateX(0); }

/* ============ GLOBAL SELECTION & FOCUS ============ */
::selection { background: var(--lime); color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }

/* ============ CUSTOM SCROLLBARS ============ */
.file-preview::-webkit-scrollbar { height: 6px; width: 6px; }
.file-preview::-webkit-scrollbar-track { background: transparent; }
.file-preview::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ============ MARQUEE ============ */
.marquee { display: flex; overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.marquee-track { display: flex; gap: 3rem; animation: scroll 40s linear infinite; flex-shrink: 0; padding-right: 3rem; align-items: center; }
@keyframes scroll { from { transform: translateX(0); } to { transform: translateX(-100%); } }

/* ============ HERO PDF VISUALIZATION ============ */
.pdf-stack { position: relative; width: 100%; height: 100%; perspective: 1200px; }
.pdf-page {
  position: absolute; background: #fff; border-radius: 6px;
  box-shadow: 0 1px 2px rgba(10,10,11,0.06), 0 8px 24px rgba(10,10,11,0.08);
  border: 1px solid #ECE7DC; transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.pdf-page .page-header { height: 28px; border-bottom: 1px solid #ECE7DC; display: flex; align-items: center; padding: 0 12px; gap: 6px; }
.pdf-page .page-dot { width: 6px; height: 6px; border-radius: 50%; background: #ECE7DC; }
.pdf-page .page-body { padding: 14px; }
.pdf-line { height: 4px; background: #ECE7DC; border-radius: 2px; margin-bottom: 8px; }
.pdf-line.short { width: 40%; }
.pdf-line.med { width: 70%; }
.pdf-line.long { width: 90%; }
.split-line { position: absolute; left: 0; right: 0; height: 2px; background: repeating-linear-gradient(90deg, var(--coral) 0 8px, transparent 8px 14px); z-index: 5; animation: splitPulse 3s ease-in-out infinite; }
@keyframes splitPulse { 0%, 100% { opacity: 0.4; transform: scaleX(0.95); } 50% { opacity: 1; transform: scaleX(1); } }

.floating-file {
  position: absolute; background: var(--ink); color: var(--lime); padding: 8px 12px; border-radius: 8px;
  font-family: 'JetBrains Mono', monospace; font-size: 11px; display: flex; align-items: center; gap: 6px;
  box-shadow: 0 12px 32px rgba(10,10,11,0.18); animation: floatFile 4s ease-in-out infinite;
}
@keyframes floatFile { 0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); } 50% { transform: translateY(-8px) rotate(var(--rot, 0deg)); } }

/* ============ PRIVACY SECTION SPIN ============ */
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ============ PROGRESS BAR ============ */
.progress-bar-wrap {
  width: 100%; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: 12px;
}
.progress-bar {
  height: 100%; background: var(--lime-dark); border-radius: 2px;
  transition: width 0.3s ease; width: 0%;
}

/* ============ RESULT ITEM ============ */
.result-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--cream-alt); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 18px; transition: border-color 0.2s ease;
}
.result-item:hover { border-color: var(--ink); }

/* ============ COOKIE CONSENT BANNER ============ */
.cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  background: var(--ink);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 20px 24px;
  box-shadow: 0 -8px 40px rgba(10,10,11,0.3);
  transform: translateY(110%);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.cookie-banner.visible { transform: translateY(0); }

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
