/* ============================================================
   Playbook — Hugo theme for micro.blog
   Text-first. No images required. No external resources.
   ============================================================ */

/* ── Design tokens ── */
:root {
  --bg:           #ffffff;
  --surface:      #fafaff;
  --text:         #1f2937;
  --text-muted:   #6b7280;
  --accent:       #6366f1;
  --accent-hover: #4f46e5;
  --accent-soft:  #eef2ff;
  --border:       #e5e7eb;
  --code-bg:      #f9fafb;

  --font-sans: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI",
               "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "Fira Code", Consolas,
               "Liberation Mono", "Courier New", monospace;

  --content-width: 680px;
  --wide-width:    1080px;
  --radius:        5px;
  --ease:          150ms ease;
}

/* ── Dark mode ── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:           #242038;
    --surface:      #2e2a48;
    --text:         #f1f0ff;
    --text-muted:   #a5b4fc;
    --accent:       #818cf8;
    --accent-hover: #a5b4fc;
    --accent-soft:  #312e5a;
    --border:       #3d3960;
    --code-bg:      #28243e;
  }
}

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

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  hanging-punctuation: first last;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.75;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

img, video, svg { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4, h5, h6 { text-wrap: balance; }
p { text-wrap: pretty; }

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

/* ── Accessibility ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--accent);
  color: var(--surface);
  padding: 0.5rem 1rem;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 0 0 var(--radius) var(--radius);
  z-index: 999;
  transition: top var(--ease);
}
.skip-link:focus { top: 0; color: var(--surface); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

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

/* ── Layout wrappers ── */
.content-wrapper {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 3rem 1.5rem;
  width: 100%;
}

main { flex: 1; }

/* ============================================================
   HEADER & NAV
   ============================================================ */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
}

.site-header-inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0.875rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.site-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
}
.site-title:hover { color: var(--accent); }

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius);
  transition: color var(--ease), background var(--ease);
}
.site-nav a:hover { color: var(--text); background: var(--code-bg); }
.site-nav a[aria-current="page"] { color: var(--accent); }

/* ============================================================
   HOME INTRO
   ============================================================ */
.home-intro {
  padding: 3.5rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.home-intro h1 {
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.home-intro p,
.home-intro-body p {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 52ch;
  line-height: 1.7;
}

.home-intro-body p + p { margin-top: 0.75rem; }

/* ============================================================
   POST LIST
   ============================================================ */
.post-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.post-item {
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--border);
}
.post-item:first-child { padding-top: 0; }
.post-item:last-child { border-bottom: none; }

.post-item-meta {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.post-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.post-reading-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.post-reading-time::before { content: "·"; margin-right: 0.4rem; }

.post-tags {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-left: 0.25rem;
}

.tag {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 0.1rem 0.5rem;
  border-radius: 99px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color var(--ease), border-color var(--ease);
  line-height: 1.6;
}
.tag:hover { color: var(--accent); border-color: var(--accent); }

.post-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-bottom: 0.4rem;
}
.post-title a { color: var(--text); }
.post-title a:hover { color: var(--accent); }

.post-excerpt {
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.65;
  margin-bottom: 0.65rem;
  max-width: 60ch;
}

.micro-post .post-excerpt {
  color: var(--text);
  font-size: 1rem;
}

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
}
.read-more:hover { color: var(--accent-hover); gap: 0.5rem; }

/* ============================================================
   SINGLE POST
   ============================================================ */
.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: 0.875rem;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.post-meta time { font-variant-numeric: tabular-nums; }

.post-meta-divider { color: var(--border); user-select: none; }

.micro-post-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   PROSE (article content)
   ============================================================ */
.prose {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.8;
}

.prose > * + * { margin-top: 1.5rem; }

.prose h2,
.prose h3,
.prose h4 {
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-top: 2.5rem;
  margin-bottom: 0.5rem;
}
.prose h2 { font-size: 1.4375rem; }
.prose h3 { font-size: 1.1875rem; }
.prose h4 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.05em; }

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.prose a:hover { color: var(--accent-hover); }

/* External link indicator */
.prose a[href^="http"]:not([href*="micro.blog"]):not([href*="localhost"])::after {
  content: "\2197"; /* ↗ */
  font-size: 0.65em;
  vertical-align: super;
  margin-left: 0.15em;
  opacity: 0.6;
}

.prose strong { font-weight: 700; color: var(--text); }
.prose em { font-style: italic; }

.prose ul,
.prose ol {
  padding-left: 1.5rem;
}
.prose li + li { margin-top: 0.35rem; }
.prose li > p { margin-top: 0.5rem; }

.prose blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.75rem 0;
  padding: 0.5rem 0 0.5rem 1.25rem;
  color: var(--text-muted);
  font-style: italic;
}
.prose blockquote p { margin: 0; }

/* Inline code */
.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

/* Code blocks */
.prose pre {
  background: #1c1917;
  color: #d6d3d1;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.65;
  tab-size: 2;
}
.prose pre code {
  background: transparent;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

@media (prefers-color-scheme: dark) {
  .prose pre { background: #0d0c1a; }
}

.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  overflow-x: auto;
  display: block;
}
.prose th {
  text-align: left;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--border);
  color: var(--text);
}
.prose td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  vertical-align: top;
}
.prose tr:hover td { background: var(--code-bg); }

.prose img {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 1.75rem auto;
}

.prose figure { margin: 1.75rem 0; }
.prose figcaption {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-style: italic;
}

/* ============================================================
   POST FOOTER
   ============================================================ */
.post-footer {
  margin-top: 3rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.post-footer-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.post-nav {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 1;
}

.post-nav-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: color var(--ease);
  max-width: 22ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.post-nav-link:hover { color: var(--accent); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 2rem;
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  gap: 1rem;
  flex-wrap: wrap;
}

.pagination a {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--ease);
}
.pagination a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.pagination-info {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ============================================================
   LIST HEADER (taxonomy / section pages)
   ============================================================ */
.list-header {
  padding-bottom: 1.75rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.list-header h1 {
  font-size: 1.625rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
}
.list-header h1 em { font-style: normal; color: var(--accent); }

.list-header p { color: var(--text-muted); font-size: 0.9375rem; }
.list-count { margin-top: 0.35rem; }

/* ============================================================
   TAG CLOUD (all-tags page)
   ============================================================ */
.tag-cloud {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-cloud a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.35rem 0.85rem;
  border-radius: 99px;
  transition: all var(--ease);
}
.tag-cloud a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.tag-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--code-bg);
  border-radius: 99px;
  padding: 0.05rem 0.45rem;
  min-width: 1.4rem;
  text-align: center;
  font-weight: 600;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.75rem 0;
  margin-top: auto;
}

.site-footer-inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-copy {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
}

.footer-links a {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}
.footer-links a:hover { color: var(--accent); }

/* ============================================================
   SYNDICATION LINKS (micro.blog cross-posting)
   ============================================================ */

.syndication-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.syndication-links a {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
}

.syndication-links a:hover { color: var(--accent); border-color: var(--accent); }

/* ============================================================
   ARCHIVE PAGE
   ============================================================ */

.archive-list { display: flex; flex-direction: column; gap: 2.5rem; }

.archive-month-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.archive-posts { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }

.archive-post {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.9375rem;
}

.archive-post .post-date {
  flex-shrink: 0;
  width: 4rem;
  font-size: 0.75rem;
}

.archive-post a { color: var(--text); }
.archive-post a:hover { color: var(--accent); }

/* ============================================================
   UTILITY
   ============================================================ */
.no-posts {
  color: var(--text-muted);
  font-style: italic;
  padding: 2rem 0;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  html { font-size: 16px; }

  .site-header-inner { padding: 0.75rem 1rem; }
  .content-wrapper { padding: 2rem 1rem; }

  .home-intro { padding: 2.5rem 0 2rem; }

  .post-header h1 { font-size: 1.4375rem; }

  .post-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .post-nav { justify-content: flex-start; }

  .pagination { flex-direction: column; align-items: stretch; text-align: center; }
  .pagination a { justify-content: center; }

  .site-footer-inner { flex-direction: column; text-align: center; }
  .footer-links { justify-content: center; }
}

/* ============================================================
   CALLOUT SHORTCODE
   ============================================================ */

.callout {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.875rem 1.125rem;
  margin: 1.75rem 0;
}

.callout-title {
  font-weight: 700;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.callout-body { font-size: 0.9375rem; }
.callout-body p:last-child { margin-bottom: 0; }

.callout-note   { border-color: #6b7280; background: var(--code-bg); }
.callout-note   .callout-title { color: #6b7280; }
.callout-warning { border-color: #d97706; background: #fffbeb; }
.callout-warning .callout-title { color: #d97706; }

@media (prefers-color-scheme: dark) {
  .callout-warning { background: #2d1f00; }
}

/* ============================================================
   IMAGES
   ============================================================ */

/* Cover image — full-width banner above post header */
.post-cover {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid var(--border);
}

/* Cover image wrapper for aspect-ratio control */
.post-cover-wrap {
  width: 100%;
  max-height: 420px;
  overflow: hidden;
  background: var(--surface);
}

/* Post card thumbnail — optional small image beside excerpt */
.post-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.post-item-inner {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.post-item-text { flex: 1; min-width: 0; }

/* Inline images in prose */
.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
  margin: 2rem auto;
}

/* Wide images that break out of the content column */
.prose .img-wide {
  max-width: min(100vw - 3rem, 900px);
  margin-left: 50%;
  transform: translateX(-50%);
}

/* Full-bleed images */
.prose .img-full {
  max-width: 100vw;
  margin-left: 50%;
  transform: translateX(-50%);
  border-radius: 0;
  border-left: none;
  border-right: none;
}

/* Figure + caption */
/* Hugo {{< figure >}} shortcode + render hook output */
.prose figure,
.prose .figure,
.prose-figure {
  margin: 2rem 0;
}

.prose figcaption,
.prose .figure figcaption,
.prose-figure figcaption {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.625rem;
  font-style: italic;
  line-height: 1.5;
}

/* Image gallery grid */
.prose .gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin: 2rem 0;
}

.prose .gallery img {
  margin: 0;
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: opacity 150ms ease;
}

.prose .gallery img:hover { opacity: 0.88; }

/* Responsive: stack thumb on small screens */
@media (max-width: 480px) {
  .post-item-inner { flex-direction: column; }
  .post-thumb { width: 100%; height: 160px; border-radius: var(--radius); }
  .prose .img-wide,
  .prose .img-full { max-width: 100%; margin-left: 0; transform: none; border-radius: var(--radius); border: 1px solid var(--border); }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .site-header,
  .site-footer,
  .post-footer,
  .post-nav,
  .pagination,
  .skip-link { display: none !important; }

  body { background: #fff; color: #000; font-size: 12pt; }
  .content-wrapper { padding: 0; max-width: 100%; }

  a { color: #000; text-decoration: underline; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; }

  .prose pre {
    border: 1px solid #ccc;
    background: #f8f8f8;
    color: #000;
    white-space: pre-wrap;
  }
}
