/* Faithful theme — modern rewrite */

:root {
  --bg: #f2efe6;
  --paper: #ffffff;
  --ink: #2b2a26;
  --ink-2: #5b5a52;
  --rule: #d7d2c2;
  --accent: #7a8c5a;
  --accent-2: #b08040;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
  line-height: 1.65;
  background-image:
    linear-gradient(rgba(122,140,90,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122,140,90,0.03) 1px, transparent 1px);
  background-size: 20px 20px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }

.wrap {
  max-width: 960px;
  margin: 0 auto;
  background: var(--paper);
  box-shadow: 0 1px 0 rgba(0,0,0,0.04), 0 20px 60px rgba(0,0,0,0.08);
  border: 1px solid var(--rule);
}

/* Top menu */
.menu {
  background: var(--ink);
  display: flex;
  border-bottom: 4px solid var(--accent);
}
.menu a {
  padding: 14px 22px;
  color: #e9e6da;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 12px;
  font-weight: 600;
  border-right: 1px solid #3a3933;
}
.menu a.current,
.menu a:hover { background: var(--accent); color: #fff; }

.menu-more {
  position: relative;
  display: flex;
}

.menu-more-toggle {
  display: block;
  padding: 14px 22px;
  color: #e9e6da;
  background: transparent;
  border: 0;
  border-right: 1px solid #3a3933;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.menu-more-toggle::after {
  content: " ▾";
  letter-spacing: 0;
}

.menu-more-toggle:hover,
.menu-more.open .menu-more-toggle {
  background: var(--accent);
  color: #fff;
}

.menu-more-panel {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 170px;
  display: none;
  flex-direction: column;
  background: var(--ink);
  border-top: 4px solid var(--accent);
  box-shadow: 0 14px 30px rgba(0,0,0,0.18);
  z-index: 20;
}

.menu-more:focus-within .menu-more-panel,
.menu-more.open .menu-more-panel {
  display: flex;
}

.menu-more-panel a {
  border-right: 0;
  border-bottom: 1px solid #3a3933;
  white-space: nowrap;
}

/* Layout grid */
.layout { display: grid; grid-template-columns: 240px 1fr; }

/* Sidebar */
.sidebar {
  padding: 32px 26px;
  border-right: 1px solid var(--rule);
  background: #faf8f1;
}
.sidebar .header h1,
.sidebar h1 {
  font-family: 'Merriweather', serif;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.sidebar h1 a { color: var(--ink); }
.sidebar h1 strong { color: var(--accent); }
.sidebar h1 span {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-top: 6px;
}
.sidebar .rss {
  display: block;
  margin: 26px 0;
  padding: 14px 16px;
  background: var(--accent-2);
  color: #fff;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-align: center;
}
.sidebar .rss:hover { background: var(--accent); color: #fff; }
.sidebar .rss span {
  display: block;
  font-weight: 400;
  font-size: 10px;
  margin-top: 4px;
  letter-spacing: 0.2em;
  opacity: 0.9;
}
.sidebar h4 {
  font-family: 'Merriweather', serif;
  font-size: 15px;
  padding-bottom: 8px;
  margin: 22px 0 10px;
  border-bottom: 2px solid var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.sidebar ul { list-style: none; }
.sidebar ul li {
  border-bottom: 1px dotted var(--rule);
  padding: 7px 0;
  font-size: 13px;
}
.sidebar ul li::before { content: "»"; color: var(--accent); margin-right: 8px; }

.sidebar ul li:has(> a:empty) {
  display: none;
}

/* Index hero / slider */
main { padding: 0; }
.slider {
  height: 240px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  display: flex;
  align-items: flex-end;
  padding: 24px 28px;
  color: #fff;
}
.slider::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,0.15), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(0,0,0,0.2), transparent 40%);
}
.slider .label {
  position: relative;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
  padding: 14px 18px;
  border-radius: 3px;
  max-width: 440px;
}
.slider .label strong {
  font-family: 'Merriweather', serif;
  font-size: 20px;
  display: block;
  margin-bottom: 4px;
}

/* Post list (index) */
.posts { padding: 32px 36px 40px; }
.post {
  padding-bottom: 32px;
  margin-bottom: 32px;
  border-bottom: 1px dashed var(--rule);
  position: relative;
}
.post:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.post .bubble {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--accent);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 3px 0 var(--accent-2);
}
.post h2 {
  font-family: 'Merriweather', serif;
  font-size: 22px;
  line-height: 1.25;
  margin-bottom: 6px;
  padding-right: 60px;
}
.post h2 a { color: var(--ink); }
.post h2 a:hover { color: var(--accent); }
.post .meta { font-size: 12px; color: var(--ink-2); margin-bottom: 14px; }
.post .meta strong { color: var(--ink); font-weight: 600; }
.post .thumb {
  display: block;
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, #c0c4a8, #e8dfc2);
  margin-bottom: 14px;
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}
.post .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.post p { color: var(--ink-2); margin-bottom: 12px; }
.post .more { font-weight: 600; font-size: 13px; }
.post .more::after { content: " →"; }

.empty {
  color: var(--ink-2);
  padding: 18px 0;
  font-style: italic;
}

.posts > h1 {
  font-family: 'Merriweather', serif;
  font-size: 28px;
  line-height: 1.2;
  margin: 0 0 24px;
  color: var(--ink);
}

.video-card .thumb {
  height: auto;
  aspect-ratio: 16 / 9;
}

.video-card .placeholder,
.project-card .placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #c0c4a8, #e8dfc2);
  color: var(--ink);
  font-family: 'Merriweather', serif;
  font-size: 18px;
  padding: 18px;
}

.gallery-card .thumb {
  height: auto;
  aspect-ratio: 4 / 3;
}

.gallery-card .placeholder,
.meme-tile {
  min-height: 180px;
  background: linear-gradient(135deg, #c0c4a8, #e8dfc2);
}

.gallery-grid,
.meme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.gallery-grid img,
.meme-grid img,
.term-figure img {
  width: 100%;
  height: auto;
  border-radius: 3px;
}

.snippet-card pre,
.term-snippet pre {
  background: #2b2a26;
  color: #e9e6da;
  padding: 14px 18px;
  border-radius: 3px;
  overflow-x: auto;
  margin: 14px 0;
}

/* Pagination */
.pagination {
  text-align: center;
  padding: 0 36px 36px;
  font-size: 13px;
}
.pagination a { font-weight: 600; }

/* Single post (show) */
.article { padding: 38px 40px; }
.article .title {
  font-family: 'Merriweather', serif;
  font-size: 28px;
  line-height: 1.25;
  margin-bottom: 8px;
}
.article .meta {
  font-size: 12px;
  color: var(--ink-2);
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px dashed var(--rule);
}
.article .meta strong { color: var(--ink); font-weight: 600; }
.article .hero {
  background: #f3efe4;
  border-radius: 3px;
  margin-bottom: 22px;
  position: relative;
  overflow: visible;
}
.article .hero img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}
.article .hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 40%, rgba(255,255,255,0.3), transparent 50%);
  pointer-events: none;
}
.article .hero img + ::after { display: none; }

.article .body p,
.article .post_content p { margin-bottom: 16px; color: #3a3933; }
.article .body h2,
.article .body h3,
.article .post_content h2,
.article .post_content h3 {
  font-family: 'Merriweather', serif;
  margin: 28px 0 12px;
  color: var(--accent);
}
.article .body h2,
.article .post_content h2 { font-size: 22px; }
.article .body h3,
.article .post_content h3 { font-size: 19px; }
.article .body ul,
.article .body ol,
.article .post_content ul,
.article .post_content ol { margin: 0 0 16px 22px; color: #3a3933; }
.article .body code,
.article .post_content code {
  background: #f5f2e8;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.92em;
}
.article .body pre,
.article .post_content pre {
  background: #2b2a26;
  color: #e9e6da;
  padding: 14px 18px;
  border-radius: 3px;
  overflow-x: auto;
  margin: 16px 0;
  font-size: 13px;
  line-height: 1.5;
}
.article .body pre code,
.article .post_content pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

/* Syntax highlighting — JetBrains Darcula palette on the dark code block (#2b2a26
   ≈ Darcula #2B2B2B). Self-contained: replaces the external Prism CDN theme so
   colours stay consistent under any OS colour preference. */
.article .body pre[class*="language-"],
.article .post_content pre[class*="language-"] { text-shadow: none; }
.article .body code[class*="language-"],
.article .post_content code[class*="language-"] { color: #a9b7c6; }
.article .body code[class*="language-"] .token,
.article .post_content code[class*="language-"] .token { background: none; }

/* comments / javadoc — grey */
.article .body .token.comment,
.article .body .token.prolog,
.article .body .token.doctype,
.article .body .token.cdata,
.article .post_content .token.comment,
.article .post_content .token.prolog,
.article .post_content .token.doctype,
.article .post_content .token.cdata { color: #808080; }

/* operators / punctuation — base foreground */
.article .body .token.punctuation,
.article .body .token.operator,
.article .body .token.entity,
.article .post_content .token.punctuation,
.article .post_content .token.operator,
.article .post_content .token.entity { color: #a9b7c6; background: none; }

/* keywords — orange */
.article .body .token.keyword,
.article .body .token.atrule,
.article .body .token.rule,
.article .body .token.important,
.article .post_content .token.keyword,
.article .post_content .token.atrule,
.article .post_content .token.rule,
.article .post_content .token.important { color: #cc7832; font-weight: 600; }

/* numbers / booleans — blue */
.article .body .token.boolean,
.article .body .token.number,
.article .post_content .token.boolean,
.article .post_content .token.number { color: #6897bb; }

/* strings — green */
.article .body .token.string,
.article .body .token.char,
.article .body .token.attr-value,
.article .body .token.inserted,
.article .body .token.url,
.article .post_content .token.string,
.article .post_content .token.char,
.article .post_content .token.attr-value,
.article .post_content .token.inserted,
.article .post_content .token.url { color: #6a8759; }

/* class / type names — light foreground (reads near-white, authentic Darcula) */
.article .body .token.class-name,
.article .body .token.builtin,
.article .body .token.tag,
.article .post_content .token.class-name,
.article .post_content .token.builtin,
.article .post_content .token.tag { color: #a9b7c6; }

/* method / function names — yellow */
.article .body .token.function,
.article .post_content .token.function { color: #ffc66d; }

/* annotations — olive-yellow */
.article .body .token.annotation,
.article .body .token.attr-name,
.article .post_content .token.annotation,
.article .post_content .token.attr-name { color: #bbb529; }

/* fields / variables / static constants — purple */
.article .body .token.variable,
.article .body .token.property,
.article .body .token.constant,
.article .body .token.symbol,
.article .post_content .token.variable,
.article .post_content .token.property,
.article .post_content .token.constant,
.article .post_content .token.symbol { color: #9876aa; }

.article .body .token.regex,
.article .post_content .token.regex { color: #6a8759; }
.article .body .token.deleted,
.article .post_content .token.deleted { color: #cc7832; }
.article .body .token.bold,
.article .post_content .token.bold { font-weight: 700; }
.article .body .token.italic,
.article .post_content .token.italic { font-style: italic; }
.article .body blockquote,
.article .post_content blockquote {
  border-left: 3px solid var(--accent);
  padding: 10px 16px;
  margin: 16px 0;
  background: #faf8f1;
  color: var(--ink-2);
  font-style: normal;
}
.article .post_content blockquote h2,
.article .post_content blockquote h3,
.article .body blockquote h2,
.article .body blockquote h3 {
  border: 0;
  margin: 0;
  padding: 0;
  text-transform: none;
  display: block;
}
.article .post_content blockquote h2,
.article .body blockquote h2 {
  font-size: 28px;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 4px;
}
.article .post_content blockquote h3,
.article .body blockquote h3 {
  font-size: 18px;
  line-height: 1.25;
  color: var(--ink);
}
.article .post_content p:empty,
.article .body p:empty,
.article .post_content h2:empty,
.article .body h2:empty { display: none; }
.article .body img,
.article .post_content img { max-width: 100%; height: auto; border-radius: 3px; }

/* Tables */
.article .body table,
.article .post_content table,
.table-rich table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 13px;
  background: #faf8f1;
  border: 1px solid var(--rule);
}
.article .body th,
.article .body td,
.article .post_content th,
.article .post_content td,
.table-rich th,
.table-rich td {
  border: 1px solid var(--rule);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}
.article .body thead th,
.article .post_content thead th,
.table-rich thead th {
  background: var(--ink);
  color: #f5f1e8;
  font-family: 'Merriweather', serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 12px;
}
.article .body tbody tr:nth-child(even),
.article .post_content tbody tr:nth-child(even),
.table-rich tbody tr:nth-child(even) { background: #f5f1e6; }

.table-rich { margin: 16px 0; }
.table-rich figcaption {
  font-size: 12px;
  color: var(--ink-2);
  font-style: italic;
  margin-bottom: 6px;
  text-align: center;
}
.table-rich__scroll { overflow-x: auto; }

/* Footer */
.footer {
  background: var(--ink);
  color: #b8b5a8;
  padding: 18px 26px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
}
.footer a { color: var(--accent-2); }

/* Responsive */
@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--rule); }
  .menu { overflow-x: auto; }
  .posts { padding: 24px 20px; }
  .article { padding: 24px 20px; }
}
