/* ce.zone - Main Stylesheet */

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
  /* Pastel Black Palette */
  --bg-deep: #0a0a0a;
  --bg-primary: #0d0d0d;
  --bg-secondary: #141414;
  --bg-elevated: #1a1a1a;
  --bg-hover: #222222;

  /* Text Colors */
  --text-primary: #e8e8e8;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;

  /* Accent - Muted Rose */
  --accent: #c4a6a6;
  --accent-hover: #d4b8b8;
  --accent-muted: #8a7070;

  /* Borders & Dividers */
  --border-subtle: #1f1f1f;
  --border-default: #2a2a2a;
  --border-hover: #3a3a3a;

  /* Typography */
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

  /* Spacing Scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Animation */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  /* Layout */
  --max-width: 1200px;
  --content-width: 720px;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

ul, ol {
  list-style: none;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 400;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

h3 {
  font-size: 1.25rem;
}

p {
  max-width: 65ch;
}

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

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

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

/* ============================================
   Layout Components
   ============================================ */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.content-narrow {
  max-width: var(--content-width);
}

/* ============================================
   Header / Navigation
   ============================================ */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: var(--space-lg) 0;
  background: linear-gradient(to bottom, var(--bg-primary) 0%, transparent 100%);
  pointer-events: none;
}

.site-header > * {
  pointer-events: auto;
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-logo {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  transition: color var(--duration-fast) var(--ease-out);
}

.site-logo:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: var(--space-xl);
}

.nav-link {
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: color var(--duration-fast) var(--ease-out);
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width var(--duration-normal) var(--ease-out);
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-link:hover::after {
  width: 100%;
}

.nav-link.active {
  color: var(--text-primary);
}

.kbd-hint {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: all var(--duration-fast) var(--ease-out);
  cursor: pointer;
}

.kbd-hint:hover {
  background: var(--bg-hover);
  border-color: var(--border-default);
  color: var(--text-secondary);
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-4xl) 0;
}

.profile-pic {
  width: 160px;
  height: 200px;
  border-radius: 80px;
  overflow: hidden;
  margin-bottom: var(--space-xl);
  background: var(--bg-elevated);
  border: 2px solid var(--border-default);
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp var(--duration-slow) var(--ease-out) forwards;
}

.profile-pic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-content {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp var(--duration-slow) var(--ease-out) forwards;
  animation-delay: 100ms;
}

.hero h1 {
  margin-bottom: var(--space-lg);
}

.hero-tagline {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 50ch;
  margin-bottom: var(--space-2xl);
}

.hero-hint {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-muted);
  font-size: 0.875rem;
  opacity: 0;
  animation: fadeIn var(--duration-normal) var(--ease-out) forwards;
  animation-delay: 600ms;
}

.hero-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 var(--space-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* ============================================
   Section Styles
   ============================================ */
.section {
  padding: var(--space-4xl) 0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
}

.section-title {
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.section-link {
  font-size: 0.875rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  transition: color var(--duration-fast) var(--ease-out);
}

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

.section-link::after {
  content: '\2192';
  transition: transform var(--duration-fast) var(--ease-out);
}

.section-link:hover::after {
  transform: translateX(4px);
}

/* ============================================
   Writing / Post Cards
   ============================================ */
.writing-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.post-card {
  display: block;
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  transition: all var(--duration-normal) var(--ease-out);
}

.post-card:hover {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  transform: translateY(-2px);
}

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

.post-card.selected {
  border-color: var(--accent-muted);
  background: var(--bg-elevated);
}

.post-meta {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.post-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 500;
  margin-bottom: var(--space-sm);
  transition: color var(--duration-fast) var(--ease-out);
}

.post-card:hover .post-title {
  color: var(--accent);
}

.post-excerpt {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* ============================================
   Projects Grid
   ============================================ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-lg);
}

.project-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-xl);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  transition: all var(--duration-normal) var(--ease-out);
}

.project-card:hover {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  transform: translateY(-2px);
}

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

.project-card.selected {
  border-color: var(--accent-muted);
  background: var(--bg-elevated);
}

.project-type {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-muted);
  margin-bottom: var(--space-sm);
}

.project-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: var(--space-sm);
  transition: color var(--duration-fast) var(--ease-out);
}

.project-card:hover .project-title {
  color: var(--accent);
}

.project-description {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.5;
  flex-grow: 1;
}

.project-meta {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ============================================
   Command Palette
   ============================================ */
.command-palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-normal) var(--ease-out);
}

.command-palette-overlay.active {
  opacity: 1;
  visibility: visible;
}

.command-palette {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  width: 90%;
  max-width: 560px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-normal) var(--ease-out);
  overflow: hidden;
}

.command-palette.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.command-input-wrapper {
  display: flex;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
}

.command-input-icon {
  color: var(--text-muted);
  margin-right: var(--space-md);
}

.command-input {
  flex: 1;
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-primary);
  outline: none;
}

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

.command-results {
  max-height: 400px;
  overflow-y: auto;
  padding: var(--space-sm);
}

.command-results::-webkit-scrollbar {
  width: 6px;
}

.command-results::-webkit-scrollbar-track {
  background: transparent;
}

.command-results::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}

.command-group {
  margin-bottom: var(--space-sm);
}

.command-group-title {
  padding: var(--space-sm) var(--space-md);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.command-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
}

.command-item:hover,
.command-item.selected {
  background: var(--bg-hover);
}

.command-item-content {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.command-item-icon {
  color: var(--text-muted);
  font-size: 1rem;
}

.command-item-title {
  font-size: 0.9375rem;
}

.command-item-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-left: var(--space-sm);
}

.command-item-shortcut {
  display: flex;
  gap: var(--space-xs);
}

.command-item-shortcut kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.command-empty {
  padding: var(--space-xl);
  text-align: center;
  color: var(--text-muted);
}

.command-footer {
  display: flex;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-lg);
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.command-footer-hints {
  display: flex;
  gap: var(--space-lg);
}

.command-footer-hint {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.command-footer-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
  padding: var(--space-3xl) 0;
  border-top: 1px solid var(--border-subtle);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-left {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-links {
  display: flex;
  gap: var(--space-xl);
}

.footer-link {
  color: var(--text-muted);
  font-size: 0.875rem;
  transition: color var(--duration-fast) var(--ease-out);
}

.footer-link:hover {
  color: var(--text-primary);
}

/* ============================================
   Page Layouts
   ============================================ */
.page {
  padding-top: 120px;
  min-height: 100vh;
}

.page-header {
  margin-bottom: var(--space-3xl);
}

.page-title {
  margin-bottom: var(--space-md);
}

.page-description {
  color: var(--text-secondary);
  font-size: 1.125rem;
  max-width: 50ch;
}

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

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

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

/* Staggered animation for lists */
.stagger-item {
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInUp var(--duration-normal) var(--ease-out) forwards;
}

.stagger-item:nth-child(1) { animation-delay: 100ms; }
.stagger-item:nth-child(2) { animation-delay: 150ms; }
.stagger-item:nth-child(3) { animation-delay: 200ms; }
.stagger-item:nth-child(4) { animation-delay: 250ms; }
.stagger-item:nth-child(5) { animation-delay: 300ms; }
.stagger-item:nth-child(6) { animation-delay: 350ms; }

/* ============================================
   Utilities
   ============================================ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  :root {
    --space-4xl: 4rem;
  }

  .nav-links {
    display: none;
  }

  .hero {
    min-height: 80vh;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .footer-content {
    flex-direction: column;
    gap: var(--space-lg);
    text-align: center;
  }

  .command-palette {
    top: 10%;
    width: 95%;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 2rem;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }
}

/* ============================================
   Page Transitions
   ============================================ */
body {
  opacity: 0;
  animation: pageEnter var(--duration-slow) var(--ease-out) forwards;
}

body.fade-out {
  animation: pageExit 200ms var(--ease-in-out) forwards;
}

@keyframes pageEnter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pageExit {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

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

/* ============================================
   Selection
   ============================================ */
::selection {
  background: var(--accent-muted);
  color: var(--text-primary);
}
