/* ---- Theme tokens (dark only) ---- */
:root {
  --bg: #2f2f34;
  --surface: #3a3a40;
  --text: #ececea;
  --muted: #a8a8a5;
  --border: #47474e;
  --accent: #7fd9d7;        /* brand light teal — the dark-mode accent */
  --accent-strong: #00a3a0; /* brand core teal */
  --accent-soft: #123a39;   /* dark teal, for badge backgrounds */
  --max: 44rem;
  --font-sans: "Liberation Sans", Arimo, Arial, Helvetica, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
}

/* ---- Base ---- */
* { box-sizing: border-box; }
/* Present for screen readers and search engines, invisible on screen. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 1.05rem;
  transition: background 0.2s ease, color 0.2s ease;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ---- Layout ---- */
.site-header,
.site-rule,
.content,
.site-footer {
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: 1.25rem;
}
.content { padding-block: 1rem 3rem; }

/* ---- Header ---- */
/* No bottom border: the snake below acts as the rule. */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1.5rem 1rem;
}
.site-logo {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}
.site-logo img { display: block; width: 150px; height: auto; }

/* ---- Snake divider (stands in for the header rule) ----
   The kit ships the snake as a standalone section divider. Kept narrow and
   centred so it reads as an ornament rather than a slab; aspect ratio is
   always preserved — it is never squashed to a fixed height. */
.site-rule {
  display: flex;
  justify-content: center;
  padding-block: 0 0.75rem;
}
.site-rule img {
  display: block;
  width: 58%;
  height: auto;
}
.site-nav { display: flex; align-items: center; gap: 1.1rem; }
.site-nav a { color: var(--muted); font-size: 0.95rem; }
.site-nav a:hover { color: var(--text); text-decoration: none; }

/* ---- Intro ---- */
.intro { padding-block: 2rem 1rem; }
.intro h1 { font-size: 2.4rem; margin: 0 0 0.25rem; letter-spacing: -0.03em; }
.tagline { color: var(--muted); font-size: 1.1rem; margin: 0; }

/* ---- Section cards ---- */
.section-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0 3rem;
}
.section-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.4rem 1.5rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.section-card:hover {
  text-decoration: none;
  border-color: var(--accent);
  transform: translateY(-2px);
}
.section-card-kicker {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
}
.section-card h2 { margin: 0.4rem 0 0.5rem; font-size: 1.5rem; color: var(--accent); letter-spacing: -0.01em; }
.section-card p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* ---- Landing highlights ----
   auto-fit means a lone column fills the width rather than sitting in a
   half-empty grid, which matters while one section is still empty. */
.highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 2.5rem;
}
.highlight-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
}
.highlight-head h3 { margin: 0; font-size: 1.05rem; letter-spacing: -0.01em; }
.highlight-head a { font-size: 0.85rem; }
.highlights .feed { margin-top: 0; }
.highlights .feed-title { font-size: 1.15rem; }

/* ---- Empty section ---- */
.empty-state {
  margin: 2rem 0 0;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

@media (max-width: 640px) {
  .section-cards,
  .highlights { grid-template-columns: 1fr; }
  .highlights { gap: 1.5rem; }
  /* Give the snake a bit more presence on a narrow screen. */
  .site-rule img { width: 78%; }
  /* The logo + four nav links don't fit on one line on a phone, so stack them. */
  .site-header {
    flex-direction: column;
    gap: 0.9rem;
    padding-block: 1.25rem 0.75rem;
  }
  .site-nav {
    flex-wrap: wrap;
    justify-content: center;
  }
  .hero h1 { font-size: 2.4rem; }
}

/* ---- Feed ---- */
.feed { list-style: none; padding: 0; margin: 2rem 0 0; }
.feed-item {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}
.feed-title { font-size: 1.35rem; margin: 0.3rem 0; letter-spacing: -0.01em; }
.feed-title a { color: var(--text); }
.feed-title a:hover { color: var(--accent); text-decoration: none; }
.feed-summary { color: var(--muted); margin: 0.4rem 0 0; }

/* ---- Entry meta ---- */
.entry-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.entry-type {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
}
.entry-source { color: var(--muted); font-size: 0.9rem; margin: 0.3rem 0 0; }

/* ---- Drafts (only ever rendered in the local preview) ---- */
.entry-type--draft {
  background: #4a3a12;
  color: #f5c451;
}
.feed-item--draft { opacity: 0.72; }
.draft-banner {
  margin: 0 0 1.5rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid #6b5418;
  border-left: 3px solid #f5c451;
  border-radius: 6px;
  background: #3a3018;
  color: #f0dca8;
  font-size: 0.9rem;
}
.draft-banner strong { color: #f5c451; }
.draft-banner code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}

/* ---- Tags ---- */
.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 0.6rem 0 0;
}
.tag-list li { font-size: 0.82rem; }
.tag-list a { color: var(--muted); }
.tag-list a:hover { color: var(--accent); text-decoration: none; }

/* ---- Tag cloud (the /tags/ index) ---- */
.tag-cloud {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.tag-cloud li {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  background: var(--surface);
}
.tag-cloud a { color: var(--text); }
.tag-cloud a:hover { color: var(--accent); text-decoration: none; }
.tag-count { color: var(--muted); font-size: 0.8rem; }

/* ---- Full entry ---- */
.entry--full { padding-block: 2rem 1rem; }
.entry-title { font-size: 2rem; margin: 0.5rem 0; letter-spacing: -0.02em; line-height: 1.2; }
.entry-body { margin-top: 1.5rem; }
.entry-body h2 { margin-top: 2rem; letter-spacing: -0.01em; }
.entry-body blockquote {
  margin: 1.5rem 0;
  padding-left: 1.1rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-family: var(--font-serif);
  font-style: italic;
}
.entry-body pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
}
.entry-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}
/* Inline code (not inside a highlighted block) gets a subtle chip. */
.entry-body :not(pre) > code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}
.back-link { margin-top: 2.5rem; font-size: 0.9rem; }

/* ---- Syntax highlighting (Prism, generated at build time) ----
   A restrained four-hue palette that sits on --surface and keeps the brand
   teal as the dominant accent. */
.entry-body pre[class*="language-"] { margin: 1.5rem 0; }
.entry-body code[class*="language-"] { color: var(--text); }
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata { color: var(--muted); font-style: italic; }
.token.punctuation,
.token.operator { color: var(--muted); }
.token.keyword,
.token.tag,
.token.selector,
.token.important,
.token.atrule { color: var(--accent); }
.token.string,
.token.char,
.token.attr-value,
.token.regex { color: #9ad4a0; }
.token.number,
.token.boolean,
.token.constant,
.token.symbol { color: #f0b37e; }
.token.function,
.token.class-name,
.token.attr-name,
.token.property { color: #e8d18b; }
.token.deleted { color: #f08b8b; }
.token.inserted { color: #9ad4a0; }
.token.bold { font-weight: 600; }
.token.italic { font-style: italic; }

/* ---- Heading anchors ----
   markdown-it-anchor wraps the heading text in a link; keep it looking like a
   plain heading until hover, so the page stays calm. */
.entry-body .header-anchor {
  color: inherit;
  text-decoration: none;
}
.entry-body .header-anchor:hover {
  color: var(--accent);
  text-decoration: none;
}

/* ---- Footnotes ---- */
/* markdown-it-footnote injects its own <hr>; we draw the divider with the
   border-top below instead, so hide it rather than showing two rules. */
.entry-body .footnotes-sep { display: none; }
.entry-body .footnotes {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--muted);
}
.entry-body .footnotes ol { padding-left: 1.2rem; }
.entry-body .footnotes li { margin-bottom: 0.4rem; }
.entry-body .footnotes p { margin: 0.2rem 0; }
.entry-body .footnote-ref a {
  text-decoration: none;
  padding: 0 0.15em;
}
.entry-body .footnote-backref { text-decoration: none; }

/* ---- Embedded media (youtube / video shortcodes, raw iframes) ---- */
.embed {
  width: 100%;
  margin: 1.5rem 0;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}
.embed--16x9 {
  position: relative;
  aspect-ratio: 16 / 9;
}
.embed--16x9 iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
video.embed { display: block; }
/* Any raw iframe pasted into an entry stays responsive too. */
.entry-body iframe { max-width: 100%; }

/* Instagram embed: centered, capped width. embeds.js adds its own styling
   once loaded; this styles the fallback/pre-load blockquote. */
.instagram-media {
  margin: 1.5rem auto !important;
  max-width: 540px;
}
.entry-body .instagram-media:not(iframe) {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  background: var(--surface);
}

/* Facebook embed: centered. The SDK injects an iframe once loaded. */
.fb-embed {
  margin: 1.5rem 0;
  display: flex;
  justify-content: center;
}

/* ---- 404 ---- */
.notfound { padding-block: 4rem 3rem; text-align: center; }
.notfound h1 {
  font-size: 5rem;
  margin: 0;
  letter-spacing: -0.04em;
  color: var(--accent);
}

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 1.5rem 2.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}
