/* VS Code Theme */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary: #1e1e1e;
  --bg-secondary: #252526;
  --bg-tertiary: #2d2d2d;
  --bg-hover: #2a2d2e;
  --bg-active: #37373d;
  --bg-tab: #1e1e1e;
  --bg-tab-active: #1e1e1e;
  --bg-tab-inactive: #2d2d2d;
  --border-color: #3c3c3c;
  --text-primary: #cccccc;
  --text-secondary: #969696;
  --text-bright: #e7e7e7;
  --accent: #007acc;
  --accent-hover: #1c97ea;
  --accent-subtle: rgba(0, 122, 204, 0.15);
  --sidebar-width: 220px;
  --titlebar-height: 35px;
  --tabs-height: 35px;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, Ubuntu, 'Droid Sans', sans-serif;
  --font-mono: 'SF Mono', Monaco, Menlo, Consolas, 'Ubuntu Mono', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', monospace;

  /* Animation tokens */
  --transition-fast: 120ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease-out;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.4;
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Focus states for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Title Bar */
.titlebar {
  height: var(--titlebar-height);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 12px;
  color: var(--text-secondary);
  -webkit-app-region: drag;
}

.titlebar-icon {
  width: 16px;
  height: 16px;
  margin-right: 8px;
}

.titlebar-title {
  flex: 1;
  text-align: center;
  color: var(--text-secondary);
}

.titlebar-controls {
  display: flex;
  gap: 8px;
}

.titlebar-btn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
}

.titlebar-btn.close { background: #ff5f57; }
.titlebar-btn.minimize { background: #ffbd2e; }
.titlebar-btn.maximize { background: #28c840; }

/* Tabs Bar */
.tabs-bar {
  height: var(--tabs-height);
  background: var(--bg-tertiary);
  display: flex;
  align-items: flex-end;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.tab {
  height: calc(var(--tabs-height) - 1px);
  padding: 0 20px;
  background: var(--bg-tab-inactive);
  border-right: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.tab.active {
  background: var(--bg-tab-active);
  color: var(--text-bright);
  border-top: 2px solid var(--accent);
  margin-top: -1px;
}

.tab-icon {
  font-size: 14px;
}

.tab-close {
  opacity: 0;
  font-size: 14px;
  line-height: 1;
}

.tab:hover .tab-close {
  opacity: 0.7;
}

/* Main Container */
.main-container {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Activity Bar */
.activity-bar {
  width: 48px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 4px;
}

.activity-item {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.activity-item:hover {
  color: var(--text-bright);
  text-decoration: none;
}

.activity-item.active {
  color: var(--text-bright);
}

.activity-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
}

.activity-item::after {
  content: '';
  position: absolute;
  inset: 4px;
  background: var(--accent-subtle);
  border-radius: 6px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.activity-item:hover::after {
  opacity: 1;
}

.activity-icon {
  font-size: 24px;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
}

.folder {
  user-select: none;
}

.folder-header {
  display: flex;
  align-items: center;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
}

.folder-header:hover {
  background: var(--bg-hover);
}

.folder-icon {
  margin-right: 6px;
  font-size: 14px;
  color: var(--text-secondary);
}

.folder-name {
  font-weight: 600;
}

.file-list {
  list-style: none;
}

.file-item {
  display: block;
  padding: 4px 12px 4px 28px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.file-item:hover {
  background: var(--bg-hover);
  text-decoration: none;
}

.file-item.active {
  background: var(--bg-active);
  color: var(--text-bright);
}

.file-icon {
  margin-right: 6px;
  font-size: 14px;
}

.file-icon.js { color: #f7df1e; }
.file-icon.json { color: #f7df1e; }
.file-icon.md { color: #519aba; }
.file-icon.html { color: #e34c26; }

/* Editor Area */
.editor-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}

.editor-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 40px;
}

/* Content entrance animation */
.editor-content > .content,
.editor-content > article {
  animation: fadeInUp var(--transition-slow) both;
}

/* Content Styles */
.content h1 {
  font-size: 26px;
  font-weight: 400;
  color: var(--text-bright);
  margin-bottom: 20px;
  font-family: var(--font-ui);
  letter-spacing: -0.02em;
}

.content h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright);
  margin-top: 32px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.content p {
  margin-bottom: 16px;
  line-height: 1.7;
  max-width: 65ch;
}

.content .lead {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* Code Block Style for Hero */
.hero {
  padding: 60px 0 40px;
  animation: fadeInUp var(--transition-slow) both;
}

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

.hero h1 {
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--text-bright);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.hero h1::before {
  content: '// ';
  color: #6a9955;
}

.hero-subtitle {
  font-family: var(--font-mono);
  font-size: 14px;
  color: #6a9955;
  margin-bottom: 32px;
  line-height: 1.7;
  max-width: 55ch;
}

.hero-subtitle::before {
  content: '/* ';
}

.hero-subtitle::after {
  content: ' */';
}

.hero-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--accent);
  color: #ffffff;
  border: none;
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn:hover {
  background: var(--accent-hover);
  color: #ffffff;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 122, 204, 0.3);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: var(--bg-hover);
  color: var(--text-bright);
  border-color: var(--text-secondary);
  box-shadow: none;
  transform: translateY(-1px);
}

.btn-small {
  padding: 5px 12px;
  font-size: 12px;
}

.btn-danger {
  background: #f14c4c;
}

.btn-danger:hover {
  background: #d73a3a;
  box-shadow: 0 4px 12px rgba(241, 76, 76, 0.3);
}

/* Skills as Tags */
.skills-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skills-list li {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 4px 12px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: #9cdcfe;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.skills-list li:hover {
  border-color: #9cdcfe;
  background: rgba(156, 220, 254, 0.08);
}

/* Blog Posts */
.posts-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post-preview {
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.post-preview:hover {
  border-color: var(--text-secondary);
  transform: translateX(4px);
}

.post-preview h2 {
  margin: 0 0 8px 0;
  padding: 0;
  border: none;
  font-size: 15px;
}

.post-preview h2 a {
  color: #4fc1ff;
  transition: color var(--transition-fast);
}

.post-preview h2 a:hover {
  color: #7fd4ff;
  text-decoration: none;
}

.post-preview time {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  display: block;
  margin-bottom: 10px;
}

.post-preview p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Single Post */
.post-header {
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.post-header h1 {
  margin-bottom: 12px;
  line-height: 1.3;
}

.post-header time {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.post-content {
  font-size: 14px;
  line-height: 1.8;
}

.post-content h2 {
  font-size: 16px;
  margin-top: 32px;
}

.post-content p {
  margin-bottom: 16px;
  max-width: 65ch;
}

.post-content code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 0.9em;
  border-radius: 3px;
}

.post-content pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 16px;
  overflow-x: auto;
  margin: 20px 0;
}

.post-content pre code {
  background: none;
  padding: 0;
}

/* Inline blog images */
.post-content img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  display: block;
  margin: 20px 0;
}

.post-content .blog-image-row {
  display: flex;
  gap: 12px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.post-content .blog-image-row img {
  flex: 1;
  min-width: 200px;
  max-width: calc(50% - 6px);
  margin: 0;
  object-fit: contain;
  background: var(--bg-secondary);
}

.post-content .blog-image-full img {
  max-width: 100%;
}

.post-content .blog-image-caption {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  margin-top: -12px;
  margin-bottom: 20px;
  font-style: italic;
}

.post-footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

/* Contact */
.contact-info h2 {
  font-size: 14px;
  margin-top: 16px;
}

.social-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.social-links a {
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Admin */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.admin-section {
  margin-bottom: 24px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.admin-section h2 {
  margin: 0 0 12px 0;
  padding: 0;
  border: none;
  font-size: 14px;
}

.admin-section h3 {
  font-size: 13px;
  margin-top: 16px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-form label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.admin-form input,
.admin-form textarea {
  padding: 8px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.admin-form input:focus,
.admin-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.admin-form button {
  align-self: flex-start;
  margin-top: 8px;
}

.admin-post {
  margin: 12px 0;
  padding: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
}

.admin-post h4 {
  font-size: 13px;
  margin-bottom: 8px;
}

.post-date {
  font-weight: normal;
  color: var(--text-secondary);
  font-size: 11px;
}

.btn-group {
  display: flex;
  gap: 6px;
}

.delete-form {
  display: inline;
  margin-top: 8px;
}

/* Login */
.admin-login {
  max-width: 280px;
  margin: 40px auto;
  padding: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-form label {
  font-size: 12px;
  color: var(--text-secondary);
}

.login-form input {
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.error {
  color: #f14c4c;
  font-size: 12px;
  margin-bottom: 12px;
}

/* Status Bar */
.statusbar {
  height: 22px;
  background: var(--accent);
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 12px;
  color: #ffffff;
}

.statusbar-left, .statusbar-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.statusbar-right {
  margin-left: auto;
}

.statusbar-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-active);
}

/* Game Pages */
.game-page {
  text-align: center;
  animation: fadeInUp var(--transition-slow) both;
}

.game-instructions {
  color: #6a9955;
  font-family: var(--font-mono);
  font-size: 13px;
  margin-bottom: 24px;
  line-height: 1.6;
}

.game-container {
  display: inline-block;
  text-align: center;
}

.game-container canvas {
  border: 2px solid var(--border-color);
  display: block;
  margin: 0 auto;
  transition: border-color var(--transition-fast);
}

.game-container canvas:focus {
  border-color: var(--accent);
  outline: none;
}

.game-info {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 24px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
}

#snake-status, #chess-status {
  color: #6a9955;
}

/* Profile Photo in Sidebar */
.sidebar-photo {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

.profile-photo {
  width: 100%;
  max-width: 180px;
  height: auto;
  border: 1px solid var(--border-color);
  display: block;
  margin: 0 auto;
}

.profile-photo:hover {
  border-color: var(--accent);
}

/* Photo page animation */
.photo-page .photo-container {
  animation: fadeInUp var(--transition-slow) both;
}

/* Photo Page */
.photo-page {
  text-align: center;
}

.photo-container {
  margin-top: 20px;
}

.profile-photo-large {
  max-width: 100%;
  max-height: 500px;
  border: 1px solid var(--border-color);
}

.photo-caption {
  margin-top: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Admin Photo */
.current-photo {
  margin-bottom: 16px;
}

.admin-photo-preview {
  max-width: 150px;
  max-height: 150px;
  border: 1px solid var(--border-color);
  display: block;
  margin-bottom: 8px;
}

.photo-info {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.admin-form input[type="file"] {
  padding: 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 12px;
}

/* Blog Filters */
.blog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  align-items: center;
}

.filter-label {
  color: #6a9955;
  font-family: var(--font-mono);
  font-size: 12px;
  margin-right: 4px;
}

.tag-filter {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px 10px;
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.tag-filter:hover {
  color: var(--text-bright);
  background: var(--bg-hover);
  text-decoration: none;
}

.tag-filter.active {
  color: #9cdcfe;
  border-color: #9cdcfe;
  background: rgba(156, 220, 254, 0.08);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.post-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #ce9178;
  transition: color var(--transition-fast);
}

.post-tag:hover {
  color: #e8b094;
  text-decoration: none;
}

/* Quick Post Button */
.quick-post-btn {
  position: fixed;
  bottom: 40px;
  right: 24px;
  width: 48px;
  height: 48px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 300;
  box-shadow: 0 4px 16px rgba(0, 122, 204, 0.4);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  text-decoration: none;
}

.quick-post-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 122, 204, 0.5);
  color: #fff;
  text-decoration: none;
}

/* Responsive */
@media (max-width: 768px) {
  .activity-bar {
    display: none;
  }

  .sidebar {
    display: none;
  }

  .titlebar-controls {
    display: none;
  }

  .editor-content {
    padding: 20px 16px;
  }

  .hero {
    padding: 40px 0 30px;
  }

  .hero h1 {
    font-size: 18px;
  }

  .hero-subtitle {
    font-size: 13px;
    line-height: 1.6;
  }

  .hero-links {
    flex-direction: column;
    gap: 10px;
  }

  .hero-links .btn {
    width: 100%;
    justify-content: center;
  }

  .content h1 {
    font-size: 22px;
  }

  .content h2 {
    font-size: 15px;
  }

  .post-preview {
    padding: 14px;
  }

  .post-preview:hover {
    transform: none;
  }

  .skills-list {
    gap: 6px;
  }

  .skills-list li {
    padding: 3px 10px;
    font-size: 11px;
  }

  .post-content .blog-image-row img {
    max-width: 100%;
    min-width: 0;
  }

  .blog-filters {
    gap: 6px;
  }

  .quick-post-btn {
    bottom: 32px;
    right: 16px;
    width: 44px;
    height: 44px;
    font-size: 22px;
  }

  .tabs-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tab {
    padding: 0 14px;
    font-size: 11px;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .editor-content {
    padding: 16px 12px;
  }

  .hero h1 {
    font-size: 16px;
  }

  .hero-subtitle {
    font-size: 12px;
  }

  .content h1 {
    font-size: 20px;
  }

  .statusbar {
    font-size: 11px;
    padding: 0 8px;
  }

  .statusbar-left,
  .statusbar-right {
    gap: 10px;
  }
}
