/* ========================================
   SCRAPPY MINIMALISM
   Less is More - Intentionally Raw
   ======================================== */

:root {
  /* Near-monochrome palette with one subtle accent */
  --bg: #f5f5f0;
  --text: #1a1a1a;
  --text-muted: #666666;
  --accent: #c87a5a;
  --border: #333333;

  /* Simple spacing */
  --space-1: 1rem;
  --space-2: 2rem;
  --space-3: 3rem;
  --space-4: 4rem;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  height: 100%;
}

body {
  font-family: 'Intel One Mono', 'Courier New', Courier, Monaco, monospace;
  font-size: 1rem;
  line-height: 1.6;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  background: var(--bg);
  color: var(--text);
  position: relative;
  overflow-x: hidden;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* ========================================
   GRAIN OVERLAY
   Now handled by canvas for interactive ripples
   ======================================== */

/* ========================================
   LAYOUT - BARE ESSENTIALS
   ======================================== */
.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-2);
  width: 100%;
}

.content {
  text-align: center;
  max-width: 600px;
  width: 100%;
}

/* ========================================
   TYPOGRAPHY - SYSTEM MONOSPACE
   ======================================== */
.title {
  font-family: 'Intel One Mono', 'Courier New', Courier, Monaco, monospace;
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: bold;
  letter-spacing: 0;
  margin-bottom: var(--space-2);
  text-transform: none;
}

.subtitle {
  font-size: 1rem;
  font-weight: normal;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
  text-transform: lowercase;
}

.subtitle .pipe {
  opacity: 0.3;
  margin: 0 0.5em;
}

/* ========================================
   NAVIGATION - MINIMAL BORDERS
   ======================================== */
.nav-links {
  display: flex;
  gap: var(--space-1);
  justify-content: center;
  align-items: stretch;
  margin-top: var(--space-2);
  margin-bottom: var(--space-2);
  flex-wrap: wrap;
  width: 100%;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: normal;
  color: var(--text);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  transition: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.nav-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.nav-link:active {
  background: rgba(0, 0, 0, 0.05);
}

.interaction-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
  text-transform: lowercase;
}

/* ========================================
   ETHEREAL WHEEL - SIMPLIFIED
   ======================================== */
.ethereal-wheel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 100;
  display: none;
  padding: var(--space-2);
}

.ethereal-wheel.visible {
  display: block;
}

.ethereal-wheel-container {
  position: relative;
  height: 100%;
}

.ethereal-wheel-viewport {
  max-width: 400px;
  margin: 0 auto;
}

.ethereal-wheel-list {
  list-style: none;
}

.ethereal-wheel-item {
  padding: 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.ethereal-wheel-item.selected {
  color: var(--accent);
}

.ethereal-wheel-item.selected::before {
  content: '> ';
}

.ethereal-wheel-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.ethereal-wheel-selector {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent);
  pointer-events: none;
  opacity: 0.3;
  transform: translateY(-50%);
}

/* ========================================
   TRIE VISUALIZER - ASCII ART STYLE
   ======================================== */
.trie-visualizer {
  margin-top: var(--space-3);
  text-align: center;
}

.trie-container {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: var(--space-2);
  position: relative;
}

.trie-svg {
  display: block;
  max-width: min(600px, 90vw);
  max-height: min(400px, 50vh);
  height: auto;
  width: auto;
}

/* Simplify SVG elements */
.trie-svg line {
  stroke: var(--border);
  stroke-width: 1;
  stroke-linecap: square;
}

.trie-svg circle {
  fill: none;
  stroke: var(--border);
  stroke-width: 1;
  cursor: pointer;
}

.trie-svg circle.active {
  fill: var(--accent);
  stroke: var(--accent);
}

.trie-svg text {
  fill: var(--text);
  font-family: 'Courier New', Courier, Monaco, monospace;
  font-size: 12px;
  text-anchor: middle;
  dominant-baseline: middle;
}

.trie-dot {
  fill: var(--accent);
  stroke: none;
}

.trie-hint {
  margin-top: var(--space-1);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.trie-available-options {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  font-size: 0.7rem;
  font-family: 'Courier New', Courier, Monaco, monospace;
  color: var(--text-muted);
  text-align: left;
  background: none;
  border: none;
  padding: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  line-height: 1.4;
}

.trie-sequence-indicator {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: none;
}

/* ========================================
   GHOST TYPIST - MINIMAL
   ======================================== */
.ghost-typist {
  font-size: 0.9rem;
  color: var(--accent);
  text-align: center;
  margin-top: var(--space-2);
  margin-bottom: var(--space-1);
}

.ghost-typist.visible {
  display: block;
}

.ghost-typist-cursor {
  display: inline;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ========================================
   REMOVE AMBIENT/DECORATIVE ELEMENTS
   ======================================== */
.ambient-light {
  display: none;
}

/* ========================================
   RESPONSIVE - LESS IS MORE
   ======================================== */
@media (max-width: 768px) {
  /* Reposition and resize Three.js sphere for mobile */
  body > div[style*="position: fixed"] {
    width: 200px !important;
    height: 200px !important;
    top: 5vh !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
  }

  body > div[style*="position: fixed"] > canvas {
    width: 200px !important;
    height: 200px !important;
  }

  /* Hide other canvas effects but keep the sphere */
  canvas:not([data-engine="three.js"]) {
    opacity: 0.2 !important;
  }

  /* Ensure content is properly spaced and fits without scrolling */
  .container {
    position: relative;
    z-index: 1;
    padding: 1rem;
    padding-top: calc(5vh + 210px);
    justify-content: flex-start;
    min-height: 100vh;
    max-height: 100vh;
    overflow: hidden;
  }

  .content {
    max-width: 100%;
    padding: 0 var(--space-1);
  }

  .title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    line-height: 1.1;
    font-weight: 700;
    color: var(--text) !important;
    opacity: 1 !important;
  }

  .subtitle {
    font-size: 0.8rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
    letter-spacing: 0.03em;
  }

  .nav-links {
    flex-direction: column;
    gap: 0;
    margin-top: 0;
    margin-bottom: 0;
    max-width: 100%;
  }

  .nav-link {
    font-size: 0.85rem;
    padding: 0.875rem 0;
    width: 100%;
    border-left: none;
    border-right: none;
    border-top: none;
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.02em;
    text-align: left;
    justify-content: flex-start;
  }

  .nav-link:first-child {
    border-top: 1px solid var(--border);
  }

  .nav-link:active {
    background: rgba(200, 122, 90, 0.05);
  }

  .interaction-hint {
    display: none;
  }

  .trie-visualizer {
    display: none;
  }

  .ethereal-wheel {
    display: none !important;
  }

  .ghost-typist {
    display: none !important;
  }

  /* Hide any absolutely positioned decorative elements */
  .ambient-light,
  .trie-hint,
  .trie-available-options,
  .trie-sequence-indicator {
    display: none !important;
  }
}

@media (max-width: 480px) {
  /* Smaller sphere for small phones */
  body > div[style*="position: fixed"] {
    width: 180px !important;
    height: 180px !important;
    top: 4vh !important;
  }

  body > div[style*="position: fixed"] > canvas {
    width: 180px !important;
    height: 180px !important;
  }

  .container {
    padding: 1rem;
    padding-top: calc(4vh + 190px);
  }

  .title {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
  }

  .subtitle {
    font-size: 0.75rem;
    margin-bottom: 1.25rem;
  }

  .nav-link {
    font-size: 0.8rem;
    padding: 0.75rem 0;
  }
}

/* Landscape mobile - keep it simple */
@media (max-width: 768px) and (max-height: 500px) and (orientation: landscape) {
  .container {
    padding: var(--space-2);
    justify-content: flex-start;
  }

  .title {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
  }

  .subtitle {
    font-size: 0.75rem;
    margin-bottom: var(--space-1);
  }

  .nav-links {
    margin-bottom: var(--space-1);
  }

  .nav-link {
    padding: 0.625rem 0.75rem;
    font-size: 0.8rem;
  }
}

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

  body::before {
    animation: none;
  }
}

@media (prefers-contrast: high) {
  :root {
    --bg: #ffffff;
    --text: #000000;
    --text-muted: #333333;
    --accent: #cc0000;
    --border: #000000;
  }
}

/* Selection styling */
::selection {
  background: var(--accent);
  color: var(--bg);
}

::-moz-selection {
  background: var(--accent);
  color: var(--bg);
}

/* Focus states */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
