/* =========================================================
   Animated Backgrounds — Pixel-matched OriginKit design tokens
   Monochrome obsidian/graphite UI so the orange brand logo stands out
   ========================================================= */
:root {
  /* Light mode fallback (when user explicitly chooses Light in Settings) */
  --bg: #f2f2f3;
  --surface: #ffffff;
  --surface-2: #f5f5f6;
  --surface-3: #e5e6e8;
  --surface-active: #e0e1e4;
  --tab-active: #dcdde0;
  --card-surface: #ffffff;
  --card-surface-hover: #f7f7f8;
  --surface-inset: #f3f3f5;
  --text: #111214;
  --text-2: #3c3e44;
  --muted: #6e7078;
  --border: rgba(15, 16, 18, .09);
  --border-strong: rgba(15, 16, 18, .18);
  --pill-border: #d4d5d8;
  --primary: #111214;
  --primary-2: #2c2d30;
  --primary-ink: #111214;
  --primary-soft: rgba(17, 18, 20, .08);
  --grad: linear-gradient(135deg, #2b2c2f 0%, #111214 100%);
  --ink: #111214;
  --ink-text: #ffffff;
  --danger: #ef4444;
  --heart: #f43f5e;
  --green: #22c55e;
  --radius-panel: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-lg: 0 18px 46px rgba(0, 0, 0, .14);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Inter", var(--font);
  --sidebar-w: 270px;
  --gutter: 10px;
  --topbar-h: 64px;
  color-scheme: light;
}

html.dark {
  /* Exact OriginKit obsidian & graphite palette (default) */
  --bg: #0f0f10;
  --surface: #1b1c1d;
  --surface-2: #121314;
  --surface-3: #2a2b2d;
  --surface-active: #434446;
  --tab-active: #4b4c4e;
  --card-surface: #1f2022;
  --card-surface-hover: #27282b;
  --surface-inset: #0f1010;
  --text: #f7f7f7;
  --text-2: #b7b7b8;
  --muted: #8e8f93;
  --border: rgba(255, 255, 255, .07);
  --border-strong: rgba(255, 255, 255, .14);
  --pill-border: #3e3f40;
  --primary: #f7f7f7;
  --primary-2: #ffffff;
  --primary-ink: #f7f7f7;
  --primary-soft: rgba(255, 255, 255, .09);
  --grad: linear-gradient(180deg, #484a4d 0%, #37393b 100%);
  --ink: #ffffff;
  --ink-text: #0f0f10;
  --shadow: none;
  --shadow-lg: 0 22px 54px rgba(0, 0, 0, .62);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--bg); }
body {
  margin: 0; font-family: var(--font); font-size: 14px; font-weight: 400; line-height: 1.5;
  color: var(--text); background: var(--bg); letter-spacing: -.015em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
a { color: var(--text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 500; line-height: 1.25; margin: 0 0 .5em; color: var(--text); letter-spacing: -.025em; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--ink-text); padding: 8px 14px; border-radius: 10px; z-index: 999; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 2px solid rgba(255, 255, 255, .35); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Buttons (OriginKit monochrome white & graphite) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .48em;
  border: 1px solid transparent; border-radius: 10px; padding: .55em 1.1em; font-weight: 500;
  font-size: 14px; text-decoration: none !important; white-space: nowrap;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, color .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary {
  background: var(--ink); color: var(--ink-text); font-weight: 500;
}
.btn-primary:hover { opacity: .92; }
.btn-danger {
  background: rgba(239, 68, 68, .14); color: #f87171; border-color: rgba(239, 68, 68, .28);
}
.btn-danger:hover { background: #ef4444; color: #fff; border-color: #ef4444; }
.btn-dark { background: var(--ink); color: var(--ink-text); }
.btn-dark:hover { opacity: .9; }
.btn-soft { background: var(--surface-3); color: var(--text); border-color: var(--border); }
.btn-soft:hover { background: var(--surface-active); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--pill-border); }
.btn-ghost:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-3); }
.btn-block { width: 100%; }
.btn-sm { padding: .42em .88em; font-size: 13px; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; display: inline-grid; place-items: center;
  background: transparent; color: var(--text-2); border: 1px solid var(--border); font-size: 14px;
  transition: background .15s, color .15s, border-color .15s; flex: none;
}
.icon-btn:hover { color: var(--text); background: var(--surface-3); border-color: var(--border-strong); }
.icon-btn-primary { background: var(--ink); color: var(--ink-text); border-color: transparent; }
.icon-btn-primary:hover { opacity: .92; }
.icon-btn-danger { color: var(--danger); }

/* OriginKit-style crisp white top-right action pill ("Sign In" -> "+ Submit") */
.btn-submit-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 15px;
  border-radius: 11px; border: 0; background: var(--ink); color: var(--ink-text);
  font-size: 14px; font-weight: 500; letter-spacing: -.015em;
  transition: opacity .15s ease, transform .15s ease;
}
.btn-submit-pill:hover { opacity: .92; }
.btn-submit-pill:active { transform: scale(.98); }

/* ---------- Chips (monochrome OriginKit pills) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 8px;
  background: transparent; border: 1px solid var(--pill-border); color: var(--text-2);
  font-size: 13.5px; font-weight: 400; letter-spacing: -.015em;
  text-decoration: none !important; cursor: pointer; white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-3); }
.chip.active {
  background: var(--surface-active); border-color: rgba(255, 255, 255, .14); color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}
.chip small {
  font-size: 11.5px; font-weight: 400; color: var(--muted);
  background: var(--surface-3); padding: 1px 6px; border-radius: 999px;
}
.chip.active small { background: rgba(0, 0, 0, .25); color: var(--text-2); }
.chip-xs { padding: 3px 9px; font-size: 12px; border-radius: 999px; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 500; font-size: 13.5px; color: var(--text-2); }
.input, .field input, .field select, .field textarea {
  width: 100%; padding: 10px 13px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 14px; outline: none; transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--border-strong); }
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 6px 11px; border-radius: 7px; font-weight: 500; font-size: 13px; color: var(--muted); transition: background .15s, color .15s; }
.segmented button.active { background: var(--surface-active); color: var(--text); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12); }

/* ---------- Section headings ---------- */
.section { margin: 0 0 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h1, .section-head h2 { margin: 0; font-size: 18px; letter-spacing: -.025em; font-weight: 500; color: var(--text); }
.section-head h1 i, .section-head h2 i { color: var(--text-2) !important; margin-right: 4px; }
.section-head p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; }
.see-all { font-weight: 400; font-size: 13.5px; color: var(--muted); white-space: nowrap; transition: color .15s; }
.see-all:hover { color: var(--text); text-decoration: none; }

/* ---------- Empty state ---------- */
.empty {
  text-align: center; padding: 48px 20px; background: var(--surface); border-radius: var(--radius);
  border: 1px dashed var(--pill-border);
}
.empty i.big { font-size: 2rem; color: var(--muted); margin-bottom: 10px; display: block; }
.empty h3 { margin-bottom: 6px; font-weight: 500; }
.empty p { color: var(--muted); margin: 0 0 16px; }

/* =========================================================
   BLOG & PROSE
   ========================================================= */
.breadcrumbs { font-size: 13px; color: var(--muted); margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs i { font-size: 10px; opacity: .6; }

.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.post-card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; transition: transform .2s, border-color .2s; border: 1px solid var(--border);
}
.post-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.post-card a { color: inherit; text-decoration: none; }
.post-card .pc-img { aspect-ratio: 16/9; background: var(--surface-2); overflow: hidden; position: relative; }
.post-card .pc-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.post-card:hover .pc-img img { transform: scale(1.04); }
.post-card .pc-img .pc-ph { position: absolute; inset: 0; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); font-size: 1.6rem; }
.post-card .pc-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.post-card h2, .post-card h3 { font-size: 15px; font-weight: 500; margin: 0; }
.post-card p { margin: 0; color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-card .pc-meta { margin-top: auto; display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.post-card .pc-cat { align-self: flex-start; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }

.toc { position: sticky; top: 82px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; font-size: 13.5px; }
.toc h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.toc a { color: var(--text-2); }
.toc a.active, .toc a:hover { color: var(--text); }

.prose { font-size: 15px; line-height: 1.75; color: var(--text-2); min-width: 0; overflow-wrap: break-word; }
.prose > *:first-child { margin-top: 0; }
.prose p { margin: 0 0 1.1em; }
.prose h2 { font-size: 1.3rem; margin: 1.7em 0 .55em; scroll-margin-top: 86px; }
.prose h3 { font-size: 1.1rem; margin: 1.5em 0 .45em; scroll-margin-top: 86px; }
.prose a { color: var(--text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.1em; }
.prose li { margin: .35em 0; }
.prose code { background: var(--surface-3); padding: .15em .4em; border-radius: 6px; font-size: .86em; color: var(--text); }
.prose pre code { background: none; padding: 0; color: inherit; font-size: inherit; }

/* ---------- Static pages ---------- */
.page { max-width: 820px; margin: 0 auto; background: var(--surface); border-radius: var(--radius-panel); padding: 32px 34px; }
.page h1 { font-size: 1.75rem; }

/* share brand colors (monochrome) */
.s-tw, .s-fb, .s-tg, .s-pi, .s-wa, .s-li { background: var(--surface-2) !important; color: var(--text-2); border: 1px solid var(--border); }
.s-cp { background: var(--surface-3) !important; color: var(--text) !important; }
.share-row a:hover { border-color: var(--border-strong); background: var(--surface-3) !important; color: var(--text); }

@media (max-width: 960px) { .toc { position: static; } }
@media (max-width: 600px) { .page { padding: 20px 16px; } .prose { font-size: 14.5px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }
