/* ==========================================================================
   KURAGEWEB v1.8.0 - WINDOW SYSTEM + FX
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,700;1,400&family=VT323&display=swap');

/* 0. PALETTE — Catppuccin Mocha (default) */
:root {
  --bg-color: #1e1e2e;
  --bg-darker: #181825;
  --bg-crust: #11111b;
  --text-color: #cdd6f4;
  --subtext: #a6adc8;
  --muted: #6c7086;
  --accent-color: #89b4fa;
  --border-color: #313244;
  --surface: #45475a;
  --pink: #f5c2e7;
  --green: #a6e3a1;
  --peach: #fab387;
  --lavender: #b4befe;
  --yellow: #f9e2af;
  --red: #f38ba8;
  --mauve: #cba6f7;
  --font-main: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  --font-display: 'VT323', 'JetBrains Mono', monospace;
  color-scheme: dark;
}

/* Catppuccin Latte — `theme latte` */
html[data-theme="latte"] {
  --bg-color: #eff1f5;
  --bg-darker: #e6e9ef;
  --bg-crust: #dce0e8;
  --text-color: #4c4f69;
  --subtext: #6c6f85;
  --muted: #9ca0b0;
  --accent-color: #1e66f5;
  --border-color: #ccd0da;
  --surface: #bcc0cc;
  --pink: #ea76cb;
  --green: #40a02b;
  --peach: #fe640b;
  --lavender: #7287fd;
  --yellow: #df8e1d;
  --red: #d20f39;
  --mauve: #8839ef;
  color-scheme: light;
}

/* 1. LAYOUT BASE */
body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-main);
  line-height: 1.6;
  margin: 0;
  padding: 2rem 0;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: background-color 0.3s, color 0.3s;
}

#global-header, main, #global-footer {
  width: 95%;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

#global-header, #global-footer {
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border-radius: 4px;
}

/* Header placeholder keeps its height while header.html loads (no layout jump) */
#global-header:empty { min-height: 260px; }

/* 2. WINDOW SYSTEM — every content box gets a title tab + HUD corner */
.window {
  position: relative;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2rem 1.5rem 1.5rem;
  margin: 1.25rem 0 2.25rem;
  background: color-mix(in srgb, var(--bg-darker) 45%, transparent);
}
.window[data-title]::before {
  content: "┌─ " attr(data-title) " ─";
  position: absolute;
  top: -0.75em;
  left: 0.9rem;
  padding: 0 0.5rem;
  background: var(--bg-color);
  color: var(--lavender);
  font-size: 0.75rem;
  letter-spacing: 1px;
  line-height: 1.5;
  white-space: nowrap;
  max-width: calc(100% - 2rem);
  overflow: hidden;
  text-overflow: ellipsis;
}
.window::after {
  content: "";
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 14px;
  height: 14px;
  border-right: 2px solid var(--pink);
  border-bottom: 2px solid var(--pink);
  opacity: 0.6;
  pointer-events: none;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
}
.counter { color: var(--lavender); font-size: 0.8rem; }
.lead { color: var(--subtext); }

/* 3. PROMPT LINE — kurage@space:~/blog$ ls */
.prompt {
  font-size: 0.85rem;
  margin: 0 0 1rem;
  color: var(--subtext);
  overflow-wrap: anywhere;
}
.prompt .p-user { color: var(--green); }
.prompt .p-path { color: var(--accent-color); }
.prompt .p-cmd  { color: var(--text-color); }

.cursor {
  display: inline-block;
  color: var(--pink);
  animation: cursorBlink 1s steps(1) infinite;
}
@keyframes cursorBlink { 50% { opacity: 0; } }

/* 4. HEADER & JELLYFISH */
#global-header {
  display: flex !important;
  align-items: center;
  gap: 3rem;
}

.jelly-wrap {
  transition: transform 0.9s cubic-bezier(0.23, 1, 0.32, 1);
  cursor: inherit;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.jellyfish-ascii {
  white-space: pre;
  line-height: 1.3;
  font-size: 12px;
  color: var(--pink);
  animation: floatJelly 4s ease-in-out infinite, glowJelly 9s ease-in-out infinite;
}
.jelly-wrap.pulse .jellyfish-ascii {
  animation: floatJelly 4s ease-in-out infinite, jellyPulse 0.25s ease-in-out 6;
}

@keyframes floatJelly { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes glowJelly {
  0%, 100% { color: var(--pink);         filter: drop-shadow(0 0 3px var(--pink)); }
  33%      { color: var(--lavender);     filter: drop-shadow(0 0 10px var(--lavender)); }
  66%      { color: var(--accent-color); filter: drop-shadow(0 0 6px var(--accent-color)); }
}
@keyframes jellyPulse {
  50% { color: var(--green); filter: drop-shadow(0 0 16px var(--green)); }
}

.header-text p { margin: 0; }
.h-handle { color: var(--accent-color); font-weight: bold; }
.h-rule   { color: var(--border-color); }
.h-key    { color: var(--lavender); }
#typewriter-text { color: var(--green); }

.color-bar { display: flex; gap: 6px; margin: 0.8rem 0; }
.color-block { width: 8px; height: 8px; flex: none; }
main > .color-bar { margin: 0 0 2rem; }
main > .color-bar .color-block { flex: 1; height: 4px; }

.site-nav { margin-top: 1.5rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.site-nav a[aria-current="page"] {
  background: var(--pink);
  color: var(--bg-darker);
  padding: 0 4px;
}
.site-nav .term-open { color: var(--muted); }

/* 5. TYPOGRAPHY & LINKS */
h1, h2, h3 { font-weight: normal; margin: 0; }
h1 { font-family: var(--font-display); }
h2 { color: var(--accent-color); }
h2::before { content: "> "; color: var(--pink); }

a { color: var(--accent-color); text-decoration: none; transition: 0.2s; }
a:hover { color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); }

:focus-visible { outline: 1px dashed var(--green); outline-offset: 2px; }

/* Shared terminal button */
.term-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  font-family: var(--font-main);
  font-size: 0.8rem;
  padding: 0.35rem 0.9rem;
  border-radius: 3px;
  transition: 0.2s;
}
.term-btn:hover { border-color: var(--green); color: var(--green); }
.term-btn.block { display: block; width: 100%; margin-top: 2rem; padding: 0.5rem 1rem; }
.term-btn[aria-pressed="true"] { border-color: var(--pink); color: var(--pink); }

/* Filter banner (blog + log) */
.filter-banner {
  display: none;
  margin-bottom: 1.5rem;
  font-size: 0.8rem;
  color: var(--green);
  border: 1px dashed var(--green);
  background: color-mix(in srgb, var(--green) 5%, transparent);
  padding: 0.8rem;
  border-radius: 4px;
}
.filter-banner.active { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.filter-banner .term-btn { border-color: var(--green); color: var(--green); font-size: 0.7rem; padding: 2px 8px; }

/* 6. BLOG (Semantic Void) */
.blog-item {
  margin-bottom: 2rem;
  padding: 1.5rem;
  border: 1px solid transparent;
  border-bottom-color: var(--border-color);
  transition: all 0.3s ease;
}
.blog-item:hover {
  border-color: var(--border-color);
  background: color-mix(in srgb, var(--text-color) 3%, transparent);
}
.blog-meta-tags { font-size: 0.8rem; color: var(--peach); min-width: 9rem; }
.blog-meta-tags .clickable-tag { display: block; margin-top: 0.2rem; }
.blog-excerpt { color: var(--subtext); }

/* Tags are real buttons now (keyboard + screen readers) */
.clickable-tag {
  font: inherit;
  background: none;
  border: 0;
  padding: 0 4px;
  color: var(--accent-color);
  border-radius: 3px;
  transition: 0.2s;
  text-align: left;
}
.clickable-tag:hover { background: color-mix(in srgb, var(--accent-color) 15%, transparent); }

/* Spoilers: hover on mouse, tap / Enter everywhere */
.spoiler {
  background-color: var(--border-color);
  color: transparent !important;
  text-shadow: 0 0 8px color-mix(in srgb, var(--text-color) 50%, transparent);
  transition: all 0.4s ease;
  border-radius: 3px;
  padding: 0 2px;
}
.spoiler.revealed { background-color: transparent; color: var(--text-color) !important; text-shadow: none; }
@media (hover: hover) {
  .spoiler:hover { background-color: transparent; color: var(--text-color) !important; text-shadow: none; }
}

/* 7. LOGS (Neural Drift) */
.log-entry {
  border-left: 2px solid var(--pink);
  padding-left: 1.5rem;
  margin-bottom: 2.5rem;
  position: relative;
  scroll-margin-top: 2rem;
  transition: background 0.6s;
}
.log-entry::before {
  content: "";
  position: absolute; top: 0.35rem; left: -5px;
  width: 8px; height: 8px;
  background-color: var(--pink);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--pink);
}
.log-entry.targeted { background: color-mix(in srgb, var(--pink) 8%, transparent); }
.log-entry.targeted::before { background: var(--green); box-shadow: 0 0 12px var(--green); }

.log-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; font-size: 0.85rem; }
.log-date { color: var(--peach); }
.log-ago  { color: var(--muted); font-size: 0.75rem; }
.log-meta .clickable-tag { color: var(--green); font-weight: bold; }
.log-loc  { color: var(--lavender); }
.log-permalink { color: var(--muted); font-size: 0.75rem; margin-left: auto; }
.log-content { margin: 0.6rem 0 0; }

.log-media {
  display: block;
  width: fit-content;
  margin-top: 1rem;
  cursor: inherit;
}
.log-media:hover { background: none; }
.log-media .blog-aside-media { width: min(100%, 320px); height: auto; aspect-ratio: 4 / 3; }
.media-tag {
  position: absolute;
  top: 5px;
  z-index: 4;
  background: color-mix(in srgb, var(--bg-darker) 85%, transparent);
  padding: 2px 4px;
  font-size: 0.6rem;
  pointer-events: none;
}
.media-tag.left  { left: 5px;  color: var(--green); }
.media-tag.right { right: 5px; color: var(--pink); }

.log-video {
  display: block;
  width: 100%;
  max-width: 640px;
  margin-top: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}
.log-link {
  display: inline-block;
  margin-top: 0.8rem;
  font-size: 0.8rem;
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: 3px;
  overflow-wrap: anywhere;
}

/* 8. HOME — system_summary (neofetch) */
.fetch-row { display: grid; grid-template-columns: 12.5rem 1fr; gap: 0.25rem 1rem; margin-bottom: 0.9rem; }
.fetch-key { color: var(--lavender); white-space: nowrap; overflow: hidden; }
.fetch-key::after { content: " ......"; color: var(--border-color); }
.fetch-val { min-width: 0; }
.fetch-val small { color: var(--muted); }
.fetch-list { list-style: none; margin: 0; padding: 0; }
.fetch-list li { margin-bottom: 0.3rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fetch-list .log-date { font-size: 0.8rem; }
.fetch-list .tag { color: var(--green); }

/* Live facade — iframe only loads on click, so the box has to beg for it */
.live-facade {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
  font-family: var(--font-main);
  color: var(--text-color);
  border: 1px solid color-mix(in srgb, var(--pink) 45%, var(--border-color));
  border-radius: 4px;
  background:
          repeating-linear-gradient(0deg, transparent 0 2px, color-mix(in srgb, var(--text-color) 4%, transparent) 2px 3px),
          radial-gradient(ellipse at center, color-mix(in srgb, var(--pink) 10%, var(--bg-darker)) 0%, var(--bg-crust) 75%);
  animation: liveBorder 2.4s ease-in-out infinite;
  transition: transform 0.2s, border-color 0.2s;
}
.live-facade:hover { transform: scale(1.01); border-color: var(--green); animation-play-state: paused; }
@keyframes liveBorder {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--pink) 0%, transparent), inset 0 0 30px color-mix(in srgb, var(--pink) 8%, transparent); }
  50%      { box-shadow: 0 0 22px 2px color-mix(in srgb, var(--pink) 35%, transparent), inset 0 0 50px color-mix(in srgb, var(--pink) 15%, transparent); }
}

.live-status, .live-cta, .live-hint { position: relative; z-index: 1; }
.live-status { color: var(--peach); letter-spacing: 3px; font-size: 0.85rem; display: flex; align-items: center; gap: 0.6rem; }
.live-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
  animation: liveDot 1s steps(1) infinite;
}
@keyframes liveDot { 50% { opacity: 0.15; } }

.live-cta {
  font-family: var(--font-display);
  font-size: 2.4rem;
  line-height: 1;
  color: var(--bg-darker);
  background: var(--pink);
  padding: 0.35rem 1.2rem 0.45rem;
  white-space: nowrap;
  box-shadow: 0 0 25px color-mix(in srgb, var(--pink) 60%, transparent);
  animation: liveCta 1.2s ease-in-out infinite, liveGlitch 4s steps(1) infinite;
}
.live-facade:hover .live-cta { background: var(--green); box-shadow: 0 0 30px color-mix(in srgb, var(--green) 70%, transparent); animation: none; }
@keyframes liveCta { 50% { transform: scale(1.06); } }
@keyframes liveGlitch {
  0%, 92%, 100% { text-shadow: none; translate: 0 0; }
  93% { text-shadow: 3px 0 var(--accent-color), -3px 0 var(--green); translate: -2px 0; }
  95% { text-shadow: -2px 0 var(--accent-color), 2px 0 var(--green); translate: 2px 0; }
}
.live-hint { font-size: 0.75rem; color: var(--subtext); }

/* HUD corner brackets */
.live-corner { position: absolute; width: 16px; height: 16px; border-color: var(--pink); border-style: solid; border-width: 0; z-index: 1; }
.live-corner.tl { top: 10px; left: 10px; border-top-width: 2px; border-left-width: 2px; }
.live-corner.tr { top: 10px; right: 10px; border-top-width: 2px; border-right-width: 2px; }
.live-corner.bl { bottom: 10px; left: 10px; border-bottom-width: 2px; border-left-width: 2px; }
.live-corner.br { bottom: 10px; right: 10px; border-bottom-width: 2px; border-right-width: 2px; }

@media (max-width: 600px) {
  .live-facade { height: 220px; }
  .live-cta { font-size: 1.5rem; padding: 0.3rem 0.8rem 0.4rem; }
}

.live-frame { width: 100%; aspect-ratio: 16 / 9; max-height: 480px; border: 1px solid var(--border-color); }

/* 9. DEBUG / WOK */
.view-toggle { display: flex; gap: 0.5rem; }
.view-toggle .term-btn { font-size: 0.7rem; padding: 2px 8px; }

.wok-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}
.wok-card {
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  border-radius: 4px;
  background: var(--bg-darker);
  transition: 0.3s;
}
.wok-card:hover { border-color: var(--pink); transform: translateY(-2px); }
.wok-card > a { display: block; }
.wok-card > a:hover { background: none; }
.wok-thumb {
  width: 100%;
  max-height: 150px;
  object-fit: cover;
  border-radius: 2px;
  margin-bottom: 1rem;
  border: 1px solid var(--border-color);
  display: block;
}
.wok-card h3 { color: var(--pink); margin: 0 0 0.5rem; font-family: var(--font-display); font-size: 1.6rem; line-height: 1; }
.wok-cat { color: var(--accent-color); font-size: 0.8rem; margin-bottom: 0.8rem; }
.wok-desc { font-size: 0.85rem; line-height: 1.4; margin-bottom: 1rem; }
.wok-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.wok-tag { font-size: 0.7rem; border: 1px solid var(--lavender); padding: 2px 6px; color: var(--lavender); opacity: 0.8; }

/* ps aux view */
.ps-wrap { overflow-x: auto; margin-top: 1rem; }
.ps-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; white-space: nowrap; }
.ps-table th { text-align: left; color: var(--lavender); font-weight: normal; border-bottom: 1px solid var(--border-color); padding: 0.4rem 0.8rem 0.4rem 0; }
.ps-table td { padding: 0.5rem 0.8rem 0.5rem 0; border-bottom: 1px dashed var(--border-color); vertical-align: top; }
.ps-table tr:hover td { background: color-mix(in srgb, var(--text-color) 3%, transparent); }
.ps-pid { color: var(--peach); }
.ps-thumb { width: 64px; padding-top: 0.35rem !important; padding-bottom: 0.35rem !important; }
.ps-thumb a, .ps-thumb span { display: block; width: 64px; height: 40px; }
.ps-thumb a:hover { background: none; }
.ps-thumb img {
  display: block;
  width: 64px;
  height: 40px;
  object-fit: cover;
  border: 1px solid var(--border-color);
  clip-path: polygon(12% 0, 100% 0, 100% 80%, 88% 100%, 0 100%, 0 20%);
  filter: grayscale(100%) contrast(110%);
  opacity: 0.7;
  transition: all 0.3s;
}
.ps-table tr:hover .ps-thumb img { filter: none; opacity: 1; }
.ps-thumb .no-thumb { border: 1px dashed var(--border-color); color: var(--muted); font-size: 0.6rem; line-height: 40px; text-align: center; }
.ps-cmd a, .ps-cmd span { color: var(--pink); }
.ps-desc { color: var(--muted); white-space: normal; min-width: 16rem; }
.stat { font-weight: bold; }
.stat-running  { color: var(--green); }
.stat-sleeping { color: var(--accent-color); }
.stat-zombie   { color: var(--yellow); }
.stat-killed   { color: var(--red); }

/* 10. FOOTER */
.footer-container {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  width: 100%;
}
.footer-left, .footer-center, .footer-right { flex: 1; font-size: 0.75rem; }
.footer-center { text-align: center; word-spacing: 0.4rem; }
.footer-right { text-align: right; color: var(--peach); opacity: 0.8; }
.footer-status { color: var(--green); font-weight: bold; }
.footer-toggles { margin-top: 0.5rem; color: var(--muted); }
.footer-toggles button {
  font: inherit;
  background: none;
  border: 0;
  padding: 0 2px;
  color: var(--accent-color);
}
.footer-toggles button:hover { color: var(--green); }

.flicker-text { animation: statusFlicker 3s linear infinite; }
@keyframes statusFlicker {
  0%, 18%, 22%, 25%, 53%, 57%, 100% { opacity: 1; }
  20%, 24%, 55% { opacity: 0.3; }
}

/* 11. QUOTES — DATA_FRAGMENT */
blockquote {
  margin: 2rem 0;
  padding: 1.5rem 2rem;
  background: linear-gradient(90deg, color-mix(in srgb, var(--border-color) 40%, transparent) 0%, transparent 100%);
  border-left: 3px solid var(--pink);
  position: relative;
  font-style: italic;
  color: var(--text-color);
  line-height: 1.8;
}
blockquote::before {
  content: "SOURCE_STRING // CITA";
  position: absolute;
  top: -10px;
  left: 10px;
  background: var(--bg-darker);
  color: var(--pink);
  font-size: 0.65rem;
  font-weight: bold;
  padding: 0 8px;
  border: 1px solid var(--pink);
  font-style: normal;
  letter-spacing: 1px;
}
blockquote::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  width: 15px;
  height: 15px;
  border-right: 2px solid var(--border-color);
  border-bottom: 2px solid var(--border-color);
}
blockquote strong {
  color: var(--yellow);
  text-shadow: 0 0 5px color-mix(in srgb, var(--yellow) 30%, transparent);
}

/* 12. BLOG THUMBNAILS + CRT FX */
.blog-content-wrapper {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-top: 1rem;
}
.blog-text { flex: 1; min-width: 0; }

.blog-aside-media {
  position: relative;
  width: 130px;
  height: 130px;
  flex-shrink: 0;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  clip-path: polygon(15% 0, 100% 0, 100% 85%, 85% 100%, 0 100%, 0 15%);
  overflow: hidden;
}
.blog-aside-media::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%),
  linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
  background-size: 100% 3px, 3px 100%;
  z-index: 2;
  pointer-events: none;
}
.blog-aside-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.6;
  filter: grayscale(100%) contrast(110%);
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}
.blog-item:hover .blog-aside-media img,
.log-media:hover .blog-aside-media img,
.log-media:focus-visible .blog-aside-media img {
  opacity: 1;
  filter: grayscale(0%) contrast(100%);
  transform: scale(1.08);
}
.blog-item:hover .blog-aside-media::after,
.log-media:hover .blog-aside-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--pink);
  opacity: 0.05;
  animation: glitch-fx 0.15s infinite;
  z-index: 3;
}
@keyframes glitch-fx {
  0% { transform: translate(0); }
  25% { transform: translate(-1px, 1px); }
  50% { transform: translate(1px, -1px); }
  75% { transform: translate(-1px, -1px); }
  100% { transform: translate(0); }
}

/* Title reveal — staggered by --i (set in JS, works for any number of posts) */
.blog-title a {
  color: var(--pink) !important;
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1.1;
  display: inline-block;
  opacity: 0;
  transform: translateX(-10px);
  animation: titleReveal 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
  animation-delay: calc(0.1s + var(--i, 0) * 0.08s);
}
@keyframes titleReveal {
  0%   { opacity: 0; transform: translateX(-15px); text-shadow: 2px 0 var(--accent-color), -2px 0 var(--green); }
  50%  { opacity: 0.5; text-shadow: none; }
  100% { opacity: 1; transform: translateX(0); text-shadow: 0 0 8px color-mix(in srgb, var(--pink) 30%, transparent); }
}

/* 13. POST PAGE */
.full-post h1 {
  color: var(--pink);
  font-size: 3rem;
  line-height: 1;
  position: relative;
  display: inline-block;
  margin-bottom: 1.5rem;
  opacity: 0;
  transform: translateY(5px);
  animation: postTitleLoad 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: 0.2s;
}
.full-post h1::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--pink);
  box-shadow: 0 0 10px var(--pink);
  animation: lineExpand 0.6s ease-out forwards;
  animation-delay: 0.8s;
}
@keyframes postTitleLoad {
  0%   { opacity: 0; transform: translateY(10px); text-shadow: 3px 0 var(--accent-color), -3px 0 var(--green); }
  20%  { opacity: 0.5; text-shadow: 2px 0 var(--accent-color), -2px 0 var(--green); }
  100% { opacity: 1; transform: translateY(0); text-shadow: 0 0 12px color-mix(in srgb, var(--pink) 40%, transparent); }
}
@keyframes lineExpand { to { width: 100%; } }

.post-meta { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.8rem; margin-bottom: 0.75rem; }
.post-meta time { color: var(--peach); }
.post-tags { color: var(--green); }
.post-content { line-height: 1.8; }
.post-content .lead { font-size: 1.05rem; border-left: 2px solid var(--border-color); padding-left: 1rem; }
.post-content h2 { margin: 2.5rem 0 1rem; font-size: 1.2rem; }
.post-content h3 { color: var(--lavender); margin: 1.5rem 0 0.5rem; }
.post-content img { max-width: 100%; height: auto; display: block; }
.post-content ul, .post-content ol { padding-left: 1.5rem; }

code {
  font-family: var(--font-main);
  font-size: 0.9em;
  background: var(--border-color);
  color: var(--peach);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
pre {
  background: var(--bg-crust);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-color);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  border-radius: 4px;
  line-height: 1.5;
}
pre code { background: none; padding: 0; color: var(--text-color); }

.tech-snippet {
  border: 1px dashed var(--green);
  background: color-mix(in srgb, var(--green) 5%, transparent);
  padding: 1rem 1.5rem;
  margin: 2rem 0;
  border-radius: 4px;
}
.tech-snippet h3 { color: var(--green); margin-top: 0; font-size: 0.9rem; }
.tech-snippet h3::before { content: "// "; opacity: 0.6; }
.tech-snippet ul { margin: 0.5rem 0 0; }
.tech-snippet strong { color: var(--yellow); }

figure { margin: 2rem 0; }
figure img { border: 1px solid var(--border-color); border-radius: 4px; }
figcaption { font-size: 0.75rem; color: var(--muted); margin-top: 0.5rem; }
figcaption::before { content: "fig_ > "; color: var(--pink); }

.post-footer { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--border-color); }

/* 14. BOOT SEQUENCE */
html.booting body > *:not(#boot) { visibility: hidden; }
#boot {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg-crust);
  color: var(--subtext);
  font-family: var(--font-main);
  font-size: 0.8rem;
  padding: 2rem;
  box-sizing: border-box;
  transition: opacity 0.4s;
}
#boot .ok { color: var(--green); }
#boot .hi { color: var(--pink); }
#boot.done { opacity: 0; pointer-events: none; }

/* 15. TERMINAL OVERLAY */
#term {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  background: color-mix(in srgb, var(--bg-crust) 55%, transparent);
  backdrop-filter: blur(2px);
}
#term.open { display: flex; }
#term .window { width: min(760px, 100%); margin: 0 0 3vh; background: var(--bg-darker); box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.term-out {
  max-height: 50vh;
  overflow-y: auto;
  font-size: 0.85rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin-bottom: 0.5rem;
}
.term-out .err { color: var(--red); }
.term-out .dim { color: var(--muted); }
.term-out .echo { color: var(--subtext); }
.term-line { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; }
.term-line .prompt { margin: 0; white-space: nowrap; }
.term-line input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text-color);
  font: inherit;
  caret-color: var(--pink);
}

/* Toast (easter egg + terminal hints) */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9500;
  background: var(--bg-darker);
  border: 1px solid var(--pink);
  color: var(--text-color);
  font-size: 0.8rem;
  padding: 0.6rem 1rem;
  border-radius: 4px;
  box-shadow: 0 0 20px color-mix(in srgb, var(--pink) 25%, transparent);
  max-width: 90vw;
}

/* 16. GLOBAL CRT LAYER — `fx off` or footer toggle disables it */
html[data-fx="on"] body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 8000;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.12) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
html[data-fx="on"] body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 8001;
  pointer-events: none;
  background:
          linear-gradient(transparent 0%, color-mix(in srgb, var(--text-color) 4%, transparent) 50%, transparent 100%) 0 -20vh / 100% 20vh no-repeat,
          radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.35) 100%);
  animation: crtRoll 7s linear infinite;
}
html[data-theme="latte"][data-fx="on"] body::before { background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.04) 0 1px, transparent 1px 3px); }
html[data-theme="latte"][data-fx="on"] body::after {
  background:
          linear-gradient(transparent 0%, rgba(0,0,0,0.03) 50%, transparent 100%) 0 -20vh / 100% 20vh no-repeat,
          radial-gradient(ellipse at center, transparent 65%, rgba(0, 0, 0, 0.12) 100%);
}
@keyframes crtRoll { to { background-position: 0 120vh, 0 0; } }

/* 17. RESPONSIVE ENGINE */
@media (min-width: 1024px) { #global-header, main, #global-footer { width: 70%; } }
@media (max-width: 768px) {
  #global-header, #global-footer, main { width: 94% !important; }
  #global-header { gap: 1rem; padding: 0 0 1.5rem; flex-wrap: wrap; }
  #global-header:empty { min-height: 200px; }
  .footer-center { word-spacing: normal; }
  .window { padding: 1.75rem 1rem 1rem; }
  .blog-item { padding: 1rem 0; }
  .footer-container { flex-direction: column; align-items: center; text-align: center; }
  .footer-right { text-align: center; }
  .jellyfish-ascii { padding: 0; }
  .post-content { overflow-wrap: break-word; }
  .fetch-row { grid-template-columns: 1fr; gap: 0.1rem; }
  .log-permalink { margin-left: 0; }
}
@media (max-width: 600px) {
  .blog-content-wrapper { flex-direction: column-reverse; gap: 1rem; }
  .blog-content-wrapper .blog-aside-media { width: 100%; height: 160px; clip-path: none; }
  .blog-meta-tags .clickable-tag { display: inline-block; }
  .full-post h1 { font-size: 2.3rem; }
}

/* 18. REDUCED MOTION — no animations, nothing left invisible */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .blog-title a, .full-post h1 { opacity: 1; transform: none; }
  .full-post h1::after { width: 100%; }
  .cursor { opacity: 1; }
}

/* 19. CURSORS */
html, body {
  cursor: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB4PSI0IiB5PSIyIiB3aWR0aD0iOCIgaGVpZ2h0PSIxMiIgZmlsbD0iI2Y1YzJlNyIgc3R5bGU9ImZpbHRlcjpkcm9wLXNoYWRvdygwIDAgMnB4ICNmNWMyZTcpIi8+PC9zdmc+"), auto !important;
}
a,
button,
.clickable-tag,
.spoiler,
.blog-aside-media,
.jelly-wrap,
input[type="submit"] {
  cursor: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB4PSI0IiB5PSIyIiB3aWR0aD0iOCIgaGVpZ2h0PSIxMiIgZmlsbD0iI2E2ZTNhMSIgc3R5bGU9ImZpbHRlcjpkcm9wLXNoYWRvdygwIDAgM3B4ICNhNmUzYTEpIi8+PC9zdmc+"), pointer !important;
}

/* 21. POST READER */
#read-progress {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 3px;
  z-index: 8500;
  background: var(--pink);
  box-shadow: 0 0 10px var(--pink);
  transform-origin: 0 50%;
  transform: scaleX(0);
  pointer-events: none;
}
#read-readout {
  position: fixed;
  top: 10px;
  right: 14px;
  z-index: 8500;
  font-size: 0.7rem;
  white-space: pre;
  color: var(--pink);
  background: color-mix(in srgb, var(--bg-darker) 90%, transparent);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
#read-readout.visible { opacity: 1; }
#read-readout.done { color: var(--green); border-color: var(--green); }
.read-time { color: var(--lavender); }
.read-time::before { content: "// "; color: var(--muted); }

.post-nav { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.post-nav a {
  flex: 1;
  max-width: 48%;
  border: 1px solid var(--border-color);
  padding: 0.6rem 0.9rem;
  border-radius: 4px;
  color: var(--pink);
}
.post-nav a:hover { border-color: var(--green); }
.post-nav a.next { text-align: right; }
.post-nav small { display: block; color: var(--muted); font-size: 0.7rem; }

.term-out mark { background: color-mix(in srgb, var(--yellow) 30%, transparent); color: var(--yellow); }

/* 22. 404 — SIGNAL_LOST */
.err-window { text-align: center; }
.err-ascii {
  white-space: pre;
  display: inline-block;
  text-align: left;
  font-size: 13px;
  line-height: 1.2;
  color: var(--red);
  text-shadow: 2px 0 color-mix(in srgb, var(--accent-color) 50%, transparent), -2px 0 color-mix(in srgb, var(--green) 40%, transparent);
  animation: statusFlicker 2.5s linear infinite;
  margin: 0.5rem 0 1rem;
}
.err-code { color: var(--red); letter-spacing: 2px; font-size: 0.8rem; }
.err-window h1 { color: var(--red); font-size: 2.4rem; margin: 1rem 0 0.5rem; }
.err-window p { max-width: 34rem; margin: 0.6rem auto; color: var(--subtext); }
.err-window code { color: var(--peach); overflow-wrap: anywhere; }
.err-jelly { color: var(--pink); font-size: 0.8rem; margin-top: 1.5rem; }
.err-actions { display: flex; justify-content: center; gap: 0.75rem; flex-wrap: wrap; margin: 1.75rem 0 1rem; }
.err-actions a.term-btn:hover { background: none; }
.err-countdown { font-size: 0.7rem; color: var(--muted); }

@media (max-width: 600px) {
  #read-readout { display: none; }
  .post-nav { flex-direction: column; }
  .post-nav a { max-width: none; }
  .err-ascii { font-size: 10px; }
}

/* 23. IMAGE VIEWER */
html.viewer-lock { overflow: hidden; }
#viewer {
  position: fixed;
  inset: 0;
  z-index: 9200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2vh 2vw;
  box-sizing: border-box;
  background: color-mix(in srgb, var(--bg-crust) 88%, transparent);
  backdrop-filter: blur(3px);
}
#viewer.open { display: flex; animation: viewerIn 0.25s ease-out; }
@keyframes viewerIn { from { opacity: 0; } }
.viewer-frame {
  position: relative;
  width: min(1100px, 100%);
  max-height: 96vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-darker);
  box-shadow: 0 0 40px color-mix(in srgb, var(--pink) 15%, transparent);
}
.viewer-frame::after {
  content: "";
  position: absolute;
  right: -1px; bottom: -1px;
  width: 16px; height: 16px;
  border-right: 2px solid var(--pink);
  border-bottom: 2px solid var(--pink);
  pointer-events: none;
}
.viewer-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.7rem;
}
.media-tag-inline.green { color: var(--green); }
.viewer-id { color: var(--pink); }
.viewer-count { color: var(--muted); margin-left: auto; }
.viewer-btn, .viewer-nav {
  font: inherit;
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  border-radius: 3px;
}
.viewer-btn { padding: 1px 6px; }
.viewer-btn:hover, .viewer-nav:hover { border-color: var(--green); color: var(--green); }

.viewer-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 3.5rem;
  overflow: hidden;
}
.viewer-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, 0.12) 2px 3px);
  pointer-events: none;
  z-index: 2;
}
.viewer-img {
  display: block;
  max-width: 100%;
  max-height: 68vh;
  object-fit: contain;
  border: 1px solid var(--border-color);
  opacity: 0;
  filter: grayscale(100%);
  transition: opacity 0.35s, filter 0.6s;
}
.viewer-img.loaded { opacity: 1; filter: none; }
.viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  font-size: 1.2rem;
  width: 2.2rem;
  height: 3rem;
  background: color-mix(in srgb, var(--bg-darker) 80%, transparent);
}
.viewer-nav.prev { left: 0.75rem; }
.viewer-nav.next { right: 0.75rem; }
.viewer-nav[hidden] { display: none; }

.viewer-bottom {
  padding: 0.6rem 1rem 0.9rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
}
.viewer-meta { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: baseline; }
.viewer-status { color: var(--green); font-weight: bold; }
.viewer-meta a { color: var(--muted); font-size: 0.75rem; }
.viewer-caption { margin: 0.4rem 0 0.5rem; max-height: 4.8em; overflow-y: auto; }
.viewer-orig { font-size: 0.7rem; }

@media (max-width: 600px) {
  #viewer { padding: 0; }
  .viewer-frame { max-height: 100vh; height: 100%; border-radius: 0; }
  .viewer-stage { padding: 0.5rem; }
  .viewer-img { max-height: 60vh; }
  .viewer-nav { top: auto; bottom: 0.5rem; transform: none; }
}

/* 20. UTIL */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }