@import url('https://fonts.googleapis.com/css2?family=Zilla+Slab:ital,wght@0,400;0,600;0,700;1,400&family=Inconsolata:wght@400;500;600&display=swap');

/* ── Variables ────────────────────────────────────────────── */
:root {
  --bg:          #fbf1c7;
  --bg2:         #f2e5bc;
  --surface:     #ebdbb2;
  --border:      #d5c4a1;
  --text:        #3c3836;
  --text-muted:  #7c6f64;
  --accent:      #98971a;
  --accent-dark: #79740e;
  --header:      #d65d0e;
  --visited:     #b57614;
  --green:       #427b58;
  --selection:   #af3a03;
  --radius:      6px;
  --spacing:     1.2rem;
}

::selection {
  background: var(--selection);
  color: var(--bg);
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Base ─────────────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inconsolata', monospace;
  font-size: 20px;
  line-height: 1.7;
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  hyphens: manual;
}

a {
  color: currentColor;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 0.2ex;
  text-underline-offset: 0.3ex;
}

a:hover {
  text-decoration-thickness: 0.4ex;
  background-color: var(--surface);
}

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

/* ── Header ───────────────────────────────────────────────── */
.site-header {
  margin-bottom: 24px;
}

.site-header h1 {
  font-family: 'Zilla Slab', serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--header);
  line-height: 1.2;
  margin-bottom: 8px;
}

.site-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── Skeleton ─────────────────────────────────────────────── */
.skeleton-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.skeleton-line {
  border-radius: 3px;
  background: linear-gradient(
    90deg,
    var(--border) 25%,
    var(--bg2)    50%,
    var(--border) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-title       { height: 16px; width: 70%; }
.skeleton-title-short { height: 16px; width: 50%; }
.skeleton-meta        { height: 12px; width: 30%; margin-top: 6px; }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Post List ────────────────────────────────────────────── */
.post-list {
  list-style: decimal;
  padding-left: 1.8em;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
  padding-bottom: 60px;
}

/* ── Post Item ────────────────────────────────────────────── */
.post-item {
  line-height: 1.5;
}

.post-item a.post-title {
  font-family: 'Inconsolata', monospace;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  text-decoration-color: var(--accent);
}

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

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

.post-meta {
  display: inline;
  font-size: 0.88rem;
  color: var(--text-muted);
}

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

.post-date {
  color: var(--text-muted);
  margin-left: 4px;
}

/* ── Images ───────────────────────────────────────────────── */
img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  display: block;
  margin: auto;
}

/* ── Post date - italic + muted color ────────────────────── */
.post-date {
  color: var(--accent);
  font-style: italic;
  font-size: 0.82rem;
  margin-left: 2px;
}

/* ── Images - no background no wrapper ───────────────────── */
img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: auto;
}

.img-wrapper {
  display: contents; /* removes wrapper visually */
}

.img-wrapper::before {
  display: none; /* kills the skeleton overlay */
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 1.5em auto;
  box-shadow: 1px 2px 10px rgba(0,0,0,0.15);
}

.img-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    var(--border) 25%,
    var(--bg2)    50%,
    var(--border) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  z-index: 1;
  transition: opacity 0.3s ease;
}

.img-wrapper.loaded::before {
  opacity: 0;
  pointer-events: none;
}

.img-wrapper img {
  position: relative;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.3s ease;
  width: 100%;
}

.img-wrapper.loaded img {
  opacity: 1;
}

/* ── Post Page ────────────────────────────────────────────── */
.post-page {
  max-width: 720px;
  padding: 40px 0 80px;
}

.post-page-nav {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
  font-size: 0.85rem;
}

.post-page-nav a {
  color: var(--accent);
  text-decoration: none;
  font-family: 'Inconsolata', monospace;
  font-weight: 600;
  border-bottom: 1px solid var(--accent);
}

.post-page-nav a:hover {
  background: var(--surface);
}

.post-page h1 {
  font-family: 'Zilla Slab', serif;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 32px;
  color: var(--header);
  max-width: 70ch;
}

/* ── Article Content ──────────────────────────────────────── */
.post-content {
  font-family: 'Inconsolata', monospace;
  font-size: 1rem;
  line-height: 1.9;
  color: var(--text);
  max-width: 72ch;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5 {
  font-family: 'Zilla Slab', serif;
  font-weight: 700;
  line-height: 1.3;
  margin: 1.8em 0 0.5em;
  max-width: 70ch;
}

.post-content h1 { font-size: 1.9rem; color: #d65d0e; }
.post-content h2 { font-size: 1.6rem; color: #b57614; }
.post-content h3 { font-size: 1.35rem; color: #427b58; }
.post-content h4 { font-size: 1.15rem; color: #427b58; }
.post-content h5 { font-size: 1rem;    color: #8f3f71; }

.post-content p {
  margin-bottom: 1.3em;
  max-width: 72ch;
}

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

.post-content a:hover {
  background-color: var(--surface);
}

.post-content a:visited {
  color: var(--visited);
}

.post-content blockquote {
  margin: 1.5em 0;
  padding: 0.2em 0 0.2em 1.2em;
  color: var(--text-muted);
  font-style: italic;
  font-size: 1.1rem;
  font-family: 'Zilla Slab', serif;
}

.post-content pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  font-size: 0.88rem;
  margin: 1.5em 0;
  line-height: 1.4;
}

.post-content code {
  background: var(--surface);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-size: 0.88em;
  font-family: 'Inconsolata', monospace;
}

.post-content pre code {
  background: none;
  padding: 0;
}

.post-content ul,
.post-content ol {
  padding-left: var(--spacing);
  margin-bottom: 1.3em;
}

.post-content li {
  margin-bottom: 0.4em;
  margin-left: var(--spacing);
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 1.5em auto;
  box-shadow: 1px 2px 10px rgba(0,0,0,0.15);
}

.post-content figure {
  border: thin #c0c0c0 solid;
  max-width: 60%;
  padding: 2px;
  margin: 1.5em auto;
  border-radius: var(--radius);
  box-shadow: 1px 2px 10px rgba(0,0,0,0.2);
}

.post-content figcaption {
  background-color: #3c3836;
  color: var(--bg);
  font: italic smaller 'Zilla Slab', serif;
  padding: 4px;
  text-align: center;
  border-radius: 0 0 3px 3px;
}

table { width: 100%; border-collapse: collapse; }
th { text-align: left; border-bottom: 2px solid var(--border); padding: 8px; }
td { padding: 8px; border-bottom: 1px solid var(--border); }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 16px 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--green);
  margin-top: 40px;
}

.site-footer a {
  color: var(--green);
  text-decoration-color: var(--green);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
  body {
    padding: 20px 16px 60px;
    font-size: 17px;
  }

  .post-content figure {
    max-width: 100%;
  }

  .post-content blockquote {
    border: none;
    font-size: 90%;
  }

  .post-content blockquote p::before { content: '\201C'; }
  .post-content blockquote p::after  { content: '\201D'; }
}

/* ── Dark Mode ────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:         #1d2021;
    --bg2:        #282828;
    --surface:    #32302f;
    --border:     #504945;
    --text:       #fbf1c7;
    --text-muted: #a89984;
    --accent:     #98971a;
    --accent-dark:#b8bb26;
    --header:     #fabd2f;
    --visited:    #d3869b;
    --green:      #8ec07c;
  }

  .post-content h1 { color: #fe8019; }
  .post-content h2 { color: #fabd2f; }
  .post-content h3 { color: #b8bb26; }
  .post-content h4 { color: #8ec07c; }
  .post-content h5 { color: #d3869b; }

  a:hover { background-color: var(--surface); }
  img { opacity: 0.92; }

  .post-content code { background: #282828; }
}

/* ── Print ────────────────────────────────────────────────── */
@media print {
  body { font-size: 12pt; background: white; color: black; }
  .site-footer, .post-page-nav { display: none; }
}