/* ============================================================
   style.css - old-school technical blog
   No frameworks. One file. Edit freely.
   ============================================================ */

:root {
  --paper:      #fdfcf7;
  --ink:        #1c1c1c;
  --faded:      #6b6b60;
  --accent:     #007020;   /* terminal green, dialled down for print */
  --accent-alt: #8a4b00;   /* burnt orange for secondary accents */
  --border:     #b5b0a0;
  --code-bg:    #f2f0e6;
  --rule:       1px solid var(--border);
  --max-width:  46rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:      #111310;
    --ink:        #c8c8bd;
    --faded:      #8a8a7e;
    --accent:     #3fdc73;
    --accent-alt: #e09a4a;
    --border:     #3a3d35;
    --code-bg:    #1a1d18;
  }
}

/* ---------- base ---------- */

* { box-sizing: border-box; }

html { font-size: 17px; }

body {
  margin: 0;
  padding: 0 1rem;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.65;
}

code, pre, kbd, samp {
  font-family: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  font-size: 0.88em;
}

/* ---------- layout ---------- */

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-bottom: 4rem;
}

/* ---------- masthead ---------- */

header.site {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 0 1rem;
  border-bottom: 3px double var(--border);
}

header.site h1 {
  margin: 0;
  font-size: 1.9rem;
  letter-spacing: 0.02em;
}

header.site h1 a {
  color: var(--ink);
  text-decoration: none;
}

header.site h1 a:hover { color: var(--accent); }

header.site .tagline {
  margin: 0.2rem 0 0.8rem;
  color: var(--faded);
  font-style: italic;
}

nav.site {
  font-family: ui-monospace, Consolas, Menlo, monospace;
  font-size: 0.9rem;
}

nav.site a {
  color: var(--accent);
  text-decoration: underline;
  margin-right: 1.2rem;
}

/* ---------- article ---------- */

article { padding-top: 2rem; }

article h1, article h2, article h3 {
  line-height: 1.3;
  color: var(--ink);
}

article h1 { font-size: 1.75rem; margin: 0 0 0.3rem; }

article h2 {
  font-size: 1.3rem;
  margin-top: 2.4rem;
  padding-bottom: 0.25rem;
  border-bottom: var(--rule);
}

article h3 { font-size: 1.1rem; margin-top: 1.8rem; }

article p, article ul, article ol { margin: 1rem 0; }

article li { margin: 0.3rem 0; }

.meta {
  color: var(--faded);
  font-family: ui-monospace, Consolas, Menlo, monospace;
  font-size: 0.85rem;
  margin-bottom: 2rem;
}

.meta .tags a {
  color: var(--accent-alt);
  text-decoration: none;
  border: var(--rule);
  border-radius: 3px;
  padding: 0 0.4em;
  margin-right: 0.4em;
}

/* ---------- links ---------- */

a { color: var(--accent); }

article a, nav.archive a { text-decoration: underline; }

/* ---------- blockquote ---------- */

blockquote {
  margin: 1.2rem 0;
  padding: 0.2rem 1.2rem;
  border-left: 4px solid var(--accent);
  color: var(--faded);
  font-style: italic;
}

/* ---------- code ---------- */

pre {
  background: var(--code-bg);
  border: var(--rule);
  border-radius: 4px;
  padding: 0.9rem 1.1rem;
  overflow-x: auto;
  line-height: 1.5;
}

pre code { padding: 0; background: none; border: none; }

code {
  background: var(--code-bg);
  border: var(--rule);
  border-radius: 3px;
  padding: 0.05em 0.35em;
}

kbd {
  border: var(--rule);
  border-bottom-width: 3px;
  border-radius: 4px;
  padding: 0.05em 0.45em;
  background: var(--code-bg);
}

/* filename bar above a code block:
   <div class="code-title">crackme.c</div><pre>...</pre> */
.code-title {
  display: inline-block;
  font-family: ui-monospace, Consolas, Menlo, monospace;
  font-size: 0.78rem;
  color: var(--paper);
  background: var(--faded);
  border: var(--rule);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  padding: 0.15em 0.8em;
  margin: 1.2rem 0 -1px 0;
}

/* ---------- tables ---------- */

table {
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 0.92em;
}

th, td {
  border: var(--rule);
  padding: 0.35rem 0.8rem;
  text-align: left;
}

th { background: var(--code-bg); }

/* ---------- post list / archive ---------- */

ul.postlist {
  list-style: none;
  padding: 0;
  margin: 2rem 0;
}

ul.postlist li {
  display: flex;
  gap: 1.2em;
  padding: 0.45rem 0;
  border-bottom: 1px dotted var(--border);
  align-items: baseline;
}

ul.postlist time {
  flex: 0 0 6.5em;
  font-family: ui-monospace, Consolas, Menlo, monospace;
  font-size: 0.82rem;
  color: var(--faded);
}

ul.postlist a { font-weight: bold; }

nav.archive {
  font-family: ui-monospace, Consolas, Menlo, monospace;
  font-size: 0.9rem;
  margin-top: 2rem;
}

/* ---------- pagination / footer ---------- */

footer.site {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.2rem 0 3rem;
  border-top: 3px double var(--border);
  color: var(--faded);
  font-size: 0.85rem;
}

footer.site a { color: var(--faded); }

/* ============================================================
   highlight.js token theme - hand-rolled to match the palette
   (use highlight.js with no bundled CSS theme)
   ============================================================ */

.hljs       { color: var(--ink); background: transparent; }
.hljs-comment, .hljs-quote { color: var(--faded); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal,
.hljs-section, .hljs-doctag, .hljs-type, .hljs-name,
.hljs-strong { font-weight: bold; }
.hljs-keyword, .hljs-selector-tag, .hljs-type { color: var(--accent); }
.hljs-string, .hljs-regexp, .hljs-addition { color: var(--accent-alt); }
.hljs-number, .hljs-symbol, .hljs-bullet, .hljs-meta { color: #a03090; }
.hljs-title, .hljs-title.function_ { color: #2050a0; font-weight: bold; }
@media (prefers-color-scheme: dark) {
  .hljs-title, .hljs-title.function_ { color: #7ab0ff; }
  .hljs-number, .hljs-symbol, .hljs-bullet, .hljs-meta { color: #e07ad0; }
}
.hljs-title.class_, .hljs-class .hljs-title { color: var(--ink); }
.hljs-attr, .hljs-attribute, .hljs-variable,
.hljs-template-variable, .hljs-params { color: var(--ink); }
.hljs-built_in { color: var(--accent-alt); }
.hljs-deletion { color: #c04040; }
.hljs-emphasis { font-style: italic; }
.hljs-link { text-decoration: underline; }
