/* VOID Station — Perseids meteor-shower theme for the whole site.
   Inspired by the id.void.st IdentityProvider design (void-idp-sso).
   Replaces the old scheef-scroll theme; no skew, no inline CSS (AGENTS.md).
   Light/dark via CSS custom properties keyed on html[data-theme], set by
   static/js/asteroid.js from the ast_theme cookie or the system preference. */

/* ---- Theme tokens ---------------------------------------------------- */
:root {
  --bg: #eaf0f8;
  --bg-grad: #dfe8f5;
  --card: rgba(255, 255, 255, 0.82);
  --card-border: rgba(20, 40, 80, 0.10);
  --text: #1c2430;
  --sub: #5b6672;
  --label: #3d4754;
  --input-bg: #ffffff;
  --input-border: #cbd3df;
  --accent: #3557d4;
  --accent-text: #ffffff;
  --btn-bg: #3557d4;
  --btn-text: #ffffff;
  --err: #c03434;
  --ok: #1c7a4c;
  --meteor: rgba(60, 110, 230, 0.55);
  --meteor-glow: rgba(60, 110, 230, 0.30);
  --toggle-bg: rgba(255, 255, 255, 0.7);
  --toggle-border: rgba(20, 40, 80, 0.15);
  /* painterly cinematic night sky (SVG) */
  --sky-a: #7b9fd6;
  --sky-b: #a8c4e8;
  --sky-c: #d7e3f2;
  --star: #ffffff;
  --swirl: rgba(90, 130, 200, 0.55);
  --blob-a1: rgba(255, 220, 170, 0.55);
  --blob-a2: rgba(255, 220, 170, 0);
  --blob-b1: rgba(180, 210, 255, 0.50);
  --blob-b2: rgba(180, 210, 255, 0);
  --sand-a: #f5e2c4;
  --sand-b: #c9a26c;
  --sun-a: rgba(255, 238, 200, 0.95);
  --sun-b: rgba(255, 210, 140, 0);
  --sun: #ffe6b0;
  --tat-hi: #ecd7ac;
  --tat-lo: #a67c4e;
  --sea-a: #4b5a63;
  --sea-b: #314047;
  --ast-hi: #e9f0fb;
  --ast-mid: #a9bcd4;
  --ast-lo: #55627c;
  --ast-rim: rgba(255, 255, 255, 0.35);
}

html[data-theme="dark"] {
  --bg: #0b0d12;
  --bg-grad: #10141c;
  --card: rgba(26, 31, 40, 0.86);
  --card-border: rgba(120, 150, 220, 0.10);
  --text: #e7eaf0;
  --sub: #8a8f98;
  --label: #b9bec7;
  --input-bg: #14171e;
  --input-border: #333a44;
  --accent: #6f8bff;
  --accent-text: #0b0d12;
  --btn-bg: #4f6ef7;
  --btn-text: #ffffff;
  --err: #ff7a7a;
  --ok: #6fd3a0;
  --meteor: rgba(185, 205, 255, 0.90);
  --meteor-glow: rgba(185, 205, 255, 0.35);
  --toggle-bg: rgba(20, 26, 36, 0.7);
  --toggle-border: rgba(120, 150, 220, 0.15);
  /* painterly cinematic night sky (SVG) */
  --sky-a: #0a0e1a;
  --sky-b: #16233f;
  --sky-c: #243b5e;
  --star: #dbe7ff;
  --swirl: rgba(120, 160, 240, 0.35);
  --blob-a1: rgba(255, 200, 130, 0.35);
  --blob-a2: rgba(255, 200, 130, 0);
  --blob-b1: rgba(120, 160, 255, 0.30);
  --blob-b2: rgba(120, 160, 255, 0);
  --m-red: #f15a5a;
  --m-yel: #f2d35b;
  --m-blu: #7ea3ff;
  --ast-hi: #cfe0f2;
  --ast-mid: #6d7f9c;
  --ast-lo: #2c3450;
  --ast-rim: rgba(180, 210, 255, 0.25);
}

/* ---- Base / layout --------------------------------------------------- */
* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  background-image: radial-gradient(140% 140% at 50% 0%, var(--bg-grad), var(--bg));
  color: var(--text);
  line-height: 1.7;
  margin: 0;
  padding: 0 1rem 3rem;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover, a:focus { text-decoration: underline; }

h1 { font-size: 1.4rem; font-weight: 650; margin: 0 0 0.4rem; }
h2 { font-size: 1.2rem; font-weight: 650; margin: 0 0 0.4rem; }
h3 { font-size: 1.05rem; font-weight: 650; margin: 1rem 0 0.5rem; }
code {
  font-size: 0.9em;
  background: var(--toggle-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  padding: 0.1em 0.35em;
}
p { margin: 0 0 0.8rem; }

/* ---- Meteor shower background ---------------------------------------- */
.meteors {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.meteor {
  position: absolute;
  left: 0;
  top: 0;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: hsl(var(--hue, 220), 100%, 68%);
  box-shadow:
    0 0 6px 2px hsl(var(--hue, 220), 100%, 66%, 0.35),
    0 0 22px 8px hsl(var(--hue, 220), 100%, 66%, 0.30);
  opacity: 0;
  animation: meteor-fall var(--dur) linear infinite;
  animation-delay: var(--delay);
}
.meteor::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 1px;
  width: var(--trail);
  height: 2px;
  background: linear-gradient(to right, hsl(var(--hue, 220), 100%, 70%), transparent);
  transform: rotate(var(--angle));
  transform-origin: left center;
}
@keyframes meteor-fall {
  0%   { transform: translate3d(var(--x0), var(--y0), 0); opacity: 0; }
  4%   { opacity: 1; }
  100% { transform: translate3d(var(--x1), var(--y1), 0); opacity: 0; }
}

/* ---- Painterly cinematic night sky (SVG, no bitmaps) -------------------- */
.void-sky {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.void-sky svg.night {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
stop.sky-a { stop-color: var(--sky-a); }
stop.sky-b { stop-color: var(--sky-b); }
stop.sky-c { stop-color: var(--sky-c); }
stop.blob-a1 { stop-color: var(--blob-a1); }
stop.blob-a2 { stop-color: var(--blob-a2); }
stop.blob-b1 { stop-color: var(--blob-b1); }
stop.blob-b2 { stop-color: var(--blob-b2); }
stop.ast-hi { stop-color: var(--ast-hi); }
stop.ast-mid { stop-color: var(--ast-mid); }
stop.ast-lo { stop-color: var(--ast-lo); }

/* Stars twinkle */
.star {
  fill: var(--star);
  animation: twinkle 6s ease-in-out infinite;
}
.star:nth-child(odd) { animation-delay: 2s; }
.star:nth-child(3n) { animation-delay: 4s; }
@keyframes twinkle {
  0%, 100% { opacity: 0.15; }
  50%      { opacity: 0.9; }
}

/* Van Gogh painterly swirls drift slowly */
.swirl {
  stroke: var(--swirl);
  stroke-width: 3;
  fill: none;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(120, 160, 230, 0.25));
  transform-box: fill-box;
  transform-origin: center;
  animation: swirl-drift 60s linear infinite;
}
@keyframes swirl-drift {
  from { transform: rotate(0deg); }
  to   { transform: rotate(4deg); }
}

/* Monet impressionistic color blobs pulse softly */
.blob { opacity: 0.9; }
.blob-a {
  fill: url(#blob-a);
  animation: blob-pulse 14s ease-in-out infinite;
}
.blob-b {
  fill: url(#blob-b);
  animation: blob-pulse 18s ease-in-out infinite;
}
@keyframes blob-pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50%      { transform: scale(1.06); opacity: 1; }
}

/* Mondriaan primary-color blocks bob gently */
.mondriaan .m-red {
  fill: var(--m-red);
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.25));
  animation: mond-bob 20s ease-in-out infinite;
}
.mondriaan .m-yel {
  fill: var(--m-yel);
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.25));
  animation: mond-bob 16s ease-in-out infinite;
}
.mondriaan .m-blu {
  fill: var(--m-blu);
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.25));
  animation: mond-bob 24s ease-in-out infinite;
}
@keyframes mond-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

/* 3D-shaded asteroid floats gently */
.asteroid3d .ast {
  fill: url(#ast-body);
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.35));
}
.asteroid3d .crat { fill: var(--ast-lo); opacity: 0.8; }
.asteroid3d .rim {
  fill: none;
  stroke: var(--ast-rim);
  stroke-width: 1.5;
}
.asteroid3d {
  transform-box: fill-box;
  transform-origin: center;
  animation: ast-float 24s ease-in-out infinite;
}
@keyframes ast-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

/* ---- Header / nav ---------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--card);
  border-bottom: 1px solid var(--card-border);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  padding: 1.1rem 3.4rem 1.1rem 2rem;   /* right space makes room for the fixed toggle */
}
.site-branding {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.site-title {
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}
.site-title a { color: var(--text); }
.site-title a:hover { color: var(--accent); text-decoration: none; }
.site-description { font-size: 0.9rem; color: var(--sub); }
.primary-navigation { margin-top: 0; }
.primary-navigation .menu {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
}
.primary-navigation .menu li a {
  color: var(--sub);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}
.primary-navigation .menu li a:hover,
.primary-navigation .menu li a:focus { color: var(--accent); }
.primary-navigation .menu li.current a {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}

/* ---- Container -------------------------------------------------------- */
.container {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 2.2rem auto;
  padding: 0 1rem;
}

/* ---- Cards (was .skew-item; skew is gone) ----------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-radius: 16px;
  padding: 1.4rem 1.6rem;
  margin: 1.4rem auto;
  max-width: 860px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.04);
  filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.20));
  transition: background 0.3s, border-color 0.3s, transform 0.25s ease, box-shadow 0.25s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.card h2 a { color: var(--accent); text-decoration: none; }
.card h2 a:hover { text-decoration: underline; }
.card.post, .card.page { margin: 1.4rem auto; }

/* ---- Entry content (markdown body) ----------------------------------- */
.entry-content p { margin-bottom: 1rem; }
.entry-content img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  margin: 0.5rem 0;
}
.entry-content iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 0;
  border-radius: 10px;
  margin: 0.75rem 0;
}
.entry-content iframe.spotify-embed {
  aspect-ratio: auto;
  height: 380px;
}
.entry-content audio { width: 100%; margin: 0.75rem 0; }
.entry-content a { color: var(--accent); }

.entry-content .more,
p.more {
  margin: 0.75rem 0 0;
  text-align: right;
}
p.more a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
p.more a:hover { text-decoration: underline; }

.post-meta {
  font-size: 0.85rem;
  color: var(--sub);
  margin: 0 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.post-meta .author { color: var(--label); }

/* Accent badge */
.badge {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--accent-text);
  font-weight: 600;
  font-size: 0.8rem;
}

/* ---- Admin ------------------------------------------------------------ */
.admin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.admin-bar a { color: var(--accent); }
.admin-form { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--card-border); }
.admin-form label { font-weight: 600; display: block; margin-bottom: 0.4rem; }
.admin-form input { margin-bottom: 0.6rem; }
.admin-form button {
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  border-radius: 10px;
  padding: 0.55rem 1.2rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}
.hint { font-size: 0.85rem; color: var(--sub); margin-bottom: 0.6rem; }
.flash {
  border-radius: 10px;
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
  font-weight: 500;
  border: 1px solid var(--card-border);
}
.flash.ok { color: var(--ok); border-color: var(--ok); }
.flash.error { color: var(--err); border-color: var(--err); }

/* Honeypot captcha field: hidden from humans, auto-filled by bots */
.hp-field { display: none; position: absolute; left: -9999px; }

/* ---- Comments --------------------------------------------------------- */
.comments { margin: 1.6rem auto; }
.comments h3 { margin-bottom: 1rem; }
.comment { padding: 0.9rem 0; border-bottom: 1px solid var(--card-border); }
.comment-meta { font-size: 0.85rem; color: var(--sub); margin-bottom: 0.3rem; }
.comment-meta .cname { font-weight: 700; color: var(--accent); }
.comment-meta .cdate { margin-left: 0.6rem; }
.comment-meta .cweb { margin-left: 0.6rem; }
.comment-body { margin-bottom: 0.4rem; overflow-wrap: anywhere; }
.comment-actions { display: flex; gap: 1rem; font-size: 0.85rem; }
.reply-link { color: var(--accent); cursor: pointer; }
.reply-link.active { font-weight: 700; }
.comment-children {
  margin-left: 1.6rem;
  border-left: 2px solid var(--accent);
  padding-left: 1rem;
}
.mod-form { margin-left: auto; }
.mod-form button {
  background: none; border: none; color: var(--err); font-size: 0.85rem;
  cursor: pointer; padding: 0;
}

/* ---- Comment form ----------------------------------------------------- */
.comment-form-wrap {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--card-border);
}
.comment-form label { font-weight: 600; display: block; margin: 0.8rem 0 0.3rem; }
.comment-form .req { color: var(--err); font-size: 0.8rem; }
.comment-form .opt { color: var(--sub); font-size: 0.8rem; }
.comment-form input, .comment-form textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
}
.comment-form input:focus, .comment-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--meteor-glow);
}
.comment-form button {
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  border-radius: 10px;
  padding: 0.55rem 1.2rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.8rem;
  min-height: 44px;
}

/* ---- Theme toggle (fixed, top-right) ---------------------------------- */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--toggle-bg);
  border: 1px solid var(--toggle-border);
  color: var(--accent);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle::before { content: "\263d"; }        /* moon: switch to dark */
html[data-theme="dark"] .theme-toggle::before { content: "\2600"; } /* sun: switch to light */

/* ---- Footer ----------------------------------------------------------- */
.footer {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 2rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid var(--card-border);
  text-align: center;
  color: var(--sub);
  font-size: 0.9rem;
}

/* ---- Responsive (mobile-first) ---------------------------------------- */
@media (max-width: 640px) {
  .site-title { font-size: 1.3rem; }
  .card { padding: 1.2rem; margin: 1.2rem auto 1.8rem; }
  .container { padding: 0 0.2rem; }
  .site-header { padding: 1rem 3.2rem 1rem 1.2rem; }
  .primary-navigation .menu { gap: 0.9rem; }
  .theme-toggle { top: 0.75rem; right: 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  .meteor { animation: none; opacity: 0.35; }
  .star, .swirl, .blob-a, .blob-b,
  .mondriaan .m-red, .mondriaan .m-yel, .mondriaan .m-blu,
  .asteroid3d { animation: none; }
  .card:hover { transform: none; }
}
