/* ============================================================
   Terminal Archive — 4stm4 blog
   Material Design 3 dark tokens + mono-first layout
   ============================================================ */

/* ── Tokens ── */
:root {
  --bg:              #0f0d13;
  --win:             #141218;
  --win-border:      rgba(208, 188, 255, 0.18);
  --sidebar-border:  rgba(208, 188, 255, 0.10);
  --primary:         #D0BCFF;
  --secondary:       #EFB8C8;
  --success:         #81C784;
  --text:            #E6E0E9;
  --muted:           #CAC4D0;
  --dim:             rgba(230, 224, 233, 0.45);
  --outline:         rgba(208, 188, 255, 0.16);
  --outline-dash:    rgba(255, 255, 255, 0.04);
  --font:            'Roboto Mono', ui-monospace, 'Cascadia Code', monospace;
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s;
}
a:hover { color: var(--secondary); }

/* ── Skip link ── */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #1a1a2e;
  padding: 5px 14px;
  border-radius: 3px;
  z-index: 9999;
  font-size: 12px;
}
.skip-link:focus { top: 8px; }

/* ============================================================
   Window chrome
   ============================================================ */
.win {
  position: fixed;
  inset: 16px;
  background: var(--win);
  border: 1px solid var(--win-border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    0 30px 60px -20px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(0, 0, 0, 0.4);
}

/* Titlebar */
.win-titlebar {
  flex: 0 0 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.4px;
  user-select: none;
}

.win-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.win-dot.r { background: #ff5f57; }
.win-dot.y { background: #febc2e; }
.win-dot.g { background: #28c840; }

.win-tab {
  margin-left: 10px;
  padding: 3px 10px;
  background: rgba(208, 188, 255, 0.08);
  border-radius: 6px 6px 0 0;
  color: var(--primary);
  font-size: 11px;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.win-titlebar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Body: sidebar + main */
.win-body {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 0;
  overflow: hidden;
}

/* ── Sidebar ── */
.win-sidebar {
  border-right: 1px solid var(--sidebar-border);
  padding: 16px 14px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}

.ascii-logo {
  color: var(--primary);
  white-space: pre;
  line-height: 1.2;
  font-size: 10px;
  margin: 0;
  font-family: var(--font);
  border-bottom: 1px dashed rgba(208, 188, 255, 0.15);
  padding-bottom: 12px;
}

.nav-section-h {
  color: rgba(208, 188, 255, 0.55);
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.navrow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 4px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  transition: background 0.12s, color 0.12s;
}
.navrow:hover {
  background: rgba(208, 188, 255, 0.08);
  color: var(--primary);
}
.navrow.active {
  background: rgba(208, 188, 255, 0.16);
  color: var(--primary);
}

.navkey {
  color: rgba(208, 188, 255, 0.6);
  width: 24px;
  flex-shrink: 0;
}
.navcount {
  margin-left: auto;
  color: var(--dim);
  font-size: 11px;
}

.sidebar-info {
  font-size: 11px;
  color: var(--muted);
  padding: 1px 6px;
}
.sidebar-info.dim { color: var(--dim); }

/* ── Main ── */
.win-main {
  padding: 18px 24px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}

/* ── Footer bar ── */
.win-footer {
  flex: 0 0 26px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  border-top: 1px dashed var(--outline);
  font-size: 11px;
  color: var(--dim);
  background: rgba(208, 188, 255, 0.02);
  user-select: none;
}
.win-footer .footer-right { margin-left: auto; }

.key-chip {
  display: inline-block;
  padding: 1px 5px;
  background: rgba(208, 188, 255, 0.12);
  border-radius: 3px;
  color: var(--primary);
  font-size: 10px;
  margin-right: 3px;
}

/* ============================================================
   Prompt line
   ============================================================ */
.win-prompt {
  font-weight: 500;
  margin-bottom: 10px;
  font-size: 12.5px;
  line-height: 1.55;
}
.p-user { color: var(--success); }
.p-host { color: var(--secondary); }
.p-sep  { color: var(--muted); }
.p-path { color: rgba(230, 224, 233, 0.7); }
.p-cmd  { color: var(--primary); }

.term-cursor {
  display: inline-block;
  width: 7px;
  height: 13px;
  background: var(--primary);
  vertical-align: -2px;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ============================================================
   ls-style listing (home + categories)
   ============================================================ */
.ls-header {
  display: grid;
  grid-template-columns: 110px 90px 1fr 90px 52px 38px;
  gap: 10px;
  padding: 7px 10px 5px;
  font-size: 10px;
  color: rgba(208, 188, 255, 0.65);
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--outline);
  margin-bottom: 2px;
}

.ls-row {
  display: grid;
  grid-template-columns: 110px 90px 1fr 90px 52px 38px;
  gap: 10px;
  padding: 7px 10px;
  border-bottom: 1px dashed var(--outline-dash);
  align-items: baseline;
  font-size: 12.5px;
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: background 0.1s;
}
.ls-row:hover {
  background: rgba(208, 188, 255, 0.06);
  color: inherit;
}
.ls-row:hover::before {
  content: '▌';
  position: absolute;
  left: -2px;
  color: var(--primary);
  font-size: 10px;
  line-height: 2;
}

.ls-perm  { color: rgba(208, 188, 255, 0.5); font-size: 11.5px; }
.ls-date  { color: rgba(230, 224, 233, 0.55); white-space: nowrap; }
.ls-title { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-cat   { color: var(--secondary); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-rt    { color: rgba(208, 188, 255, 0.7); text-align: right; white-space: nowrap; }
.ls-lang  { color: var(--success); font-size: 11px; text-align: right; }

.ls-summary {
  margin-top: 8px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--dim);
  border-top: 1px dashed var(--outline);
}

/* ============================================================
   Post / markdown content
   ============================================================ */
.post-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 5px 10px;
  color: rgba(230, 224, 233, 0.55);
  font-size: 11.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 4px;
}
.post-meta-cat { color: var(--secondary); }
.post-meta-rt  { color: rgba(208, 188, 255, 0.65); }

.post-progressbar {
  height: 2px;
  background: rgba(208, 188, 255, 0.08);
  margin-bottom: 14px;
}
.post-progress-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.25s ease;
}

.term-md {
  font-size: 13px;
  line-height: 1.7;
  max-width: 72ch;
}

.term-md .post-title-h1 {
  color: var(--primary);
  font: 700 17px/1.3 var(--font);
  margin: 0 0 10px;
  letter-spacing: -0.3px;
}

.term-md .post-desc {
  color: var(--muted);
  font-size: 12.5px;
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--outline);
}

.term-md h1 {
  color: var(--primary);
  font: 700 16px/1.3 var(--font);
  margin: 20px 0 8px;
}

.term-md h2 {
  color: var(--primary);
  font: 600 14.5px/1.4 var(--font);
  margin: 20px 0 8px;
}
.term-md h2::before {
  content: '## ';
  color: rgba(208, 188, 255, 0.4);
}

.term-md h3 {
  color: var(--secondary);
  font: 600 13.5px/1.4 var(--font);
  margin: 16px 0 6px;
}
.term-md h3::before {
  content: '### ';
  color: rgba(239, 184, 200, 0.4);
}

.term-md h4 {
  color: var(--muted);
  font: 500 13px/1.4 var(--font);
  margin: 14px 0 5px;
}

.term-md p {
  margin: 0 0 10px;
  color: var(--muted);
}

.term-md a { color: var(--primary); }
.term-md a:hover { color: var(--secondary); }

.term-md ul,
.term-md ol {
  padding-left: 22px;
  margin: 0 0 10px;
  color: var(--muted);
}
.term-md li { margin-bottom: 3px; }
.term-md li::marker { color: var(--primary); }

.term-md pre {
  background: rgba(208, 188, 255, 0.04);
  border: 1px solid rgba(208, 188, 255, 0.10);
  border-radius: 4px;
  padding: 10px 12px;
  margin: 10px 0;
  white-space: pre;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.5;
  color: var(--success);
  font-family: var(--font);
}

.term-md code {
  color: var(--secondary);
  background: rgba(239, 184, 200, 0.08);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: var(--font);
  font-size: 12px;
}
.term-md pre code {
  color: inherit;
  background: none;
  padding: 0;
  border-radius: 0;
}

.term-md blockquote {
  border-left: 2px solid var(--primary);
  margin: 10px 0;
  padding: 6px 14px;
  color: var(--muted);
  background: rgba(208, 188, 255, 0.04);
}

.term-md img {
  max-width: 100%;
  border-radius: 4px;
  margin: 10px 0;
  display: block;
}

.term-md table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 10px 0;
}
.term-md th,
.term-md td {
  border: 1px solid var(--outline);
  padding: 5px 9px;
  text-align: left;
}
.term-md th {
  color: var(--primary);
  background: rgba(208, 188, 255, 0.06);
}

.term-md hr {
  border: none;
  border-top: 1px dashed var(--outline);
  margin: 16px 0;
}

.post-footer-bar {
  margin-top: 24px;
  padding: 10px 10px 0;
  border-top: 1px dashed var(--outline);
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--dim);
}
.post-footer-bar a { color: var(--dim); }
.post-footer-bar a:hover { color: var(--primary); }

/* ============================================================
   Categories page
   ============================================================ */
.category-archive-prompt {
  font-weight: 500;
  font-size: 12.5px;
  margin-bottom: 10px;
}

.category-archive h1 {
  display: none;
}

.category-intro {
  color: var(--muted);
  font-size: 11.5px;
  margin: 0 0 12px;
  padding: 0 10px;
  border-left: 2px solid var(--outline);
}

.category-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.category-card {
  padding: 8px 10px;
  border-bottom: 1px dashed var(--outline-dash);
}
.category-card:first-child { border-top: 1px solid var(--outline); }

.category-title {
  color: var(--primary);
  font: 600 13px/1.4 var(--font);
  margin: 0 0 2px;
}
.category-title::before {
  content: '# ';
  color: rgba(208, 188, 255, 0.4);
}

.category-summary {
  color: var(--muted);
  font-size: 11.5px;
  margin: 0 0 6px;
}

.category-links {
  list-style: none;
  padding: 0;
  margin: 0;
}
.category-links li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
  font-size: 12px;
  border-bottom: 1px dashed var(--outline-dash);
}
.category-links li::before {
  content: '└ ';
  color: rgba(208, 188, 255, 0.35);
  flex-shrink: 0;
}
.category-links a { color: var(--text); }
.category-links a:hover { color: var(--primary); }
.category-links time {
  color: var(--dim);
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============================================================
   Projects / intro page
   ============================================================ */
.projects {
  margin-top: 18px;
}

.projects__header h2 {
  color: var(--primary);
  font: 600 13px/1.4 var(--font);
  margin: 0 0 4px;
}
.projects__header h2::before {
  content: '## ';
  color: rgba(208, 188, 255, 0.4);
}
.projects__header p {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 10px;
}

.project-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-card {
  padding: 10px 12px;
  border: 1px dashed var(--outline);
  border-radius: 4px;
}

.project-card__badge {
  display: inline-block;
  font-size: 10px;
  color: var(--secondary);
  letter-spacing: 0.5px;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.project-card__title {
  font: 600 13px/1.4 var(--font);
  margin: 0 0 4px;
  color: var(--text);
}
.project-card__title a { color: var(--primary); }

.project-card__lead {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 6px;
}

.project-card__meta {
  list-style: none;
  padding: 0;
  margin: 0 0 6px;
  font-size: 11.5px;
  color: var(--muted);
}
.project-card__meta li::before {
  content: '· ';
  color: var(--primary);
}

.project-card__cta {
  font-size: 12px;
  color: var(--primary);
  display: inline-block;
}
.project-card__cta::after { content: ' →'; }
.project-card__cta:hover { color: var(--secondary); }

.project-version {
  font-size: 10px;
  color: var(--dim);
  padding: 1px 4px;
  border: 1px solid var(--outline);
  border-radius: 2px;
  margin-left: 4px;
  vertical-align: middle;
}

/* ============================================================
   Copy button (code.js)
   ============================================================ */
.snippet-clipboard-content {
  position: relative;
  margin: 10px 0;
  display: block;
}

.zeroclipboard-container {
  display: inline-flex;
  position: absolute;
  right: 6px;
  top: 6px;
  z-index: 10;
  background: rgba(15, 13, 19, 0.85);
  border: 1px solid var(--outline);
  border-radius: 4px;
  opacity: 0.35;
  transition: opacity 0.2s;
}
.snippet-clipboard-content:hover .zeroclipboard-container,
.zeroclipboard-container:focus-within {
  opacity: 1;
}

.zeroclipboard-container clipboard-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 6px;
  border-radius: inherit;
}
.zeroclipboard-container svg { fill: var(--text); transition: opacity 0.15s; }
.zeroclipboard-container .octicon-check { fill: var(--success); }
.zeroclipboard-container clipboard-copy:hover svg { opacity: 0.8; }

/* ============================================================
   Misc highlight.css pieces (code labels)
   ============================================================ */
.output-wrap {
  display: block;
  position: relative;
  margin: 10px 0;
}
.output {
  background: rgba(208, 188, 255, 0.04);
  border: 1px solid var(--outline);
  border-radius: 4px;
  overflow-x: auto;
}
.output-label {
  font-size: 10px;
  color: var(--dim);
  padding: 2px 5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  writing-mode: vertical-lr;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
}
.cmd-wrap {
  display: block;
  position: relative;
  margin: 10px 0;
}
.cmd-label {
  font-size: 10px;
  color: var(--dim);
  padding: 2px 6px;
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(208, 188, 255, 0.10);
  border-radius: 3px;
  z-index: 5;
  pointer-events: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.python-label {
  font-size: 10px;
  color: var(--dim);
  padding: 2px 6px;
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(208, 188, 255, 0.10);
  border-radius: 3px;
  z-index: 5;
  pointer-events: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.img-wrap {
  display: block;
  position: relative;
  margin: 10px 0;
  background: rgba(208, 188, 255, 0.03);
  border: 1px solid var(--outline);
  border-radius: 4px;
  overflow: hidden;
}
.img-label {
  font-size: 10px;
  color: var(--dim);
  padding: 2px 5px;
  writing-mode: vertical-lr;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.img-wrap img {
  margin: 0;
  padding: 0;
  background: none;
  border-radius: 0;
  max-width: 100%;
  height: auto;
  display: block;
}

blockquote {
  margin: 8px 0 8px 16px;
  padding: 8px 14px;
  background: rgba(208, 188, 255, 0.04);
  border-left: 2px solid var(--primary);
  border-radius: 0 4px 4px 0;
  overflow-x: auto;
}

.badge {
  background: rgba(208, 188, 255, 0.12);
  color: var(--primary);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
}

/* ============================================================
   Intro page / 404
   ============================================================ */
.intro-text {
  color: var(--muted);
  font-size: 12.5px;
  margin: 0 0 16px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 860px) {
  html, body { overflow: auto; }

  .win {
    position: static;
    inset: auto;
    border-radius: 0;
    border: none;
    box-shadow: none;
    min-height: 100svh;
  }

  .win-body {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .win-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--sidebar-border);
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .ascii-logo        { display: none; }
  .nav-section-h     { display: none; }
  .sidebar-info      { display: none; }
  .navcount          { display: none; }

  .navrow {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .win-main {
    padding: 14px 16px;
    overflow: visible;
    min-height: auto;
  }

  .win-footer {
    gap: 10px;
    font-size: 10px;
  }

  .ls-header,
  .ls-row {
    grid-template-columns: 80px 1fr 72px;
  }
  .ls-perm, .ls-rt, .ls-lang { display: none; }

  .term-md { max-width: 100%; }
}

@media (max-width: 540px) {
  .ls-header,
  .ls-row {
    grid-template-columns: 68px 1fr;
  }
  .ls-cat { display: none; }

  .win-tab { max-width: 140px; font-size: 10px; }
}
