:root {
  --bg: #f5f1e8;
  --text: #2c2c2c;
  --muted: #8b8b8b;
  --accent: #d4a574;
  --accent-hover: #c89558;
  --ring: #d4a57440;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
  color: var(--text);
  background: var(--bg);
}

.site-header { 
  padding: 1rem 2rem 0.5rem;
  text-align: center;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(1.5rem, 2vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.5px;
}

.subtitle { 
  margin: 0.2rem 0 0;
  color: var(--accent);
  font-size: 1rem;
  font-weight: 500;
}

.layout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  min-height: calc(100dvh - 200px);
  padding: 1rem;
  flex-wrap: wrap;
}

.viewer { 
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  flex-shrink: 0;
  position: relative;
}

.viewer-frame {
  width: min(80vh,80vw);
  height: min(80vh,80vw);
  background: #000;
  border-radius: 32px;
  border: 2px solid #e0dcd3;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  position: relative;
}

#sketchFrame {
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}

.description-panel {
  width: 200px;
  height: min(80vh, 80vw);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 1.5rem;
  flex-shrink: 0;
}

.project-description {
  margin: 0;
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1.6;
  font-weight: 160;
  text-align: right;
  max-width: 100%;
  word-wrap: break-word;
  opacity: 0;
  transform: translateX(30px);
}

.project-description.fade-in-left {
  animation: fadeInFromRight 1.8s ease-out forwards;
}

@keyframes fadeInFromRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.project-strip {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  height: min(80vh,80vw);
  flex-shrink: 0;
}

.nav-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 0.5rem;
  font-size: 1.25rem;
  display: none;
}

.project-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
  padding: 1rem;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--muted) transparent;
  border-radius: 16px;
  background: transparent;
  border: none;
  flex: 1;
}

.project-list::-webkit-scrollbar {
  width: 6px;
}

.project-list::-webkit-scrollbar-track {
  background: transparent;
}

.project-list::-webkit-scrollbar-thumb {
  background: var(--muted);
  border-radius: 3px;
}

.project-list::-webkit-scrollbar-thumb:hover {
  background: var(--text);
}

.project-item { 
  scroll-snap-align: start;
}

.project-button {
  padding: 0;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--text);
  white-space: normal;
  word-wrap: break-word;
  cursor: pointer;
  font-size: 1rem;
  font-family: inherit;
  text-align: left;
  transition: all 0.3s ease;
  font-weight: 500;
}

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

.project-button[aria-current="true"] {
  background: transparent;
  color: var(--accent);
  border-color: transparent;
  font-weight: 600;
}

.site-footer { 
  color: var(--muted); 
  text-align: center; 
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
}

.site-footer a { 
  color: var(--accent); 
  text-decoration: none;
  transition: color 0.2s ease;
}

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

@media (max-width: 1400px) {
  .layout {
    flex-direction: column;
    gap: 2rem;
  }
  
  .project-strip {
    width: 100%;
    height: auto;
    max-height: 300px;
  }
  
  .viewer {
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .description-panel {
    width: 100%;
    height: auto;
    padding: 0;
    justify-content: center;
    text-align: center;
  }
  
  .project-description {
    text-align: center;
  }
  
  .viewer-frame {
    width: min(90vw, 800px);
    height: min(90vw, 800px);
  }
  
  .project-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .site-header {
    padding: 1rem 0.5rem 0.5rem;
  }
  
  .layout {
    padding: 1rem 2rem;
    gap: 1rem;
  }
  
  .viewer-frame {
    width: min(95vw, 500px);
    height: min(95vw, 500px);
  }
  
  .project-strip {
    height: auto;
    max-height: 200px;
  }
  
  .project-list {
    flex-direction: row;
    overflow-x: auto;
  }
  
  .project-button {
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
  }
}