:root {
  --bg: #0f1115;
  --fg: #d7dae0;
  --muted: #8a919c;
  --accent: #5eead4;
  --accent2: #34d399;
  --accent3: #febc2e;
  --card: #171a21;
  --border: #262b36;
  --link: #7dd3fc;
}

/* AIDEV-NOTE: browser chrome (selection, caret, scrollbar, focus) themed from
   the palette — cheapest signal the page was designed, not assembled. */
::selection { background: var(--accent2); color: #0f1115; }
html { caret-color: var(--accent3); scrollbar-color: #2e3440 var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

* { box-sizing: border-box; }

html { font-size: 17px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  line-height: 1.65;
}

header {
  border-bottom: 1px solid var(--border);
  background: rgba(15, 17, 21, 0.92);
}

nav {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0.9rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

nav .brand { color: var(--fg); text-decoration: none; }
nav .links a { color: var(--muted); text-decoration: none; margin-left: 1.1rem; }
nav .links a:hover { color: var(--accent); }

main {
  max-width: 64rem;
  margin: 0 auto;
  padding: 2.5rem 1rem 3rem;
}

a { color: var(--link); }
a:hover { color: var(--accent); }

.hero h1 { margin: 0 0 0.4rem; font-size: 2.1rem; }
.tagline { color: var(--muted); margin-top: 0; font-size: 1.05rem; }

.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.3rem;
  margin-bottom: 1.2rem;
  display: flex;
  gap: 1.3rem;
  align-items: center;
  transition: transform 0.18s ease-out, border-color 0.18s ease-out;
}
.post-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent2);
}
.post-card .pc-text { flex: 1; min-width: 0; }
.post-card .pc-thumb {
  width: 11rem;
  aspect-ratio: 1376 / 768;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
@media (max-width: 44rem) {
  .post-card .pc-thumb { display: none; }
}

.post-card h2 { margin: 0.25rem 0 0.5rem; font-size: 1.25rem; }
.post-card h2 a { color: var(--fg); text-decoration: none; }
.post-card h2 a:hover { color: var(--accent); }

.meta { color: var(--muted); font-size: 0.85rem; }
.header-img {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin: 0.8rem 0 1.2rem;
  display: block;
}
.tag {
  display: inline-block;
  border: 1px solid var(--accent2);
  color: var(--accent2);
  border-radius: 999px;
  padding: 0 0.55rem;
  margin-left: 0.3rem;
}
.more { font-size: 0.9rem; text-decoration: none; }

/* AIDEV-NOTE: article prose capped at ~90ch — widened past the 65–75ch
   guideline per owner request to reduce whitespace next to full-width media. */
.post > p, .post > ul, .post > ol, .post > blockquote,
.post > h1, .post > h2, .post > h3, .post > h4, .post > .cta {
  max-width: 90ch;
}
.post h1 { font-size: 2.3rem; line-height: 1.25; }
.post blockquote {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 1.2rem 0;
  padding: 0.2rem 1rem;
  color: var(--muted);
}
.post pre {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
}
.post code { background: var(--card); padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.9em; }
.post pre code { background: none; padding: 0; }
.post img { max-width: 100%; border-radius: 8px; }
.post hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0 1rem; }

.cta {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 1rem;
}

.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; }
.pager .right { margin-left: auto; text-align: right; }

/* AIDEV-NOTE: subscribe link-buttons (index hero, article CTA, 404).
   Reuses card/border tokens; anchor styled as button, no JS. */
.btn {
  display: inline-block;
  background: var(--card);
  border: 1px solid var(--accent2);
  color: var(--accent2);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.18s ease-out, background-color 0.18s ease-out;
}
.btn:hover { transform: translateY(-1px); color: var(--accent); border-color: var(--accent); }
.subscribe-row { margin: 1.1rem 0 0; display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
.subscribe-cta { margin-top: 0.8rem; }
.subscribe-cta .btn { margin-left: 0.35rem; }
.count-line { text-align: center; margin-top: 1.6rem; }

.tag-list { list-style: none; padding: 0; }
.tag-list li { margin: 0.3rem 0; }

footer.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
  margin-top: 2.5rem;
  padding: 1.2rem 1rem 2.5rem;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbfbf9;
    --fg: #1c1e24;
    --muted: #6b7280;
    --card: #ffffff;
    --border: #e3e5ea;
    --link: #0369a1;
  }
  header { background: rgba(251, 251, 249, 0.92); }
  /* AIDEV-NOTE: accent green fails contrast on white — darker emerald for text */
  .tag { color: #047857; }
  ::selection { color: #fbfbf9; }
  /* AIDEV-NOTE: light-scheme accent override — dark-theme teal #5eead4 is
     too pale for hover/focus text on white; use teal-700 instead. */
  :root { --accent: #0f766e; }
  .tag { border-color: #047857; }
  .btn { color: #047857; border-color: #047857; }
  .btn:hover { color: #0f766e; border-color: #0f766e; }
}

/* AIDEV-NOTE: terminal-style analytics consent widget (rendered by consent.js).
   Always dark — it mimics a terminal, independent of the light/dark theme. */
#cookie-term {
  position: fixed;
  bottom: 1.2rem;
  right: 1.2rem;
  z-index: 999;
  width: min(26rem, calc(100vw - 2rem));
  background: #14161c;
  border: 1px solid #262b36;
  border-radius: 10px;
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #d7dae0;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
#cookie-term .ct-titlebar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.8rem;
  background: #1b1e26;
  border-bottom: 1px solid #262b36;
}
#cookie-term .ct-dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; }
#cookie-term .ct-dot.r { background: #ff5f57; }
#cookie-term .ct-dot.y { background: #febc2e; }
#cookie-term .ct-dot.g { background: #28c840; }
#cookie-term .ct-title {
  flex: 1;
  text-align: center;
  color: #8a919c;
  font-size: 0.78rem;
}
#cookie-term .ct-body { padding: 0.9rem 1rem 1rem; }
#cookie-term .ct-prompt { color: #34d399; font-weight: 700; }
#cookie-term .ct-actions { margin: 0.5rem 0; }
#cookie-term .ct-btn {
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  padding: 0.15rem 0.5rem 0.15rem 0;
}
#cookie-term .ct-btn:hover,
#cookie-term .ct-btn:focus-visible {
  color: #5eead4;
  outline: none;
}
#cookie-term .ct-key { color: #34d399; font-weight: 700; }
#cookie-term .ct-cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.1em;
  background: #febc2e;
  vertical-align: text-bottom;
  animation: ct-blink 1.1s steps(1) infinite;
}
@keyframes ct-blink { 50% { opacity: 0; } }
