/* ============================================
   Component Library — Light-first
   ============================================ */

/* ============================================
   GLITCH EFFECTS
   ============================================ */

.glitch-text {
  position: relative;
}

.glitch-text::before {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  color: var(--glitch-cyan);
  clip-path: polygon(0 0, 100% 0, 100% 30%, 0 30%);
  transform: translate(-2px, -1px);
  opacity: 0.2;
  pointer-events: none;
}

.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  color: var(--glitch-magenta);
  clip-path: polygon(0 70%, 100% 70%, 100% 100%, 0 100%);
  transform: translate(2px, 1px);
  opacity: 0.15;
  pointer-events: none;
}

/* Scanline Overlay (dark theme only) */
.scanlines::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* Cursor Blink */
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.cursor-blink::after {
  content: '|';
  color: var(--accent);
  animation: blink 1s step-end infinite;
  margin-left: 2px;
}

/* Flicker */
@keyframes flicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: 0.8; }
  94% { opacity: 1; }
  96% { opacity: 0.9; }
  97% { opacity: 1; }
}

.flicker {
  animation: flicker 4s infinite;
}

/* RGB Split Hover */
.rgb-split:hover {
  text-shadow:
    -1px 0 var(--glitch-cyan),
    1px 0 var(--glitch-magenta);
  transition: text-shadow 0.1s ease;
}

/* ============================================
   SURFACE TREATMENTS
   ============================================ */

/* Grain / Noise Texture */
.grain {
  position: relative;
}

.grain::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 3;
  opacity: 0.35;
  mix-blend-mode: overlay;
}

/* Dashed Border Cards */
.card-dashed {
  background: var(--bg-surface);
  border: 1.5px dashed var(--border-bright);
  border-radius: var(--rounded);
  padding: 1.5rem;
}

.card-dotted {
  background: var(--bg-surface);
  border: 1.5px dotted rgba(0,0,0,0.10);
  border-radius: var(--rounded);
  padding: 1.5rem;
}

.dark-context .card-dotted {
  border-color: rgba(255,255,255,0.10);
}

/* Double Border / Inset Frame */
.card-framed {
  background: var(--bg-surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--rounded-md);
  padding: 1.5rem;
  outline: 1px solid var(--border);
  outline-offset: 4px;
}

.card-framed-accent {
  border-color: rgba(255, 107, 53, 0.3);
  outline-color: rgba(255, 107, 53, 0.1);
}

/* Corner Bracket Decorations */
.corner-brackets {
  position: relative;
}

.corner-brackets::before,
.corner-brackets::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--accent);
  border-style: solid;
  pointer-events: none;
  z-index: 21;
}

.corner-brackets::before {
  top: -1px;
  left: -1px;
  border-width: 2px 0 0 2px;
}

.corner-brackets::after {
  bottom: -1px;
  right: -1px;
  border-width: 0 2px 2px 0;
}

.corner-brackets-data::before,
.corner-brackets-data::after {
  border-color: var(--data);
}

/* Stacked Card Effect */
.card-stacked {
  position: relative;
}

.card-stacked::before {
  content: '';
  position: absolute;
  inset: 4px -4px -4px 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--rounded-md);
  z-index: -1;
}

/* Gradient Border */
.gradient-border {
  position: relative;
  background: var(--bg-surface);
  border-radius: var(--rounded-md);
  padding: 1.5rem;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--accent) 0%, transparent 60%);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* Tinted Surfaces */
.surface-tinted-accent {
  background: linear-gradient(135deg, rgba(255,107,53,0.04) 0%, var(--bg-surface) 50%);
}

.surface-tinted-data {
  background: linear-gradient(135deg, rgba(45,212,191,0.04) 0%, var(--bg-surface) 50%);
}

/* Frosted Glass */
.frosted {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border: 1px solid rgba(0,0,0,0.06);
}

.dark-context .frosted {
  background: rgba(17, 17, 25, 0.7);
  border-color: rgba(255,255,255,0.08);
}

/* Inner Glow / Inset Shadow */
.inset-glow {
  box-shadow:
    inset 0 1px 0 rgba(0,0,0,0.04),
    inset 0 -1px 0 rgba(0,0,0,0.06);
}

.dark-context .inset-glow {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    inset 0 -1px 0 rgba(0,0,0,0.2);
}

.inset-glow-accent {
  box-shadow:
    inset 0 1px 0 rgba(255, 107, 53, 0.08),
    inset 0 -1px 0 rgba(0,0,0,0.06);
}

.dark-context .inset-glow-accent {
  box-shadow:
    inset 0 1px 0 rgba(255, 107, 53, 0.08),
    inset 0 -1px 0 rgba(0,0,0,0.2);
}

/* Embossed Text */
.text-emboss {
  text-shadow:
    0 1px 0 rgba(255,255,255,0.5),
    0 -1px 0 rgba(0,0,0,0.05);
}

.dark-context .text-emboss {
  text-shadow:
    0 1px 0 rgba(255,255,255,0.03),
    0 -1px 0 rgba(0,0,0,0.5);
}

/* Diagonal Stripe */
.stripe-accent {
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 4px,
    rgba(255, 107, 53, 0.03) 4px,
    rgba(255, 107, 53, 0.03) 8px
  );
}

/* Cross-Hatch Pattern */
.crosshatch {
  background-image:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 8px,
      rgba(0,0,0,0.03) 8px,
      rgba(0,0,0,0.03) 9px
    ),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 8px,
      rgba(0,0,0,0.03) 8px,
      rgba(0,0,0,0.03) 9px
    );
}

.dark-context .crosshatch {
  background-image:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 8px,
      rgba(255,255,255,0.015) 8px,
      rgba(255,255,255,0.015) 9px
    ),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 8px,
      rgba(255,255,255,0.015) 8px,
      rgba(255,255,255,0.015) 9px
    );
}

/* ============================================
   TERMINAL COMPONENTS
   ============================================ */

/* Terminal Block — CONTRAST with background */
.terminal-on-dark {
  background: var(--bg-inset-light);
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: var(--rounded-md);
  padding: 1rem 1.25rem;
  position: relative;
  color: var(--text-light);
  font-family: var(--font-mono);
}

.terminal-on-dark::before {
  content: '$ ';
  color: var(--data-light);
  font-weight: 600;
}

.terminal-on-light {
  background: var(--bg-inset);
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: var(--rounded-md);
  padding: 1rem 1.25rem;
  position: relative;
  color: var(--text);
  font-family: var(--font-mono);
}

.terminal-on-light::before {
  content: '$ ';
  color: var(--data);
  font-weight: 600;
}

/* ============================================
   BADGES & PILLS
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 4px 12px;
  border-radius: var(--rounded-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-accent {
  background: var(--accent-muted);
  color: var(--accent);
  border: 1px solid rgba(255, 107, 53, 0.2);
}

.badge-data {
  background: rgba(45, 212, 191, 0.10);
  color: var(--data);
  border: 1px solid rgba(45, 212, 191, 0.2);
}

.badge-muted {
  background: rgba(0,0,0,0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.dark-context .badge-muted {
  background: rgba(255,255,255,0.04);
}

/* ============================================
   STAT CARDS & METRICS
   ============================================ */

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--rounded-md);
  padding: 1.5rem;
}

.stat-label {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--data);
  letter-spacing: -0.03em;
  line-height: 1;
}

.stat-value.accent {
  color: var(--accent);
}

.stat-delta {
  font-size: 1rem;
  font-weight: 500;
  color: var(--data);
  margin-top: 8px;
}

.stat-delta.negative {
  color: var(--error);
}

/* Metric Row */
.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.metric-row:last-child {
  border-bottom: none;
}

.metric-label {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.metric-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
}

.metric-value.data {
  color: var(--data);
}

/* ============================================
   FEATURE LIST
   ============================================ */

.feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0;
  margin: 0;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 1rem;
  color: var(--text);
  line-height: 1.4;
}

.feature-check {
  color: var(--data);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

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

.feature-item.disabled .feature-check {
  color: var(--text-muted);
}

/* ============================================
   ICON BADGE (Text Symbol)
   ============================================ */

.icon-badge {
  width: 48px;
  height: 48px;
  border-radius: var(--rounded-lg);
  background: var(--accent-muted);
  border: 1px solid rgba(255, 107, 53, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent);
  flex-shrink: 0;
}

.icon-badge.data {
  background: rgba(45, 212, 191, 0.10);
  border-color: rgba(45, 212, 191, 0.15);
  color: var(--data);
}

/* ============================================
   DIVIDERS
   ============================================ */

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

.divider-accent {
  border: none;
  border-top: 2px solid var(--accent);
  width: 48px;
  margin: 24px 0;
}

.divider-dotted {
  border: none;
  border-top: 1px dashed var(--border-bright);
  margin: 24px 0;
}

/* ============================================
   QUOTE BLOCK
   ============================================ */

.quote {
  border-left: 3px solid var(--accent);
  padding: 16px 20px;
  background: var(--bg-surface);
  border-radius: 0 var(--rounded-md) var(--rounded-md) 0;
}

.quote-text {
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.5;
  font-style: italic;
}

.quote-author {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 12px;
}

/* ============================================
   PROGRESS BAR
   ============================================ */

.progress-track {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--rounded);
  height: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--data);
  border-radius: var(--rounded);
  transition: width 0.15s ease;
}

.progress-fill.accent {
  background: var(--accent);
}

/* ============================================
   TABS
   ============================================ */

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font-mono);
}

.tab:hover {
  color: var(--text-secondary);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ============================================
   TOAST / NOTIFICATION
   ============================================ */

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: var(--rounded-md);
  font-size: 1rem;
  font-weight: 500;
  border-left: 4px solid;
}

.toast-success {
  background: rgba(45, 212, 191, 0.08);
  border-color: var(--data);
  color: var(--data);
}

.toast-error {
  background: rgba(255, 59, 59, 0.08);
  border-color: var(--error);
  color: var(--error);
}

.toast-warning {
  background: rgba(255, 170, 51, 0.08);
  border-color: var(--warning);
  color: var(--warning);
}

.toast-info {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================
   CALLOUT / ANNOTATION
   ============================================ */

.callout {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--rounded) var(--rounded) 0;
  padding: 20px 24px;
}

.callout.data {
  border-left-color: var(--data);
}

.callout.warning {
  border-left-color: var(--warning);
}

.callout-prefix {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.callout-prefix.accent { color: var(--accent); }
.callout-prefix.data { color: var(--data); }
.callout-prefix.warning { color: var(--warning); }

.callout-text {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.5;
}

/* ============================================
   NUMBERED STEPS
   ============================================ */

.steps {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.step {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-content {
  flex: 1;
}

.step-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.step-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ============================================
   COMPARISON ROW
   ============================================ */

.compare-row {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.compare-label {
  flex: 1;
  font-size: 1rem;
  color: var(--text);
}

.compare-us {
  font-size: 1rem;
  font-weight: 700;
  color: var(--data);
}

.compare-them {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-muted);
  text-decoration: line-through;
}

/* ============================================
   TAG / CHIP
   ============================================ */

.tag-terminal {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--rounded);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.tag-terminal.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-muted);
}

/* ============================================
   CTA BANNER
   ============================================ */

.cta-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--rounded-md);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.cta-banner-text {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text);
}

.cta-banner-text strong {
  color: var(--accent);
}

/* ============================================
   INPUT / FORM FIELD
   ============================================ */

.input-terminal {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--rounded);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: var(--font-mono);
  color: var(--text);
  width: 100%;
  transition: border-color var(--transition-fast);
}

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

.input-terminal:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

/* ============================================
   UTILITY — FULL WIDTH BUTTON
   ============================================ */

.btn-full {
  width: 100%;
  justify-content: center;
}

/* Text gradient — orange to teal */
.text-gradient {
  background: linear-gradient(135deg, var(--accent), var(--data));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Accent link color */
a.link-accent {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a.link-accent:hover {
  color: var(--accent-hover);
}
