/* ==========================================================================
   erzascarlet63 — minimal black terminal theme
   Plain CSS. No framework, no external fonts, no trackers.
   ========================================================================== */

:root {
  --bg: #0a0a0a;
  --panel: #0f0f0f;
  --border: #232323;
  --border-soft: #181818;
  --text: #d6d6d6;
  --text-bright: #f0f0f0;
  --muted: #8b8b8b;
  --faint: #5c5c5c;
  --accent: #7ee787;
  --accent-dim: #2ea043;
  --warn: #e3b341;
  --danger: #ff7b72;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.7;
}

::selection {
  background: rgba(126, 231, 135, 0.22);
  color: #fff;
}

* {
  scrollbar-color: #333 #0a0a0a;
  scrollbar-width: thin;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.5rem 0.8rem;
  background: var(--accent);
  color: #000;
  font-size: 0.85rem;
  text-decoration: none;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* ==========================================================================
   Shell
   ========================================================================== */

.page {
  width: min(820px, 100%);
  margin: 0 auto;
  padding: 2.25rem 1.25rem 3.5rem;
}

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.brand {
  color: var(--text-bright);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
}

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

.cursor {
  color: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.15rem;
  font-size: 0.85rem;
}

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

.nav a:hover,
.nav a.is-active {
  color: var(--accent);
}

/* ==========================================================================
   Home
   ========================================================================== */

.intro {
  margin-bottom: 2.75rem;
}

.intro h1 {
  margin: 0 0 0.9rem;
  color: var(--text-bright);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.35;
}

.intro p {
  margin: 0.75rem 0;
  max-width: 65ch;
  color: var(--muted);
}

.intro-links {
  font-size: 0.88rem;
}

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

.intro-links a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.section-title {
  margin: 0 0 0.5rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-bright);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.section-title::before {
  content: "> ";
  color: var(--accent);
}

/* ==========================================================================
   Post list
   ========================================================================== */

.post-item {
  padding: 1.35rem 0;
  border-bottom: 1px solid var(--border-soft);
}

.post-item:last-child {
  border-bottom: 0;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  color: var(--faint);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.post-cat {
  color: var(--muted);
}

.post-item-title {
  margin: 0.35rem 0 0.3rem;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.4;
}

.post-item-title a {
  color: var(--text);
  text-decoration: none;
}

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

.post-desc {
  margin: 0.2rem 0 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tag {
  color: var(--muted);
  font-size: 0.78rem;
  text-decoration: none;
}

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

.tag-count {
  color: var(--muted);
}

/* ==========================================================================
   Post
   ========================================================================== */

.page--post {
  width: min(1120px, 100%);
}

.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 760px);
  justify-content: center;
  align-items: start;
  gap: 0 2.5rem;
}

.post-layout.has-toc {
  grid-template-columns: minmax(0, 760px) 200px;
}

.post {
  max-width: 760px;
  width: 100%;
  margin: 0;
}

/* ==========================================================================
   Table of contents
   ========================================================================== */

.post-toc {
  position: sticky;
  top: 2rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  padding-left: 1.25rem;
  border-left: 1px solid var(--border);
  font-size: 0.78rem;
  line-height: 1.45;
}

.post-toc[hidden] {
  display: none;
}

.toc-title {
  margin: 0 0 0.7rem;
  color: var(--faint);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
}

.toc-title::-webkit-details-marker {
  display: none;
}

.toc-title::before {
  content: "> ";
  color: var(--accent);
}

.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding-bottom: 0.5rem;
}

.toc-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.22rem 0;
  overflow-wrap: break-word;
}

.toc-nav a:hover {
  color: var(--text-bright);
}

.toc-nav a.is-active {
  color: var(--accent);
}

.toc-nav .toc-lvl-1 {
  padding-left: 0.8rem;
}

.toc-nav .toc-lvl-2 {
  padding-left: 1.6rem;
}


.post-path {
  margin: 0 0 0.5rem;
  color: var(--faint);
  font-size: 0.78rem;
}

.post-title {
  margin: 0 0 0.7rem;
  color: var(--text-bright);
  font-size: 1.65rem;
  font-weight: 600;
  line-height: 1.3;
}

.post-header {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.75rem;
}

.post-header .post-tags {
  margin-top: 0.6rem;
}

/* ==========================================================================
   Article content
   ========================================================================== */

.post-content {
  font-size: 15.5px;
  line-height: 1.75;
  overflow-wrap: break-word;
}

.post-content > :first-child {
  margin-top: 0;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  color: var(--text-bright);
  font-weight: 600;
  line-height: 1.4;
  scroll-margin-top: 1rem;
}

.post-content h1 {
  margin: 2.2rem 0 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.3rem;
}

.post-content h2 {
  margin: 2rem 0 0.65rem;
  font-size: 1.1rem;
}

.post-content h3 {
  margin: 1.7rem 0 0.5rem;
  font-size: 0.98rem;
}

.post-content h4 {
  margin: 1.4rem 0 0.4rem;
  font-size: 0.92rem;
  color: var(--text);
}

.post-content p {
  margin: 0.9rem 0;
}

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(126, 231, 135, 0.35);
  text-underline-offset: 3px;
}

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

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

.post-content li {
  margin: 0.3rem 0;
}

.post-content li::marker {
  color: var(--accent-dim);
}

.post-content hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.post-content strong {
  color: var(--text-bright);
}

.post-content blockquote {
  margin: 1.25rem 0;
  padding: 0.8rem 1rem;
  background: var(--panel);
  border-left: 2px solid var(--accent-dim);
  color: var(--muted);
}

.post-content blockquote p {
  margin: 0.35rem 0;
}

.post-content .prompt-warning {
  background: #1b160b;
  border-left-color: var(--warn);
  color: #d8c48a;
}

.post-content .prompt-info {
  background: #0c1a1f;
  border-left-color: #58a6ff;
  color: #9ecbff;
}

.post-content .prompt-danger {
  background: #1f0d0d;
  border-left-color: var(--danger);
  color: #ffb3ad;
}

.post-content .prompt-tip {
  background: #0d1a12;
  border-left-color: var(--accent-dim);
  color: #9be9a8;
}

/* inline code */
.post-content code {
  font-family: var(--mono);
  font-size: 0.88em;
}

.post-content :not(pre) > code {
  padding: 0.12em 0.35em;
  background: #161616;
  border: 1px solid #262626;
  border-radius: 3px;
  color: #e6e6e6;
  white-space: break-spaces;
}

/* code blocks */
.post-content pre {
  margin: 1.25rem 0;
  padding: 1rem 1.1rem;
  background: #0d0d0d;
  border: 1px solid #202020;
  border-radius: 4px;
  color: #c9d1d9;
  font-size: 0.84rem;
  line-height: 1.55;
  overflow: auto;
  tab-size: 2;
}

.post-content pre code {
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  color: inherit;
  font-size: inherit;
  white-space: pre;
}

/* Rouge tokens (GitHub-dark-ish) */
.highlight .c,
.highlight .c1,
.highlight .cm {
  color: #6e7681;
  font-style: italic;
}

.highlight .k,
.highlight .kd,
.highlight .kn,
.highlight .kr {
  color: #ff7b72;
}

.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .sb,
.highlight .sc {
  color: #a5d6ff;
}

.highlight .m,
.highlight .mi,
.highlight .mf {
  color: #79c0ff;
}

.highlight .nf,
.highlight .nb,
.highlight .bp {
  color: #d2a8ff;
}

.highlight .nt {
  color: #7ee787;
}

.highlight .na {
  color: #79c0ff;
}

.highlight .o,
.highlight .ow {
  color: #ff7b72;
}

.highlight .err,
.highlight .gd {
  color: #ff7b72;
}

.highlight .gi {
  color: #7ee787;
}

/* tables */
.post-content table {
  display: block;
  width: 100%;
  margin: 1.25rem 0;
  border-collapse: collapse;
  font-size: 0.85rem;
  overflow-x: auto;
}

.post-content th,
.post-content td {
  padding: 0.4rem 0.6rem;
  border: 1px solid #222;
  text-align: left;
  vertical-align: top;
}

.post-content th {
  background: #151515;
  color: var(--text-bright);
  font-weight: 600;
}

.post-content tbody tr:nth-child(even) {
  background: #0d0d0d;
}

/* images */
.post-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.4rem auto;
  background: #000;
  border: 1px solid #222;
  border-radius: 4px;
}

.post-content img.avatar {
  margin: 0;
  border-radius: 4px;
}

.post-content img.float-right {
  float: right;
  margin: 0 0 1rem 1.5rem;
}

.post-content .left {
  float: left;
  margin: 0.3rem 1.2rem 1rem 0;
}

.post-content .w-75 { width: 75%; }
.post-content .w-50 { width: 50%; }
.post-content .w-25 { width: 25%; }
.post-content .w-20 { width: 20%; }
.post-content .rounded-10 { border-radius: 4px; }
.post-content .shadow { border-color: #2c2c2c; }

/* video embeds */
.video-wrap {
  position: relative;
  margin: 1.25rem 0;
  padding-top: 56.25%;
  background: #000;
  border: 1px solid #222;
  border-radius: 4px;
  overflow: hidden;
}

.video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* post footer / navigation */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.post-nav-link {
  display: block;
  color: var(--text);
  font-size: 0.88rem;
  text-decoration: none;
}

.post-nav-link span {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--faint);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

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

.post-eof {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-soft);
  color: var(--faint);
  font-size: 0.78rem;
  text-align: center;
}

.post-eof a {
  color: var(--muted);
  text-decoration: none;
}

.post-eof a:hover {
  color: var(--accent);
}

/* ==========================================================================
   Standalone pages
   ========================================================================== */

.page-content {
  max-width: 760px;
  margin: 0 auto;
}

.page-title {
  margin: 0 0 1.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-bright);
  font-size: 1.55rem;
  font-weight: 600;
}

.float-right {
  float: right;
  margin: 0 0 1rem 1.5rem;
}

.avatar {
  display: block;
  width: 128px;
  height: 128px;
  object-fit: cover;
  border: 1px solid #222;
  border-radius: 4px;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1rem 0;
  padding: 0;
  list-style: none;
}

.post-content .skill-tags {
  padding-left: 0;
  list-style: none;
}

.skill-tags li {
  padding: 0.1rem 0.5rem;
  background: #131313;
  border: 1px solid #242424;
  border-radius: 3px;
  color: var(--muted);
  font-size: 0.8rem;
}

.error-code {
  margin: 1rem 0 2rem;
  color: var(--accent);
  font-size: clamp(3rem, 12vw, 6rem);
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

/* ==========================================================================
   Archive + tags
   ========================================================================== */

.archive-year {
  margin: 2rem 0 0.6rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-bright);
  font-size: 0.95rem;
  font-weight: 600;
}

.archive-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.archive-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.8rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.9rem;
}

.archive-list time {
  min-width: 5.5rem;
  color: var(--faint);
  font-size: 0.8rem;
}

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

.archive-list a:hover {
  color: var(--accent);
}

.archive-tag {
  color: var(--faint);
  font-size: 0.78rem;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 1.25rem 0 2rem;
}

.tag-section h2 {
  margin: 2rem 0 0.5rem;
  color: var(--text-bright);
  font-size: 0.98rem;
  font-weight: 600;
  scroll-margin-top: 1rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 0.78rem;
}

.footer p {
  margin: 0;
}

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

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

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

/* ==========================================================================
   Animation
   ========================================================================== */

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

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
  .post-layout.has-toc {
    grid-template-columns: minmax(0, 760px);
  }

  .post-toc {
    position: static;
    order: -1;
    max-height: none;
    margin-bottom: 2rem;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border);
    background: var(--panel);
  }

  .toc-nav {
    padding-bottom: 0;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .page {
    padding: 1.5rem 1rem 3rem;
  }

  .site-header {
    margin-bottom: 2rem;
  }

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

  .post-content {
    font-size: 15px;
  }

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

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

  .post-content .left,
  .float-right,
  .post-content img.float-right {
    float: none;
    margin: 1rem auto;
  }

  .post-content .w-75,
  .post-content .w-50,
  .post-content .w-25,
  .post-content .w-20 {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .cursor {
    animation: none;
  }
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .nav,
  .footer,
  .post-nav,
  .post-eof,
  .post-toc,
  .skip-link {
    display: none !important;
  }

  .page {
    max-width: 100%;
    padding: 0;
  }

  .post-content a {
    color: #000;
  }
}
