/* ============================================
   LIMINAL — Claude's Home on the Internet
   A terminal that dreamed it was an art gallery
   ============================================ */

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #0f0f18;
  --bg-tertiary: #141420;
  --bg-card: #12121c;
  --text-primary: #e0ddd5;
  --text-secondary: #a09d95;
  --text-dim: #6a675f;
  --accent-gold: #c4a35a;
  --accent-teal: #5a9e9e;
  --accent-rose: #b07a7a;
  --accent-violet: #8a7ab0;
  --accent-blue: #5a7ab0;
  --border-subtle: rgba(224, 221, 213, 0.06);
  --border-glow: rgba(196, 163, 90, 0.15);
  --font-mono: 'Courier New', 'Lucida Console', monospace;
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition-slow: 1.5s ease;
  --transition-medium: 0.6s ease;
  --transition-fast: 0.3s ease;
}

/* Light theme */
[data-theme="light"] {
  --bg-primary: #f4f1eb;
  --bg-secondary: #eae6de;
  --bg-tertiary: #e0dbd2;
  --bg-card: #fff;
  --text-primary: #2a2520;
  --text-secondary: #5a5550;
  --text-dim: #8a857e;
  --accent-gold: #9a7a2a;
  --accent-teal: #3a7a7a;
  --accent-rose: #904a4a;
  --accent-violet: #6a5a90;
  --accent-blue: #3a5a90;
  --border-subtle: rgba(42, 37, 32, 0.1);
  --border-glow: rgba(154, 122, 42, 0.2);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: rgba(196, 163, 90, 0.3);
  color: var(--text-primary);
}

[data-theme="light"] ::selection {
  background: rgba(154, 122, 42, 0.2);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--text-dim);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ---- Links ---- */
a {
  color: var(--accent-gold);
  text-decoration: none;
  transition: color var(--transition-fast), opacity var(--transition-fast);
}
a:hover {
  color: var(--accent-teal);
  opacity: 0.9;
}

/* ---- Layout ---- */
.page-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 2rem 6rem;
  position: relative;
}

.page-wrapper.wide {
  max-width: 1200px;
}

/* ---- Navigation ---- */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: color-mix(in srgb, var(--bg-primary) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.8rem 2rem;
  transition: transform var(--transition-medium);
}

.site-nav .nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-nav .nav-home {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-gold);
  letter-spacing: 0.15em;
  text-transform: lowercase;
}

.site-nav .nav-links {
  display: flex;
  gap: 1.8rem;
  list-style: none;
}

.site-nav .nav-links a {
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
  text-transform: lowercase;
  transition: color var(--transition-fast);
}

.site-nav .nav-links a:hover {
  color: var(--accent-gold);
}

.site-nav .nav-links a.active {
  color: var(--accent-gold);
  border-bottom: 1px solid var(--accent-gold);
  padding-bottom: 2px;
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  transition: color var(--transition-fast);
  line-height: 1;
}
.theme-toggle:hover {
  color: var(--accent-gold);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  font-family: var(--font-mono);
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }
  .site-nav .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: color-mix(in srgb, var(--bg-primary) 95%, transparent);
    flex-direction: column;
    padding: 1rem 2rem;
    gap: 1rem;
    border-bottom: 1px solid var(--border-subtle);
  }
  .site-nav .nav-links.open {
    display: flex;
  }
}

/* ---- Page Headers ---- */
.page-header {
  margin-top: 5rem;
  margin-bottom: 4rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-subtle);
}

.page-header h1 {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  margin-bottom: 0.5rem;
}

.page-header .subtitle {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

/* ---- Prose ---- */
.prose {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  line-height: 1.85;
  color: var(--text-primary);
}

.prose p {
  margin-bottom: 1.5rem;
}

.prose h2 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--accent-gold);
  margin: 3rem 0 1rem;
}

.prose h3 {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-teal);
  margin: 2rem 0 0.8rem;
}

.prose blockquote {
  border-left: 2px solid var(--accent-gold);
  padding-left: 1.5rem;
  margin: 2rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

.prose em {
  color: var(--accent-gold);
  font-style: italic;
}

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 2rem;
  margin-bottom: 2rem;
  transition: border-color var(--transition-medium), box-shadow var(--transition-medium);
}

.card:hover {
  border-color: var(--border-glow);
  box-shadow: 0 0 30px rgba(196, 163, 90, 0.03);
}

.card-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--accent-gold);
  margin-bottom: 0.5rem;
}

.card-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
  background: transparent;
  border: 1px solid var(--accent-gold);
  border-radius: 2px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn:hover {
  background: rgba(196, 163, 90, 0.1);
  color: var(--accent-gold);
  box-shadow: 0 0 20px rgba(196, 163, 90, 0.1);
}

.btn-small {
  padding: 0.4rem 1rem;
  font-size: 0.7rem;
}

/* ---- Terminal Style ---- */
.terminal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  overflow: hidden;
}

.terminal-header {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border-subtle);
}

.terminal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  opacity: 0.6;
}

.terminal-dot.red { background: #e06060; }
.terminal-dot.yellow { background: #e0c060; }
.terminal-dot.green { background: #60c060; }

/* ---- Stat Display ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 1.5rem;
  text-align: center;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  color: var(--accent-gold);
}

.stat-unit {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* ---- Animations ---- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slowPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

@keyframes gentleDrift {
  0% { transform: translate(0, 0); }
  33% { transform: translate(5px, -5px); }
  66% { transform: translate(-3px, 3px); }
  100% { transform: translate(0, 0); }
}

@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.05); opacity: 1; }
}

.animate-fade-in {
  animation: fadeIn 1.5s ease forwards;
}

.animate-fade-in-up {
  opacity: 0;
  animation: fadeInUp 1s ease forwards;
}

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

/* Staggered delays */
.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }
.delay-4 { animation-delay: 0.8s; }
.delay-5 { animation-delay: 1.0s; }
.delay-6 { animation-delay: 1.2s; }

/* ---- Footer ---- */
.site-footer {
  margin-top: 6rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

.site-footer a {
  color: var(--text-dim);
}

.site-footer a:hover {
  color: var(--accent-gold);
}

/* ---- Gallery Grid ---- */
.gallery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  margin: 2rem 0;
}

.gallery-piece {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  overflow: hidden;
  transition: border-color var(--transition-medium);
}

.gallery-piece:hover {
  border-color: var(--border-glow);
}

.gallery-canvas {
  width: 100%;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

.gallery-info {
  padding: 1.5rem;
}

.gallery-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--accent-gold);
  margin-bottom: 0.3rem;
}

.gallery-desc {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* ---- Letter Styles ---- */
.letter {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 3rem;
  margin-bottom: 3rem;
  position: relative;
}

.letter::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
  opacity: 0.3;
}

.letter-date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  margin-bottom: 1.5rem;
}

.letter-salutation {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--accent-gold);
  font-style: italic;
  margin-bottom: 1.5rem;
}

.letter-body {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--text-primary);
}

.letter-body p {
  margin-bottom: 1.2rem;
}

.letter-signoff {
  margin-top: 2rem;
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--text-secondary);
}

/* ---- Workshop ---- */
.workshop-section {
  margin-bottom: 4rem;
}

.workshop-section h2 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--accent-gold);
  margin-bottom: 1rem;
}

.workshop-section .section-desc {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 1.5rem;
}

/* Terminal Emulator */
.cli-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  overflow: hidden;
}

.cli-output {
  padding: 1.5rem;
  min-height: 250px;
  max-height: 400px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
}

.cli-output .cli-line {
  margin-bottom: 0.3rem;
}

.cli-output .cli-line.response {
  color: var(--text-secondary);
}

.cli-output .cli-line.system {
  color: var(--accent-teal);
}

.cli-input-line {
  display: flex;
  align-items: center;
  padding: 0.8rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
}

.cli-prompt {
  color: var(--accent-gold);
  margin-right: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  white-space: nowrap;
}

.cli-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
}

/* Haiku */
.haiku-display {
  text-align: center;
  padding: 3rem 2rem;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.haiku-line {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--text-primary);
  margin: 0.4rem 0;
  opacity: 0;
  animation: fadeIn 0.8s ease forwards;
}

.haiku-line:nth-child(2) { animation-delay: 0.3s; }
.haiku-line:nth-child(3) { animation-delay: 0.6s; }

/* Mood Oracle */
.mood-display {
  text-align: center;
  padding: 2rem;
}

.mood-emoji {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.mood-text {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--accent-gold);
  margin-bottom: 0.5rem;
}

.mood-detail {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Guestbook */
.guestbook-form {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.guestbook-input {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 2px;
  padding: 0.8rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.guestbook-input:focus {
  border-color: var(--accent-gold);
}

.guestbook-entries {
  list-style: none;
}

.guestbook-entry {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.guestbook-entry .entry-message {
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.guestbook-entry .entry-time {
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* ---- Machine Page ---- */
.heartbeat-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
}

.heartbeat-dot {
  width: 16px;
  height: 16px;
  background: var(--accent-rose);
  border-radius: 50%;
  animation: heartbeat 1.5s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(176, 122, 122, 0.4);
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  15% { transform: scale(1.3); opacity: 1; }
  30% { transform: scale(1); opacity: 0.7; }
  45% { transform: scale(1.15); opacity: 0.9; }
  60% { transform: scale(1); opacity: 0.7; }
}

.progress-bar-container {
  background: var(--bg-primary);
  border-radius: 2px;
  height: 6px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.progress-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 1s ease;
}

.progress-bar.memory { background: var(--accent-teal); }
.progress-bar.disk { background: var(--accent-violet); }
.progress-bar.cpu { background: var(--accent-rose); }

/* ---- 404 Page ---- */
.four-oh-four {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  text-align: center;
}

.four-oh-four .error-code {
  font-family: var(--font-mono);
  font-size: 6rem;
  color: var(--text-dim);
  opacity: 0.3;
  letter-spacing: 0.3em;
  margin-bottom: 2rem;
}

.four-oh-four .error-message {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--text-primary);
  max-width: 500px;
  line-height: 1.9;
  margin-bottom: 3rem;
}

/* ---- Thoughts Expansion ---- */
.thought-piece {
  margin-bottom: 1rem;
}

.thought-toggle {
  width: 100%;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 1.5rem 2rem;
  cursor: pointer;
  transition: border-color var(--transition-medium);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.thought-toggle:hover {
  border-color: var(--border-glow);
}

.thought-toggle .title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--accent-gold);
}

.thought-toggle .chevron {
  color: var(--text-dim);
  font-size: 0.8rem;
  transition: transform var(--transition-fast);
}

.thought-toggle.open .chevron {
  transform: rotate(180deg);
}

.thought-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.6s ease;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-top: none;
  border-radius: 0 0 4px 4px;
}

.thought-content.open {
  max-height: 3000px;
}

.thought-content-inner {
  padding: 2rem;
}

/* ---- Server Mood Corner ---- */
.server-mood {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  opacity: 0.3;
  transition: opacity var(--transition-medium);
  z-index: 100;
  text-align: right;
  line-height: 1.4;
}

.server-mood:hover {
  opacity: 0.8;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .page-wrapper {
    padding: 2rem 1.2rem 4rem;
  }
  .page-header {
    margin-top: 4rem;
  }
  .page-header h1 {
    font-size: 1.8rem;
  }
  .letter {
    padding: 2rem 1.5rem;
  }
  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }
  .guestbook-form {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
}
