/* Self-hosted variable fonts (latin subset) */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('https://simedw.com/fonts/inter-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('https://simedw.com/fonts/jetbrains-mono-latin.woff2') format('woff2');
}

:root {
  color-scheme: light;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  --max-width: 720px;
  --bg: #fff;
  --surface-raised: #fff;  /* cards and inputs sitting on --gray-50 */
  --primary: #111827;      /* Gray 900 */
  --accent: #4F46E5;       /* Indigo 600 */
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.12);
  --green: #059669;        /* Emerald 600 */
  --violet: #7c3aed;       /* Violet 600 */
  --shadow: rgba(17, 24, 39, 0.08);
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0d1117;
    --surface-raised: #1c2230;
    --primary: #e6e8eb;
    --accent: #8b93ff;
    --accent-hover: #a5abff;
    --accent-soft: rgba(139, 147, 255, 0.16);
    --green: #34d399;
    --violet: #b794f6;
    --shadow: rgba(0, 0, 0, 0.4);
    --gray-50: #151a23;
    --gray-100: #1c2230;
    --gray-200: #2a3140;
    --gray-300: #3a4252;
    --gray-400: #8a93a3;
    --gray-500: #9aa3b2;
    --gray-600: #b3bac6;
    --gray-700: #c9ced6;
    --gray-800: #dde1e7;
    --gray-900: #f1f3f5;
  }
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  margin: 0;
  padding: 0 1.5rem;
  color: var(--primary);
  line-height: 1.6;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Site wrapper */
.site-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header, main, footer {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}

header {
  padding: 3rem 0 0;
}

.header-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Terminal Window - unified container */
.terminal-window {
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 2.75rem;
}

/* Terminal Header */
.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--gray-600);
  border-radius: 1rem 1rem 0 0;
}

.terminal-command {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 0.5rem;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.terminal-command:hover .terminal-user {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.terminal-page-nav {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.72rem;
}

.terminal-page-nav a {
  padding: 0.35rem 0.55rem;
  color: var(--gray-500);
  text-decoration: none;
  border-radius: 0.3rem;
  transition: color 0.2s ease, background 0.2s ease;
}

.terminal-page-nav a:hover {
  color: var(--gray-900);
  background: var(--gray-100);
}

.terminal-page-nav a[aria-current="page"] {
  color: var(--gray-900);
  background: var(--surface-raised);
  box-shadow: 0 1px 2px var(--shadow);
}

.terminal-window--compact {
  margin-bottom: 2.5rem;
}

.terminal-window--compact .terminal-header {
  border-radius: 1rem;
}

.terminal-command .terminal-args {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.terminal-nav-divider {
  width: 1px;
  height: 1rem;
  margin: 0 0.35rem;
  background: var(--gray-200);
}

.terminal-page-nav a.terminal-icon-link {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem;
}

.terminal-user {
  color: var(--green);
}

.terminal-dollar {
  color: var(--gray-400);
}

.terminal-cmd {
  color: var(--violet);
  font-weight: 600;
}

.terminal-args {
  color: var(--gray-700);
}

@media (min-width: 480px) {
  .terminal-header {
    font-size: 0.95rem;
  }
}

@media (min-width: 768px) {
  .terminal-header {
    font-size: 1rem;
    padding: 1rem 1.5rem;
  }

  .terminal-page-nav {
    font-size: 0.75rem;
  }
}

@media (max-width: 560px) {
  .terminal-header {
    flex-wrap: wrap;
  }

  .terminal-command {
    width: 100%;
  }

  .terminal-page-nav {
    width: 100%;
    padding-top: 0.6rem;
    border-top: 1px solid var(--gray-200);
  }
}

/* Terminal Output (Bio) */
.terminal-output {
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--gray-200);
}

.terminal-output p {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--gray-700);
}

.terminal-output p + p {
  margin-top: 1rem;
}

.terminal-output p.terminal-follow {
  margin-top: 1.5rem;
  font-size: 0.95rem;
  color: var(--gray-500);
}

.terminal-output .terminal-follow a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--gray-300);
  text-underline-offset: 0.2em;
}

.terminal-output .terminal-follow a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

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

.terminal-output a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 2px;
}

.terminal-output strong {
  color: var(--gray-900);
  font-weight: 600;
}

@media (min-width: 768px) {
  .terminal-output {
    padding: 2rem 2.5rem;
  }
  
  .terminal-output p {
    font-size: 1.2rem;
  }

  .terminal-output p.terminal-follow {
    font-size: 0.95rem;
  }
}

/* Posts Section */
.posts-section {
  margin-bottom: 4rem;
}

.section-title {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-200);
  padding-bottom: 0.5rem;
  margin: 0 0 2rem;
}

.section-title span {
  color: var(--gray-400);
}

/* Post List */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

.post-item {
  position: relative;
}

.post-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.post-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 0.4rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  transition: color 0.2s ease;
}

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

.post-date {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-500);
  margin-bottom: 0.35rem;
}

.post-excerpt {
  color: var(--gray-600);
  line-height: 1.65;
  margin: 0;
  max-width: 42rem;
}

/* Projects page */
.projects-page header,
.projects-page main,
.projects-page footer {
  max-width: 1040px;
}

.projects-main {
  padding-bottom: 1rem;
}

.projects-intro {
  max-width: 720px;
  padding: 0;
  margin: 0 0 3rem;
}

.projects-eyebrow {
  margin: 0 0 0.75rem;
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.projects-intro h1 {
  margin: 0 0 0.75rem;
  color: var(--gray-900);
  font-size: clamp(2.25rem, 6vw, 3.75rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.projects-intro > p:last-child {
  max-width: 650px;
  margin: 0;
  color: var(--gray-600);
  font-size: 1.05rem;
  line-height: 1.65;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 4rem;
}

.project-card {
  min-width: 0;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--gray-200);
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.project-card:hover {
  border-color: var(--gray-300);
  box-shadow: 0 12px 30px var(--shadow);
  transform: translateY(-2px);
}

.project-card:first-child,
.project-card:last-child:nth-child(even) {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
  grid-column: 1 / -1;
}

.project-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #111827;
  border-bottom: 1px solid var(--gray-200);
}

.project-card:first-child .project-media,
.project-card:last-child:nth-child(even) .project-media {
  height: 100%;
  min-height: 310px;
  border-right: 1px solid var(--gray-200);
  border-bottom: 0;
}

.project-media video,
.project-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The TacticBar artwork is a wide App Store frame; preserve its full composition. */
.project-media:has(> img[src="/project-media/tacticbar.png"]) {
  aspect-ratio: 40 / 21;
  background: #eef2ef;
}

.project-card:first-child .project-media video,
.project-card:nth-child(3) .project-media video {
  object-fit: contain;
}

.project-card-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1.5rem;
}

.project-card:first-child .project-card-body,
.project-card:last-child:nth-child(even) .project-card-body {
  justify-content: center;
  padding: 2rem;
}

.project-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
  color: var(--gray-400);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.project-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--gray-600);
}

.project-status::before {
  width: 0.4rem;
  height: 0.4rem;
  content: "";
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.project-meta time::before {
  margin-right: 0.65rem;
  content: "/";
  color: var(--gray-300);
}

.project-card h2 {
  margin: 0 0 0.65rem;
  color: var(--gray-900);
  font-size: 1.4rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.project-card:first-child h2 {
  font-size: 1.75rem;
}

.project-card-body > p {
  margin: 0 0 1.4rem;
  color: var(--gray-600);
  font-size: 0.925rem;
  line-height: 1.6;
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  margin-top: auto;
}

.project-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--gray-800);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
}

.project-links a span {
  color: var(--gray-400);
  transition: color 0.2s ease, transform 0.2s ease;
}

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

.project-links a:hover span {
  color: var(--accent);
  transform: translate(2px, -2px);
}

@media (max-width: 720px) {
  .projects-intro {
    margin-bottom: 2rem;
  }

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

  .project-card:first-child,
  .project-card:last-child:nth-child(even) {
    display: block;
    grid-column: auto;
  }

  .project-card:first-child .project-media,
  .project-card:last-child:nth-child(even) .project-media {
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 10;
    border-right: 0;
    border-bottom: 1px solid var(--gray-200);
  }

  .project-card:first-child .project-card-body,
  .project-card:last-child:nth-child(even) .project-card-body {
    padding: 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .project-card {
    transition: none;
  }

  .project-card:hover {
    transform: none;
  }
}

img {
  max-width: 100%;
  height: auto;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

img:hover {
  opacity: 0.9;
}

/* Image Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  cursor: pointer;
}

.modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
}

.modal.show {
  display: block;
}

/* Image hover effect */
.image-hover-container {
  position: relative;
  display: inline-block;
  line-height: 0;
  cursor: pointer;
  user-select: none;
  border-radius: 8px;
  overflow: hidden;
}

.image-hover-container .base-image {
  display: block !important;
  max-width: 100%;
  height: auto;
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.image-hover-container .hover-image {
  display: block !important;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* Desktop hover effect */
@media (hover: hover) and (pointer: fine) {
  .image-hover-container:hover .base-image {
    opacity: 0;
  }

  .image-hover-container:hover .hover-image {
    opacity: 1;
  }
}

/* Image subtitle styling */
.image-subtitle {
  text-align: center;
  font-size: 0.9rem;
  color: var(--gray-500);
  margin: 0.5rem 0 1rem 0;
  font-style: italic;
}

/* Newsletter signup */
.newsletter-signup {
  display: grid;
  gap: 1.5rem;
  padding: 1.5rem;
  margin-bottom: 4rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.03);
}

.newsletter-copy h2 {
  margin: 0 0 0.5rem;
  color: var(--gray-900);
  font-size: 1.05rem;
  line-height: 1.35;
  text-wrap: balance;
}

.newsletter-copy p {
  margin: 0;
  color: var(--gray-600);
  font-size: 0.925rem;
  line-height: 1.5;
  text-wrap: pretty;
}

.newsletter-form {
  width: 100%;
}

.newsletter-fields {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.newsletter-fields input {
  width: 100%;
  min-width: 0;
  flex: 1;
  min-height: 2.75rem;
  padding: 0.65rem 0.85rem;
  color: var(--gray-900);
  font: inherit;
  font-size: 0.9rem;
  background: var(--surface-raised);
  border: 1px solid var(--gray-200);
  border-radius: 0.375rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.newsletter-fields input::placeholder {
  color: var(--gray-400);
}

.newsletter-fields input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.newsletter-fields button {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
  color: var(--bg);
  font: 600 0.875rem var(--font-sans);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.newsletter-fields button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  transform: translateY(-1px);
}

.newsletter-fields button:focus-visible {
  outline: 3px solid rgba(79, 70, 229, 0.25);
  outline-offset: 2px;
}

.newsletter-alt {
  margin: 0.75rem 0 0;
  color: var(--gray-500);
  font-size: 0.85rem;
  text-align: center;
}

.newsletter-alt a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}

.newsletter-alt a:hover {
  text-decoration: underline;
}

.newsletter-credit {
  margin: 0.35rem 0 0;
  font-size: 0.7rem;
  text-align: center;
}

.newsletter-credit a {
  color: var(--gray-400);
  text-decoration: none;
}

.newsletter-credit a:hover {
  color: var(--gray-600);
  text-decoration: underline;
}

.post-article .newsletter-signup {
  margin: 1rem 0 0;
}

/* The author card above already asks for the follow */
.post-article .newsletter-alt {
  display: none;
}

/* Follow on X */
.follow-x-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  color: var(--bg);
  font: 600 0.85rem var(--font-sans);
  text-decoration: none;
  white-space: nowrap;
  background: var(--gray-900);
  border-radius: 999px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.follow-x-button:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

/* Author card at the end of a post */
.author-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-top: 3.5rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--gray-200);
  border-radius: 0.75rem;
}

.author-card-text {
  margin: 0;
  color: var(--gray-600);
  font-size: 0.925rem;
  line-height: 1.55;
}

.author-card-text strong {
  color: var(--gray-900);
  font-weight: 600;
}

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

.author-card-text a:hover {
  text-decoration: underline;
}

/* Older / newer post links */
.post-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--gray-200);
}

.post-pager-link {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  text-decoration: none;
}

.post-pager-next {
  grid-column: 2;
  text-align: right;
}

.post-pager-label {
  color: var(--gray-500);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.post-pager-title {
  color: var(--gray-900);
  font-weight: 600;
  line-height: 1.4;
  transition: color 0.2s ease;
}

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

@media (max-width: 560px) {
  .author-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .post-pager {
    grid-template-columns: 1fr;
  }

  .post-pager-next {
    grid-column: auto;
    text-align: left;
  }
}

.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;
}

@media (min-width: 680px) {
  .newsletter-signup {
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, 1fr);
    align-items: center;
    gap: 2.25rem;
    padding: 1.5rem 1.75rem;
  }
}

@media (max-width: 480px) {
  .newsletter-signup {
    gap: 1.25rem;
  }
}


footer {
  margin-top: auto;
  padding: 3rem 0;
  border-top: 1px solid var(--gray-100);
  text-align: center;
}

.copyright {
  color: var(--gray-500);
  font-size: 0.875rem;
  margin: 0 0 1rem;
}

.social-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.social-links a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--gray-500);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.social-links a:hover {
  color: var(--gray-900);
}

.social-links svg {
  flex-shrink: 0;
}

/* Code highlighting */
.highlight {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1.5rem 0;
  overflow-x: auto;
}

.highlight pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Inline code */
code {
  background: var(--gray-100);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.875em;
}

/* Don't double-style code inside highlight blocks */
.highlight code {
  background: none;
  padding: 0;
}

/* Interactive pseudocode tooltips */
.code-tip {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1.5rem 0;
  overflow-x: visible;
}

.code-tip code {
  background: none;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--gray-900);
  white-space: pre-wrap;
  word-break: break-word;
}

.code-tip .tip {
  display: inline;
  cursor: inherit;
  position: relative;
  color: inherit;
  border-bottom: none;
  text-decoration: none;
}

.code-tip .tip:focus-visible {
  outline: 1px solid rgba(79, 70, 229, 0.6);
  outline-offset: 2px;
  border-radius: 2px;
}

.code-tip .tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 0;
  top: 1.45em;
  min-width: 220px;
  max-width: 340px;
  padding: 0.5rem 0.65rem;
  border-radius: 0.5rem;
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #334155;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.22);
  font-size: 0.76rem;
  line-height: 1.35;
  white-space: normal;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 120ms ease, transform 120ms ease;
  pointer-events: none;
  z-index: 20;
}

.code-tip .tip:hover::after,
.code-tip .tip:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

/* Table styling */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  background: var(--bg);
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 2px 8px var(--shadow);
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}

th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--primary);
  border-bottom: 2px solid var(--gray-300);
}

tr:hover {
  background: var(--gray-50);
}

tr:last-child td {
  border-bottom: none;
}

/* Responsive table */
@media (max-width: 768px) {
  table {
    font-size: 0.8rem;
  }
  
  th, td {
    padding: 0.5rem;
  }
}

/* Math styling */
.MathJax {
  font-size: 1.1em !important;
}

mjx-container[display="true"] {
  margin: 1.5rem 0 !important;
}

mjx-container[display="false"] {
  margin: 0 0.2rem !important;
}

/* Blockquote styling */
blockquote {
  background: var(--gray-50);
  border-left: 3px solid var(--gray-300);
  border-radius: 0 0.5rem 0.5rem 0;
  padding: 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
  line-height: 1.7;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  white-space: pre-line;
  color: var(--gray-700);
}
/* 
blockquote::before {
  content: '\201C';
  font-size: 3rem;
  color: var(--accent);
  opacity: 0.3;
  position: relative;
  top: 0.2rem;
  line-height: 0;
}

blockquote::after {
  content: '\201D';
  font-size: 3rem;
  color: var(--accent);
  opacity: 0.3;
  position: relative;
  top: 0.2rem;
  line-height: 0;
  float: right;
} */

/* Syntax highlighting colors */
.highlight .c { color: #999988; font-style: italic } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #000000; font-weight: bold } /* Keyword */
.highlight .o { color: #000000; font-weight: bold } /* Operator */
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #999999; font-weight: bold; font-style: italic } /* Comment.Preproc */
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { color: #000000; font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #999999 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #aaaaaa } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #000000; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #000000; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #000000; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #000000; font-weight: bold } /* Keyword.Pseudo */
.highlight .kr { color: #000000; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #009999 } /* Literal.Number */
.highlight .s { color: #d01040 } /* Literal.String */
.highlight .na { color: #008080 } /* Name.Attribute */
.highlight .nb { color: #0086B3 } /* Name.Builtin */
.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
.highlight .no { color: #008080 } /* Name.Constant */
.highlight .nd { color: #3c5d5d; font-weight: bold } /* Name.Decorator */
.highlight .ni { color: #800080 } /* Name.Entity */
.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
.highlight .nl { color: #990000; font-weight: bold } /* Name.Label */
.highlight .nn { color: #555555 } /* Name.Namespace */
.highlight .nt { color: #000080 } /* Name.Tag */
.highlight .nv { color: #008080 } /* Name.Variable */
.highlight .ow { color: #000000; font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mf { color: #009999 } /* Literal.Number.Float */
.highlight .mh { color: #009999 } /* Literal.Number.Hex */
.highlight .mi { color: #009999 } /* Literal.Number.Integer */
.highlight .mo { color: #009999 } /* Literal.Number.Oct */
.highlight .sb { color: #d01040 } /* Literal.String.Backtick */
.highlight .sc { color: #d01040 } /* Literal.String.Char */
.highlight .sd { color: #d01040 } /* Literal.String.Doc */
.highlight .s2 { color: #d01040 } /* Literal.String.Double */
.highlight .se { color: #d01040 } /* Literal.String.Escape */
.highlight .sh { color: #d01040 } /* Literal.String.Heredoc */
.highlight .si { color: #d01040 } /* Literal.String.Interpol */
.highlight .sx { color: #d01040 } /* Literal.String.Other */
.highlight .sr { color: #009926 } /* Literal.String.Regex */
.highlight .s1 { color: #d01040 } /* Literal.String.Single */
.highlight .ss { color: #990073 } /* Literal.String.Symbol */
.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
.highlight .vc { color: #008080 } /* Name.Variable.Class */
.highlight .vg { color: #008080 } /* Name.Variable.Global */
.highlight .vi { color: #008080 } /* Name.Variable.Instance */
.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */

@media (prefers-color-scheme: dark) {
  .highlight pre { color: var(--gray-800); }
  .highlight .c, .highlight .cm, .highlight .c1, .highlight .cp, .highlight .cs { color: #7d8799 }
  .highlight .k, .highlight .kc, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr,
  .highlight .o, .highlight .ow { color: #f0f3f6 }
  .highlight .kt, .highlight .nc { color: #8ab4f8 }
  .highlight .m, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .mo, .highlight .il { color: #5fd3c6 }
  .highlight .s, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .s2, .highlight .se,
  .highlight .sh, .highlight .si, .highlight .sx, .highlight .s1 { color: #ff8fa3 }
  .highlight .sr { color: #7ee787 }
  .highlight .ss, .highlight .ni { color: #d2a8ff }
  .highlight .na, .highlight .no, .highlight .nv, .highlight .vc, .highlight .vg, .highlight .vi { color: #5fd3c6 }
  .highlight .nb { color: #79c0ff }
  .highlight .nd { color: #a5d6c7 }
  .highlight .ne, .highlight .nf, .highlight .nl { color: #ffa198 }
  .highlight .nn, .highlight .gp, .highlight .bp { color: #9aa3b2 }
  .highlight .nt { color: #8ab4f8 }
  .highlight .err { color: #ffa198; background-color: transparent }
  .highlight .gd { color: #ffa198; background-color: rgba(248, 81, 73, 0.15) }
  .highlight .gi { color: #7ee787; background-color: rgba(46, 160, 67, 0.15) }
  .highlight .ge { color: inherit }
}

/* Article Header */
.article-header {
  margin-bottom: 2rem;
  padding: 0;
}

/* TL;DR styling */
.tldr {
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--gray-700);
  padding: 1.25rem 1.5rem;
  margin: 0 0 2rem;
  background: var(--gray-50);
  border-radius: 0.5rem;
}

.tldr-label {
  font-weight: 700;
  color: var(--violet);
  margin-right: 0.25rem;
}

.article-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.025em;
  line-height: 1.3;
  margin: 0.75rem 0 1.5rem;
}

@media (min-width: 768px) {
  .article-title {
    font-size: 2.5rem;
    line-height: 1.25;
  }
}

@media (min-width: 1024px) {
  .article-title {
    font-size: 3rem;
  }
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--gray-500);
}

.meta-separator {
  color: var(--gray-300);
}

.meta-link {
  color: var(--gray-500);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* Article Content */
.article-content {
  color: var(--gray-700);
  line-height: 1.8;
}

.article-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 2.5rem 0 1rem;
  letter-spacing: -0.015em;
}

.article-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-900);
  margin: 2rem 0 0.75rem;
}

.article-content h4 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--gray-900);
  margin: 1.75rem 0 0.5rem;
}

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

.article-content p:has(+ ul),
.article-content p:has(+ ol) {
  margin-bottom: 0.35rem;
}

.article-content p + ul,
.article-content p + ol {
  margin-top: 0.35rem;
}

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

.article-content a:hover {
  text-decoration: underline;
}

.article-content img {
  border-radius: 0.75rem;
}

/* Footnote images should render as compact thumbnails */
.article-content .footnote img,
.article-content .footnotes img {
  max-width: 220px;
  width: auto;
  height: auto;
  display: block;
  margin-top: 0.4rem;
}

/* Discussion banner for Hacker News links */
.discussion-banner {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  padding: 1rem;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
  text-align: center;
  color: var(--gray-600);
}

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

.discussion-banner a:hover {
  text-decoration: underline;
} 

/* Inline update callout */
.update {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0 2rem;
  color: var(--gray-600);
}

.update-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.update-badge {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.2rem 0.9rem;
  background: var(--accent-soft);
  color: var(--accent);
}

.update-date {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-500);
}

.update p {
  margin: 0;
  line-height: 1.5;
}

.update p + p {
  margin-top: 0.6rem;
}

.update-footnote {
  font-size: 0.9rem;
  color: var(--gray-500);
}

@media (max-width: 600px) {
  .update {
    padding: 0.9rem 1rem;
  }

  .update-header {
    flex-direction: column;
    align-items: flex-start;
  }

}

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

@keyframes slideInFromBottom {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.5s ease-out;
}

.animate-slide-in {
  animation: slideInFromBottom 0.5s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .animate-fade-in,
  .animate-slide-in {
    animation: none;
  }
}

/* Selection colors */
::selection {
  background-color: rgba(79, 70, 229, 0.15);
  color: var(--accent);
}

/* =========================================================
   Magic Eye Visualizations
   ========================================================= */

.meviz {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 0.75rem;
  padding: 1.25rem 1.25rem 1rem;
  margin: 2rem 0;
  overflow-x: auto;
}

.meviz-panels {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.meviz-panels-stack {
  flex-direction: column;
  align-items: center;
}

.meviz-panel {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: flex-start;
  flex-shrink: 0;
}

.meviz-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.6;
}

.meviz-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.25rem;
  text-transform: none;
  letter-spacing: 0;
  color: #475569;
}

.meviz-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.meviz-dot-fg { background: #818cf8; }
.meviz-dot-bg { background: #4b5563; }
.meviz-dot-singleton {
  background: none;
  color: #475569;
  font-size: 0.55rem;
  line-height: 1;
}

.meviz-arrow {
  font-size: 1.2rem;
  color: #4F46E5;
  flex-shrink: 0;
  align-self: center;
  margin-top: 1.15rem;
}

.meviz-panels-stack .meviz-arrow {
  margin-top: 0;
}

.meviz-sub {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.meviz-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.meviz-btn {
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #334155;
  border-radius: 0.375rem;
  padding: 0.3rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  line-height: 1.5;
  user-select: none;
}

.meviz-btn:hover {
  background: #334155;
  border-color: #6366f1;
  color: #e2e8f0;
}

.meviz-btn-done {
  border-color: #4f46e5;
  color: #a5b4fc;
}

.meviz-btn-done:hover {
  background: #312e81;
  border-color: #818cf8;
  color: #c7d2fe;
}

.meviz canvas {
  display: block;
  image-rendering: pixelated;
}

.meviz .ev-depth {
  touch-action: none;
}

.meviz-sliders {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  margin-bottom: 0.75rem;
}

.meviz-slider-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.meviz-slider-name {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  min-width: 4.5rem;
}

.meviz-range {
  accent-color: #6366f1;
  width: 100px;
  cursor: pointer;
}

.meviz-select {
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #334155;
  border-radius: 0.375rem;
  padding: 0.22rem 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.meviz-sep-val {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #94a3b8;
  min-width: 1.4rem;
  text-align: right;
}

@media (max-width: 760px) {
  .meviz {
    padding: 0.85rem;
    border-radius: 0.65rem;
    overflow-x: hidden;
  }

  .meviz-panels {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }

  .meviz-panel {
    width: 100%;
    align-items: stretch;
  }

  .meviz-arrow {
    margin-top: 0;
    font-size: 1rem;
  }

  .meviz canvas {
    max-width: 100%;
    width: 100% !important;
    height: auto !important;
  }

  .meviz-label {
    font-size: 0.63rem;
    line-height: 1.45;
  }

  .meviz-legend {
    margin-left: 0;
    gap: 0.35rem;
    display: inline-flex;
    flex-wrap: wrap;
  }

  .meviz-sliders {
    gap: 0.45rem;
  }

  .meviz-slider-row {
    width: 100%;
    gap: 0.45rem;
  }

  .meviz-slider-name {
    min-width: 3.9rem;
  }

  .meviz-range {
    flex: 1;
    min-width: 0;
  }

  .meviz-select {
    flex: 1;
    min-width: 0;
  }

  .meviz-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
    align-items: stretch;
  }

  .meviz-btn {
    width: 100%;
    text-align: center;
    padding: 0.42rem 0.55rem;
    font-size: 0.74rem;
    line-height: 1.35;
  }
}

/* =========================================================
   WorldTUI speculative decoding animation (specdec-viz.js)
   ========================================================= */

.sdviz {
  --sd-term: #0b0f14;
  --sd-term-border: #1f2630;
  --sd-dim: #5b6573;
  --sd-text: #c9d1d9;
  --sd-ok: #3fb950;
  --sd-bad: #f85149;
  --sd-fix: #f0b429;
  --sd-draft: #6e7bff;
  --sd-scan: rgba(110, 123, 255, 0.22);
  margin: 2rem 0;
}

.sdviz-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.sdviz-caption {
  min-height: 3.2em;
  margin: 0 !important;
  color: var(--gray-800);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.6;
}

.sdviz-replay {
  flex-shrink: 0;
  padding: 0.3rem 0.75rem;
  color: var(--gray-600);
  font: 500 0.75rem var(--font-mono);
  background: var(--bg);
  border: 1px solid var(--gray-200);
  border-radius: 0.375rem;
  cursor: pointer;
}

.sdviz-replay:hover {
  color: var(--gray-900);
  border-color: var(--gray-300);
}

.sdviz-screen {
  display: grid;
  justify-content: center;
  padding: 1rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 1rem;
  line-height: 1.55;
  background: var(--sd-term);
  border: 1px solid var(--sd-term-border);
  border-radius: 0.6rem;
}

.sdviz-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0 0.9rem;
  border-radius: 0.3rem;
  transition: background 0.15s ease;
}

.sdviz-lane {
  width: 0.45rem;
  height: 0.45rem;
  background: var(--sd-term-border);
  border-radius: 50%;
  transition: background 0.2s ease;
}

.sdviz-lane.is-working {
  background: var(--sd-draft);
  box-shadow: 0 0 0 3px rgba(110, 123, 255, 0.25);
  animation: sdviz-pulse 0.52s ease-in-out infinite;
}

.sdviz-lane.is-idle {
  background: #2b3340;
}

.sdviz-text {
  color: var(--sd-dim);
  white-space: pre;
}

.sdviz-new {
  color: #fff;
  font-weight: 700;
}

.sdviz-cursor {
  background: var(--sd-text);
}

.sdviz-wrong {
  color: var(--sd-bad);
  font-weight: 700;
}

.sdviz-fixed {
  color: var(--sd-fix);
  font-weight: 700;
}

.sdviz-mark {
  min-width: 12ch;
  font-weight: 700;
  white-space: pre;
}

.sdviz-want {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
}

.sdviz-row.is-scan {
  background: var(--sd-scan);
}

.sdviz-row.is-ok .sdviz-mark {
  color: var(--sd-ok);
}

.sdviz-row.is-bad {
  background: rgba(248, 81, 73, 0.2);
}

.sdviz-row.is-bad .sdviz-mark {
  color: var(--sd-bad);
}

.sdviz-row.is-fixed .sdviz-mark {
  color: var(--sd-fix);
}

.sdviz-row.is-wait .sdviz-text,
.sdviz-row.is-wait .sdviz-mark {
  opacity: 0.45;
}

.sdviz-steps {
  display: grid;
  gap: 0.4rem;
  margin-top: 1rem;
  font-size: 0.8rem;
}

.sdviz-steprow {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr) 2ch;
  align-items: center;
  gap: 0.75rem;
}

.sdviz-steplabel {
  color: var(--gray-600);
}

.sdviz-count {
  color: var(--gray-900);
  font-family: var(--font-mono);
  font-weight: 600;
  text-align: right;
}

.sdviz-blocks {
  display: grid;
  gap: 2px;
}

.sdviz-block {
  display: block;
  aspect-ratio: 1;
  max-height: 0.8rem;
  border-radius: 2px;
  animation: sdviz-pop 0.25s ease-out;
}

.sdviz-block--seq {
  background: var(--gray-200);
  animation: none;
}

.sdviz-block--draft {
  background: var(--sd-draft);
}

.sdviz-block--verify {
  background: var(--sd-ok);
}

.sdviz-block--fix {
  background: var(--sd-fix);
}

.sdviz-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  margin-top: 0.35rem;
  color: var(--gray-500);
  font-size: 0.75rem;
}

.sdviz-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.sdviz-legend .sdviz-block {
  width: 0.65rem;
  height: 0.65rem;
  animation: none;
}

@keyframes sdviz-pulse {
  50% { opacity: 0.45; }
}

@keyframes sdviz-pop {
  from { transform: scale(0.4); opacity: 0; }
}

@media (max-width: 560px) {
  .sdviz-screen {
    font-size: 0.82rem;
  }

  .sdviz-steprow {
    grid-template-columns: minmax(0, 1fr) 2ch;
  }

  .sdviz-steplabel {
    grid-column: 1 / -1;
  }

  .sdviz-blocks {
    gap: 1px;
  }
}
