/* ==========================================================================
   system.css — PulseChain Wonderland Ledger Executable System Contract
   Generated from DESIGN.md (rev 1)
   ========================================================================== */

/* @theme block for Tailwind compatibility */
@theme {
  --color-void: #0B0612;
  --color-surface: #150E22;
  --color-surface-raised: #1F1533;
  --color-parchment: #F4E9D4;
  --color-text: #F6EFE2;
  --color-text-muted: #A99EC0;
  --color-violet: #8B5CF6;
  --color-coral: #ED6F5C;
  --color-honey: #E9B94A;
  --color-cheshire: #A8E063;

  --font-display: 'Fraunces', 'Instrument Serif', 'GT Super', Georgia, serif;
  --font-body: 'Space Grotesk', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, ui-monospace, monospace;
}

:root {
  /* Palette Tokens */
  --color-void: #0B0612;
  --color-surface: #150E22;
  --color-surface-raised: #1F1533;
  --color-parchment: #F4E9D4;
  --color-text: #F6EFE2;
  --color-text-muted: #A99EC0;
  --color-violet: #8B5CF6;
  --color-coral: #ED6F5C;
  --color-honey: #E9B94A;
  --color-cheshire: #A8E063;

  /* Aliases to prevent CSS named-color parser collisions */
  --c-looking: var(--color-violet);
  --c-candle: var(--color-coral);

  /* Surface & Hairlines */
  --hairline: 1px solid rgba(246, 239, 226, 0.10);
  --hairline-strong: 1px solid rgba(246, 239, 226, 0.18);
  --hairline-faint: 1px solid rgba(246, 239, 226, 0.06);
  --inner-highlight: inset 0 1px 0 rgba(246, 239, 226, 0.08);

  /* Typography Stacks */
  --font-display: 'Fraunces', 'Instrument Serif', 'GT Super', Georgia, serif;
  --font-body: 'Space Grotesk', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, ui-monospace, monospace;

  /* Typography Scales */
  --display-clamp: clamp(2.75rem, 9vw, 8rem);
  --display-leading: 0.96;
  --display-tracking: -0.02em;
  --body-size: 1rem;
  --body-leading: 1.6;
  --mono-size: 0.8125rem;
  --mono-leading: 1.45;
  --mono-tracking: 0.14em;

  /* Spacing Scale (strict 0..120) */
  --space-0: 0px;
  --space-1: 1px;
  --space-2: 2px;
  --space-4: 4px;
  --space-6: 6px;
  --space-8: 8px;
  --space-10: 10px;
  --space-12: 12px;
  --space-14: 14px;
  --space-16: 16px;
  --space-20: 20px;
  --space-24: 24px;
  --space-28: 28px;
  --space-32: 32px;
  --space-36: 36px;
  --space-40: 40px;
  --space-48: 48px;
  --space-56: 56px;
  --space-64: 64px;
  --space-72: 72px;
  --space-80: 80px;
  --space-96: 96px;
  --space-120: 120px;

  /* Radius Scale */
  --radius-none: 0px;
  --radius-xs: 2px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 9999px;

  /* Motion Curves */
  --ease-gentle: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 180ms;
  --dur-base: 320ms;
  --dur-slow: 600ms;

  /* Glass Blur Ceiling */
  --glass-blur-max: 20px;
}

/* Base Reset & Document Defaults */
*, *::before, *::after {
  box-sizing: border-box;
  margin: var(--space-0);
  padding: var(--space-0);
}

html {
  background-color: var(--color-void);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: var(--body-leading);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-void);
  color: var(--color-text);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Numerics & Monospace Contract */
.tabular-nums,
[data-mono],
code,
kbd,
samp {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Cross-Hatch Engraving Texture Overlay (≤4% opacity, fixed, non-scrolling) */
.engraving-overlay {
  position: fixed;
  inset: var(--space-0);
  pointer-events: none;
  z-index: 10;
  opacity: 0.035;
  background-image:
    repeating-linear-gradient(45deg, rgba(246, 239, 226, 0.20) 0px, rgba(246, 239, 226, 0.20) 1px, transparent 0px, transparent 8px),
    repeating-linear-gradient(-45deg, rgba(246, 239, 226, 0.20) 0px, rgba(246, 239, 226, 0.20) 1px, transparent 0px, transparent 8px);
}

/* Candle-Aurora Glow Field */
.candle-aurora-glow {
  position: absolute;
  pointer-events: none;
  border-radius: var(--radius-pill);
  background: radial-gradient(circle, rgba(139, 92, 246, 0.22) 0%, rgba(237, 111, 92, 0.12) 45%, transparent 70%);
  filter: blur(40px);
}

/* ==========================================================================
   Component Primitives (Owned by System)
   ========================================================================== */

/* 5.1 Glass Plate (Curiosity Cabinet Double-Bezel) */
.glass-plate {
  background: rgba(246, 239, 226, 0.04);
  border: var(--hairline);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  position: relative;
  box-shadow: var(--inner-highlight);
  transition: border-color var(--dur-fast) var(--ease-gentle), transform var(--dur-base) var(--ease-gentle);
}

.glass-plate-inner {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-24);
  position: relative;
  box-shadow: var(--inner-highlight);
  border: var(--hairline-faint);
}

/* Ornamental corner brackets on plates */
.glass-plate-ornament::before,
.glass-plate-ornament::after {
  content: '';
  position: absolute;
  width: var(--space-8);
  height: var(--space-8);
  border-color: rgba(233, 185, 74, 0.40);
  pointer-events: none;
}
.glass-plate-ornament::before {
  top: var(--space-10);
  left: var(--space-10);
  border-top: 1px solid rgba(233, 185, 74, 0.40);
  border-left: 1px solid rgba(233, 185, 74, 0.40);
}
.glass-plate-ornament::after {
  bottom: var(--space-10);
  right: var(--space-10);
  border-bottom: 1px solid rgba(233, 185, 74, 0.40);
  border-right: 1px solid rgba(233, 185, 74, 0.40);
}

/* Focal-only glass blur layer (single blur property per block) */
.glass-focal {
  backdrop-filter: blur(16px);
  background: rgba(21, 14, 34, 0.76);
}

/* 5.2 Eyebrow Tag */
.eyebrow-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-4) var(--space-10);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--c-looking);
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.30);
  white-space: nowrap;
}

.eyebrow-tag.cheshire {
  color: var(--color-cheshire);
  background: rgba(168, 224, 99, 0.12);
  border-color: rgba(168, 224, 99, 0.30);
}

.eyebrow-tag.honey {
  color: var(--color-honey);
  background: rgba(233, 185, 74, 0.12);
  border-color: rgba(233, 185, 74, 0.30);
}

/* 5.3 Pocket-Watch Button */
.btn-watch {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
  padding: var(--space-12) var(--space-24);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.9375rem;
  line-height: 1.2;
  background: var(--c-looking);
  color: var(--color-void);
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-gentle),
              color var(--dur-fast) var(--ease-gentle),
              transform var(--dur-fast) var(--ease-gentle),
              box-shadow var(--dur-fast) var(--ease-gentle);
}

.btn-watch:hover {
  background: var(--c-candle);
  color: var(--color-void);
  box-shadow: 0 0 20px rgba(237, 111, 92, 0.25);
  transform: translateY(-1px);
}

.btn-watch .watch-fob {
  width: var(--space-24);
  height: var(--space-24);
  border-radius: var(--radius-pill);
  background: rgba(11, 6, 18, 0.20);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--dur-fast) var(--ease-gentle);
}

.btn-watch:hover .watch-fob {
  transform: translateX(2px);
}

.btn-watch-ghost {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-12) var(--space-20);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.9375rem;
  line-height: 1.2;
  background: transparent;
  color: var(--color-text);
  border: var(--hairline-strong);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-gentle),
              border-color var(--dur-fast) var(--ease-gentle),
              color var(--dur-fast) var(--ease-gentle);
}

.btn-watch-ghost:hover {
  background: var(--color-surface-raised);
  border-color: rgba(246, 239, 226, 0.32);
  color: var(--color-text);
}

/* 5.4 Caption Plate (The Mirror Surface) */
.caption-plate {
  background: var(--color-parchment);
  color: var(--color-void);
  border-radius: var(--radius-lg);
  padding: var(--space-20);
  box-shadow: 0 12px 36px rgba(11, 6, 18, 0.40);
  border: 1px solid rgba(246, 239, 226, 0.20);
}

.caption-plate h3,
.caption-plate h4 {
  color: var(--color-void);
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

.caption-plate p {
  color: #1F1533;
  font-family: var(--font-body);
  font-size: 0.875rem;
}

.caption-plate-rule {
  border: var(--space-0);
  border-top: 1px solid rgba(11, 6, 18, 0.15);
  margin: var(--space-12) var(--space-0);
}

.caption-plate-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #1F1533;
  display: flex;
  justify-content: space-between;
  text-transform: uppercase;
  letter-spacing: 0.10em;
}

/* 5.5 Roman-Numeral Section Mark */
.section-mark {
  display: flex;
  align-items: center;
  gap: var(--space-16);
  width: 100%;
  margin-bottom: var(--space-32);
}

.section-mark-num {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--color-honey);
  letter-spacing: 0.08em;
  line-height: 1;
}

.section-mark-rule {
  flex: 1;
  height: 1px;
  background: rgba(246, 239, 226, 0.10);
}

.section-mark-title {
  font-family: var(--font-mono);
  font-size: var(--mono-size);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: var(--mono-tracking);
}

/* Form / Input Primitives */
.input-ledger {
  background: var(--color-surface);
  border: var(--hairline-strong);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: var(--mono-size);
  padding: var(--space-12) var(--space-16);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-gentle), box-shadow var(--dur-fast) var(--ease-gentle);
  width: 100%;
}

.input-ledger:focus {
  border-color: var(--c-looking);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.25);
}

.input-ledger::placeholder {
  color: var(--color-text-muted);
  opacity: 0.7;
}

/* Tabular Cell / Mono Ledger Row */
.ledger-cell {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--mono-size);
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.ledger-cell-label {
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.6875rem;
}

.ledger-cell-value {
  color: var(--color-honey);
  font-weight: 500;
}

/* ==========================================================================
   Accessibility & Floors
   ========================================================================== */

/* Focus-visible floor requirement */
:focus-visible {
  outline: 2px solid var(--c-looking);
  outline-offset: 2px;
}

/* Reduced Motion Mandatory Fallback */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .candle-aurora-glow {
    filter: none;
  }
}
