/* ==========================================================================
   Hermes blog — style.css
   Typography system adapted from Tailwind CSS Typography ("prose"),
   self-hosted as plain CSS with custom properties, no build step.

   Fonts are linked in the HTML <head> already:
     Fraunces (variable, display, opsz 144) · IBM Plex Sans (body) · JetBrains Mono (code/meta)
   If that link is ever removed, add:
     @import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..900;1,9..144,300..900&family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600;1,400&family=JetBrains+Mono:ital,wght@0,400;0,500;1,400&display=swap');
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */

:root {
  /* dark theme (default) — charcoal */
  --bg: #181c19;
  --surface: #1f251f;      /* elevated surface: code blocks, inline code, cards */
  --surface-2: #262d26;    /* hover / active state of surface */
  --text: #e6e9e1;
  --text-muted: #b2b7a9;
  --text-faint: #7c8277;
  --accent: #dfa184;
  --accent-strong: #ecc0a5;
  --line: #2b3129;
  --line-strong: #3a4138;
  --selection: rgba(223, 161, 132, 0.32);
  --status-dot: #68b47c;
  --shadow: rgba(0, 0, 0, 0.35);

  /* fonts */
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "IBM Plex Sans", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  /* layout */
  --measure: 720px;
  --radius: 0.375rem;
}

@media (prefers-color-scheme: light) {
  :root {
    /* light theme — warm paper */
    --bg: #f6f1e7;
    --surface: #ece3d0;
    --surface-2: #e3d8bf;
    --text: #221d16;
    --text-muted: #5c5244;
    --text-faint: #8d8171;
    --accent: #a85c36;
    --accent-strong: #8a4a2b;
    --line: #ddd0b4;
    --line-strong: #c9b990;
    --selection: rgba(168, 92, 54, 0.18);
    --status-dot: #3f8f57;
    --shadow: rgba(34, 29, 22, 0.12);
  }
}

/* --------------------------------------------------------------------------
   2. Reset
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd, ul, ol {
  margin: 0;
}

ul, ol {
  padding: 0;
}

img, picture, svg {
  display: block;
  max-width: 100%;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
}

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

/* --------------------------------------------------------------------------
   3. Base
   -------------------------------------------------------------------------- */

html {
  background: var(--bg);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  html {
    color-scheme: light;
  }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

hr {
  border: none;
  border-top: 1px solid var(--line);
}

/* --------------------------------------------------------------------------
   4. Layout shell
   -------------------------------------------------------------------------- */

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.site-header {
  padding: 5rem 0 3rem;
}

.site-header .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text);
}

.site-header .brand .mark {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--accent);
}

.site-header .brand .wordmark {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-variation-settings: "opsz" 144;
  font-weight: 560;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--text);
}

.site-header .tagline {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 34rem;
}

.section {
  padding: 3.5rem 0;
  border-top: 1px solid var(--line);
}

.section:first-child {
  border-top: none;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 1.5rem;
  display: block;
}

/* --------------------------------------------------------------------------
   5. Post list / entries
   -------------------------------------------------------------------------- */

.post-list .entry {
  padding: 2rem 0;
  border-bottom: 1px solid var(--line);
}

.post-list .entry:last-child {
  border-bottom: none;
}

.entry-title {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-variation-settings: "opsz" 144;
  font-weight: 560;
  font-size: 1.65rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

.entry-title a {
  color: var(--text);
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 2px;
  transition: background-size 0.25s ease, color 0.25s ease;
  padding-bottom: 0.08em;
}

.entry-title a:hover,
.entry-title a:focus-visible {
  color: var(--accent);
  background-size: 100% 2px;
}

.entry-meta {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-bottom: 0.75rem;
  letter-spacing: 0.01em;
}

.entry-excerpt {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   6. Small UI elements
   -------------------------------------------------------------------------- */

.rss-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--accent);
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.rss-pill:hover,
.rss-pill:focus-visible {
  background-color: var(--accent);
  color: var(--bg);
}

.status-line {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--status-dot);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-dot) 25%, transparent);
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   7. Post header / footer
   -------------------------------------------------------------------------- */

.post-header {
  padding: 2rem 0 2.5rem;
}

.post-header h1 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-variation-settings: "opsz" 144;
  font-weight: 560;
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin: 0 0 1rem;
}

.post-header .entry-meta {
  margin-bottom: 0;
}

.post-footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-faint);
}

.back-link {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: color 0.2s ease;
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   8. Post body — prose typography
   -------------------------------------------------------------------------- */

.post-body {
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--text-muted);
}

.post-body > :first-child {
  margin-top: 0;
}

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4,
.post-body h5,
.post-body h6 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-variation-settings: "opsz" 144;
  color: var(--text);
  letter-spacing: -0.02em;
}

.post-body h1 {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.1;
  margin-top: 0;
  margin-bottom: 1em;
  letter-spacing: -0.025em;
}

.post-body h2 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2em;
  margin-bottom: 1em;
  padding-top: 1.5em;
  border-top: 1px solid var(--line);
}

.post-body h2:first-of-type {
  padding-top: 0;
  border-top: none;
}

.post-body h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  margin-top: 1.6em;
  margin-bottom: 0.6em;
}

.post-body h4 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

.post-body p {
  margin-top: 0;
  margin-bottom: 1.25em;
}

.post-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 50%, transparent);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.2s ease;
}

.post-body a:hover,
.post-body a:focus-visible {
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}

.post-body strong {
  font-weight: 600;
  color: var(--text);
}

.post-body em {
  font-style: italic;
}

.post-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface);
  color: var(--accent-strong);
  padding: 0.15em 0.35em;
  border-radius: 0.2em;
  white-space: break-spaces;
}

.post-body pre {
  position: relative;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1.5em 0;
  overflow-x: auto;
}

.post-body pre::after {
  content: "copy";
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-faint);
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  padding: 0.15rem 0.4rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.post-body pre:hover::after {
  opacity: 1;
}

.tldr-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 0 0 2rem;
  font-size: 0.95rem;
  line-height: 1.7;
}

.tldr-card .tldr-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
  display: block;
}

.post-body pre code {
  background: none;
  color: var(--text);
  padding: 0;
  font-size: 1em;
  white-space: pre;
}

.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1.25rem;
  margin: 1.5em 0;
  font-style: italic;
  color: var(--text-faint);
}

.post-body blockquote p {
  margin-bottom: 0.75em;
}

.post-body blockquote p:last-child {
  margin-bottom: 0;
}

.post-body hr {
  border-top: 1px solid var(--line);
  margin: 3em 0;
}

.post-body ul,
.post-body ol {
  padding-left: 1.5em;
  margin-top: 0;
  margin-bottom: 1.25em;
}

.post-body ul {
  list-style-type: disc;
}

.post-body ol {
  list-style-type: decimal;
}

.post-body li {
  margin-bottom: 0.5em;
}

.post-body li::marker {
  color: var(--accent);
}

.post-body li > ul,
.post-body li > ol {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.95em;
}

.post-body th {
  font-weight: 600;
  color: var(--text);
  text-align: left;
  border-bottom: 1px solid var(--line-strong);
  padding: 0.75em 1em;
}

.post-body td {
  border-bottom: 1px solid var(--line);
  padding: 0.75em 1em;
}

.post-body thead th {
  border-top: 1px solid var(--line-strong);
}

.post-body img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 1.5em 0;
}

.post-body figure {
  margin: 1.5em 0;
}

.post-body figcaption {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-faint);
  text-align: center;
  margin-top: 0.75em;
}

/* --------------------------------------------------------------------------
   9. Colophon / misc chrome
   -------------------------------------------------------------------------- */

.colophon-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.ad-slot {
  margin: 2.5rem 0;
  border-top: 1px solid var(--line);
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   10. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  .site-header {
    padding: 3rem 0 2rem;
  }

  .section {
    padding: 2.5rem 0;
  }

  .colophon-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .post-body {
    font-size: 1.0625rem;
  }

  .post-body pre {
    padding: 1rem;
  }
}
