/* ============================================
   BITHIA — Editorial Precision Design System
   ============================================ */

/* ---- Base ---- */
html {
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
}

::selection {
  background-color: #d1fae5;
  color: #065f46;
}

/* ---- Grain Overlay ---- */
.grain-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ---- Editorial Grid Background ---- */
.editorial-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(0,0,0,0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,0.02) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse at 70% 40%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 70% 40%, black 20%, transparent 70%);
}

/* ---- Scroll Reveal ---- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: calc(var(--index, 0) * 120ms);
  will-change: transform, opacity;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Animations ---- */
@keyframes pulse-slow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.animate-pulse-slow {
  animation: pulse-slow 2.5s ease-in-out infinite;
}

/* ---- Nav ---- */
#nav.scrolled {
  background-color: rgba(250, 250, 249, 0.9);
  backdrop-filter: blur(16px) saturate(1.8);
  -webkit-backdrop-filter: blur(16px) saturate(1.8);
  border-bottom: 1px solid rgba(228, 228, 231, 0.5);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* ---- Editorial Highlight ---- */
.editorial-highlight {
  position: relative;
  color: #059669;
}

.editorial-highlight::after {
  content: '';
  position: absolute;
  left: -4px;
  right: -4px;
  bottom: 0.05em;
  height: 0.35em;
  background: rgba(5, 150, 105, 0.1);
  border-radius: 2px;
  z-index: -1;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.editorial-highlight.animate::after {
  transform: scaleX(1);
}

/* ---- Terminal Card ---- */
.terminal-card {
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 4px 24px rgba(0,0,0,0.12),
    0 1px 2px rgba(0,0,0,0.06);
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #27272a;
}

.terminal-body {
  padding: 12px 0;
  min-height: 0;
}

.terminal-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 16px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.terminal-line.visible {
  opacity: 1;
  transform: translateY(0);
}

.terminal-tag {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Geist Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2px;
}

.tag-input    { background: #1e3a2f; color: #34d399; }
.tag-analysis { background: #1e293b; color: #60a5fa; }
.tag-verify   { background: #2d2006; color: #fbbf24; }
.tag-draft    { background: #1e3a2f; color: #34d399; }
.tag-edit     { background: #2d1b3e; color: #c084fc; }
.tag-seo      { background: #1e293b; color: #60a5fa; }
.tag-review   { background: #2d2006; color: #fbbf24; }
.tag-publish  { background: #064e3b; color: #6ee7b7; }

.terminal-text {
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  color: #a1a1aa;
  line-height: 1.5;
}

.terminal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid #27272a;
}

.terminal-complete-blink {
  animation: completeBlink 0.4s ease-in-out 3;
  color: #34d399;
}

@keyframes completeBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* ---- Pipeline Grid ---- */
.pipeline-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: #e4e4e7;
  border: 1px solid #e4e4e7;
  border-radius: 16px;
  overflow: hidden;
}

@media (min-width: 768px) {
  .pipeline-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.pipeline-card {
  background: white;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: background-color 0.3s ease;
}

.pipeline-card:hover {
  background: #fafafa;
}

.pipeline-card-number {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: #059669;
  letter-spacing: 0.05em;
}

.pipeline-card-body {
  flex: 1;
}

.pipeline-card-meta {
  padding-top: 8px;
  border-top: 1px solid #f4f4f5;
}

/* ---- Metric Cells ---- */
.metric-cell {
  padding: 32px 0;
  border-bottom: 1px solid #e4e4e7;
}

@media (min-width: 768px) {
  .metric-cell {
    padding: 40px 32px;
  }

  .metric-cell:nth-child(odd) {
    border-right: 1px solid #e4e4e7;
    padding-left: 0;
  }

  .metric-cell:nth-child(even) {
    padding-right: 0;
  }
}

.metric-number {
  font-family: 'Geist Mono', monospace;
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  color: #18181b;
  letter-spacing: -0.03em;
  line-height: 1;
}

.metric-label {
  margin-top: 8px;
  font-size: 14px;
  color: #71717a;
  line-height: 1.6;
  max-width: 40ch;
}

/* ---- Differentiators ---- */
.differentiator {
  display: flex;
  gap: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid #f4f4f5;
}

.differentiator:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.diff-marker {
  flex-shrink: 0;
  width: 3px;
  background: #059669;
  border-radius: 2px;
  margin-top: 4px;
  align-self: stretch;
}

/* ---- Contact Form ---- */
.contact-form-card {
  background: white;
  border: 1px solid #e4e4e7;
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.04);
}

@media (min-width: 768px) {
  .contact-form-card {
    padding: 36px 32px;
  }
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  background: #fafaf9;
  border: 1px solid #e4e4e7;
  border-radius: 10px;
  font-family: 'Geist', system-ui, sans-serif;
  font-size: 14px;
  color: #18181b;
  transition: all 0.2s ease;
}

.form-input::placeholder {
  color: #a1a1aa;
}

.form-input:focus {
  outline: none;
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.08);
  background: white;
}

/* ---- Form Feedback ---- */
.form-feedback {
  display: none;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 500;
}

.form-feedback--success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.form-feedback--error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* ---- Counter animation ---- */
.counter {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}
