:root {
  --bg: #0a0e14;
  --surface: #14191f;
  --text: #e6e6e6;
  --muted: #8a919e;
  --accent: #64d9ff;
  --accent-strong: #4fc3f7;
  --highlight: #ffb454;
  --comment: #6b7280;
  --border: #1f2933;
  --cursor-blink: 1s;
  --max-width: 1040px;
  --sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 100%;
}

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Grid overlay removed in light theme */
body::before { content: none; }

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

a:hover,
a:focus-visible {
  color: var(--accent-strong);
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 0.5rem;
  background: var(--surface);
  color: var(--text);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 20;
}

.skip-link:focus {
  opacity: 1;
  pointer-events: auto;
}

.wrap {
  width: min(var(--max-width), 92vw);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.75);
  border-bottom: 1px solid #ececf2;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}

.site-title {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: 0.01em;
  font-size: 1rem;
  color: #3a3a3a;
}

.site-title:hover,
.site-title:focus-visible {
  color: var(--accent);
}

.site-nav {
  display: flex;
  gap: 1.25rem;
  font-family: var(--sans);
  font-size: 0.95rem;
}

.site-nav a {
  color: var(--muted);
  position: relative;
  padding-bottom: 0.15rem;
}

.site-nav a::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}

.site-nav a:hover::after,
.site-nav a:focus-visible::after {
  transform: scaleX(1);
}

.hero {
  padding: 4.5rem 0 3.5rem;
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(2.2rem, 6vw, 3.75rem);
  letter-spacing: -0.02em;
}

.hero .subhead {
  margin: 0 0 1.5rem;
  color: var(--muted);
  max-width: 46rem;
  font-size: 1.1rem;
  line-height: 1.6;
}

.hero .prompt {
  margin: 0 0 0.5rem;
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.9rem;
  opacity: 0.7;
}

.with-caret::after {
  content: '▋';
  display: inline-block;
  margin-left: 0.25rem;
  animation: blink 1s steps(2, start) infinite;
}

.hero-ctas {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.terminal {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  max-width: 780px;
  animation: fadeInUp 0.8s ease-out;
  cursor: pointer;
}

/* Allow terminal to expand on article pages */
.wrap-simple.article-page .terminal {
  max-width: 100%;
  cursor: default; /* Remove pointer cursor from article pages */
}

.terminal__chrome {
  display: flex;
  gap: 0.6rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.terminal__chrome span {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.terminal__chrome span:nth-child(1) {
  background: #ef4444;
}

.terminal__chrome span:nth-child(2) {
  background: #facc15;
}

.terminal__chrome span:nth-child(3) {
  background: #22c55e;
}

.terminal__screen {
  padding: 3rem 3.5rem 3.5rem;
  font-family: var(--mono);
  font-size: clamp(1.05rem, 1.6vw, 1.15rem);
  line-height: 1.65;
}

.terminal__line {
  margin: 0 0 0.3rem;
  color: var(--text);
  white-space: pre-wrap;
  position: relative;
  opacity: 0;
}

.terminal__line.visible {
  opacity: 1;
}

.terminal__line--past {
  color: var(--muted);
}

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

.terminal__line--prompt {
  color: var(--accent);
  font-weight: 500;
  transition: filter 0.2s ease;
}

.terminal__line--prompt:hover {
  filter: brightness(1.15);
}

.terminal__line--comment {
  color: var(--comment);
}

.terminal__line--link a {
  color: var(--accent);
  text-decoration: none;
  transition: all 0.2s ease;
}

.terminal__line--link a:hover {
  text-decoration: underline;
  filter: brightness(1.1);
}

.terminal__line--cursor::after {
  content: '▋';
  display: inline-block;
  margin-left: 0.5rem;
  animation: blink var(--cursor-blink) steps(2, start) infinite;
  color: var(--accent);
}

.highlight {
  color: var(--highlight);
  font-weight: 500;
  transition: all 0.2s ease;
}

a.highlight {
  color: var(--highlight);
  text-decoration: none;
}

a.highlight:hover,
.highlight:hover {
  text-decoration: underline;
  text-shadow: 0 0 12px rgba(255, 180, 84, 0.4);
}

.comment {
  color: var(--comment);
}

.section {
  padding: 3rem 0;
}

.section__header {
  margin-bottom: 2rem;
}

.section__eyebrow {
  margin: 0 0 0.5rem;
  font-family: var(--sans);
  letter-spacing: 0.03em;
  font-size: 0.85rem;
  color: var(--muted);
}

.section__header h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.9rem, 3vw, 2.4rem);
  letter-spacing: -0.01em;
}

.section__header p {
  margin: 0;
  max-width: 36rem;
  color: var(--muted);
}

.directory {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.5rem;
}

.directory--tight {
  gap: 1.2rem;
}

.directory__item {
  border-bottom: 1px solid #ececf2;
  padding-bottom: 1.2rem;
}

.directory__item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.directory__link {
  font-family: var(--sans);
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  position: relative;
}

.directory__item p {
  margin: 0.65rem 0 0;
  color: var(--muted);
  max-width: 46rem;
}

.directory__split {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.tag {
  border: 1px solid rgba(125, 249, 184, 0.4);
  color: var(--accent);
  padding: 0.15rem 0.55rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.grid__item {
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  padding-left: 1.5rem;
}

.grid__item h3 {
  margin: 0 0 0.5rem;
  font-family: var(--mono);
  letter-spacing: 0.05em;
  font-size: 1.05rem;
}

.grid__item p {
  margin: 0 0 0.85rem;
  color: var(--muted);
}

.inline-link { font-family: var(--sans); font-size: 0.9rem; }

/* Cards and buttons */
.card {
  display: block;
  padding: 1.25rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
}

.btn {
  display: inline-block;
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.btn:hover,
.btn:focus-visible {
  text-decoration: none;
  border-color: #d7d7e2;
}

.btn.primary {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.principles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.3rem;
  max-width: 46rem;
}

.principles li {
  color: var(--muted);
}

.principles strong { color: var(--text); font-weight: 600; letter-spacing: 0.01em; }

.about {
  max-width: 46rem;
  color: var(--muted);
}

.about p:first-child {
  margin-top: 0;
}

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

.site-footer {
  border-top: 1px solid #ececf2;
  padding: 2.5rem 0 3rem;
  text-align: center;
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--muted);
}

.hero-simple {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  padding: 3rem 0;
}

.wrap-simple {
  width: min(680px, 92vw);
  margin: 0 auto;
}

/* Reading-optimized width for article pages */
/* Text content should be 720px, so with terminal padding (56px x 2 = 112px), container needs to be 832px */
.wrap-simple.article-page {
  width: min(832px, 92vw);
}

@media (min-width: 1200px) {
  .wrap-simple.article-page {
    width: min(860px, 92vw);
  }
}

.site-footer-simple {
  padding: 2rem 0;
  text-align: center;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
}

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  50.01%,
  100% {
    opacity: 0;
  }
}

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


@media (max-width: 720px) {
  .site-header .wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1.2rem 0;
  }

  .site-nav {
    gap: 1rem;
    font-size: 0.72rem;
  }

  .terminal {
    max-width: 100%;
    border-radius: 16px;
  }

  .terminal__screen {
    padding: 2rem 1.5rem;
    font-size: 0.88rem;
  }

  .highlight, .comment {
    display: inline;
  }

  .hero-simple {
    min-height: auto;
    padding: 2rem 0;
  }

  .grid__item { border-left: none; border-top: 1px solid #ececf2; padding: 1.5rem 0 0; }
}

@media (max-width: 480px) {
  .terminal__screen {
    padding: 1.5rem 1.25rem;
    font-size: 0.82rem;
  }

  .wrap-simple {
    width: 95vw;
  }
}

/* Writing Section - Terminal Style */
.filter-active {
  color: var(--accent);
  cursor: pointer;
}

.filter-inactive {
  color: var(--comment);
  cursor: pointer;
  opacity: 0.7;
}

.filter-inactive:hover {
  color: var(--accent);
  opacity: 1;
}

.article-tags {
  display: inline-flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.article-tags .tag {
  color: var(--accent);
  opacity: 0.8;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--muted);
}

.article-date {
  color: var(--muted);
}

.article-content {
  max-width: 680px;
  margin: 0 auto;
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text);
}

.article-content h1 {
  font-size: clamp(2rem, 5vw, 2.5rem);
  margin: 2rem 0 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.article-content h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin: 2.5rem 0 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.article-content h3 {
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  margin: 2rem 0 0.75rem;
  font-weight: 600;
  line-height: 1.4;
}

.article-content p {
  margin: 1rem 0;
}

.article-content strong {
  color: var(--text);
  font-weight: 600;
}

.article-content em {
  font-style: italic;
}

.article-content code {
  background: var(--surface);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.9em;
  color: var(--accent);
  border: 1px solid var(--border);
}

.article-content pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 1.5rem 0;
}

.article-content pre code {
  background: none;
  padding: 0;
  border: none;
  color: var(--accent);
}

.article-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1.5rem;
  margin: 1.5rem 0;
  color: var(--muted);
  font-style: italic;
}

.article-content ul,
.article-content ol {
  margin: 1rem 0;
  padding-left: 2rem;
}

.article-content li {
  margin: 0.5rem 0;
}

/* YouTube Embed Styling - Facade Pattern */
.video-facade {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  margin: 2.5rem 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.video-facade:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.video-facade img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.video-facade::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  transition: background 0.3s ease;
  z-index: 1;
}

.video-facade:hover::before {
  background: rgba(0, 0, 0, 0.2);
}

.video-facade .play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: 80px;
  height: 80px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #0a0e1a;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(100, 217, 255, 0.4);
}

.video-facade:hover .play-btn {
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 6px 24px rgba(100, 217, 255, 0.6);
}

.video-facade .play-btn::before {
  content: '▶';
  margin-left: 4px; /* Optical centering */
}

/* Active iframe embed */
.video-embed {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  margin: 2.5rem 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 12px;
}

/* Video embed on smaller screens */
@media (max-width: 720px) {
  .video-facade,
  .video-embed {
    margin: 2rem 0;
    border-radius: 8px;
  }
  
  .video-facade img,
  .video-facade::before,
  .video-embed iframe {
    border-radius: 8px;
  }
  
  .video-facade .play-btn {
    width: 64px;
    height: 64px;
    font-size: 24px;
  }
}

/* Article footer message */
.article-footer {
  margin: 0;
}

.article-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(100, 217, 255, 0.3);
  transition: text-decoration-color 0.2s ease;
}

.article-content a:hover {
  text-decoration-color: var(--accent);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.9rem;
  transition: opacity 0.2s ease;
}

.back-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal,
  .is-visible {
    opacity: 1 !important;
    transform: none !important;
  }

  .terminal {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .terminal__line {
    opacity: 1 !important;
  }
}
