:root {
  color-scheme: dark;
  --page: #0e1116;
  --window: #151a21;
  --panel: #1b222b;
  --panel-soft: #181e26;
  --border: #303946;
  --text: #d8dee9;
  --muted: #8995a5;
  --green: #8fbc8f;
  --blue: #91b7d6;
  --code: #0c1015;
  --shadow: rgba(0, 0, 0, .34);
}

:root[data-theme="light"] {
  color-scheme: light;
  --page: #e7eaee;
  --window: #f8f9fb;
  --panel: #eef1f4;
  --panel-soft: #f4f5f7;
  --border: #c9d0d8;
  --text: #29313a;
  --muted: #66717f;
  --green: #49765a;
  --blue: #396f96;
  --code: #e8ebef;
  --shadow: rgba(28, 36, 44, .12);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--green) 8%, transparent), transparent 30rem),
    var(--page);
  color: var(--text);
  font: 16px/1.65 "JetBrains Mono", "Cascadia Code", "Fira Code", monospace;
}

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

a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.desktop {
  width: min(1180px, calc(100% - 40px));
  margin: 34px auto;
}

.terminal-window {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--window);
  box-shadow: 0 28px 85px var(--shadow);
}

.window-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.window-buttons {
  display: flex;
  gap: 8px;
}

.window-buttons span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--border);
}

.window-buttons span:nth-child(2) { opacity: .72; }
.window-buttons span:nth-child(3) { opacity: .48; }

.window-title {
  color: var(--muted);
  font-size: 13px;
}

.theme-toggle {
  justify-self: end;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 18px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 48px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

main {
  padding: clamp(20px, 4vw, 48px);
}

.hero {
  padding: clamp(28px, 6vw, 72px);
  border: 1px solid var(--border);
  border-radius: 11px;
  background: linear-gradient(145deg, var(--panel), var(--panel-soft));
}

.prompt-line {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.prompt-line span { color: var(--green); }
.prompt-line b { color: var(--blue); font-weight: 400; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(220px, .65fr);
  gap: clamp(28px, 7vw, 80px);
  align-items: end;
  margin-top: 34px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 13px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(48px, 9vw, 92px);
  line-height: .95;
  letter-spacing: -.075em;
}

.cursor {
  color: var(--green);
  animation: blink 1.1s steps(2, jump-none) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.hero-copy {
  max-width: 750px;
  margin: 26px 0 0;
  color: var(--muted);
  font: 18px/1.7 system-ui, sans-serif;
}

.system-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--code);
  font-size: 13px;
}

.system-card div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 6px 0;
}

.system-card span { color: var(--muted); }
.system-card b { color: var(--green); font-weight: 500; }

.articles-section {
  margin-top: 52px;
}

.section-top {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  margin-bottom: 16px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(320px, 100%);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--green);
  font-size: 13px;
}

.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.article-card {
  padding: 27px 0;
  border-top: 1px solid var(--border);
}

.file-row {
  display: flex;
  gap: 20px;
  color: var(--muted);
  font-size: 12px;
}

.article-card h2 {
  margin: 8px 0;
  font-size: clamp(22px, 3vw, 31px);
  line-height: 1.25;
}

.article-card p {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  font: 16px/1.65 system-ui, sans-serif;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 16px;
  font-size: 13px;
}

.tag {
  display: inline-block;
  margin-right: 10px;
  color: var(--green);
  text-decoration: none;
}

.tag:hover,
.tag.is-active {
  text-decoration: underline;
}

.article-view {
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(26px, 6vw, 70px);
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--panel-soft);
}

.article-view h1 {
  margin: 22px 0 10px;
  font: 700 clamp(38px, 7vw, 68px)/1.05 system-ui, sans-serif;
  letter-spacing: -.045em;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 13px;
}

.article-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 42px;
}

.pdf-button,
.md-button {
  padding: 8px 12px;
  border: 1px solid var(--blue);
  border-radius: 6px;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font: 13px "JetBrains Mono", monospace;
}

.pdf-button:hover,
.md-button:hover {
  background: color-mix(in srgb, var(--blue) 12%, transparent);
}

.pdf-button:focus-visible,
.md-button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.article-content {
  font: 18px/1.75 system-ui, sans-serif;
}

.article-content img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 1.5rem auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.article-content h2,
.article-content h3,
.article-content h4 {
  margin-top: 2em;
  font-family: "JetBrains Mono", monospace;
  line-height: 1.35;
}

.article-content code {
  padding: .13em .35em;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--code);
  font-family: "JetBrains Mono", monospace;
  font-size: .9em;
}

.table-shell {
  overflow-x: auto;
  margin: 28px 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--code);
}

.table-shell:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.article-content table {
  width: 100%;
  min-width: 580px;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.55;
}

.article-content th,
.article-content td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.article-content th {
  background: var(--panel);
  color: var(--green);
  font: 600 12px/1.4 "JetBrains Mono", monospace;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.article-content tbody tr:last-child td {
  border-bottom: 0;
}

.article-content tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--panel) 45%, transparent);
}

.article-content tbody tr:hover {
  background: var(--panel);
}

.article-content td:first-child {
  color: var(--blue);
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
}

.article-content .align-center { text-align: center; }
.article-content .align-right { text-align: right; }

blockquote {
  margin-left: 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--green);
  color: var(--muted);
}

.code-shell {
  overflow: hidden;
  margin: 26px 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--code);
}

.code-header {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font: 12px "JetBrains Mono", monospace;
}

.copy-button {
  border: 0;
  background: none;
  color: var(--blue);
  cursor: pointer;
  font: inherit;
}

pre {
  overflow-x: auto;
  margin: 0;
  padding: 20px;
}

pre code {
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

.back-link {
  display: inline-block;
  margin-bottom: 18px;
  font-size: 13px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

[hidden] { display: none !important; }

@media (max-width: 760px) {
  .desktop {
    width: 100%;
    margin: 0;
  }

  .terminal-window {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .window-bar {
    grid-template-columns: 1fr auto;
  }

  .window-title,
  .status {
    display: none;
  }

  .site-nav {
    padding-inline: 16px;
  }

  main {
    padding: 16px;
  }

  .hero {
    padding: 28px 20px;
  }

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

  .section-top,
  .card-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-box {
    width: 100%;
  }

  .article-view {
    padding: 28px 20px;
  }

  footer {
    flex-direction: column;
  }
}

@page {
  size: A4;
  margin: 18mm 16mm 20mm;
}

@media print {
  :root,
  :root[data-theme="light"] {
    color-scheme: light;
    --page: #fff;
    --window: #fff;
    --panel: #f3f4f6;
    --panel-soft: #fff;
    --border: #c7cbd1;
    --text: #111827;
    --muted: #4b5563;
    --green: #285c38;
    --blue: #245b7d;
    --code: #f3f4f6;
  }

  html,
  body {
    min-width: 0;
    background: #fff;
  }

  .desktop {
    width: auto;
    margin: 0;
  }

  .terminal-window {
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .window-bar,
  .site-nav,
  footer,
  .back-link,
  .prompt-line,
  .article-actions,
  .copy-button {
    display: none !important;
  }

  main,
  .article-view {
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: #fff;
  }

  .article-view h1 {
    margin-top: 0;
    font-size: 32pt;
  }

  .article-meta {
    margin-bottom: 10mm;
  }

  .article-content {
    font-size: 11pt;
    line-height: 1.55;
  }

  .article-content h2,
  .article-content h3,
  .article-content h4,
  .article-content img,
  .code-shell,
  .table-shell {
    break-inside: avoid;
  }

  pre {
    overflow: visible;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .table-shell {
    overflow: visible;
  }

  .article-content table {
    min-width: 0;
    font-size: 9pt;
  }
}
