/* ----- base ----- */
html, body { margin: 0; padding: 0; min-height: 100%; background: #0c0f0d; }
body.term-root {
  width: auto; height: auto; min-height: 100vh; overflow: visible;
  max-width: 860px;
  margin: 0 auto;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
body.term-root.light { background: #f4f2ec; }
html:has(body.term-root.light) { background: #ebe7dd; }
html { background: #070908; }
.term-scroll { height: auto; overflow: visible; }
.term-chrome { position: sticky; top: 0; }
a { color: inherit; }

/* links in the post body use the accent color */
.term-post-body a { color: var(--accent); }
.term-post-body a:hover { text-decoration: underline; }

/* rouge syntax highlighting — minimal overrides to match terminal palette */
.highlight, .highlighter-rouge .highlight { background: transparent !important; }
.term-post-body .highlight pre, .term-post-body pre.highlight { background: var(--panel); }
.highlight .k, .highlight .kd, .highlight .kr, .highlight .kt { color: var(--accent); }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb { color: var(--amber); }
.highlight .c, .highlight .c1, .highlight .cm { color: var(--muted); font-style: italic; }
.highlight .n, .highlight .nf, .highlight .nc, .highlight .nb { color: #7faedc; }
.highlight .mi, .highlight .mf { color: var(--amber); }
.highlight .o { color: var(--fg); }

/* blog index post-row must keep baseline when spans are anchors */
a.term-post-row { text-decoration: none; }

/* projects card must stay a block even as an anchor */
a.term-proj { display: block; color: inherit; }

/* slightly nicer wrap */
.term-post-title { text-wrap: pretty; }


.term-root {
  --bg: #0c0f0d;
  --panel: #111613;
  --border: #1f2925;
  --fg: #d4dbd5;
  --muted: #6b7a72;
  --dim: #8a968f;
  --accent: #7fdc8c;
  --accent-dim: #2d4a35;
  --red: #e07b7b;
  --amber: #e0c87b;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  background: var(--bg);
  color: var(--fg);
  font-size: 13px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  width: 100%; height: 100%;
  overflow: hidden;
  position: relative;
}
.term-root.light {
  --bg: #f4f2ec;
  --panel: #ebe7dd;
  --border: #d6d0bf;
  --fg: #1a1f1c;
  --muted: #6b6658;
  --dim: #4a463b;
  --accent: #1f7a34;
  --accent-dim: #c9dfc9;
  --red: #a83838;
  --amber: #8a6a1c;
}
.term-scroll { height: 100%; overflow-y: auto; padding: 0; }
.term-scroll::-webkit-scrollbar { width: 0; }

/* top chrome */
.term-chrome {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky; top: 0; z-index: 5;
  font-size: 11px; color: var(--dim);
}
.term-dots { display: flex; gap: 5px; }
.term-dots i { width: 9px; height: 9px; border-radius: 50%; display: block; background: var(--border); }
.term-dots i:nth-child(1) { background: var(--red); }
.term-dots i:nth-child(2) { background: var(--amber); }
.term-dots i:nth-child(3) { background: var(--accent); }
.term-path { flex: 1; text-align: center; font-size: 11px; }
.term-path b { color: var(--fg); font-weight: 500; }
.term-path .term-home { color: inherit; text-decoration: underline dotted var(--muted); text-underline-offset: 3px; }
.term-path .term-home:hover { text-decoration-style: solid; text-decoration-color: var(--accent); }
.term-path .term-home:hover b { color: var(--accent); }
.term-clock { font-variant-numeric: tabular-nums; }

/* hero */
.term-hero { padding: 36px 32px 28px; border-bottom: 1px dashed var(--border); }
.term-prompt { color: var(--accent); }
.term-line { display: flex; gap: 10px; margin-bottom: 6px; }
.term-line .cmd { color: var(--fg); }
.term-comment { color: var(--muted); }
.term-hero h1 {
  font-family: inherit;
  font-size: 32px; font-weight: 500;
  margin: 18px 0 6px;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.term-hero h1 .cursor {
  display: inline-block; width: 0.55em; height: 0.95em;
  background: var(--accent); vertical-align: -0.08em;
  animation: term-blink 1.1s steps(1) infinite;
  margin-left: 2px;
}
@keyframes term-blink { 50% { opacity: 0; } }
.term-hero .tagline { color: var(--dim); font-size: 13px; max-width: 56ch; }
.term-hero .badges { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.term-badge {
  border: 1px solid var(--border); padding: 3px 9px;
  font-size: 11px; color: var(--dim);
  border-radius: 2px;
}
.term-badge.ok { color: var(--accent); border-color: var(--accent-dim); }

/* section */
.term-sect { padding: 24px 32px; border-bottom: 1px dashed var(--border); }
.term-sect h2 {
  font-family: inherit; font-size: 13px; font-weight: 500;
  color: var(--accent); margin: 0 0 14px;
  display: flex; align-items: center; gap: 10px;
}
.term-sect h2::before { content: '##'; color: var(--muted); }
.term-sect h2 .meta { margin-left: auto; font-size: 11px; color: var(--muted); font-weight: 400; }

/* about */
.term-about p { color: var(--dim); max-width: 62ch; margin: 0 0 10px; }
.term-about p strong { color: var(--fg); font-weight: 500; }
.term-about .kv { display: grid; grid-template-columns: 100px 1fr; gap: 4px 14px; margin-top: 14px; font-size: 12px; }
.term-about .kv dt { color: var(--muted); }
.term-about .kv dd { color: var(--fg); margin: 0; }

/* posts list */
.term-posts { display: flex; flex-direction: column; }
.term-post-row {
  display: grid; grid-template-columns: 92px 1fr auto;
  gap: 18px; padding: 10px 0;
  border-bottom: 1px dotted var(--border);
  align-items: baseline;
  cursor: pointer;
  transition: background .12s, padding .12s;
}
.term-post-row:last-child { border-bottom: none; }
.term-post-row:hover { background: var(--panel); padding-left: 8px; padding-right: 8px; margin: 0 -8px; }
.term-post-row:hover .term-post-title { color: var(--accent); }
.term-post-row .date { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.term-post-title { color: var(--fg); font-size: 14px; }
.term-post-row .tag { color: var(--accent); font-size: 11px; }
.term-post-row .tag::before { content: '#'; color: var(--muted); }

/* projects */
.term-projects { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.term-proj {
  border: 1px solid var(--border); background: var(--panel);
  padding: 14px; border-radius: 3px;
  position: relative;
}
.term-proj .h { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.term-proj .h .name { color: var(--fg); font-size: 13px; font-weight: 500; }
.term-proj .h .star { margin-left: auto; color: var(--muted); font-size: 11px; }
.term-proj .desc { color: var(--dim); font-size: 12px; margin-bottom: 12px; min-height: 36px; }
.term-proj .foot { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--muted); }
.term-proj .lang { display: flex; align-items: center; gap: 5px; }
.term-proj .lang::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.term-proj.rust .lang::before { background: #d4916b; }
.term-proj.go .lang::before { background: #6bb8d4; }
.term-proj.ts .lang::before { background: #6b8fd4; }

/* now */
.term-now { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; }
.term-now .row { display: flex; gap: 10px; }
.term-now .row .bul { color: var(--accent); }
.term-now .row .txt { color: var(--dim); font-size: 12px; }

/* shelf */
.term-shelf { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.term-book {
  position: relative;
  aspect-ratio: 2/3;
  background: repeating-linear-gradient(45deg, var(--panel), var(--panel) 4px, var(--border) 4px, var(--border) 5px);
  border: 1px solid var(--border); border-radius: 2px;
  padding: 10px 8px;
  display: flex; flex-direction: column; justify-content: space-between;
  font-size: 10px; color: var(--dim);
  overflow: hidden;
}
.term-book.has-cover {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.term-book.has-cover::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.15) 35%, rgba(0,0,0,0.15) 55%, rgba(0,0,0,0.85) 100%);
  pointer-events: none;
}
.term-book.has-cover > * { position: relative; z-index: 1; }
.term-book.has-cover .t,
.term-book.has-cover .a,
.term-book.has-cover .status,
.term-book.has-cover .status.done { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.9); }
.term-book .t { color: var(--fg); font-weight: 500; font-size: 11px; line-height: 1.3; }
.term-book .t a { color: inherit; text-decoration: none; }
.term-book .t a:hover,
.term-book .t a:focus-visible { text-decoration: underline; }
.term-book .a { color: var(--muted); }
.term-book .status { color: var(--accent); font-size: 10px; }
.term-book .status .ico { font-size: 11px; margin-right: 2px; }
.term-book .status.done .ico { color: #6cd47f; }
.term-book .status.reading .ico { color: #7faedc; }
.term-book .status.re-reading .ico { color: var(--amber); }
.term-book .status.promoting .ico { color: #f0c86a; }

.term-book.is-promoting {
  border-color: #d4a84a;
  box-shadow: 0 0 0 1px #d4a84a, 0 0 18px 2px rgba(212, 168, 74, 0.55);
  animation: term-book-glow 2.4s ease-in-out infinite;
}
.term-book.is-promoting .status { color: #f0c86a; }
.term-book.is-promoting.has-cover .status { color: #f7d98a; }
.term-book.is-promoting::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: -60%;
  width: 40%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(255, 230, 150, 0) 30%,
    rgba(255, 235, 170, 0.55) 50%,
    rgba(255, 230, 150, 0) 70%,
    transparent 100%
  );
  transform: skewX(-18deg);
  pointer-events: none;
  z-index: 2;
  animation: term-book-sheen 3.8s ease-in-out infinite;
}
@keyframes term-book-glow {
  50% { box-shadow: 0 0 0 1px #e6c36a, 0 0 26px 4px rgba(230, 195, 106, 0.8); }
}
@keyframes term-book-sheen {
  0%   { left: -60%; opacity: 0; }
  15%  { opacity: 1; }
  55%  { left: 120%; opacity: 1; }
  60%  { opacity: 0; }
  100% { left: 120%; opacity: 0; }
}

/* contact */
.term-contact { display: flex; flex-direction: column; gap: 5px; }
.term-contact a {
  color: var(--fg); text-decoration: none; font-size: 13px;
  display: flex; align-items: center; gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dotted var(--border);
}
.term-contact a:last-child { border-bottom: none; }
.term-contact a:hover { color: var(--accent); }
.term-contact .k { color: var(--muted); width: 80px; display: inline-block; }
.term-contact .arrow { margin-left: auto; color: var(--muted); }

/* footer */
.term-foot { padding: 18px 32px 32px; color: var(--muted); font-size: 11px; display: flex; justify-content: space-between; }

/* blog index specific */
.term-blog-head { padding: 32px; border-bottom: 1px dashed var(--border); }
.term-blog-head h1 { font-size: 22px; margin: 8px 0; color: var(--fg); font-weight: 500; letter-spacing: -0.02em; }
.term-blog-head .desc { color: var(--dim); max-width: 60ch; }
.term-blog-filter { display: flex; gap: 4px; margin-top: 16px; flex-wrap: wrap; }
.term-chip {
  padding: 3px 10px; border: 1px solid var(--border);
  color: var(--dim); font-size: 11px; border-radius: 2px;
  cursor: pointer;
}
.term-chip.on { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.term-blog-group-label { color: var(--muted); font-size: 11px; padding: 16px 32px 6px; }

/* post page */
.term-post-head { padding: 36px 32px 24px; border-bottom: 1px dashed var(--border); }
.term-post-head .crumb { color: var(--muted); font-size: 11px; margin-bottom: 14px; }
.term-post-head .crumb a { color: var(--dim); }
.term-post-head h1 {
  font-family: inherit; font-weight: 500; font-size: 26px;
  letter-spacing: -0.02em; margin: 0 0 12px; color: var(--fg);
}
.term-post-head .meta { display: flex; gap: 14px; color: var(--muted); font-size: 11px; }
.term-post-body { padding: 28px 32px; }
.term-post-body p { color: var(--dim); margin: 0 0 14px; max-width: 64ch; }
.term-post-body h3 { font-size: 13px; color: var(--accent); margin: 22px 0 10px; font-weight: 500; }
.term-post-body h3::before { content: '## '; color: var(--muted); }
.term-post-body pre {
  background: var(--panel); border: 1px solid var(--border);
  padding: 14px 16px; border-radius: 3px; overflow-x: auto;
  font-size: 12px; line-height: 1.55; color: var(--fg);
  margin: 14px 0;
}
.term-post-body pre .k { color: var(--accent); }
.term-post-body pre .s { color: var(--amber); }
.term-post-body pre .c { color: var(--muted); font-style: italic; }
.term-post-body pre .n { color: #7faedc; }
.term-post-body blockquote {
  border-left: 2px solid var(--accent); padding: 2px 14px;
  color: var(--dim); font-style: italic; margin: 14px 0;
}
.term-post-body code:not(pre code) {
  background: var(--panel); padding: 1px 6px; border-radius: 2px;
  color: var(--accent); font-size: 0.92em;
}
.term-post-body ul { color: var(--dim); padding-left: 18px; margin: 0 0 14px; }
.term-post-body ul li::marker { color: var(--muted); content: '› '; }
.term-post-body ul li { padding-left: 4px; margin-bottom: 4px; }

.term-toc {
  position: sticky; top: 50px;
  border-left: 1px solid var(--border);
  padding: 0 0 0 16px; margin: 24px 0;
  font-size: 11px;
}
