/* index.css */

:root {
  /* Colors - Editorial Warm Dark Theme */
  --bg: #0a0b0d;
  --surface: #101115;
  --border: rgba(253, 252, 247, 0.07);
  --text-primary: #fdfcf7;
  --text-secondary: #a9a9b2;
  --text-muted: #5b5c65;
  --accent: #d4a373;
  --accent-hover: #c59464;
  --up: #a3b18a;
  --down: #e07a5f;
  --neutral: #e9c46a;

  /* Typography */
  --font-display: 'Playfair Display', serif;
  --font-body: 'Instrument Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.5rem;

  /* Spacing Base Scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-9: 36px;
  --space-10: 40px;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms ease;

  /* Dynamic padding vars initialized by script */
  --pt: 64px;
  --pb: 64px;
  --pl: 64px;
  --pr: 64px;
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background-color: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Background Canvas */
#background-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
}

/* Page Header */
.page-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border);
  z-index: 10;
  background-color: rgba(10, 11, 13, 0.85);
  backdrop-filter: blur(4px);
}

.header-logo {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.header-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--down);
  animation: pulse-dot 2s infinite ease-in-out;
}

.status-text {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Main Wrapper & Layout */
.main-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
  padding: var(--space-6);
  z-index: 5;
}

/* Outer Layout Container showing dynamic padding bounds */
.debug-outer-container {
  position: relative;
  border: 1px dashed rgba(253, 252, 247, 0.15);
  background-color: rgba(253, 252, 247, 0.01);
  padding: var(--pt) var(--pr) var(--pb) var(--pl);
  transition: padding 50ms linear;
  max-width: 90%;
  margin: 0 auto;
}

/* Central Card hosting content */
.error-card {
  position: relative;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  max-width: 580px;
  overflow: hidden;
}

/* Fine-grid background overlay */
.grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
  opacity: 0.4;
  z-index: 1;
}

/* Inner elements styling */
.error-code {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--accent);
  margin-bottom: var(--space-4);
  position: relative;
  z-index: 2;
  letter-spacing: 0.05em;
}

.error-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 400;
  line-height: 1.25;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  position: relative;
  z-index: 2;
}

.error-desc {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
  position: relative;
  z-index: 2;
}

/* Interactive Actions */
.action-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  position: relative;
  z-index: 2;
}

.action-btn {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-primary);
  background-color: transparent;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-5);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  outline: none;
}

.action-btn:hover {
  background-color: var(--accent);
  color: var(--bg);
}

.action-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.action-subtext {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* Dynamic Padding Rulers */
.ruler {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  z-index: 3;
}

.ruler-line {
  background-image: linear-gradient(to bottom, var(--accent) 50%, transparent 50%);
  background-size: 1px 6px;
  background-repeat: repeat-y;
}

.ruler-label {
  background-color: var(--bg);
  padding: var(--space-1) var(--space-2);
  border: 1px solid rgba(212, 163, 115, 0.3);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* Ruler Alignments and Sizing */
.ruler-top {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  height: var(--pt);
  flex-direction: column;
}

.ruler-top .ruler-line {
  width: 1px;
  flex-grow: 1;
}

.ruler-bottom {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  height: var(--pb);
  flex-direction: column;
}

.ruler-bottom .ruler-line {
  width: 1px;
  flex-grow: 1;
}

.ruler-left {
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: var(--pl);
  flex-direction: row;
}

.ruler-left .ruler-line {
  height: 1px;
  flex-grow: 1;
  background-image: linear-gradient(to right, var(--accent) 50%, transparent 50%);
  background-size: 6px 1px;
  background-repeat: repeat-x;
}

.ruler-right {
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: var(--pr);
  flex-direction: row;
}

.ruler-right .ruler-line {
  height: 1px;
  flex-grow: 1;
  background-image: linear-gradient(to right, var(--accent) 50%, transparent 50%);
  background-size: 6px 1px;
  background-repeat: repeat-x;
}

/* Page Footer with Logs Console */
.page-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  border-top: 1px solid var(--border);
  background-color: rgba(10, 11, 13, 0.95);
  z-index: 10;
}

.debugger-panel {
  padding: var(--space-3) var(--space-6);
}

.debugger-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
  border-bottom: 1px solid rgba(253, 252, 247, 0.04);
  padding-bottom: var(--space-2);
}

.debugger-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

.debugger-speed {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--up);
}

.debugger-body {
  max-height: 80px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Custom Scrollbar for Logs */
.debugger-body::-webkit-scrollbar {
  width: 4px;
}
.debugger-body::-webkit-scrollbar-track {
  background: transparent;
}
.debugger-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.log-entry {
  color: var(--text-muted);
}
.log-system {
  color: var(--text-secondary);
}
.log-warn {
  color: var(--neutral);
}
.log-info {
  color: var(--accent);
}

/* Animations */
@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* Media Queries for Tablets and Desktop (Progressive Enhancement) */
@media (min-width: 768px) {
  :root {
    --text-2xl: 2.25rem;
    --text-3xl: 3rem;
  }
  
  .error-card {
    padding: var(--space-8);
  }
  
  .error-title {
    font-size: var(--text-3xl);
  }
  
  .error-desc {
    font-size: var(--text-base);
  }
  
  .action-panel {
    flex-direction: row;
    align-items: center;
    gap: var(--space-5);
  }

  .debugger-body {
    max-height: 100px;
  }
}

@media (min-width: 1200px) {
  .debug-outer-container {
    max-width: 800px;
  }
}
