/* ============================================================================
   blog.araz.me — "Phosphor" Terminal UI
   Author: Araz Shahkarami
   A full Linux-terminal themed design system (CRT + tmux + vim vibes)
   ========================================================================== */

/* ----------------------------- Design tokens ----------------------------- */
:root {
  /* surfaces */
  --bg:            #06090c;
  --bg-window:     #0b1015;
  --bg-panel:      #0e151b;
  --bg-panel-2:    #121b22;
  --bg-titlebar:   #141d25;
  --bg-status:     #0a1116;
  --bg-input:      #070b0e;

  /* lines */
  --border:        #1d2a34;
  --border-soft:   #16202a;
  --border-strong: #2b3d4a;

  /* text */
  --fg:            #cbd6e2;
  --fg-bright:     #eaf2f8;
  --dim:           #7c8f9d;
  --dimmer:        #4d5f6d;

  /* ansi-ish palette */
  --green:         #3df08c;
  --green-soft:    #26b268;
  --green-deep:    #16764a;
  --cyan:          #5ad6e0;
  --blue:          #79b8ff;
  --yellow:        #ffcf6b;
  --orange:        #ff9d5c;
  --red:           #ff6b63;
  --magenta:       #cba6f7;
  --white:         #f2f7fa;

  /* effects */
  --shadow:        0 24px 70px rgba(0, 0, 0, .65);
  --glow:          0 0 8px rgba(61, 240, 140, .30);
  --glow-strong:   0 0 14px rgba(61, 240, 140, .55);
  --radius:        10px;

  /* type */
  --mono: "JetBrains Mono", "Fira Code", "Cascadia Mono", "Ubuntu Mono",
          "DejaVu Sans Mono", Menlo, Consolas, "Courier New", monospace;
  --fs:   15px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  padding: 18px;
  min-height: 100vh;
  font-family: var(--mono);
  font-size: var(--fs);
  line-height: 1.7;
  color: var(--fg);
  background:
    radial-gradient(1200px 700px at 15% -10%, #0d1b1a 0%, transparent 60%),
    radial-gradient(900px 600px at 100% 100%, #0d1420 0%, transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(61, 240, 140, .28); color: var(--white); }

/* ---------------------------- CRT overlays ------------------------------- */
.crt, .crt-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}
.crt {
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, .022) 0px,
    rgba(255, 255, 255, .022) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
  animation: flicker 6s infinite steps(60);
}
.crt-vignette {
  background: radial-gradient(ellipse at center,
              transparent 55%, rgba(0, 0, 0, .55) 100%);
}
@keyframes flicker {
  0%, 96%, 100% { opacity: 1; }
  97%           { opacity: .86; }
  98%           { opacity: 1; }
  99%           { opacity: .92; }
}
@media (prefers-reduced-motion: reduce) {
  .crt { animation: none; }
  * { animation-duration: .001s !important; }
}

/* --------------------------- Scrollbars --------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--bg-status); }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 2px solid var(--bg-status);
  border-radius: 8px;
}
*::-webkit-scrollbar-thumb:hover { background: var(--green-deep); }

/* ========================================================================
   TERMINAL WINDOW
   ====================================================================== */
.tw {
  max-width: 1180px;
  margin: 0 auto;
  min-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(12,18,24,.96), rgba(8,12,16,.98));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 0 90px rgba(0, 40, 25, .10);
  overflow: hidden;
  backdrop-filter: blur(2px);
}
body[data-page="login"] .tw { max-width: 760px; }

/* ------------------------------ Titlebar -------------------------------- */
.tw__titlebar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 14px;
  background: linear-gradient(180deg, #18222b, #111a21);
  border-bottom: 1px solid var(--border);
  user-select: none;
}
.dots { display: flex; gap: 8px; }
.dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.35);
}
.dot--red    { background: #ff5f56; }
.dot--yellow { background: #ffbd2e; }
.dot--green  { background: #27c93f; }

.tw__title {
  flex: 1;
  text-align: center;
  font-size: .84rem;
  letter-spacing: .04em;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tw__title b { color: var(--fg); font-weight: 500; }

.tw__winmeta {
  font-size: .74rem;
  color: var(--dimmer);
  letter-spacing: .06em;
}

/* -------------------------------- Tabs ---------------------------------- */
.tw__tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: #0c141a;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: .8rem;
  color: var(--dim);
  text-decoration: none;
  border-right: 1px solid var(--border-soft);
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.tab:hover { color: var(--green); background: rgba(61,240,140,.05); }
.tab.is-active {
  color: var(--green);
  background: var(--bg-panel);
  box-shadow: inset 0 -2px 0 var(--green);
  text-shadow: var(--glow);
}
.tab__idx { color: var(--dimmer); font-size: .72rem; }
.tab--right { margin-left: auto; border-right: 0; border-left: 1px solid var(--border-soft); }
.tab--danger:hover { color: var(--red); background: rgba(255,107,99,.06); }

/* ------------------------------ Body ------------------------------------ */
.tw__body {
  flex: 1;
  padding: 26px 28px 34px;
  overflow-x: hidden;
}

/* ----------------------------- Status bar ------------------------------- */
.tw__status {
  display: flex;
  align-items: stretch;
  font-size: .74rem;
  background: var(--bg-status);
  border-top: 1px solid var(--border);
  letter-spacing: .05em;
  user-select: none;
}
.seg { padding: 5px 12px; display: inline-flex; align-items: center; gap: 6px; }
.seg--mode   { background: var(--green-deep); color: #04120b; font-weight: 700; }
.seg--branch { background: #16222b; color: var(--magenta); }
.seg--file   { color: var(--dim); }
.seg--spacer { flex: 1; }
.seg--info   { color: var(--cyan); }
.seg--clock  { background: #16222b; color: var(--yellow); }

/* ========================================================================
   TERMINAL PRIMITIVES
   ====================================================================== */

/* Prompt line: araz@blog:~/posts$ command */
.prompt {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0;
  margin: 26px 0 12px;
  font-size: .94rem;
  line-height: 1.9;
  word-break: break-word;
}
.prompt:first-child { margin-top: 0; }
.ps1-user  { color: var(--green); text-shadow: var(--glow); font-weight: 600; }
.ps1-at    { color: var(--dimmer); }
.ps1-host  { color: var(--cyan); }
.ps1-sep   { color: var(--dimmer); }
.ps1-path  { color: var(--blue); }
.ps1-git   { color: var(--magenta); margin-left: 6px; }
.ps1-sign  { color: var(--green); margin: 0 7px 0 4px; font-weight: 700; }
.cmd       { color: var(--fg-bright); }
.cmd .flag { color: var(--yellow); }
.cmd .arg  { color: var(--orange); }
.cmd .str  { color: var(--cyan); }

/* blinking cursor */
.cursor {
  display: inline-block;
  width: 9px; height: 1.05em;
  background: var(--green);
  margin-left: 3px;
  vertical-align: text-bottom;
  box-shadow: var(--glow-strong);
  animation: blink 1.1s steps(2, start) infinite;
}
@keyframes blink { 0%,50% { opacity: 1; } 50.01%,100% { opacity: 0; } }

/* output text under a command */
.out       { color: var(--dim); margin: 0 0 6px; padding-left: 2px; }
.out--fg   { color: var(--fg); }
.out strong{ color: var(--fg-bright); font-weight: 600; }
.out code, .inline-code {
  background: #101a20;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--cyan);
  font-size: .88em;
}

/* comment lines: # ... */
.comment { color: var(--dimmer); }
.comment::before { content: "# "; color: var(--green-deep); }

/* boot log lines */
.boot { margin: 0 0 22px; padding: 0; list-style: none; font-size: .82rem; }
.boot li { color: var(--dim); }
.boot li::before {
  content: "[  OK  ] ";
  color: var(--green);
  text-shadow: var(--glow);
}
.boot li.warn::before { content: "[ WARN ] "; color: var(--yellow); text-shadow: none; }

/* dividers */
.hr {
  border: 0;
  height: 1px;
  margin: 30px 0;
  background: repeating-linear-gradient(to right,
    var(--border) 0 8px, transparent 8px 14px);
}
.hr--solid { background: var(--border); }

/* ============================== Panels ================================== */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin: 0 0 22px;
}
.panel__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  background: linear-gradient(180deg, #16202a, #111a21);
  border-bottom: 1px solid var(--border);
  font-size: .78rem;
  color: var(--dim);
  letter-spacing: .05em;
}
.panel__bar::before {
  content: "▍";
  color: var(--green);
  text-shadow: var(--glow);
}
.panel__title { color: var(--fg); }
.panel__meta  { margin-left: auto; color: var(--dimmer); font-size: .74rem; }
.panel__body  { padding: 18px; }
.panel--accent { border-color: var(--green-deep); box-shadow: 0 0 0 1px rgba(61,240,140,.06); }
.panel--danger { border-color: rgba(255,107,99,.35); }

/* =============================== Buttons ================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: .82rem;
  padding: 6px 12px;
  color: var(--dim);
  background: #0d151b;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
  transition: all .16s ease;
  white-space: nowrap;
}
.btn::before { content: "["; color: var(--dimmer); }
.btn::after  { content: "]"; color: var(--dimmer); }
.btn:hover {
  color: var(--green);
  border-color: var(--green-soft);
  background: rgba(61,240,140,.07);
  box-shadow: 0 0 0 1px rgba(61,240,140,.15), var(--glow);
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  color: #04120b;
  background: var(--green-soft);
  border-color: var(--green);
  font-weight: 700;
}
.btn--primary::before, .btn--primary::after { color: rgba(0,0,0,.45); }
.btn--primary:hover {
  color: #04120b;
  background: var(--green);
  box-shadow: 0 0 18px rgba(61,240,140,.35);
}
.btn--danger { color: var(--red); border-color: rgba(255,107,99,.4); }
.btn--danger:hover {
  color: #fff; background: rgba(255,107,99,.18);
  border-color: var(--red); box-shadow: 0 0 12px rgba(255,107,99,.25);
}
.btn--sm { font-size: .74rem; padding: 3px 9px; }
.btn--plain::before, .btn--plain::after { content: none; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ================================ Forms ================================= */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.label {
  font-size: .78rem;
  color: var(--dim);
  letter-spacing: .05em;
}
.label::before { content: "──╼ "; color: var(--green-deep); }
.label .req { color: var(--red); }
.hint { font-size: .72rem; color: var(--dimmer); }

.input, .textarea, .select {
  width: 100%;
  font-family: var(--mono);
  font-size: .88rem;
  color: var(--fg-bright);
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  caret-color: var(--green);
}
.input::placeholder, .textarea::placeholder { color: var(--dimmer); }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--green-soft);
  box-shadow: 0 0 0 1px rgba(61,240,140,.25), inset 0 0 22px rgba(61,240,140,.04);
}
.textarea { resize: vertical; line-height: 1.75; min-height: 130px; }
.textarea--ascii {
  min-height: 170px;
  color: var(--green);
  letter-spacing: .02em;
  line-height: 1.35;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}
.textarea--content { min-height: 460px; font-size: .86rem; }
.select { appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--green) 50%),
                    linear-gradient(135deg, var(--green) 50%, transparent 50%);
  background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* inline command-style form (search / subscribe) */
.cmdline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 8px 12px;
  transition: border-color .15s, box-shadow .15s;
}
.cmdline:focus-within {
  border-color: var(--green-soft);
  box-shadow: 0 0 0 1px rgba(61,240,140,.2);
}
.cmdline__ps { color: var(--green); font-weight: 700; }
.cmdline__label { color: var(--yellow); font-size: .82rem; }
.cmdline input {
  flex: 1 1 190px;
  min-width: 120px;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--fg-bright);
  font-family: var(--mono);
  font-size: .88rem;
  caret-color: var(--green);
}
.cmdline input::placeholder { color: var(--dimmer); }

/* ================================ Alerts ================================ */
.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: .84rem;
  margin: 0 0 18px;
  border: 1px solid;
}
.alert--ok  { color: var(--green); border-color: rgba(61,240,140,.35); background: rgba(61,240,140,.07); }
.alert--err { color: var(--red);   border-color: rgba(255,107,99,.4);  background: rgba(255,107,99,.08); }
.alert--info{ color: var(--cyan);  border-color: rgba(90,214,224,.3);  background: rgba(90,214,224,.06); }
.alert__tag { font-weight: 700; white-space: nowrap; }

/* =============================== Neofetch =============================== */
.neofetch {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 30px;
  align-items: start;
  padding: 22px 20px;
  background:
    radial-gradient(600px 200px at 0% 0%, rgba(61,240,140,.06), transparent 70%),
    var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.neofetch__art {
  margin: 0;
  color: var(--green);
  font-size: .74rem;
  line-height: 1.15;
  text-shadow: var(--glow-strong);
  white-space: pre;
}
.neofetch__art .sub {
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(90,214,224,.35);
}
.nf-head { color: var(--green); font-weight: 700; margin-bottom: 4px; }
.nf-head span { color: var(--dimmer); font-weight: 400; }
.nf-rule { color: var(--dimmer); margin-bottom: 8px; letter-spacing: -.5px; }
.nf-list { list-style: none; margin: 0; padding: 0; font-size: .84rem; }
.nf-list li { display: flex; gap: 10px; padding: 1.5px 0; }
.nf-key { color: var(--yellow); min-width: 108px; flex: 0 0 108px; }
.nf-key::after { content: ":"; color: var(--dimmer); }
.nf-val { color: var(--fg); flex: 1; word-break: break-word; }
.nf-val a { color: var(--cyan); text-decoration: none; border-bottom: 1px dotted var(--border-strong); }
.nf-val a:hover { color: var(--green); border-color: var(--green-soft); }
.nf-colors { display: flex; gap: 4px; margin-top: 12px; }
.nf-colors i { width: 20px; height: 10px; display: inline-block; border-radius: 2px; }

/* =============================== Post list ============================== */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 12px;
  margin: 0 0 24px;
}
.stat {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green-soft);
  border-radius: 6px;
  padding: 12px 14px;
}
.stat__k { font-size: .72rem; color: var(--dim); letter-spacing: .08em; text-transform: uppercase; }
.stat__v { font-size: 1.45rem; color: var(--green); text-shadow: var(--glow); line-height: 1.4; }
.stat--cyan   { border-left-color: var(--cyan);   } .stat--cyan   .stat__v { color: var(--cyan);   text-shadow: none; }
.stat--yellow { border-left-color: var(--yellow); } .stat--yellow .stat__v { color: var(--yellow); text-shadow: none; }
.stat--magenta{ border-left-color: var(--magenta);} .stat--magenta .stat__v{ color: var(--magenta);text-shadow: none; }

.postlist { display: flex; flex-direction: column; gap: 16px; }

.post-card {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.post-card:hover {
  border-color: var(--green-soft);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0,0,0,.45), 0 0 0 1px rgba(61,240,140,.12);
}
.post-card__thumb {
  display: flex; align-items: center; justify-content: center;
  padding: 14px 10px;
  background: linear-gradient(160deg, #0a1218, #0d1a1c);
  border-right: 1px solid var(--border-soft);
  overflow: hidden;
}
.post-card__thumb pre {
  margin: 0;
  color: var(--green);
  font-size: .52rem;
  line-height: 1.15;
  white-space: pre;
  text-shadow: var(--glow);
  opacity: .95;
}
.post-card__body { padding: 15px 18px 16px; min-width: 0; }
.post-card__meta {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  font-size: .72rem; color: var(--dimmer); margin-bottom: 7px;
}
.post-card__meta b { color: var(--dim); font-weight: 400; }
.post-card__title { margin: 0 0 8px; font-size: 1.06rem; font-weight: 600; line-height: 1.5; }
.post-card__title a { color: var(--fg-bright); text-decoration: none; }
.post-card__title a::before { content: "❯ "; color: var(--green); }
.post-card__title a:hover { color: var(--green); text-shadow: var(--glow); }
.post-card__excerpt {
  font-size: .82rem; color: var(--dim); margin: 0 0 12px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card__foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* chips / tags */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: .71rem;
  padding: 2px 8px;
  color: var(--cyan);
  background: rgba(90,214,224,.07);
  border: 1px solid rgba(90,214,224,.22);
  border-radius: 20px;
  text-decoration: none;
  white-space: nowrap;
}
.chip::before { content: "#"; color: var(--dimmer); }
.chip:hover { color: var(--green); border-color: var(--green-soft); background: rgba(61,240,140,.08); }
.chip--cat {
  color: var(--magenta); background: rgba(203,166,247,.08);
  border-color: rgba(203,166,247,.25); border-radius: 4px;
}
.chip--cat::before { content: "▸ "; }
.chip--cat.is-active {
  color: #0b0410; background: var(--magenta); border-color: var(--magenta); font-weight: 700;
}

/* empty state */
/* ---------------------------- (ادامه) empty state ----------------------- */
.empty {
  padding: 46px 20px;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  color: var(--dim);
  background: rgba(255,255,255,.012);
}
.empty pre {
  margin: 0 0 14px;
  color: var(--green-deep);
  font-size: .72rem;
  line-height: 1.2;
}
.empty__msg   { color: var(--red); font-size: .88rem; }
.empty__hint  { color: var(--dimmer); font-size: .78rem; margin-top: 6px; }

/* ========================================================================
   ARTICLE / POST PAGE
   ====================================================================== */
.article__head {
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    radial-gradient(700px 220px at 10% 0%, rgba(61,240,140,.055), transparent 70%),
    var(--bg-panel);
  padding: 0;
  overflow: hidden;
  margin-bottom: 26px;
}
.article__banner {
  display: flex;
  justify-content: center;
  padding: 22px 14px 8px;
  overflow-x: auto;
}
.article__banner pre {
  margin: 0;
  color: var(--green);
  font-size: .76rem;
  line-height: 1.18;
  white-space: pre;
  text-shadow: var(--glow-strong);
}
.article__headmain { padding: 6px 22px 20px; }
.article__title {
  margin: 6px 0 14px;
  font-size: 1.72rem;
  line-height: 1.42;
  color: var(--fg-bright);
  font-weight: 700;
  letter-spacing: -.01em;
}
.article__title::before { content: "❯ "; color: var(--green); text-shadow: var(--glow); }
.article__meta {
  display: flex; flex-wrap: wrap; gap: 8px 20px;
  font-size: .78rem; color: var(--dimmer);
  padding-top: 12px; border-top: 1px dashed var(--border);
}
.article__meta span b { color: var(--yellow); font-weight: 400; }
.article__meta span i { color: var(--fg); font-style: normal; }

/* toolbar (copy / share) */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 9px; align-items: center;
  padding: 11px 16px;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  margin-bottom: 24px;
}
.toolbar__label { font-size: .76rem; color: var(--dim); margin-right: 4px; }
.toolbar__url {
  flex: 1 1 260px; min-width: 0;
  font-size: .76rem; color: var(--cyan);
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  border-radius: 5px; padding: 5px 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------------------- rendered markdown (.md) -------------------------- */
.md { font-size: .93rem; line-height: 1.85; color: var(--fg); }
.md > *:first-child { margin-top: 0; }

.md h1, .md h2, .md h3, .md h4 {
  color: var(--fg-bright);
  line-height: 1.5;
  margin: 34px 0 12px;
  font-weight: 700;
  scroll-margin-top: 20px;
}
.md h1 { font-size: 1.42rem; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.md h2 { font-size: 1.22rem; }
.md h3 { font-size: 1.05rem; color: var(--cyan); }
.md h4 { font-size: .95rem; color: var(--yellow); }
.md h1::before { content: "# ";   color: var(--green-deep); }
.md h2::before { content: "## ";  color: var(--green-deep); }
.md h3::before { content: "### "; color: var(--green-deep); }
.md h4::before { content: "#### ";color: var(--green-deep); }

.md p { margin: 0 0 16px; }
.md strong { color: var(--fg-bright); font-weight: 700; }
.md em { color: var(--yellow); font-style: italic; }
.md del { color: var(--dimmer); }
.md a {
  color: var(--cyan); text-decoration: none;
  border-bottom: 1px dashed rgba(90,214,224,.45);
}
.md a:hover { color: var(--green); border-bottom-color: var(--green); }

.md ul, .md ol { margin: 0 0 18px; padding-left: 26px; }
.md li { margin: 5px 0; }
.md ul { list-style: none; padding-left: 20px; }
.md ul > li::before {
  content: "▸";
  color: var(--green);
  margin-left: -18px;
  margin-right: 9px;
  display: inline-block;
  width: 9px;
}
.md ol { list-style: none; counter-reset: li; padding-left: 22px; }
.md ol > li { counter-increment: li; }
.md ol > li::before {
  content: counter(li) ".";
  color: var(--yellow);
  margin-left: -22px; margin-right: 8px;
  display: inline-block; width: 14px; text-align: right;
}

.md blockquote {
  margin: 0 0 18px;
  padding: 10px 16px;
  border-left: 3px solid var(--green-soft);
  background: rgba(61,240,140,.045);
  color: var(--dim);
  border-radius: 0 6px 6px 0;
}
.md blockquote p:last-child { margin-bottom: 0; }

.md hr {
  border: 0; height: 1px; margin: 26px 0;
  background: repeating-linear-gradient(to right, var(--border) 0 8px, transparent 8px 14px);
}

.md :not(pre) > code {
  background: #101a20;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 1.5px 6px;
  color: var(--cyan);
  font-size: .86em;
}

.md table {
  width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: .84rem;
}
.md th, .md td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.md th { background: var(--bg-panel-2); color: var(--yellow); font-weight: 600; }
.md tr:nth-child(even) td { background: rgba(255,255,255,.014); }

.md img { max-width: 100%; border: 1px solid var(--border); border-radius: 6px; }

/* ------------------------- code blocks ---------------------------------- */
.codeblock {
  margin: 0 0 22px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #070c10;
  overflow: hidden;
}
.codeblock__bar {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px;
  background: linear-gradient(180deg, #131d25, #0e161c);
  border-bottom: 1px solid var(--border);
  font-size: .72rem; color: var(--dim); letter-spacing: .06em;
}
.codeblock__lang { color: var(--green); text-transform: lowercase; }
.codeblock__lang::before { content: "◆ "; color: var(--green-deep); }
.codeblock__copy {
  margin-left: auto;
  font-family: var(--mono); font-size: .7rem;
  color: var(--dim); background: transparent;
  border: 1px solid var(--border-strong); border-radius: 4px;
  padding: 2px 8px; cursor: pointer; transition: all .15s;
}
.codeblock__copy:hover { color: var(--green); border-color: var(--green-soft); }
.codeblock__copy.done { color: var(--green); border-color: var(--green); }
.codeblock pre {
  margin: 0; padding: 14px 16px; overflow-x: auto;
  font-size: .82rem; line-height: 1.7; color: #d7e3ec;
}
.codeblock code { font-family: var(--mono); }

/* naive syntax colors */
.tok-com { color: var(--dimmer); font-style: italic; }
.tok-str { color: var(--green); }
.tok-key { color: var(--magenta); }
.tok-num { color: var(--orange); }
.tok-fn  { color: var(--blue); }

/* ------------------------ post navigation ------------------------------- */
.post-nav {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
  margin-top: 30px; padding-top: 20px; border-top: 1px dashed var(--border);
}

/* ========================================================================
   ADMIN
   ====================================================================== */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .82rem; min-width: 640px; }
.table thead th {
  position: sticky; top: 0;
  text-align: left; padding: 9px 12px;
  background: var(--bg-panel-2);
  color: var(--yellow); font-weight: 600;
  border-bottom: 1px solid var(--border);
  letter-spacing: .05em; font-size: .74rem; text-transform: uppercase;
  white-space: nowrap;
}
.table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--fg); vertical-align: middle;
}
.table tbody tr:hover td { background: rgba(61,240,140,.035); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .col-id   { color: var(--dimmer); width: 46px; }
.table .col-date { color: var(--dim); white-space: nowrap; font-size: .76rem; }
.table .col-act  { white-space: nowrap; text-align: right; }
.table a.tlink   { color: var(--fg-bright); text-decoration: none; }
.table a.tlink:hover { color: var(--green); }
.table .slug { display: block; font-size: .7rem; color: var(--dimmer); margin-top: 2px; }

.inline-form { display: inline; }

/* subscribers */
.sub-list { list-style: none; margin: 0; padding: 0; font-size: .82rem; max-height: 320px; overflow-y: auto; }
.sub-list li {
  display: flex; gap: 12px; align-items: center;
  padding: 7px 4px; border-bottom: 1px dashed var(--border-soft);
}
.sub-list li:last-child { border-bottom: 0; }
.sub-list .idx { color: var(--dimmer); min-width: 26px; }
.sub-list .mail { color: var(--cyan); flex: 1; word-break: break-all; }
.sub-list .when { color: var(--dimmer); font-size: .72rem; white-space: nowrap; }

/* running / spinner */
.runbox {
  display: none; align-items: center; gap: 10px;
  margin-top: 12px; font-size: .82rem; color: var(--green);
}
.runbox.on { display: flex; }
.spinner::after {
  content: "|"; display: inline-block; width: 10px;
  animation: spin 0.35s linear infinite;
}
@keyframes spin {
  0%   { content: "|"; }
  25%  { content: "/"; }
  50%  { content: "—"; }
  75%  { content: "\\"; }
  100% { content: "|"; }
}

/* ========================================================================
   LOGIN
   ====================================================================== */
.login-wrap { max-width: 520px; margin: 10px auto; }
.login-art {
  margin: 0 0 18px; text-align: center;
  color: var(--green); font-size: .68rem; line-height: 1.15;
  text-shadow: var(--glow-strong);
}
.login-box { }
.tty-line { font-size: .84rem; color: var(--dim); margin-bottom: 4px; }
.tty-line b { color: var(--fg); font-weight: 400; }
.pw-field {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--bg-input); padding: 9px 12px; margin: 14px 0 6px;
}
.pw-field:focus-within { border-color: var(--green-soft); box-shadow: 0 0 0 1px rgba(61,240,140,.22); }
.pw-field span { color: var(--green); font-weight: 700; white-space: nowrap; }
.pw-field input {
  flex: 1; background: transparent; border: 0; outline: none;
  color: var(--fg-bright); font-family: var(--mono); font-size: .9rem;
  letter-spacing: .25em; caret-color: var(--green);
}

/* ========================================================================
   FOOTER PROMPT
   ====================================================================== */
.footer-prompt {
  margin-top: 34px; padding-top: 16px;
  border-top: 1px dashed var(--border);
  font-size: .84rem;
}
.sitefoot {
  margin-top: 10px; font-size: .72rem; color: var(--dimmer);
  display: flex; flex-wrap: wrap; gap: 6px 18px;
}
.sitefoot a { color: var(--dim); text-decoration: none; }
.sitefoot a:hover { color: var(--green); }

/* toast */
.toast {
  position: fixed; bottom: 26px; left: 50%;
  transform: translate(-50%, 24px);
  background: var(--bg-titlebar);
  border: 1px solid var(--green-soft);
  color: var(--green);
  padding: 9px 18px; border-radius: 6px;
  font-size: .82rem; z-index: 10000;
  opacity: 0; pointer-events: none;
  transition: all .25s ease;
  box-shadow: 0 12px 30px rgba(0,0,0,.5), var(--glow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ========================================================================
   RESPONSIVE
   ====================================================================== */
@media (max-width: 860px) {
  .neofetch { grid-template-columns: 1fr; gap: 18px; }
  .neofetch__art { font-size: .58rem; text-align: center; }
  .post-card { grid-template-columns: 1fr; }
  .post-card__thumb { border-right: 0; border-bottom: 1px solid var(--border-soft); padding: 12px; }
  .post-card__thumb pre { font-size: .5rem; }
}
@media (max-width: 620px) {
  body { padding: 8px; font-size: 14px; }
  .tw { border-radius: 7px; min-height: calc(100vh - 16px); }
  .tw__body { padding: 18px 14px 26px; }
  .tw__title { display: none; }
  .tw__winmeta { display: none; }
  .article__title { font-size: 1.28rem; }
  .nf-key { min-width: 88px; flex-basis: 88px; }
  .seg--file, .seg--info { display: none; }
  .tab { padding: 8px 11px; font-size: .74rem; }
  .toolbar__url { flex-basis: 100%; }
}

/* print */
@media print {
  body { background: #fff; color: #000; padding: 0; }
  .crt, .crt-vignette, .tw__titlebar, .tw__tabs, .tw__status,
  .toolbar, .footer-prompt, .post-nav { display: none !important; }
  .tw { border: 0; box-shadow: none; }
  .md, .md * { color: #000 !important; }
}
/* two-column option grid */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px 22px;
}

/* optional label marker */
.label .opt { color: var(--dimmer); font-weight: 400; font-size: .72rem; }

/* checkbox / radio rows */
.check {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: .82rem; color: var(--fg); cursor: pointer; user-select: none;
}
.check input { accent-color: var(--green); margin-top: 3px; }
.check i { color: var(--dimmer); font-style: normal; font-size: .76rem; }
.check:hover span { color: var(--fg-bright); }