/*
 * blog.css — hand-written CSS for the edge-rendered blog (worker/blog/*).
 * Not part of the Tailwind build: the main site prerenders via Nuxt+Tailwind,
 * but /blog/* is rendered by the Worker itself, so this stylesheet is served
 * as-is from public/blog.css. Design tokens below are copied verbatim from
 * app/assets/css/tailwind.css (:root block) to keep the blog visually
 * consistent with the main site's "restrained dark" system.
 */

:root {
  /* Backgrounds — deep slate, restrained (no neon). RGB channels for <alpha-value>. */
  --bg-deep:     7 12 22;      /* #070C16 page + footer */
  --bg-base:     11 18 32;     /* #0B1220 primary surface */
  --bg-elevated: 19 28 46;     /* #131C2E cards */

  /* Hairlines */
  --line-subtle: 148 163 184;  /* slate-400, used at low alpha */
  --line-strong: 56 189 248;   /* sky, used at low alpha for accent edges */

  /* Brand accent — steady sky blue (replaces cyan+violet) */
  --brand:        56 189 248;  /* #38BDF8 sky-400 */
  --brand-strong: 14 165 233;  /* #0EA5E9 sky-500 */

  /* CTA accent — warm amber, reserved for primary calls to action */
  --cta:       249 115 22;     /* #F97316 orange-500 */
  --cta-hover: 251 146 60;     /* #FB923C orange-400 */

  /* Foreground text */
  --fg-primary:   230 236 245; /* #E6ECF5 */
  --fg-secondary: 166 178 200; /* #A6B2C8 */
  --fg-muted:     123 137 164; /* #7B89A4 */
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  padding: 0;
  background: rgb(var(--bg-base));
  color: rgb(var(--fg-primary));
  color-scheme: dark;
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans TC', sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: rgb(var(--brand));
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid rgb(var(--brand));
  outline-offset: 2px;
  border-radius: 2px;
}

/* ─── Nav ─── */
.blog-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  background: rgba(7, 12, 22, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.blog-nav-brand {
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgb(var(--fg-primary));
}

.blog-nav-brand:hover {
  color: rgb(var(--brand));
  text-decoration: none;
}

.blog-nav-link {
  font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgb(var(--fg-secondary));
}

.blog-nav-link:hover {
  color: rgb(var(--brand));
  text-decoration: none;
}

/* ─── Layout ─── */
.blog-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
}

.blog-header {
  margin-bottom: 2rem;
}

.blog-heading {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 1.25rem;
}

/* ─── Category nav ─── */
.blog-cat-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.blog-cat-pill {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 999px;
  font-size: 0.8rem;
  color: rgb(var(--fg-secondary));
}

.blog-cat-pill:hover {
  border-color: rgb(var(--brand));
  color: rgb(var(--brand));
  text-decoration: none;
}

.blog-cat-pill.is-active {
  border-color: rgb(var(--brand));
  color: rgb(var(--brand));
  background: rgba(56, 189, 248, 0.08);
}

/* ─── Banner ─── */
.blog-banner {
  margin-bottom: 1.5rem;
  padding: 0.9rem 1.1rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.blog-banner-success {
  border: 1px solid rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.08);
  color: rgb(var(--fg-primary));
}

/* ─── List ─── */
.blog-list {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.blog-card {
  padding-bottom: 1.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.blog-card:last-child {
  border-bottom: none;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 0.5rem;
  font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgb(var(--fg-muted));
}

.blog-card-category {
  color: rgb(var(--brand));
}

.blog-card-title {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
}

.blog-card-title a {
  color: rgb(var(--fg-primary));
}

.blog-card-title a:hover {
  color: rgb(var(--brand));
  text-decoration: none;
}

.blog-card-excerpt {
  margin: 0 0 0.6rem;
  color: rgb(var(--fg-secondary));
}

.blog-card-more {
  font-size: 0.85rem;
  font-weight: 500;
}

.blog-empty {
  padding: 2rem 0;
  color: rgb(var(--fg-muted));
}

/* ─── Pagination ─── */
.blog-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  font-size: 0.85rem;
  color: rgb(var(--fg-muted));
}

.blog-page-link {
  color: rgb(var(--brand));
}

/* ─── Post ─── */
.blog-post-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0.25rem 0 1.5rem;
}

.blog-post-body {
  font-size: 1.02rem;
  line-height: 1.75;
  color: rgb(var(--fg-primary));
}

.blog-post-body h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2rem 0 1rem;
  line-height: 1.3;
}

.blog-post-body h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 1.75rem 0 0.75rem;
  line-height: 1.35;
}

.blog-post-body p {
  margin: 0 0 1.25rem;
}

.blog-post-body a {
  color: rgb(var(--brand));
  text-decoration: underline;
  text-underline-offset: 2px;
}

.blog-post-body ul,
.blog-post-body ol {
  margin: 0 0 1.25rem;
  padding-left: 1.5rem;
}

.blog-post-body li {
  margin-bottom: 0.4rem;
}

.blog-post-body blockquote {
  margin: 1.5rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 2px solid rgb(var(--brand));
  color: rgb(var(--fg-secondary));
  font-size: 1.05rem;
}

.blog-post-body code {
  font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  font-size: 0.9em;
  background: rgb(var(--bg-elevated));
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.blog-post-body pre {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: rgb(var(--bg-elevated));
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 8px;
  overflow-x: auto;
}

.blog-post-body pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

.blog-post-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1.5rem 0;
}

.blog-post-body hr {
  margin: 2.5rem 0;
  border: none;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.blog-back {
  margin-top: 2.5rem;
  font-size: 0.9rem;
}

/* ─── Subscribe ─── */
.blog-subscribe {
  margin-top: 3.5rem;
  padding: 1.75rem;
  border: 1px solid rgba(148, 163, 184, 0.1);
  background: rgba(19, 28, 46, 0.6);
  border-radius: 10px;
}

.blog-subscribe-title {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.blog-subscribe-desc {
  margin: 0 0 1.1rem;
  color: rgb(var(--fg-secondary));
  font-size: 0.9rem;
}

.blog-subscribe-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.blog-subscribe-input {
  flex: 1 1 220px;
  padding: 0.65rem 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 6px;
  background: rgb(var(--bg-deep));
  color: rgb(var(--fg-primary));
  font-size: 0.9rem;
}

.blog-subscribe-input:focus {
  outline: none;
  border-color: rgb(var(--brand));
}

.blog-subscribe-turnstile {
  flex-basis: 100%;
  min-height: 65px;
}

.blog-subscribe-btn {
  padding: 0.65rem 1.5rem;
  border: none;
  border-radius: 6px;
  background: rgb(var(--cta));
  color: rgb(var(--bg-deep));
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.blog-subscribe-btn:hover {
  background: rgb(var(--cta-hover));
}

.blog-subscribe-message {
  margin: 1rem 0 0;
  font-size: 0.9rem;
  color: rgb(var(--fg-secondary));
}

.blog-hp {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ─── 404 ─── */
.blog-notfound {
  padding: 3rem 0;
  text-align: center;
}

.blog-notfound h1 {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}

.blog-notfound p {
  color: rgb(var(--fg-secondary));
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
