/*
 * Sharp Black & White Theme
 * Minimal, high-contrast design
 */

:root {
  --bg: #000;
  --fg: #fff;
  --gray: #888;
  --border: #333;
  --accent: #fff;
}

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

html {
  font-size: 16px;
}

body {
  font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.7;
  min-height: 100vh;
}

a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s;
}

a:hover {
  border-color: var(--fg);
}

/* Layout */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 4rem 2rem;
}

/* Header */
.site-header {
  margin-bottom: 4rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.site-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.site-title a {
  border: none;
}

.site-description {
  color: var(--gray);
  font-size: 0.875rem;
}

/* Navigation */
.site-nav {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.75rem;
}

.nav-link {
  font-size: 0.875rem;
  color: var(--gray);
  border: none;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid transparent;
}

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

.nav-link.active {
  color: var(--fg);
  border-bottom-color: var(--fg);
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 3rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -2rem;
  top: 0.5rem;
  width: 7px;
  height: 7px;
  background: var(--fg);
  transform: translateX(-3px);
}

.timeline-date {
  font-size: 0.75rem;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.timeline-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.timeline-excerpt {
  color: var(--gray);
  font-size: 0.875rem;
}

/* Post */
.post-header {
  margin-bottom: 3rem;
}

.post-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.post-meta {
  font-size: 0.75rem;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.post-content {
  font-size: 1rem;
}

.post-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 2.5rem 0 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.post-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
}

.post-content p {
  margin-bottom: 1.5rem;
}

.post-content ul,
.post-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.5rem;
}

.post-content code {
  font-family: inherit;
  background: var(--border);
  padding: 0.15em 0.4em;
  font-size: 0.9em;
}

.post-content pre {
  background: #111;
  border: 1px solid var(--border);
  padding: 1.5rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  line-height: 1.6;
}

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

/* Shiki code highlighting */
.post-content .shiki,
.gist-content .shiki {
  background: #111 !important;
  border: 1px solid var(--border);
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 0;
  font-size: 0.875rem;
  line-height: 1.6;
  font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;
}

.post-content .shiki {
  padding: 1.5rem;
}

.post-content .shiki code,
.gist-content .shiki code {
  background: none;
  padding: 0;
  font-family: inherit;
}

/* Code block with copy button */
.code-block {
  position: relative;
  margin-bottom: 1.5rem;
}

.gist-content .code-block {
  margin-bottom: 0.75rem;
}

.gist-content .code-block:last-child {
  margin-bottom: 0;
}

.code-block .shiki {
  margin-bottom: 0;
}

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  background: #111;
  border: 1px solid var(--border);
  color: var(--gray);
  font-family: inherit;
  font-size: 0.7rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s, border-color 0.2s;
}

.code-block:hover .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  color: var(--fg);
  border-color: var(--fg);
}

.copy-btn.copied {
  color: var(--fg);
}

.copy-icon {
  width: 12px;
  height: 12px;
}

.copy-text {
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.post-content blockquote {
  border-left: 2px solid var(--fg);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--gray);
  font-style: italic;
}

.post-content img {
  max-width: 100%;
  margin: 1.5rem 0;
}

.post-content img.post-hero {
  width: 100%;
  margin: 0 0 2rem 0;
  border: 1px solid var(--border);
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.post-content th,
.post-content td {
  border: 1px solid var(--border);
  padding: 0.75rem;
  text-align: left;
}

.post-content th {
  background: #111;
}

/* Back link */
.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  font-size: 0.875rem;
  color: var(--gray);
  border-color: var(--border);
}

.back-link:hover {
  color: var(--fg);
}

/* About Page */
.about-content {
  display: flex;
  flex-direction: row-reverse;
  gap: 3rem;
  align-items: flex-start;
}

.about-avatar {
  width: 160px;
  height: 160px;
  flex-shrink: 0;
}

.about-avatar img {
  width: 100%;
  height: 100%;
}

.about-bio {
  flex: 1;
}

.about-bio h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.about-bio p {
  margin-bottom: 1rem;
  color: var(--gray);
}

.about-bio p:last-child {
  margin-bottom: 0;
}

.about-section {
  margin-top: 2.5rem;
}

.about-section h3 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
  color: var(--fg);
}

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

.about-list li {
  margin-bottom: 0.75rem;
  padding-left: 1rem;
  position: relative;
  color: var(--gray);
  font-size: 0.875rem;
}

.about-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 4px;
  height: 4px;
  background: var(--fg);
}

.about-links {
  display: flex;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.about-links a {
  font-size: 0.875rem;
  color: var(--gray);
}

.about-links a:hover {
  color: var(--fg);
}

@media (max-width: 600px) {
  .about-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .about-avatar {
    width: 120px;
    height: 120px;
  }

  .about-list li {
    text-align: left;
  }

  .about-links {
    justify-content: center;
  }
}

/* Projects */
.projects {
  display: flex;
  flex-direction: column;
  gap: 4rem;
}

.project {
  border-bottom: 1px solid var(--border);
  padding-bottom: 3rem;
}

.project:last-child {
  border-bottom: none;
}

.project-header {
  margin-bottom: 1.5rem;
}

.project-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.project-tagline {
  color: var(--gray);
  font-size: 0.875rem;
}

.project-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.project-video {
  width: 100%;
}

.project-video video {
  width: 100%;
  border: 1px solid var(--border);
  background: #111;
}

.project-details h3 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
  color: var(--fg);
}

.project-details ul {
  list-style: none;
}

.project-details li {
  margin-bottom: 0.75rem;
  padding-left: 1rem;
  position: relative;
  color: var(--gray);
  font-size: 0.875rem;
}

.project-details li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 4px;
  height: 4px;
  background: var(--fg);
}

/* Gists */
.gists {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.gist {
  border-bottom: 1px solid var(--border);
  padding-bottom: 2rem;
}

.gist:last-child {
  border-bottom: none;
}

.gist-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
}

.gist-title {
  font-size: 1rem;
  font-weight: 600;
}

.gist-date {
  font-size: 0.75rem;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.gist-content {
  font-size: 0.875rem;
}

.gist-content p {
  margin-bottom: 0.75rem;
  color: var(--gray);
}

.gist-content pre {
  background: #111;
  border: 1px solid var(--border);
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.gist-content pre:last-child {
  margin-bottom: 0;
}

.gist-content code {
  font-family: inherit;
}

/* Footer */
.site-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--gray);
}

/* Header with search */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.site-header-content {
  flex: 1;
}

.search-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--gray);
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.search-btn:hover {
  border-color: var(--fg);
  color: var(--fg);
}

.search-btn svg {
  width: 14px;
  height: 14px;
}

.search-btn kbd {
  font-family: inherit;
  font-size: 0.7rem;
  padding: 0.1em 0.4em;
  background: var(--border);
}

/* Search Modal */
.search-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.search-modal.active {
  display: block;
}

.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
}

.search-container {
  position: relative;
  max-width: 600px;
  margin: 10vh auto 0;
  background: #111;
  border: 1px solid var(--border);
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.search-icon {
  width: 20px;
  height: 20px;
  color: var(--gray);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg);
  font-family: inherit;
  font-size: 1rem;
  padding: 0 1rem;
}

.search-input::placeholder {
  color: var(--gray);
}

.search-kbd {
  font-family: inherit;
  font-size: 0.7rem;
  padding: 0.2em 0.5em;
  background: var(--border);
  color: var(--gray);
}

.search-results {
  max-height: 60vh;
  overflow-y: auto;
}

.search-result-item {
  display: block;
  padding: 1rem;
  border: none;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover,
.search-result-item.active {
  background: #1a1a1a;
}

.search-result-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: rgba(255, 255, 255, 0.9);
}

.search-result-excerpt {
  font-size: 0.875rem;
  color: var(--gray);
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-date {
  font-size: 0.75rem;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.search-result-item mark {
  background: transparent;
  color: var(--fg);
}

.search-result-title mark {
  font-weight: 800;
  color: #fff;
}

.search-result-excerpt mark {
  font-weight: 700;
}

.search-empty {
  padding: 2rem;
  text-align: center;
  color: var(--gray);
}

/* Responsive */
@media (max-width: 600px) {
  .container {
    padding: 2rem 1rem;
  }

  .post-title {
    font-size: 1.5rem;
  }

  .timeline {
    padding-left: 1.5rem;
  }

  .timeline-item::before {
    left: -1.5rem;
  }
}
