/* blog.charliekrug.com — warm editorial, paper (light) / ink (dark). */
:root {
  --bg: #faf8f4; --bg2: #f1ede5; --card: #fdfcf9;
  --ink: #2a251c; --muted: #756c5c; --line: #e6e0d4;
  --accent: #8a5f2e; --code-bg: #2b2620; --code-ink: #e9e2d2;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
html[data-theme="dark"] {
  --bg: #191713; --bg2: #201d17; --card: #1e1b16;
  --ink: #e6e0d3; --muted: #9a907f; --line: #2e2a22;
  --accent: #c29a62; --code-bg: #12100c; --code-ink: #ddd6c6;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    --bg: #191713; --bg2: #201d17; --card: #1e1b16;
    --ink: #e6e0d3; --muted: #9a907f; --line: #2e2a22;
    --accent: #c29a62; --code-bg: #12100c; --code-ink: #ddd6c6;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 17px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* a11y: hidden until keyboard-focused */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 10;
  background: var(--accent); color: var(--bg); padding: 8px 14px;
  border-radius: 0 0 8px 0; text-decoration: none; font-family: var(--sans);
}
.skip:focus { left: 0; }

/* masthead */
.masthead {
  max-width: 880px; margin: 0 auto; padding: 22px 20px 18px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font-family: var(--serif); font-size: 1.5rem; font-weight: 700;
  color: var(--ink); text-decoration: none; letter-spacing: -0.01em;
  display: inline-flex; align-items: center; gap: 12px;
}
.wordmark-mark { width: 30px; height: 30px; border-radius: 7px; flex-shrink: 0; }
.wordmark-sub {
  display: block; font-family: var(--sans); font-size: .72rem; font-weight: 600;
  color: var(--accent); text-transform: uppercase; letter-spacing: .14em;
}
.masthead nav { display: flex; align-items: center; gap: 18px; font-size: .92rem; }
.masthead nav a { color: var(--muted); text-decoration: none; }
.masthead nav a:hover { color: var(--accent); }
#theme-toggle {
  background: none; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); font-size: 1rem; line-height: 1; padding: 5px 9px; cursor: pointer;
}
#theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

main { max-width: 880px; margin: 0 auto; padding: 0 20px 60px; }

/* index */
.hero { padding: 44px 0 8px; max-width: 640px; }
.hero h1 {
  font-family: var(--serif); font-size: clamp(1.6rem, 4vw, 2.2rem);
  line-height: 1.25; margin: 0 0 12px; letter-spacing: -0.01em;
}
.hero-sub { color: var(--muted); margin: 0; }
.cards { display: flex; flex-direction: column; padding: 20px 0 28px; }
.card {
  display: block; padding: 22px 4px; color: var(--ink); text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.card:first-child { border-top: 1px solid var(--line); }
.card:hover h2 { color: var(--accent); }
.card h2 { font-family: var(--serif); font-size: 1.35rem; margin: 8px 0 6px; line-height: 1.3;
  transition: color .12s ease; }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }
.card-meta, .post-meta {
  display: flex; align-items: center; gap: 10px;
  font-size: .78rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em;
}
.chip { font-weight: 700; }
.dot { opacity: .5; }

/* post */
.post article { max-width: 680px; margin: 0 auto; padding-top: 32px; }
.crumb { margin: 0 0 18px; font-size: .88rem; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); }
.post-title {
  font-family: var(--serif); font-size: clamp(1.9rem, 5vw, 2.6rem);
  line-height: 1.18; margin: 14px 0 10px; letter-spacing: -0.015em;
}
.dek { font-size: 1.12rem; color: var(--muted); margin: 0 0 8px; line-height: 1.55; }
.body { font-family: var(--serif); font-size: 1.06rem; line-height: 1.75; }
.body h2 { font-size: 1.45rem; margin: 2em 0 .5em; line-height: 1.3; }
.body h3 { font-size: 1.15rem; margin: 1.6em 0 .4em; }
.body p { margin: 0 0 1.1em; }
.body ul, .body ol { padding-left: 1.4em; margin: 0 0 1.1em; }
.body li { margin-bottom: .35em; }
.body blockquote {
  margin: 1.2em 0; padding: .2em 1.1em; border-left: 3px solid var(--accent);
  color: var(--muted); font-style: italic; background: var(--bg2); border-radius: 0 8px 8px 0;
}
.body img { max-width: 100%; border-radius: 8px; }
.body code {
  font-family: var(--mono); font-size: .85em;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 5px; padding: .1em .35em;
}
.body pre {
  background: var(--code-bg); color: var(--code-ink);
  border-radius: 10px; padding: 16px 18px; overflow-x: auto;
  font-size: .85rem; line-height: 1.55;
}
.body pre code { background: none; border: none; padding: 0; color: inherit; }
.body hr { border: none; border-top: 1px solid var(--line); margin: 2em 0; }
.body table { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: .92rem; }
.body th, .body td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
.body th { background: var(--bg2); }

/* promo + outro */
.promo {
  margin: 2.2em 0 0; padding: 18px 20px; border-radius: 12px;
  background: var(--bg2); border: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
}
.promo-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-block; background: var(--accent); color: var(--bg);
  border: none; border-radius: 8px; padding: 9px 16px; font-weight: 700;
  font-size: .92rem; font-family: var(--sans); text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.outro {
  margin: 1.4em 0 0; padding-top: 1.2em; border-top: 1px solid var(--line);
  color: var(--muted); font-size: .95rem;
}
.outro p { margin: 0; }

/* prev / next */
.postnav {
  max-width: 680px; margin: 28px auto 0; padding-top: 18px;
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.postnav a {
  display: block; color: var(--ink); text-decoration: none;
  font-family: var(--serif); font-size: 1.02rem; line-height: 1.35;
}
.postnav a span {
  display: block; font-family: var(--sans); font-size: .75rem; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px;
}
.postnav a:hover { color: var(--accent); }
.pn-older { text-align: right; }

/* comments */
.comments { max-width: 680px; margin: 40px auto 0; padding-top: 8px; }
.comments h2 { font-family: var(--serif); font-size: 1.4rem; border-top: 1px solid var(--line); padding-top: 28px; }
.comment {
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.comment .who { font-weight: 700; font-size: .92rem; }
.comment .when { color: var(--muted); font-size: .78rem; margin-left: 8px; }
.comment .text { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .96rem; }
#comment-form { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; position: relative; }
#comment-form input, #comment-form textarea {
  width: 100%; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  font-family: var(--sans); font-size: .95rem; resize: vertical;
}
#comment-form input:focus, #comment-form textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
#comment-form .row { display: flex; align-items: center; gap: 12px; }
#comment-form .row input { max-width: 320px; }
.muted { color: var(--muted); font-size: .88rem; }

footer {
  border-top: 1px solid var(--line); margin-top: 20px;
  padding: 22px 20px 34px; text-align: center; color: var(--muted); font-size: .88rem;
}
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }

@media (max-width: 560px) {
  .masthead { flex-direction: column; gap: 8px; align-items: flex-start; }
  .promo { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .card:hover { transition: none; transform: none; }
  html { scroll-behavior: auto; }
}
