@charset "UTF-8";

/* ================================================================
   Nocturne — shared visual system
   Local-first CSS for a Cloudflare Pages technical blog.
   ================================================================ */

:root {
  color-scheme: dark;
  --bg: #0a0a12;
  --bg-soft: #0d101a;
  --surface: #10141f;
  --surface-2: #111827;
  --surface-3: #161d2c;
  --surface-glass: rgba(16, 20, 31, 0.82);
  --primary: #2563eb;
  --primary-rgb: 37, 99, 235;
  --primary-hover: #3b82f6;
  --accent: #a855f7;
  --accent-rgb: 168, 85, 247;
  --text: #e2e8f0;
  --text-strong: #f8fafc;
  --muted: #94a3b8;
  --muted-2: #64748b;
  --border: #1e293b;
  --border-strong: #334155;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #38bdf8;
  --shadow-sm: 0 10px 30px rgba(0, 0, 0, 0.16);
  --shadow-md: 0 18px 50px rgba(0, 0, 0, 0.28);
  --shadow-glow: 0 16px 48px rgba(var(--primary-rgb), 0.16);
  --ring: 0 0 0 3px rgba(var(--primary-rgb), 0.24);
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --header-height: 72px;
  --content-width: 1180px;
  --reading-width: 760px;
  --sidebar-width: 300px;
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.75, 0.25, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition: 220ms var(--ease);
}

[data-theme="dim"] {
  color-scheme: dark;
  --bg: #10131c;
  --bg-soft: #141925;
  --surface: #181e2a;
  --surface-2: #1c2432;
  --surface-3: #222c3d;
  --surface-glass: rgba(24, 30, 42, 0.88);
  --text: #dce5f1;
  --text-strong: #f1f5f9;
  --muted: #9cabc0;
  --border: #2a3548;
  --border-strong: #3a4960;
  --shadow-sm: 0 10px 28px rgba(2, 6, 23, 0.22);
  --shadow-md: 0 18px 50px rgba(2, 6, 23, 0.34);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f8fafc;
  --bg-soft: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2ff;
  --surface-glass: rgba(255, 255, 255, 0.88);
  --primary: #1d4ed8;
  --primary-rgb: 29, 78, 216;
  --primary-hover: #2563eb;
  --accent: #9333ea;
  --accent-rgb: 147, 51, 234;
  --text: #1e293b;
  --text-strong: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --border: #dbe3ee;
  --border-strong: #cbd5e1;
  --shadow-sm: 0 10px 30px rgba(15, 23, 42, 0.07);
  --shadow-md: 0 20px 48px rgba(15, 23, 42, 0.11);
  --shadow-glow: 0 16px 44px rgba(var(--primary-rgb), 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 28px);
  scrollbar-color: var(--border-strong) var(--bg);
  scrollbar-width: thin;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  padding-top: var(--header-height);
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: 0.005em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  transition: background-color 360ms var(--ease), color 260ms var(--ease),
    opacity 180ms ease;
}

body.no-scroll {
  overflow: hidden;
}

body::before {
  position: fixed;
  z-index: -2;
  inset: 0;
  background:
    radial-gradient(circle at 12% 7%, rgba(var(--primary-rgb), 0.1), transparent 28rem),
    radial-gradient(circle at 88% 26%, rgba(var(--accent-rgb), 0.07), transparent 31rem);
  content: "";
  pointer-events: none;
}

body::after {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.022) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
  content: "";
  pointer-events: none;
}

[data-theme="light"] body::after {
  opacity: 0.55;
}

::selection {
  background: rgba(var(--primary-rgb), 0.38);
  color: var(--text-strong);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  border: 3px solid var(--bg);
  border-radius: 999px;
  background: var(--border-strong);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted-2);
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd {
  margin-block-start: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-strong);
  font-weight: 680;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition), opacity var(--transition),
    transform var(--transition), border-color var(--transition),
    background-color var(--transition), box-shadow var(--transition);
}

button,
input,
textarea,
select {
  margin: 0;
  color: inherit;
  font: inherit;
}

button,
[role="button"] {
  cursor: pointer;
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--primary-hover);
  outline-offset: 3px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 2000;
  top: 12px;
  left: 16px;
  padding: 10px 16px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--text-strong);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.container,
.site-container,
.nav-shell,
.page-shell {
  width: min(calc(100% - 40px), var(--content-width));
  margin-inline: auto;
}

.page-shell,
main {
  position: relative;
}

main {
  min-height: calc(100vh - var(--header-height) - 220px);
}

.section {
  padding-block: clamp(56px, 7vw, 96px);
}

.section-sm {
  padding-block: clamp(36px, 5vw, 64px);
}

.section-header {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
}

.section-heading,
.section-title {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 3vw, 2.2rem);
}

.section-heading {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
  font-size: inherit;
}

.section-heading > .search-field {
  flex: 0 1 370px;
}

.section-kicker,
.eyebrow {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  color: var(--primary-hover);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow::before,
.section-kicker::before {
  width: 18px;
  height: 1px;
  background: currentColor;
  content: "";
}

.section-description,
.lead {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.04rem;
}

.text-muted {
  color: var(--muted) !important;
}

.text-primary {
  color: var(--primary-hover) !important;
}

.accent-text {
  color: var(--accent) !important;
}

.mono {
  font-family: var(--font-mono);
}

/* Buttons, pills and shared controls */

.button,
.btn,
button.btn,
.icon-button,
.action-button {
  position: relative;
  display: inline-flex;
  min-height: 42px;
  gap: 9px;
  align-items: center;
  justify-content: center;
  padding: 10px 17px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: none;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1;
  transition: transform var(--transition), border-color var(--transition),
    background-color var(--transition), color var(--transition),
    box-shadow var(--transition), opacity var(--transition);
}

.button:hover,
.btn:hover,
.icon-button:hover,
.action-button:hover {
  border-color: rgba(var(--primary-rgb), 0.7);
  background: var(--surface-3);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
  color: var(--text-strong);
  transform: translateY(-2px);
}

.button:active,
.btn:active,
.icon-button:active,
.action-button:active {
  transform: translateY(0) scale(0.98);
}

.button-primary,
.btn-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 12px 28px rgba(var(--primary-rgb), 0.24);
}

.button-primary:hover,
.btn-primary:hover {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
  color: #fff;
  box-shadow: 0 16px 34px rgba(var(--primary-rgb), 0.3);
}

.button-ghost,
.btn-ghost {
  background: transparent;
}

.button-danger,
.btn-danger {
  border-color: rgba(239, 68, 68, 0.42);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

.button-danger:hover,
.btn-danger:hover {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.17);
  color: #fecaca;
}

.button-sm,
.btn-sm {
  min-height: 34px;
  padding: 7px 11px;
  font-size: 0.78rem;
}

.icon-button {
  width: 42px;
  padding: 0;
  border-radius: 50%;
}

.badge,
.tag,
.status,
.post-tag,
.chip {
  display: inline-flex;
  min-height: 26px;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border: 1px solid rgba(var(--primary-rgb), 0.22);
  border-radius: 999px;
  background: rgba(var(--primary-rgb), 0.08);
  color: #93b4ff;
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.2;
  transition: color var(--transition), border-color var(--transition),
    background-color var(--transition), transform var(--transition);
}

[data-theme="light"] :is(.badge, .tag, .status, .post-tag, .chip) {
  color: #1d4ed8;
}

.tag:hover,
.post-tag:hover,
.chip:hover {
  border-color: rgba(var(--primary-rgb), 0.55);
  background: rgba(var(--primary-rgb), 0.14);
  color: var(--text-strong);
  transform: translateY(-1px);
}

.status::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
  content: "";
}

.status-success,
.status-approved,
.status-published {
  border-color: rgba(34, 197, 94, 0.28);
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
}

.status-warning,
.status-pending,
.status-draft {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.1);
  color: #fcd34d;
}

.status-danger,
.status-rejected {
  border-color: rgba(239, 68, 68, 0.28);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

/* Fixed navigation */

.site-header {
  position: fixed;
  z-index: 1000;
  top: 0;
  right: 0;
  left: 0;
  height: var(--header-height);
  border-bottom: 1px solid transparent;
  background: rgba(10, 10, 18, 0.72);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  transition: height var(--transition), border-color var(--transition),
    background-color var(--transition), box-shadow var(--transition);
}

[data-theme="dim"] .site-header {
  background: rgba(16, 19, 28, 0.8);
}

[data-theme="light"] .site-header {
  background: rgba(248, 250, 252, 0.84);
}

.site-header.is-scrolled,
.site-header.scrolled {
  border-color: var(--border);
  background: var(--surface-glass);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.site-header[data-parallax] {
  transform: none;
}

.nav-shell,
.navbar {
  display: flex;
  height: 100%;
  gap: 30px;
  align-items: center;
  justify-content: space-between;
}

.brand,
.site-brand {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 10px;
  align-items: center;
  color: var(--text-strong);
  font-weight: 750;
  letter-spacing: -0.02em;
}

.brand:hover,
.site-brand:hover {
  color: #fff;
  transform: translateY(-1px);
}

[data-theme="light"] :is(.brand, .site-brand):hover {
  color: var(--primary);
}

.brand-mark,
.brand-logo {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(var(--primary-rgb), 0.55);
  border-radius: 9px;
  background: rgba(var(--primary-rgb), 0.12);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  box-shadow: inset 0 0 18px rgba(var(--primary-rgb), 0.08);
}

.brand-mark::after,
.brand-logo::after {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.9);
  content: "";
}

.brand-copy small {
  display: block;
  margin-top: -4px;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.61rem;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.nav-links,
.nav-menu {
  display: flex;
  height: 100%;
  gap: 4px;
  align-items: center;
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
}

.nav-links a,
.nav-link,
.nav-menu a {
  position: relative;
  display: inline-flex;
  height: 42px;
  align-items: center;
  padding: 0 13px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 580;
}

.nav-links a::after,
.nav-link::after,
.nav-menu a::after {
  position: absolute;
  right: 14px;
  bottom: 5px;
  left: 14px;
  height: 1px;
  background: var(--primary-hover);
  content: "";
  opacity: 0;
  transform: scaleX(0.3);
  transition: opacity var(--transition), transform var(--transition);
}

.nav-links a:hover,
.nav-link:hover,
.nav-menu a:hover,
.nav-links a.active,
.nav-link.active,
.nav-menu a.active,
.nav-links a[aria-current="page"] {
  background: rgba(var(--primary-rgb), 0.08);
  color: var(--text-strong);
}

.nav-links a:hover::after,
.nav-link:hover::after,
.nav-menu a:hover::after,
.nav-links a.active::after,
.nav-link.active::after,
.nav-menu a.active::after,
.nav-links a[aria-current="page"]::after {
  opacity: 1;
  transform: scaleX(1);
}

.nav-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
}

.theme-toggle,
.menu-toggle,
.nav-toggle {
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.04);
  color: var(--muted);
  transition: color var(--transition), background-color var(--transition),
    border-color var(--transition), transform var(--transition),
    box-shadow var(--transition);
}

.theme-toggle:hover,
.menu-toggle:hover,
.nav-toggle:hover {
  border-color: rgba(var(--primary-rgb), 0.55);
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--text-strong);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.13);
  transform: translateY(-2px);
}

.menu-toggle,
.nav-toggle {
  display: none;
}

.menu-toggle-lines,
.hamburger {
  position: relative;
  width: 18px;
  height: 14px;
}

.menu-toggle-lines::before,
.menu-toggle-lines::after,
.hamburger::before,
.hamburger::after,
.hamburger span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.5px;
  border-radius: 99px;
  background: currentColor;
  content: "";
  transition: transform var(--transition), top var(--transition), opacity var(--transition);
}

.menu-toggle-lines::before,
.hamburger::before {
  top: 2px;
}

.menu-toggle-lines::after,
.hamburger::after {
  top: 11px;
}

.hamburger span {
  top: 6.5px;
}

.nav-open .menu-toggle-lines::before,
.nav-open .hamburger::before {
  top: 6px;
  transform: rotate(45deg);
}

.nav-open .menu-toggle-lines::after,
.nav-open .hamburger::after {
  top: 6px;
  transform: rotate(-45deg);
}

.nav-open .hamburger span {
  opacity: 0;
}

/* Hero */

.hero {
  position: relative;
  display: grid;
  min-height: min(720px, calc(100vh - var(--header-height)));
  align-items: center;
  padding-block: clamp(76px, 10vw, 132px);
  overflow: clip;
}

.hero::before {
  position: absolute;
  top: 12%;
  right: -10%;
  width: min(42vw, 560px);
  aspect-ratio: 1;
  border: 1px solid rgba(var(--primary-rgb), 0.14);
  border-radius: 50%;
  box-shadow:
    0 0 0 80px rgba(var(--primary-rgb), 0.025),
    0 0 0 160px rgba(var(--accent-rgb), 0.018);
  content: "";
  opacity: 0.8;
  pointer-events: none;
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: clamp(42px, 7vw, 88px);
  align-items: center;
}

.hero-copy {
  max-width: 720px;
}

.hero h1,
.hero-title {
  max-width: 760px;
  margin-bottom: 24px;
  color: var(--text-strong);
  font-size: clamp(2.75rem, 6vw, 4.7rem);
  font-weight: 760;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.hero-title .highlight,
.gradient-text {
  background: linear-gradient(105deg, #7aa2ff 15%, #c084fc 90%);
  background-clip: text;
  color: transparent;
  -webkit-background-clip: text;
}

.hero-description,
.hero-subtitle {
  max-width: 620px;
  margin-bottom: 34px;
  color: var(--muted);
  font-size: clamp(1.02rem, 1.7vw, 1.18rem);
  line-height: 1.78;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-meta,
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 42px;
}

.hero-stat {
  padding-right: 24px;
  border-right: 1px solid var(--border);
}

.hero-stat:last-child {
  padding-right: 0;
  border-right: 0;
}

.hero-stat strong {
  display: block;
  color: var(--text-strong);
  font-family: var(--font-mono);
  font-size: 1.05rem;
  line-height: 1.2;
}

.hero-stat span {
  color: var(--muted-2);
  font-size: 0.72rem;
}

.hero-visual,
.hero-card,
.terminal-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(17, 24, 39, 0.72);
  box-shadow: var(--shadow-md), 0 0 70px rgba(var(--primary-rgb), 0.08);
  transform: perspective(1000px) rotateY(-2deg) rotateX(1deg);
  transition: transform 500ms var(--ease), border-color var(--transition),
    box-shadow var(--transition);
}

[data-theme="light"] :is(.hero-visual, .hero-card, .terminal-card) {
  background: rgba(255, 255, 255, 0.88);
}

.hero-visual:hover,
.hero-card:hover,
.terminal-card:hover {
  border-color: rgba(var(--primary-rgb), 0.45);
  box-shadow: var(--shadow-md), 0 0 80px rgba(var(--primary-rgb), 0.13);
  transform: perspective(1000px) rotateY(0) rotateX(0) translateY(-5px);
}

.terminal-header {
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 15px 17px;
  border-bottom: 1px solid var(--border);
}

.terminal-header i,
.window-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted-2);
}

.terminal-header i:nth-child(1),
.window-dot.red {
  background: #ef4444;
}

.terminal-header i:nth-child(2),
.window-dot.yellow {
  background: #f59e0b;
}

.terminal-header i:nth-child(3),
.window-dot.green {
  background: #22c55e;
}

.terminal-title {
  margin-left: auto;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.terminal-body {
  min-height: 280px;
  padding: clamp(20px, 4vw, 34px);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: clamp(0.78rem, 1.2vw, 0.9rem);
  line-height: 1.9;
}

.terminal-body .prompt,
.code-keyword {
  color: #c084fc;
}

.terminal-body .command,
.code-function {
  color: #7dd3fc;
}

.terminal-body .success,
.code-string {
  color: #86efac;
}

.terminal-cursor {
  display: inline-block;
  width: 7px;
  height: 1.05em;
  margin-left: 3px;
  background: var(--primary-hover);
  vertical-align: -2px;
  animation: cursor-blink 1.1s steps(1) infinite;
}

/* Main blog layouts and cards */

.layout-grid,
.content-grid,
.blog-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-width);
  gap: 32px;
  align-items: start;
}

.content-column,
.posts-column {
  min-width: 0;
}

.post-grid,
.article-list,
.posts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.post-card,
.article-card,
.card {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(16, 20, 31, 0.78);
  box-shadow: var(--shadow-sm);
  transition: transform 320ms var(--ease), border-color var(--transition),
    background-color var(--transition), box-shadow var(--transition);
}

[data-theme="dim"] :is(.post-card, .article-card, .card) {
  background: rgba(24, 30, 42, 0.86);
}

[data-theme="light"] :is(.post-card, .article-card, .card) {
  background: rgba(255, 255, 255, 0.9);
}

.post-card:hover,
.article-card:hover,
.card.hoverable:hover {
  border-color: rgba(var(--primary-rgb), 0.48);
  box-shadow: var(--shadow-md), 0 12px 42px rgba(var(--primary-rgb), 0.08);
  transform: translateY(-6px);
}

.post-card-cover,
.article-card-image,
.card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-2);
}

.post-card-cover::after,
.article-card-image::after,
.card-media::after {
  position: absolute;
  inset: auto 0 0;
  height: 42%;
  background: linear-gradient(to top, rgba(10, 10, 18, 0.48), transparent);
  content: "";
  opacity: 0.7;
  pointer-events: none;
}

.post-card-cover img,
.article-card-image img,
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 650ms var(--ease), filter var(--transition), opacity 400ms ease;
}

.post-card:hover .post-card-cover img,
.article-card:hover .article-card-image img,
.card:hover .card-media img {
  transform: scale(1.035);
}

.post-card-content,
.article-card-body,
.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 22px;
}

.post-card-meta,
.article-meta,
.post-meta,
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.post-card-meta > span,
.article-meta > span,
.post-meta > span,
.meta-item {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.post-card-title,
.article-card-title,
.card-title {
  margin: 14px 0 10px;
  font-size: clamp(1.08rem, 2vw, 1.32rem);
  line-height: 1.35;
}

.post-card-title a,
.article-card-title a {
  display: inline;
  background-image: linear-gradient(var(--primary-hover), var(--primary-hover));
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0 1px;
  transition: color var(--transition), background-size 350ms var(--ease);
}

.post-card:hover .post-card-title a,
.article-card:hover .article-card-title a,
.post-card-title a:hover,
.article-card-title a:hover {
  background-size: 100% 1px;
  color: #b9ccff;
}

[data-theme="light"] :is(.post-card-title, .article-card-title) a:hover,
[data-theme="light"] .post-card:hover .post-card-title a,
[data-theme="light"] .article-card:hover .article-card-title a {
  color: var(--primary);
}

.post-card-excerpt,
.article-card-excerpt,
.card-description {
  display: -webkit-box;
  margin-bottom: 18px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.91rem;
  line-height: 1.75;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.post-card-footer,
.article-card-footer,
.card-footer {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.post-tags,
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.read-more {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--primary-hover);
  font-size: 0.8rem;
  font-weight: 650;
}

.read-more:hover {
  gap: 10px;
  color: #93c5fd;
  transform: translateX(2px);
}

.post-card.featured,
.article-card.featured {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(260px, 0.95fr) minmax(0, 1.05fr);
}

.post-card.featured .post-card-cover,
.article-card.featured .article-card-image {
  height: 100%;
  min-height: 320px;
  aspect-ratio: auto;
}

.post-card.featured .post-card-content,
.article-card.featured .article-card-body {
  justify-content: center;
  padding: clamp(28px, 4vw, 44px);
}

.post-card.featured .post-card-title,
.article-card.featured .article-card-title {
  font-size: clamp(1.55rem, 3vw, 2rem);
}

/* Sidebar, tag cloud and mini tools */

.sidebar {
  position: sticky;
  top: calc(var(--header-height) + 24px);
  display: grid;
  gap: 18px;
}

.panel,
.sidebar-panel,
.widget {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(16, 20, 31, 0.72);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), transform var(--transition),
    background-color var(--transition), box-shadow var(--transition);
}

[data-theme="dim"] :is(.panel, .sidebar-panel, .widget) {
  background: rgba(24, 30, 42, 0.84);
}

[data-theme="light"] :is(.panel, .sidebar-panel, .widget) {
  background: rgba(255, 255, 255, 0.9);
}

.panel:hover,
.sidebar-panel:hover,
.widget:hover {
  border-color: rgba(var(--primary-rgb), 0.34);
  box-shadow: var(--shadow-sm), 0 10px 30px rgba(var(--primary-rgb), 0.05);
}

.panel-title,
.widget-title {
  display: flex;
  gap: 9px;
  align-items: center;
  margin-bottom: 16px;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
}

.panel-title::before,
.widget-title::before {
  width: 3px;
  height: 14px;
  border-radius: 99px;
  background: var(--primary);
  box-shadow: 0 0 12px rgba(var(--primary-rgb), 0.55);
  content: "";
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-cloud a {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.tag-cloud a:hover,
.tag-cloud a.active {
  border-color: rgba(var(--accent-rgb), 0.55);
  background: rgba(var(--accent-rgb), 0.09);
  color: #d8b4fe;
  transform: translateY(-2px);
}

[data-theme="light"] .tag-cloud a:hover {
  color: var(--accent);
}

.latest-list,
.recent-posts,
.mini-tool-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.latest-list li + li,
.recent-posts li + li,
.mini-tool-list li + li {
  border-top: 1px solid var(--border);
}

.latest-list a,
.recent-posts a,
.mini-tool {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  padding: 12px 0;
}

.latest-list a:hover,
.recent-posts a:hover,
.mini-tool:hover {
  color: var(--primary-hover);
  transform: translateX(3px);
}

.latest-list time,
.recent-posts time,
.mini-tool small {
  display: block;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.63rem;
}

.mini-tool-icon,
.list-index {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--primary-hover);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.sidebar-clock,
.digital-clock {
  color: var(--text-strong);
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 650;
  letter-spacing: -0.05em;
}

.weather-line,
.tool-output {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

/* Search, filtering and pagination */

.search-bar,
.filter-bar,
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.search-field {
  position: relative;
  min-width: min(100%, 280px);
  flex: 1;
}

.search-field svg,
.search-icon {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 14px;
  width: 17px;
  color: var(--muted-2);
  pointer-events: none;
  transform: translateY(-50%);
}

.search-field input {
  padding-left: 42px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 36px;
}

.pagination a,
.pagination button {
  display: grid;
  min-width: 38px;
  height: 38px;
  padding: 0 9px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
}

.pagination a:hover,
.pagination button:hover,
.pagination .active {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--text-strong);
  transform: translateY(-2px);
}

/* Article detail and Markdown */

.article-page,
.post-page {
  padding-block: clamp(52px, 7vw, 92px);
}

.article-hero,
.post-header {
  width: min(100%, 920px);
  margin: 0 auto clamp(38px, 6vw, 64px);
  text-align: center;
}

.article-hero h1,
.post-header h1,
.article-title {
  margin: 14px auto 20px;
  color: var(--text-strong);
  font-size: clamp(2.1rem, 5.5vw, 4.25rem);
  line-height: 1.08;
}

.article-hero .article-meta,
.post-header .post-meta {
  justify-content: center;
}

.article-cover,
.post-cover {
  width: min(100%, 1080px);
  margin: 0 auto clamp(42px, 6vw, 72px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  box-shadow: var(--shadow-md);
}

.article-cover img,
.post-cover img {
  width: 100%;
  max-height: 600px;
  object-fit: cover;
}

.article-layout,
.post-layout {
  display: grid;
  grid-template-columns: minmax(0, var(--reading-width)) 250px;
  gap: clamp(38px, 7vw, 74px);
  justify-content: center;
  align-items: start;
}

.article-content,
.post-content {
  min-width: 0;
}

.article-toc,
.toc {
  position: sticky;
  top: calc(var(--header-height) + 28px);
  padding: 18px;
  border-left: 1px solid var(--border);
}

.toc-title {
  margin-bottom: 13px;
  color: var(--text-strong);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.article-toc ul,
.toc ul {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.article-toc a,
.toc a {
  display: block;
  padding: 6px 8px;
  border-left: 1px solid transparent;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.article-toc a:hover,
.toc a:hover,
.article-toc a.active,
.toc a.active {
  border-left-color: var(--primary);
  color: var(--text-strong);
  transform: translateX(3px);
}

.reading-progress {
  position: fixed;
  z-index: 1100;
  top: 0;
  left: 0;
  width: var(--progress, 0%);
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  box-shadow: 0 0 12px rgba(var(--primary-rgb), 0.7);
  transition: width 80ms linear;
}

.markdown-body {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.86;
  overflow-wrap: anywhere;
}

.markdown-body > :first-child {
  margin-top: 0 !important;
}

.markdown-body > :last-child {
  margin-bottom: 0 !important;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  position: relative;
  margin: 2.2em 0 0.8em;
  scroll-margin-top: calc(var(--header-height) + 28px);
}

.markdown-body h1 {
  padding-bottom: 0.5em;
  border-bottom: 1px solid var(--border);
  font-size: 2.15rem;
}

.markdown-body h2 {
  padding-bottom: 0.4em;
  border-bottom: 1px solid var(--border);
  font-size: 1.65rem;
}

.markdown-body h3 {
  font-size: 1.3rem;
}

.markdown-body h4 {
  font-size: 1.08rem;
}

.markdown-body .heading-anchor {
  position: absolute;
  left: -1.25em;
  color: var(--muted-2);
  font-weight: 500;
  opacity: 0;
}

.markdown-body :is(h1, h2, h3, h4):hover .heading-anchor {
  opacity: 1;
}

.markdown-body p {
  margin: 0 0 1.35em;
}

.markdown-body a {
  border-bottom: 1px solid rgba(var(--primary-rgb), 0.45);
  color: #84a9ff;
}

.markdown-body a:hover {
  border-bottom-color: var(--primary-hover);
  color: #b4c7ff;
}

[data-theme="light"] .markdown-body a {
  color: var(--primary);
}

.markdown-body strong {
  color: var(--text-strong);
  font-weight: 680;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0 0 1.4em;
  padding-left: 1.6em;
}

.markdown-body li {
  margin: 0.4em 0;
  padding-left: 0.25em;
}

.markdown-body li::marker {
  color: var(--primary-hover);
}

.markdown-body blockquote {
  position: relative;
  margin: 1.8em 0;
  padding: 16px 20px 16px 22px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: rgba(var(--accent-rgb), 0.055);
  color: var(--muted);
}

.markdown-body blockquote p:last-child {
  margin-bottom: 0;
}

.markdown-body :not(pre) > code {
  padding: 0.16em 0.4em;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: #c4b5fd;
  font-size: 0.88em;
}

[data-theme="light"] .markdown-body :not(pre) > code {
  color: #7e22ce;
}

.markdown-body pre,
.code-block,
.code-wrapper {
  position: relative;
  margin: 1.8em 0;
  overflow: hidden;
  border: 1px solid #1e293b;
  border-radius: var(--radius);
  background: #111827;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.18);
}

.markdown-body pre {
  padding: 22px;
  overflow-x: auto;
  color: #dbeafe;
  font-size: 0.86rem;
  line-height: 1.75;
  tab-size: 2;
}

.code-wrapper pre,
.code-block pre {
  margin: 0;
  padding: 44px 22px 22px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.code-language,
.language-label {
  position: absolute;
  z-index: 2;
  top: 11px;
  left: 14px;
  color: #64748b;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.copy-code,
.copy-button,
.code-copy-btn {
  position: absolute;
  z-index: 3;
  top: 9px;
  right: 10px;
  display: inline-flex;
  min-height: 28px;
  gap: 5px;
  align-items: center;
  padding: 5px 9px;
  border: 1px solid #334155;
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.85);
  color: #94a3b8;
  font-family: var(--font-sans);
  font-size: 0.65rem;
  transition: color var(--transition), border-color var(--transition),
    background-color var(--transition), transform var(--transition);
}

.copy-code:hover,
.copy-button:hover,
.code-copy-btn:hover {
  border-color: rgba(var(--primary-rgb), 0.65);
  background: #172033;
  color: #e2e8f0;
  transform: translateY(-1px);
}

.copy-code.copied,
.copy-button.copied,
.code-copy-btn.copied {
  border-color: rgba(34, 197, 94, 0.5);
  color: #86efac;
}

.hljs-comment,
.token.comment,
.token.prolog,
.token.doctype {
  color: #64748b;
  font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.token.keyword,
.token.boolean,
.token.operator {
  color: #c084fc;
}

.hljs-string,
.hljs-attr,
.token.string,
.token.attr-value {
  color: #86efac;
}

.hljs-number,
.hljs-literal,
.token.number,
.token.constant {
  color: #fbbf24;
}

.hljs-title,
.hljs-function,
.token.function,
.token.class-name {
  color: #7dd3fc;
}

.hljs-variable,
.hljs-template-variable,
.token.variable,
.token.property {
  color: #f9a8d4;
}

.hljs-built_in,
.hljs-type,
.token.builtin,
.token.tag {
  color: #93c5fd;
}

.markdown-body table {
  width: 100%;
  margin: 1.8em 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.markdown-body th,
.markdown-body td {
  padding: 11px 14px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.markdown-body tr:last-child td {
  border-bottom: 0;
}

.markdown-body th:last-child,
.markdown-body td:last-child {
  border-right: 0;
}

.markdown-body th {
  background: var(--surface-2);
  color: var(--text-strong);
  font-weight: 650;
}

.markdown-body tr:hover td {
  background: rgba(var(--primary-rgb), 0.035);
}

.markdown-body img {
  margin: 1.8em auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
}

.markdown-body figure {
  margin: 2em 0;
}

.markdown-body figure img {
  margin-bottom: 0.7em;
}

.markdown-body figcaption {
  color: var(--muted-2);
  font-size: 0.75rem;
  text-align: center;
}

.task-list-item {
  list-style: none;
}

.task-list-item input[type="checkbox"] {
  margin: 0 8px 0 -1.5em;
  accent-color: var(--primary);
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 42px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.article-navigation,
.post-navigation {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 48px;
}

.article-navigation a,
.post-navigation a {
  display: flex;
  min-height: 110px;
  flex-direction: column;
  justify-content: center;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.article-navigation a:last-child,
.post-navigation a:last-child {
  text-align: right;
}

.article-navigation a:hover,
.post-navigation a:hover {
  border-color: rgba(var(--primary-rgb), 0.52);
  box-shadow: var(--shadow-glow);
  transform: translateY(-4px);
}

.article-navigation small,
.post-navigation small {
  margin-bottom: 5px;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  text-transform: uppercase;
}

.article-navigation strong,
.post-navigation strong {
  color: var(--text-strong);
  font-size: 0.92rem;
}

/* Forms */

.form-group,
.field {
  display: grid;
  gap: 8px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-label,
.field label,
label.form-label {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 650;
}

.required {
  color: #f87171;
}

.form-help,
.field-hint,
.form-error {
  color: var(--muted-2);
  font-size: 0.7rem;
}

.form-error {
  color: #fca5a5;
}

.input,
.form-control,
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="datetime-local"],
input[type="number"],
textarea,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: 0;
  background: var(--surface-2);
  color: var(--text);
  caret-color: var(--primary-hover);
  transition: border-color var(--transition), box-shadow var(--transition),
    background-color var(--transition), transform 130ms var(--ease-spring);
}

textarea {
  min-height: 130px;
  resize: vertical;
}

select {
  padding-right: 34px;
}

.input::placeholder,
.form-control::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
  opacity: 0.74;
}

.input:hover,
.form-control:hover,
input:hover,
textarea:hover,
select:hover {
  border-color: var(--border-strong);
}

.input:focus,
.form-control:focus,
input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  background: var(--surface-3);
  box-shadow: var(--ring);
}

.input[aria-invalid="true"],
.form-control[aria-invalid="true"],
.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
}

.checkbox-row,
.switch-row {
  display: flex;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-size: 0.8rem;
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.switch {
  position: relative;
  display: inline-flex;
  width: 42px;
  height: 23px;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch-track {
  width: 100%;
  height: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
  transition: background-color var(--transition), border-color var(--transition);
}

.switch-track::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
  transition: transform var(--transition), background-color var(--transition);
}

.switch input:checked + .switch-track {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.24);
}

.switch input:checked + .switch-track::after {
  background: #fff;
  transform: translateX(19px);
}

.switch input:focus-visible + .switch-track {
  box-shadow: var(--ring);
}

/* Markdown editor */

.editor-page,
.admin-page,
.tools-page,
.about-page {
  padding-block: clamp(38px, 5vw, 68px);
}

.editor-shell,
.admin-shell {
  width: min(calc(100% - 40px), 1440px);
  margin-inline: auto;
}

.editor-header,
.admin-header,
.page-header {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 26px;
}

.page-header h1,
.editor-header h1,
.admin-header h1 {
  margin-bottom: 7px;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.page-header p,
.editor-header p,
.admin-header p {
  margin-bottom: 0;
  color: var(--muted);
}

.editor-actions,
.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: flex-end;
}

.editor-meta-panel,
.editor-settings {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.cover-picker,
.image-upload {
  position: relative;
  display: grid;
  min-height: 110px;
  place-items: center;
  overflow: hidden;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  text-align: center;
  transition: border-color var(--transition), background-color var(--transition),
    color var(--transition);
}

.cover-picker:hover,
.image-upload:hover,
.cover-picker.is-dragging,
.image-upload.is-dragging {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.07);
  color: var(--text-strong);
}

.cover-picker input,
.image-upload input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
}

.cover-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.editor-toolbar,
.markdown-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface);
}

.toolbar-group {
  display: flex;
  gap: 4px;
  align-items: center;
  padding-right: 8px;
  margin-right: 3px;
  border-right: 1px solid var(--border);
}

.toolbar-group:last-child {
  padding-right: 0;
  margin-right: 0;
  border-right: 0;
}

.toolbar-button,
.editor-toolbar button,
.markdown-toolbar button {
  display: grid;
  width: 34px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  transition: color var(--transition), border-color var(--transition),
    background-color var(--transition), transform var(--transition);
}

.toolbar-button:hover,
.editor-toolbar button:hover,
.markdown-toolbar button:hover,
.toolbar-button.active {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--text-strong);
  transform: translateY(-1px);
}

.editor-grid,
.editor-workspace,
.editor-split {
  display: grid;
  min-height: 640px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.editor-pane,
.preview-pane {
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.editor-pane {
  border-right: 1px solid var(--border);
}

.pane-header,
.editor-pane-header {
  display: flex;
  height: 42px;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.editor-input,
#markdown-input,
.markdown-input {
  display: block;
  width: 100%;
  height: calc(100% - 42px);
  min-height: 598px;
  padding: 24px;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: #0d1320;
  color: #dbeafe;
  box-shadow: none;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.75;
  resize: none;
  tab-size: 2;
}

[data-theme="light"] :is(.editor-input, #markdown-input, .markdown-input) {
  background: #f7f9fc;
  color: #172033;
}

.editor-input:focus,
#markdown-input:focus,
.markdown-input:focus {
  border: 0;
  background: #0e1625;
  box-shadow: inset 3px 0 0 var(--primary);
}

[data-theme="light"] :is(.editor-input, #markdown-input, .markdown-input):focus {
  background: #fff;
}

.preview-content,
.editor-preview {
  height: calc(100% - 42px);
  min-height: 598px;
  padding: 24px;
  overflow: auto;
}

.editor-statusbar,
.status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.63rem;
}

.editor-input.is-typing,
.markdown-input.is-typing,
.typing-bounce {
  animation: typing-bounce 150ms var(--ease-spring);
}

.typing-char {
  display: inline-block;
  animation: character-pop 180ms var(--ease-spring);
}

.draft-list {
  display: grid;
  gap: 10px;
}

.draft-item {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  transition: border-color var(--transition), transform var(--transition);
}

.draft-item:hover {
  border-color: rgba(var(--primary-rgb), 0.46);
  transform: translateX(3px);
}

/* Administration */

.admin-tabs,
.tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 22px;
  padding: 5px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.admin-tab,
.tab-button,
.tabs button {
  display: inline-flex;
  min-height: 38px;
  flex: 0 0 auto;
  gap: 7px;
  align-items: center;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 620;
  transition: color var(--transition), background-color var(--transition),
    border-color var(--transition), transform var(--transition);
}

.admin-tab:hover,
.tab-button:hover,
.tabs button:hover {
  color: var(--text-strong);
}

.admin-tab.active,
.tab-button.active,
.tabs button.active,
.admin-tab[aria-selected="true"] {
  border-color: rgba(var(--primary-rgb), 0.35);
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--text-strong);
}

.tab-panel,
.admin-panel {
  display: none;
}

.tab-panel.active,
.admin-panel.active,
.tab-panel:not([hidden]) {
  display: block;
  animation: panel-in 300ms var(--ease) both;
}

.stats-grid,
.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  position: relative;
  min-height: 132px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color var(--transition), transform var(--transition),
    box-shadow var(--transition);
}

.stat-card::after {
  position: absolute;
  right: -16px;
  bottom: -22px;
  width: 86px;
  height: 86px;
  border: 14px solid rgba(var(--primary-rgb), 0.06);
  border-radius: 50%;
  content: "";
}

.stat-card:hover {
  border-color: rgba(var(--primary-rgb), 0.42);
  box-shadow: var(--shadow-glow);
  transform: translateY(-3px);
}

.stat-label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.75rem;
}

.stat-value {
  color: var(--text-strong);
  font-family: var(--font-mono);
  font-size: clamp(1.55rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
}

.stat-trend {
  display: block;
  margin-top: 10px;
  color: var(--success);
  font-family: var(--font-mono);
  font-size: 0.65rem;
}

.data-panel,
.table-card,
.log-panel {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.data-panel-header,
.table-header,
.log-header {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 17px 19px;
  border-bottom: 1px solid var(--border);
}

.data-panel-header h2,
.table-header h2,
.log-header h2 {
  margin: 0;
  font-size: 1rem;
}

.table-wrap,
.data-table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.data-table,
.admin-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.data-table th,
.admin-table th {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td,
.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tr:last-child td,
.admin-table tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr,
.admin-table tbody tr {
  transition: background-color var(--transition);
}

.data-table tbody tr:hover,
.admin-table tbody tr:hover {
  background: rgba(var(--primary-rgb), 0.045);
}

.table-actions,
.moderation-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}

.table-actions button,
.moderation-actions button {
  display: grid;
  width: 31px;
  height: 31px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  transition: color var(--transition), border-color var(--transition),
    background-color var(--transition), transform var(--transition);
}

.table-actions button:hover,
.moderation-actions button:hover {
  border-color: rgba(var(--primary-rgb), 0.6);
  color: var(--text-strong);
  transform: translateY(-2px);
}

.table-actions .approve:hover,
.moderation-actions .approve:hover {
  border-color: rgba(34, 197, 94, 0.6);
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
}

.table-actions .reject:hover,
.table-actions .delete:hover,
.moderation-actions .reject:hover,
.moderation-actions .delete:hover {
  border-color: rgba(239, 68, 68, 0.6);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

.visitor-ip,
.log-ip,
.log-path,
.ua-text {
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.log-path {
  color: #93c5fd;
}

.ua-text {
  display: block;
  max-width: 300px;
  overflow: hidden;
  color: var(--muted-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comment-preview {
  display: -webkit-box;
  max-width: 360px;
  overflow: hidden;
  color: var(--muted);
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* Tools page */

.tool-grid,
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.tool-card {
  position: relative;
  display: flex;
  min-height: 240px;
  flex-direction: column;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 320ms var(--ease), border-color var(--transition),
    box-shadow var(--transition), background-color var(--transition);
}

.tool-card::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 74px;
  height: 74px;
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.18);
  border-left: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 0 0 0 74px;
  content: "";
  pointer-events: none;
}

.tool-card:hover {
  border-color: rgba(var(--accent-rgb), 0.45);
  box-shadow: var(--shadow-md), 0 14px 48px rgba(var(--accent-rgb), 0.06);
  transform: translateY(-6px);
}

.tool-card-icon {
  display: grid;
  width: 44px;
  height: 44px;
  margin-bottom: 20px;
  place-items: center;
  border: 1px solid rgba(var(--primary-rgb), 0.34);
  border-radius: 12px;
  background: rgba(var(--primary-rgb), 0.1);
  color: #93b4ff;
}

.tool-card h2,
.tool-card h3 {
  margin-bottom: 9px;
  font-size: 1.08rem;
}

.tool-card p {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.84rem;
}

.tool-card .button,
.tool-card .btn {
  margin-top: auto;
  align-self: flex-start;
}

.tool-workspace,
.utility-panel {
  margin-top: 28px;
  padding: clamp(20px, 4vw, 32px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.converter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.tool-result,
.result-box {
  min-height: 110px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

/* About page */

.about-hero {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.28fr);
  gap: clamp(34px, 7vw, 80px);
  align-items: center;
  margin-bottom: clamp(60px, 8vw, 100px);
}

.profile-visual,
.avatar-frame {
  position: relative;
  width: min(100%, 360px);
  margin-inline: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.profile-visual::before,
.avatar-frame::before {
  position: absolute;
  z-index: -1;
  inset: -10px;
  border: 1px solid rgba(var(--primary-rgb), 0.18);
  border-radius: calc(var(--radius-xl) + 8px);
  content: "";
  transform: rotate(-3deg);
}

.profile-visual img,
.avatar-frame img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: calc(var(--radius-xl) - 8px);
  object-fit: cover;
}

.about-copy h1 {
  margin-bottom: 20px;
  font-size: clamp(2.4rem, 6vw, 4.7rem);
}

.about-copy p {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.02rem;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.social-link {
  display: inline-flex;
  min-height: 40px;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted);
  font-size: 0.78rem;
}

.social-link:hover {
  border-color: rgba(var(--primary-rgb), 0.5);
  background: rgba(var(--primary-rgb), 0.08);
  color: var(--text-strong);
  transform: translateY(-3px);
}

.timeline {
  position: relative;
  display: grid;
  gap: 0;
  margin-left: 7px;
  padding-left: 30px;
  border-left: 1px solid var(--border);
}

.timeline-item {
  position: relative;
  padding: 0 0 30px;
}

.timeline-item::before {
  position: absolute;
  top: 5px;
  left: -36px;
  width: 11px;
  height: 11px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.15),
    0 0 16px rgba(var(--primary-rgb), 0.5);
  content: "";
}

.timeline-date {
  margin-bottom: 5px;
  color: var(--primary-hover);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.timeline-item h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.timeline-item p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.skill-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: transform var(--transition), border-color var(--transition),
    background-color var(--transition);
}

.skill-card:hover {
  border-color: rgba(var(--accent-rgb), 0.5);
  background: var(--surface-2);
  transform: translateY(-4px);
}

.skill-card strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text-strong);
  font-size: 0.86rem;
}

.skill-card span {
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.66rem;
}

/* Guestbook and comments */

.comment-section,
.guestbook {
  width: min(100%, 820px);
  margin: clamp(54px, 8vw, 90px) auto 0;
}

.comment-form,
.guestbook-form {
  display: grid;
  gap: 16px;
  margin-bottom: 28px;
  padding: clamp(20px, 4vw, 28px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.comment-form-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
}

.comment-form h2,
.guestbook-form h2 {
  margin-bottom: 3px;
  font-size: 1.12rem;
}

.comment-form p,
.guestbook-form p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.77rem;
}

.comment-list,
.message-list {
  display: grid;
  gap: 13px;
}

.comment-item,
.message-item {
  position: relative;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform var(--transition), border-color var(--transition),
    box-shadow var(--transition);
}

.comment-item:hover,
.message-item:hover {
  border-color: rgba(var(--primary-rgb), 0.38);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.comment-head,
.comment-author-row,
.message-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.comment-author {
  display: flex;
  min-width: 0;
  gap: 10px;
  align-items: center;
}

.comment-avatar,
.avatar {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(var(--primary-rgb), 0.35);
  border-radius: 10px;
  background: rgba(var(--primary-rgb), 0.11);
  color: #a9c1ff;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
}

.comment-author strong {
  display: block;
  color: var(--text-strong);
  font-size: 0.84rem;
}

.comment-time,
.message-time {
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.64rem;
}

.comment-content,
.message-content {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.72;
  white-space: pre-wrap;
}

.comment-actions {
  display: flex;
  gap: 12px;
  margin-top: 13px;
}

.comment-actions button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted-2);
  font-size: 0.7rem;
  transition: color var(--transition), transform var(--transition);
}

.comment-actions button:hover {
  color: var(--primary-hover);
  transform: translateY(-1px);
}

.comment-pending {
  border-style: dashed;
  opacity: 0.76;
}

.char-counter {
  margin-left: auto;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.65rem;
}

/* Lazy images and lightbox */

.lazy-image,
img[data-src],
img[loading="lazy"] {
  background: var(--surface-2);
  opacity: 0;
  filter: blur(12px) saturate(0.72);
  transform: scale(1.015);
  transition: opacity 520ms ease, filter 720ms var(--ease),
    transform 720ms var(--ease);
}

.lazy-image.loaded,
.lazy-image.is-loaded,
img[data-src].loaded,
img[data-src].is-loaded,
img[loading="lazy"].loaded,
img[loading="lazy"].is-loaded {
  opacity: 1;
  filter: blur(0) saturate(1);
  transform: scale(1);
}

img[loading="lazy"]:not([data-src]) {
  opacity: 1;
  filter: none;
  transform: none;
}

.image-skeleton,
.skeleton-media {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--surface-2);
  pointer-events: none;
}

.image-skeleton::after,
.skeleton-media::after,
.skeleton::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(148, 163, 184, 0.09) 48%,
    transparent 76%
  );
  content: "";
  transform: translateX(-100%);
  animation: shimmer 1.55s infinite;
}

.is-loaded + .image-skeleton,
.loaded + .image-skeleton,
.image-loaded .image-skeleton {
  opacity: 0;
  transition: opacity 300ms ease;
}

.lightbox,
.image-lightbox {
  position: fixed;
  z-index: 1800;
  inset: 0;
  display: grid;
  padding: clamp(18px, 4vw, 48px);
  place-items: center;
  background: rgba(2, 6, 23, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease;
}

.lightbox.open,
.lightbox.active,
.image-lightbox.open,
.image-lightbox.active,
.lightbox[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.lightbox img,
.image-lightbox img {
  max-width: min(100%, 1400px);
  max-height: 88vh;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: var(--radius);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.58);
  object-fit: contain;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 300ms ease, transform 420ms var(--ease);
}

.lightbox.open img,
.lightbox.active img,
.image-lightbox.open img,
.image-lightbox.active img,
.lightbox[aria-hidden="false"] img {
  opacity: 1;
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.74);
  color: #e2e8f0;
  font-size: 1.15rem;
  transition: transform var(--transition), background-color var(--transition),
    border-color var(--transition);
}

.lightbox-close:hover {
  border-color: rgba(255, 255, 255, 0.48);
  background: rgba(30, 41, 59, 0.92);
  transform: rotate(8deg) scale(1.04);
}

.lightbox-caption {
  position: absolute;
  right: 20px;
  bottom: 15px;
  left: 20px;
  color: #94a3b8;
  font-size: 0.74rem;
  text-align: center;
}

/* Modals, toasts and transient states */

.modal-backdrop,
.dialog-backdrop {
  position: fixed;
  z-index: 1600;
  inset: 0;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.modal-backdrop.open,
.modal-backdrop.active,
.dialog-backdrop.open,
.dialog-backdrop.active,
.modal-backdrop[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.modal,
.dialog {
  width: min(100%, 520px);
  max-height: min(86vh, 760px);
  padding: clamp(21px, 4vw, 28px);
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  transition: opacity 240ms ease, transform 320ms var(--ease);
}

.open > .modal,
.active > .modal,
.open > .dialog,
.active > .dialog,
[aria-hidden="false"] > .modal {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.modal-header,
.dialog-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-header h2,
.dialog-header h2 {
  margin-bottom: 0;
  font-size: 1.12rem;
}

.modal-actions,
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: flex-end;
  margin-top: 24px;
}

.toast-container {
  position: fixed;
  z-index: 2000;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: min(calc(100vw - 36px), 380px);
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 11px;
  align-items: start;
  padding: 14px 15px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-glass);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: auto;
  transform: translateY(14px) scale(0.98);
  animation: toast-in 350ms var(--ease) forwards;
}

.toast.hide,
.toast.is-leaving {
  animation: toast-out 240ms ease forwards;
}

.toast-icon {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--primary-hover);
}

.toast-success .toast-icon {
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
}

.toast-error .toast-icon {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

.toast strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text-strong);
  font-size: 0.8rem;
}

.toast p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

.toast-close {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted-2);
}

.empty-state,
.error-state,
.loading-state {
  display: grid;
  min-height: 280px;
  padding: 38px 20px;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.empty-state-icon,
.state-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface-2);
  color: var(--muted-2);
  font-size: 1.25rem;
}

.empty-state h3,
.error-state h3,
.loading-state h3 {
  margin-bottom: 6px;
  font-size: 1rem;
}

.empty-state p,
.error-state p,
.loading-state p {
  max-width: 420px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.8rem;
}

.spinner,
.loader {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--primary-hover);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.skeleton {
  position: relative;
  min-height: 14px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface-2);
}

.skeleton + .skeleton {
  margin-top: 10px;
}

/* Global interaction animation hooks */

.click-ripple,
.ripple-effect,
.global-ripple {
  position: fixed;
  z-index: 3000;
  width: 16px;
  height: 16px;
  border: 1px solid rgba(147, 180, 255, 0.72);
  border-radius: 50%;
  background: rgba(var(--primary-rgb), 0.16);
  box-shadow: 0 0 18px rgba(var(--primary-rgb), 0.28);
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0);
  animation: ripple-expand 620ms var(--ease-out, ease-out) forwards;
}

.page-transition,
.page-fade {
  opacity: 0;
  animation: page-enter 440ms var(--ease) 40ms forwards;
}

body.page-ready main,
body.is-ready main,
main.page-ready {
  animation: page-enter 440ms var(--ease) both;
}

body.page-leaving,
body.is-leaving {
  opacity: 0;
}

.reveal,
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 650ms var(--ease), transform 650ms var(--ease);
}

.reveal.revealed,
.reveal.is-visible,
.reveal.visible,
[data-reveal].revealed,
[data-reveal].is-visible,
[data-reveal].visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 {
  transition-delay: 80ms;
}

.reveal-delay-2 {
  transition-delay: 160ms;
}

.reveal-delay-3 {
  transition-delay: 240ms;
}

.parallax,
.parallax-layer,
[data-parallax] {
  will-change: transform;
  transform: translate3d(0, var(--parallax-y, 0), 0);
  transition: transform 80ms linear;
}

/* Footer */

.site-footer {
  margin-top: clamp(70px, 9vw, 120px);
  border-top: 1px solid var(--border);
  background: rgba(13, 16, 26, 0.66);
}

[data-theme="light"] .site-footer {
  background: rgba(241, 245, 249, 0.7);
}

.footer-main,
.footer-shell {
  display: grid;
  width: min(calc(100% - 40px), var(--content-width));
  grid-template-columns: 1.4fr repeat(2, 0.7fr);
  gap: 44px;
  margin-inline: auto;
  padding-block: 52px 34px;
}

.footer-brand p {
  max-width: 390px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.footer-column h3 {
  margin-bottom: 13px;
  color: var(--text-strong);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.footer-links {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links a {
  color: var(--muted);
  font-size: 0.78rem;
}

.footer-links a:hover {
  color: var(--primary-hover);
  transform: translateX(3px);
}

.footer-bottom {
  display: flex;
  width: min(calc(100% - 40px), var(--content-width));
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  margin-inline: auto;
  padding: 20px 0 24px;
  border-top: 1px solid var(--border);
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.66rem;
}

.footer-status {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.footer-status::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.6);
  content: "";
}

/* ----------------------------------------------------------------
   Concrete template hooks
   These selectors mirror the shipped HTML while keeping the visual
   primitives above reusable for user-created pages.
   ---------------------------------------------------------------- */

.ambient-grid {
  position: fixed;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient-grid::before,
.ambient-grid::after {
  position: absolute;
  width: min(38vw, 520px);
  aspect-ratio: 1;
  border: 1px solid rgba(var(--primary-rgb), 0.08);
  border-radius: 50%;
  content: "";
  filter: blur(0.2px);
}

.ambient-grid::before {
  top: 12vh;
  left: -22vw;
  box-shadow: 0 0 100px rgba(var(--primary-rgb), 0.05);
}

.ambient-grid::after {
  right: -24vw;
  bottom: 5vh;
  border-color: rgba(var(--accent-rgb), 0.07);
  box-shadow: 0 0 100px rgba(var(--accent-rgb), 0.04);
}

.glass-panel {
  border: 1px solid var(--border);
  background: var(--surface-glass);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
}

.text-gradient {
  background: linear-gradient(105deg, #79a3ff 10%, #c084fc 92%);
  background-clip: text;
  color: transparent;
  -webkit-background-clip: text;
}

.brand-dot {
  color: var(--accent);
  text-shadow: 0 0 12px rgba(var(--accent-rgb), 0.65);
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.08),
    0 0 13px rgba(34, 197, 94, 0.72);
}

.button-small {
  min-height: 34px;
  padding: 7px 11px;
  font-size: 0.76rem;
}

.text-link,
.text-button {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary-hover);
  font-size: 0.78rem;
  font-weight: 650;
  transition: gap var(--transition), color var(--transition),
    transform var(--transition);
}

.text-link:hover,
.text-button:hover {
  gap: 10px;
  color: #a9c1ff;
  transform: translateX(2px);
}

[data-theme="light"] :is(.text-link, .text-button):hover {
  color: var(--primary);
}

.nav-toggle {
  position: relative;
  border-radius: 10px;
}

.nav-toggle > span {
  position: absolute;
  left: 10px;
  width: 18px;
  height: 1.5px;
  border-radius: 99px;
  background: currentColor;
  transition: top var(--transition), opacity var(--transition),
    transform var(--transition);
}

.nav-toggle > span:nth-child(1) {
  top: 12px;
}

.nav-toggle > span:nth-child(2) {
  top: 18px;
}

.nav-toggle > span:nth-child(3) {
  top: 24px;
}

.nav-toggle[aria-expanded="true"] > span:nth-child(1) {
  top: 18px;
  transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] > span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] > span:nth-child(3) {
  top: 18px;
  transform: rotate(-45deg);
}

.page-heading {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: clamp(28px, 5vw, 44px);
}

.page-heading h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 5vw, 3.4rem);
}

.page-heading > div > p:last-child,
.page-heading > p:last-child {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
}

.page-heading.centered {
  display: block;
  max-width: 760px;
  margin-inline: auto;
  margin-bottom: clamp(42px, 6vw, 66px);
  text-align: center;
}

.page-heading.centered .eyebrow {
  justify-content: center;
}

.page-heading.centered > p:last-child {
  margin-inline: auto;
}

/* Shipped home page */

.hero.container {
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
  gap: clamp(42px, 7vw, 88px);
}

.hero-copy {
  position: relative;
  z-index: 1;
}

.hero-copy h1 {
  margin-bottom: 24px;
}

.hero-lead {
  max-width: 640px;
  margin-bottom: 34px;
  color: var(--muted);
  font-size: clamp(1.02rem, 1.7vw, 1.18rem);
  line-height: 1.78;
}

.hero-console {
  position: relative;
  min-width: 0;
  overflow: visible;
  border-radius: var(--radius-lg);
  transform: translate3d(0, var(--parallax-y, 0), 0) perspective(1000px)
    rotateY(-2deg) rotateX(1deg);
  transition: border-color var(--transition), box-shadow var(--transition),
    transform 500ms var(--ease);
}

.hero-console:hover {
  border-color: rgba(var(--primary-rgb), 0.48);
  box-shadow: var(--shadow-md), 0 0 70px rgba(var(--primary-rgb), 0.13);
  transform: translate3d(0, calc(var(--parallax-y, 0px) - 5px), 0)
    perspective(1000px) rotateY(0) rotateX(0);
}

.console-bar {
  display: flex;
  min-height: 46px;
  gap: 7px;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}

.console-bar > span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
}

.console-bar > span:nth-child(2) {
  background: #f59e0b;
}

.console-bar > span:nth-child(3) {
  background: #22c55e;
}

.console-bar b {
  margin-left: auto;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
}

.console-body {
  min-height: 310px;
  padding: clamp(24px, 4vw, 38px);
  overflow: auto;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: clamp(0.72rem, 1.15vw, 0.86rem);
  line-height: 1.9;
}

.console-body p {
  margin: 0;
  white-space: nowrap;
}

.console-body i {
  display: inline-block;
  width: 28px;
  color: #475569;
  font-style: normal;
  user-select: none;
}

.console-result {
  margin-top: 20px !important;
  color: #86efac;
}

.code-purple {
  color: #c084fc;
}

.code-blue {
  color: #7dd3fc;
}

.code-green {
  color: #86efac;
}

.cursor {
  display: inline-block;
  width: 7px;
  height: 1em;
  margin-left: 4px;
  background: var(--primary-hover);
  vertical-align: -2px;
  animation: cursor-blink 1.1s steps(1) infinite;
}

.signal-orbit {
  position: absolute;
  z-index: -1;
  right: -26px;
  bottom: -26px;
  width: 110px;
  height: 110px;
  border: 1px solid rgba(var(--accent-rgb), 0.24);
  border-radius: 50%;
  animation: orbit-spin 15s linear infinite;
}

.signal-orbit::before {
  position: absolute;
  top: -4px;
  left: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.9);
  content: "";
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: clamp(60px, 8vw, 96px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(16, 20, 31, 0.66);
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .metric-strip {
  background: rgba(255, 255, 255, 0.8);
}

.metric-strip > div {
  min-width: 0;
  padding: 20px clamp(16px, 3vw, 28px);
  border-right: 1px solid var(--border);
}

.metric-strip > div:last-child {
  border-right: 0;
}

.metric-strip strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text-strong);
  font-family: var(--font-mono);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  letter-spacing: -0.04em;
}

.metric-strip span {
  color: var(--muted-2);
  font-size: 0.69rem;
}

.content-section {
  scroll-margin-top: calc(var(--header-height) + 24px);
}

.section-heading h2 {
  margin-bottom: 0;
}

.search-field > span:not(.sr-only) {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 14px;
  color: var(--muted-2);
  font-size: 1rem;
  pointer-events: none;
  transform: translateY(-52%);
}

.search-field kbd {
  position: absolute;
  top: 50%;
  right: 10px;
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted-2);
  font-size: 0.64rem;
  pointer-events: none;
  transform: translateY(-50%);
}

.search-field input {
  padding-right: 44px;
}

.skeleton-card {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(var(--surface-2), var(--surface-2)) 0 0 / 100% 52% no-repeat,
    linear-gradient(var(--surface-2), var(--surface-2)) 22px 68% / 44% 16px no-repeat,
    linear-gradient(var(--surface-2), var(--surface-2)) 22px 78% / calc(100% - 44px) 11px no-repeat,
    linear-gradient(var(--surface-2), var(--surface-2)) 22px 85% / 68% 11px no-repeat,
    var(--surface);
}

.skeleton-card::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 22%,
    rgba(148, 163, 184, 0.08) 48%,
    transparent 74%
  );
  content: "";
  transform: translateX(-100%);
  animation: shimmer 1.55s infinite;
}

.panel-title {
  justify-content: space-between;
}

.panel-title::before {
  display: none;
}

.panel-title > span {
  display: inline-flex;
  gap: 9px;
  align-items: center;
}

.panel-title > span::before {
  width: 3px;
  height: 14px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 12px rgba(var(--primary-rgb), 0.55);
  content: "";
}

.panel-title > small {
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.recent-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: recent;
}

.recent-list li {
  counter-increment: recent;
}

.recent-list li + li {
  border-top: 1px solid var(--border);
}

.recent-list a {
  position: relative;
  display: block;
  padding: 12px 0 12px 35px;
  color: var(--text);
  font-size: 0.79rem;
  line-height: 1.45;
}

.recent-list a::before {
  position: absolute;
  top: 12px;
  left: 0;
  color: var(--muted-2);
  content: "0" counter(recent);
  font-family: var(--font-mono);
  font-size: 0.64rem;
}

.recent-list a:hover {
  color: var(--primary-hover);
  transform: translateX(3px);
}

.recent-list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.recent-list li > span {
  padding-top: 12px;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.62rem;
}

.recent-list li > a {
  padding-left: 0;
}

.recent-list li > a::before {
  display: none;
}

.recent-list a small {
  display: block;
  margin-top: 4px;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.58rem;
}

.tag-cloud button {
  display: inline-flex;
  min-height: 30px;
  gap: 6px;
  align-items: center;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  transition: color var(--transition), border-color var(--transition),
    background-color var(--transition), transform var(--transition);
}

.tag-cloud button small {
  color: var(--muted-2);
  font-size: 0.58rem;
}

.tag-cloud button:hover,
.tag-cloud button.is-active {
  border-color: rgba(var(--accent-rgb), 0.52);
  background: rgba(var(--accent-rgb), 0.09);
  color: #d8b4fe;
  transform: translateY(-2px);
}

.post-card .post-cover {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface-2);
  box-shadow: none;
}

.post-card .post-cover::after {
  position: absolute;
  z-index: 1;
  inset: auto 0 0;
  height: 45%;
  background: linear-gradient(to top, rgba(10, 10, 18, 0.58), transparent);
  content: "";
  pointer-events: none;
}

.post-card .post-cover img {
  width: 100%;
  height: 100%;
  max-height: none;
  margin: 0;
  object-fit: cover;
  transition: opacity 520ms ease, filter 720ms var(--ease),
    transform 650ms var(--ease);
}

.post-card:hover .post-cover img {
  transform: scale(1.035);
}

.cover-index {
  position: absolute;
  z-index: 2;
  right: 13px;
  bottom: 10px;
  color: rgba(226, 232, 240, 0.78);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
}

.post-card-body {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  padding: 22px;
}

.post-card-body h3 {
  margin: 14px 0 10px;
  font-size: clamp(1.08rem, 2vw, 1.3rem);
  line-height: 1.36;
}

.post-card-body h3 a {
  display: inline;
  background-image: linear-gradient(var(--primary-hover), var(--primary-hover));
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0 1px;
  transition: color var(--transition), background-size 350ms var(--ease);
}

.post-card:hover .post-card-body h3 a,
.post-card-body h3 a:hover {
  background-size: 100% 1px;
  color: #b9ccff;
}

[data-theme="light"] .post-card:hover .post-card-body h3 a {
  color: var(--primary);
}

.post-card-body > p {
  display: -webkit-box;
  margin-bottom: 18px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.72;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.post-card-body .post-meta {
  justify-content: space-between;
  margin-top: auto;
  padding-top: 15px;
  border-top: 1px solid var(--border);
}

.post-tags > span {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid rgba(var(--primary-rgb), 0.22);
  border-radius: 999px;
  background: rgba(var(--primary-rgb), 0.08);
  color: #93b4ff;
  font-size: 0.7rem;
  font-weight: 650;
}

[data-theme="light"] .post-tags > span {
  color: var(--primary);
}

.sidebar .utility-panel {
  margin-top: 0;
  padding: 20px;
  border-radius: var(--radius);
}

.utility-panel .mini-tool {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 0;
}

.utility-panel .mini-tool label {
  color: var(--muted);
  font-size: 0.74rem;
}

.utility-panel .mini-tool textarea {
  min-height: 82px;
  font-size: 0.78rem;
}

.utility-panel .mini-tool output {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--primary-hover);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.sidebar .utility-panel > .text-link {
  margin-top: 14px;
}

.comment-intro {
  display: grid;
  max-width: 640px;
  margin: 0 auto 25px;
  justify-items: center;
  text-align: center;
}

.comment-intro h2 {
  margin-bottom: 8px;
  font-size: clamp(1.55rem, 3vw, 2.1rem);
}

.comment-intro > p:not(.eyebrow) {
  margin-bottom: 15px;
  color: var(--muted);
  font-size: 0.86rem;
}

.api-mode-badge {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
}

.api-mode-badge span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.7);
}

.api-mode-badge.is-online span,
.api-mode-badge.production span,
.api-mode-badge.is-cloud span {
  background: var(--success);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.7);
}

.api-mode-badge.is-local span {
  background: var(--warning);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.7);
}

.comment-board {
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.comment-board .comment-form {
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.comment-board .comment-list {
  padding: clamp(18px, 4vw, 28px);
}

.comment-list .comment-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.comment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  align-items: center;
}

.comment-meta strong {
  color: var(--text-strong);
  font-size: 0.8rem;
}

.comment-meta time {
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.61rem;
}

.comment-list .comment-item p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.empty-state.compact {
  min-height: 150px;
  padding: 24px 16px;
}

.comment-form > label,
.comment-form .form-row > label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 650;
}

.form-actions {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
}

.form-actions small {
  color: var(--muted-2);
  font-size: 0.67rem;
}

/* Shipped article page */

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 38px;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.breadcrumb a:hover {
  color: var(--primary-hover);
  transform: translateY(-1px);
}

.article-shell {
  width: 100%;
}

.article-header {
  width: min(100%, 900px);
  margin: 0 auto clamp(38px, 6vw, 60px);
  text-align: center;
}

.article-header .post-tags {
  justify-content: center;
}

.article-header h1 {
  margin: 14px auto 18px;
  font-size: clamp(2.15rem, 5.5vw, 4.35rem);
  line-height: 1.08;
}

.article-summary {
  max-width: 720px;
  margin: 0 auto 24px;
  color: var(--muted);
  font-size: clamp(0.98rem, 1.8vw, 1.12rem);
  line-height: 1.75;
}

.article-header .article-meta {
  justify-content: center;
}

.author-chip {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--text);
}

.avatar-mini {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid rgba(var(--primary-rgb), 0.38);
  border-radius: 7px;
  background: rgba(var(--primary-rgb), 0.1);
  color: #a9c1ff;
  font-size: 0.55rem;
  font-weight: 700;
}

.article-page .article-cover {
  aspect-ratio: 16 / 8.2;
}

.article-page .article-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}

.article-page .article-layout {
  grid-template-columns: 220px minmax(0, var(--reading-width));
}

.article-rail {
  position: sticky;
  top: calc(var(--header-height) + 26px);
}

.toc-box {
  padding-left: 16px;
  border-left: 1px solid var(--border);
}

.toc-box > strong {
  display: block;
  margin-bottom: 12px;
  color: var(--text-strong);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toc-box nav,
.toc-box ol,
.toc-box ul {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc-box a {
  display: block;
  padding: 5px 7px;
  border-left: 1px solid transparent;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.toc-box a:hover,
.toc-box a.is-active,
.toc-box a.active {
  border-left-color: var(--primary);
  color: var(--text-strong);
  transform: translateX(3px);
}

.toc-box .toc-level-3,
.toc-box a[data-level="3"],
.toc-box .toc-h3 {
  padding-left: 18px;
  font-size: 0.68rem;
}

.article-progress {
  width: 2px;
  height: 110px;
  margin: 26px 0 0 17px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--border);
}

.article-progress > span {
  display: block;
  width: 100%;
  height: var(--progress, 0%);
  border-radius: inherit;
  background: var(--primary);
  box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.7);
  transition: height 100ms linear;
}

.post-nav-card {
  min-width: 0;
}

/* Code blocks emitted by code-highlight.js */

.markdown-body .code-shell,
.code-shell {
  position: relative;
  margin: 1.8em 0;
  overflow: hidden;
  border: 1px solid #1e293b;
  border-radius: var(--radius);
  background: #111827;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.18);
}

.code-shell > pre,
.markdown-body .code-shell > pre {
  margin: 0;
  padding: 22px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.code-toolbar {
  display: flex;
  min-height: 40px;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 7px 9px 7px 14px;
  border-bottom: 1px solid #1e293b;
  background: #0f1624;
}

.code-toolbar .code-language {
  position: static;
  color: #64748b;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
}

.code-copy-button {
  display: inline-flex;
  min-height: 27px;
  gap: 5px;
  align-items: center;
  padding: 5px 9px;
  border: 1px solid #334155;
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.85);
  color: #94a3b8;
  font-family: var(--font-sans);
  font-size: 0.64rem;
  transition: color var(--transition), border-color var(--transition),
    background-color var(--transition), transform var(--transition);
}

.code-copy-button:hover {
  border-color: rgba(var(--primary-rgb), 0.65);
  background: #172033;
  color: #e2e8f0;
  transform: translateY(-1px);
}

.code-copy-button.is-copied {
  border-color: rgba(34, 197, 94, 0.5);
  color: #86efac;
}

.code-copy-button.is-error {
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}

/* Shipped editor */

.editor-status {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.status-dot.is-published {
  background: var(--success);
}

.status-dot.is-saving {
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.08),
    0 0 13px rgba(245, 158, 11, 0.72);
  animation: status-pulse 1s ease-in-out infinite;
}

.editor-page .editor-shell {
  display: grid;
  width: 100%;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.editor-library {
  position: sticky;
  top: calc(var(--header-height) + 22px);
  min-width: 0;
}

.editor-library .panel-title {
  margin-bottom: 14px;
}

.editor-library .panel-title::before {
  display: none;
}

.compact-field {
  display: grid;
  gap: 7px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.7rem;
}

.compact-field input {
  font-size: 0.76rem;
}

.editor-article-list {
  display: grid;
  max-height: 520px;
  gap: 8px;
  padding-top: 14px;
  margin-top: 14px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}

.editor-article-item,
.editor-article-list > button,
.editor-article-list > article {
  display: block;
  width: 100%;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  transition: border-color var(--transition), background-color var(--transition),
    transform var(--transition);
}

.editor-article-item:hover,
.editor-article-list > button:hover,
.editor-article-list > article:hover,
.editor-article-item.is-active,
.editor-article-list > button.is-active {
  border-color: rgba(var(--primary-rgb), 0.48);
  background: rgba(var(--primary-rgb), 0.08);
  transform: translateX(2px);
}

.editor-article-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: center;
}

.editor-article-item strong,
.editor-article-list > button strong {
  display: block;
  margin-bottom: 4px;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-article-item small,
.editor-article-list > button small {
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.59rem;
}

.editor-page .editor-workspace {
  display: block;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.editor-workspace > form {
  display: block;
}

.editor-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.editor-meta-grid > label {
  display: grid;
  min-width: 0;
  gap: 7px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 650;
}

.editor-meta-grid .wide {
  grid-column: 1 / -1;
}

.editor-meta-grid textarea {
  min-height: 72px;
}

.editor-tabs {
  display: flex;
  min-height: 44px;
  gap: 4px;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.editor-tab {
  min-height: 31px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 0.7rem;
  transition: color var(--transition), border-color var(--transition),
    background-color var(--transition);
}

.editor-tab:hover,
.editor-tab.is-active,
.editor-tab[aria-selected="true"] {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text-strong);
}

.editor-tabs > span {
  margin-left: auto;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.62rem;
}

.editor-page .editor-toolbar {
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.editor-panes {
  display: grid;
  min-height: 560px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.editor-panes .editor-pane {
  display: block;
  min-width: 0;
  overflow: hidden;
  border: 0;
}

.editor-panes .write-pane {
  border-right: 1px solid var(--border);
}

.editor-panes #markdown-input {
  display: block;
  width: 100%;
  height: 560px;
  min-height: 560px;
  padding: 22px;
  border: 0;
  border-radius: 0;
  background: #0d1320;
  box-shadow: none;
  color: #dbeafe;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.72;
  resize: none;
  tab-size: 2;
}

[data-theme="light"] .editor-panes #markdown-input {
  background: #f7f9fc;
  color: #172033;
}

.editor-panes #markdown-input:focus {
  background: #0e1625;
  box-shadow: inset 3px 0 0 var(--primary);
}

[data-theme="light"] .editor-panes #markdown-input:focus {
  background: #fff;
}

.editor-panes .preview-pane {
  height: 560px;
  padding: 22px;
  overflow: auto;
}

.editor-panes[data-view="write"],
.editor-panes.view-write,
.editor-panes.is-write {
  grid-template-columns: minmax(0, 1fr);
}

.editor-panes[data-view="write"] .preview-pane,
.editor-panes.view-write .preview-pane,
.editor-panes.is-write .preview-pane {
  display: none;
}

.editor-panes[data-view="preview"],
.editor-panes.view-preview,
.editor-panes.is-preview {
  grid-template-columns: minmax(0, 1fr);
}

.editor-panes[data-view="preview"] .write-pane,
.editor-panes.view-preview .write-pane,
.editor-panes.is-preview .write-pane {
  display: none;
}

.editor-page .editor-actions {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.action-spacer {
  flex: 1;
}

/* Shipped admin dashboard */

.admin-access {
  display: flex;
  gap: 22px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 18px;
  border-radius: var(--radius);
}

.admin-access > div {
  display: flex;
  min-width: 0;
  gap: 12px;
  align-items: center;
}

.access-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(var(--primary-rgb), 0.32);
  border-radius: 11px;
  background: rgba(var(--primary-rgb), 0.1);
  color: #93b4ff;
  font-size: 1.1rem;
}

.admin-access strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text-strong);
  font-size: 0.84rem;
}

.admin-access p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.admin-access form {
  display: flex;
  min-width: min(100%, 390px);
  gap: 8px;
}

.admin-access form input {
  min-width: 0;
}

.admin-access form .button,
.admin-access form .btn {
  min-width: 94px;
  white-space: nowrap;
}

.admin-stats > article {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 126px;
  gap: 15px;
  align-items: flex-start;
  padding: 19px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition),
    transform var(--transition);
}

.admin-stats > article:hover {
  border-color: rgba(var(--primary-rgb), 0.4);
  box-shadow: var(--shadow-glow);
  transform: translateY(-3px);
}

.stat-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(var(--primary-rgb), 0.3);
  border-radius: 10px;
  background: rgba(var(--primary-rgb), 0.09);
  color: #93b4ff;
}

.stat-icon.purple {
  border-color: rgba(var(--accent-rgb), 0.3);
  background: rgba(var(--accent-rgb), 0.09);
  color: #d8b4fe;
}

.stat-icon.cyan {
  border-color: rgba(56, 189, 248, 0.3);
  background: rgba(56, 189, 248, 0.09);
  color: #7dd3fc;
}

.stat-icon.green {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.09);
  color: #86efac;
}

.admin-stats small,
.admin-stats em {
  display: block;
  color: var(--muted-2);
  font-size: 0.66rem;
  font-style: normal;
}

.admin-stats strong {
  display: block;
  max-width: 150px;
  margin: 5px 0 7px;
  overflow: hidden;
  color: var(--text-strong);
  font-family: var(--font-mono);
  font-size: clamp(1.18rem, 2vw, 1.65rem);
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-page .admin-shell {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.admin-page .admin-tabs {
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface-2);
}

.admin-tabs > button {
  display: inline-flex;
  min-height: 38px;
  flex: 0 0 auto;
  gap: 7px;
  align-items: center;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 620;
  transition: color var(--transition), background-color var(--transition),
    border-color var(--transition);
}

.admin-tabs > button:hover {
  color: var(--text-strong);
}

.admin-tabs > button.is-active,
.admin-tabs > button[aria-selected="true"] {
  border-color: rgba(var(--primary-rgb), 0.35);
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--text-strong);
}

.count-badge {
  display: grid;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  place-items: center;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.15);
  color: #d8b4fe;
  font-family: var(--font-mono);
  font-size: 0.6rem;
}

.admin-page .admin-panel {
  display: none;
  background: transparent;
}

.admin-page .admin-panel.is-active,
.admin-page .admin-panel:not([hidden]) {
  display: block;
  animation: panel-in 300ms var(--ease) both;
}

.admin-panel-head {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.admin-panel-head h2 {
  margin-bottom: 2px;
  font-size: 1rem;
}

.admin-panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.admin-page .table-wrap {
  width: 100%;
  overflow-x: auto;
}

.admin-page .table-wrap table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 0.79rem;
}

.admin-page .table-wrap th {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.63rem;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-page .table-wrap td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-page .table-wrap tbody tr:last-child td {
  border-bottom: 0;
}

.admin-page .table-wrap tbody tr {
  transition: background-color var(--transition);
}

.admin-page .table-wrap tbody tr:hover {
  background: rgba(var(--primary-rgb), 0.045);
}

.table-article {
  display: grid;
  min-width: 220px;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
}

.table-article img {
  width: 48px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  object-fit: cover;
}

.table-article strong {
  display: block;
  max-width: 320px;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 0.77rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-article small,
.admin-page .table-wrap td > small {
  display: block;
  max-width: 360px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.63rem;
  font-weight: 650;
}

.status-pill.status-published,
.status-pill.status-approved {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.09);
  color: #86efac;
}

.status-pill.status-draft,
.status-pill.status-pending {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.09);
  color: #fcd34d;
}

.status-pill.status-rejected {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.09);
  color: #fca5a5;
}

.table-actions .icon-button.danger,
.moderation-actions .icon-button.danger {
  border-color: rgba(239, 68, 68, 0.28);
  color: #fca5a5;
}

.table-actions .icon-button.danger:hover,
.moderation-actions .icon-button.danger:hover {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.11);
}

.admin-page .table-wrap td > code {
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: #93c5fd;
  font-size: 0.68rem;
}

.inline-loader {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 24px;
  color: var(--muted);
  font-size: 0.75rem;
}

.inline-loader::before {
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--border-strong);
  border-top-color: var(--primary-hover);
  border-radius: 50%;
  content: "";
  animation: spin 0.75s linear infinite;
}

.moderation-list {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.moderation-item,
.moderation-list > article {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.moderation-content {
  min-width: 0;
}

.moderation-content p {
  white-space: pre-wrap;
}

.moderation-content > small {
  display: block;
  margin-top: 7px;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.59rem;
}

.moderation-item p,
.moderation-list > article p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.deploy-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 20px;
}

.deploy-checklist article {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 13px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.deploy-checklist article > span {
  color: var(--primary-hover);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.deploy-checklist h3 {
  margin-bottom: 7px;
  font-size: 0.9rem;
}

.deploy-checklist p {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.deploy-checklist code {
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: #c4b5fd;
}

/* Shipped tools */

.tools-page .tool-grid {
  align-items: stretch;
}

.tool-card.tool-wide {
  grid-column: span 2;
}

.tool-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 13px;
  align-items: start;
  margin-bottom: 20px;
}

.tool-head h2 {
  margin-bottom: 4px;
  font-size: 1.02rem;
}

.tool-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.tool-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(var(--primary-rgb), 0.34);
  border-radius: 11px;
  background: rgba(var(--primary-rgb), 0.1);
  color: #a9c1ff;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.local-badge {
  padding: 4px 7px;
  border: 1px solid rgba(34, 197, 94, 0.28);
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.08);
  color: #86efac;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.08em;
}

.tool-body {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 12px;
}

.tool-body.stacked {
  align-content: start;
}

.tool-body label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.7rem;
}

.tool-card.tool-wide .tool-body textarea {
  min-height: 258px;
  font-family: var(--font-mono);
  font-size: 0.79rem;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tool-actions output {
  margin-left: auto;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.64rem;
}

.tool-body > output,
.code-output,
.large-output {
  display: block;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

.large-output {
  display: grid;
  min-height: 118px;
  place-content: center;
  color: var(--text-strong);
  font-size: 1.2rem;
  text-align: center;
}

.large-output small {
  display: block;
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 0.62rem;
}

.code-output {
  display: flex;
  align-items: center;
  min-height: 68px;
  color: #a9c1ff;
}

.text-link.as-button {
  justify-self: start;
}

.color-input-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

input[type="color"] {
  width: 48px;
  height: 44px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
}

.color-preview {
  display: grid;
  min-height: 100px;
  padding: 18px;
  place-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #2563eb;
  color: #fff;
  text-align: center;
  transition: background-color var(--transition), color var(--transition);
}

.color-preview strong {
  font-size: 1rem;
}

.color-preview span {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  opacity: 0.78;
}

/* Shipped about page */

.about-avatar {
  position: relative;
  display: grid;
  width: min(72vw, 370px);
  aspect-ratio: 1;
  margin-inline: auto;
  place-items: center;
}

.avatar-core {
  position: relative;
  display: grid;
  width: 62%;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(var(--primary-rgb), 0.42);
  border-radius: 34% 45% 38% 46%;
  background: var(--surface);
  box-shadow: inset 0 0 48px rgba(var(--primary-rgb), 0.13),
    0 20px 70px rgba(var(--primary-rgb), 0.12);
  transform: rotate(-4deg);
}

.avatar-core::before {
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.26);
  border-radius: inherit;
  content: "";
}

.avatar-core span {
  color: var(--text-strong);
  font-family: var(--font-mono);
  font-size: clamp(2rem, 7vw, 4.5rem);
  font-weight: 760;
  letter-spacing: -0.08em;
  text-shadow: 0 0 24px rgba(var(--primary-rgb), 0.4);
  transform: rotate(4deg);
}

.orbit {
  position: absolute;
  inset: 9%;
  border: 1px solid rgba(var(--primary-rgb), 0.2);
  border-radius: 50%;
  animation: orbit-spin 18s linear infinite;
}

.orbit::after {
  position: absolute;
  top: -4px;
  left: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary-hover);
  box-shadow: 0 0 14px rgba(var(--primary-rgb), 0.85);
  content: "";
}

.orbit-two {
  inset: 2%;
  border-color: rgba(var(--accent-rgb), 0.16);
  animation-direction: reverse;
  animation-duration: 26s;
}

.orbit-two::after {
  background: var(--accent);
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.85);
}

.about-avatar > small {
  position: absolute;
  right: 0;
  bottom: 4%;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.09em;
  line-height: 1.6;
}

.about-lead {
  max-width: 700px;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.8;
}

.about-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
  gap: 20px;
  margin-bottom: clamp(70px, 9vw, 110px);
}

.manifesto {
  padding: clamp(26px, 5vw, 46px);
}

.manifesto h2 {
  margin-bottom: 18px;
  font-size: clamp(1.55rem, 3.8vw, 2.45rem);
}

.manifesto > p:not(.eyebrow) {
  color: var(--muted);
}

.manifesto blockquote {
  margin: 25px 0 0;
  padding: 14px 17px;
  border-left: 2px solid var(--accent);
  background: rgba(var(--accent-rgb), 0.06);
  color: var(--text);
  font-size: 0.9rem;
}

.now-panel ul {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.now-panel li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}

.now-panel li:last-child {
  border-bottom: 0;
}

.now-panel li > span {
  color: var(--primary-hover);
  font-family: var(--font-mono);
  font-size: 0.63rem;
}

.now-panel strong {
  display: block;
  color: var(--text-strong);
  font-size: 0.78rem;
}

.now-panel small {
  display: block;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.58rem;
}

.journey-section,
.stack-section {
  margin-bottom: clamp(70px, 9vw, 110px);
}

.journey-section .timeline {
  margin-left: 7px;
}

.journey-section .timeline > article {
  position: relative;
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 25px;
  padding: 0 0 34px;
}

.journey-section .timeline > article::before {
  position: absolute;
  top: 6px;
  left: -36px;
  width: 11px;
  height: 11px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.15),
    0 0 16px rgba(var(--primary-rgb), 0.5);
  content: "";
}

.journey-section time {
  color: var(--primary-hover);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.journey-section h3 {
  margin-bottom: 7px;
  font-size: 1rem;
}

.journey-section article p {
  margin-bottom: 11px;
  color: var(--muted);
  font-size: 0.84rem;
}

.stack-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.stack-grid span {
  display: grid;
  min-height: 62px;
  padding: 10px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  transition: color var(--transition), border-color var(--transition),
    background-color var(--transition), transform var(--transition);
}

.stack-grid span:hover {
  border-color: rgba(var(--accent-rgb), 0.48);
  background: rgba(var(--accent-rgb), 0.06);
  color: var(--text-strong);
  transform: translateY(-4px);
}

.contact-banner {
  display: flex;
  gap: 30px;
  align-items: center;
  justify-content: space-between;
  padding: clamp(25px, 5vw, 46px);
  border: 1px solid rgba(var(--primary-rgb), 0.35);
  border-radius: var(--radius-lg);
  background: rgba(var(--primary-rgb), 0.055);
  box-shadow: var(--shadow-glow);
}

.contact-banner h2 {
  margin-bottom: 8px;
  font-size: clamp(1.4rem, 3vw, 2.1rem);
}

.contact-banner p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

/* Shipped compact footer and message layers */

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(120px, 0.5fr) auto;
  gap: 38px;
  align-items: start;
  padding-block: 38px;
}

.footer-grid > div:first-child > p {
  max-width: 420px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.footer-grid .footer-links {
  display: grid;
  gap: 7px;
}

.footer-meta {
  margin: 0;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  line-height: 1.8;
  text-align: right;
}

.toast-region {
  position: fixed;
  z-index: 2000;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: min(calc(100vw - 36px), 380px);
  gap: 10px;
  pointer-events: none;
}

.toast-region .toast {
  display: block;
  padding: 13px 15px;
  border-left: 3px solid var(--primary);
  color: var(--text);
  font-size: 0.76rem;
  line-height: 1.55;
  animation: none;
  opacity: 0;
  pointer-events: auto;
  transform: translateY(12px) scale(0.98);
  transition: opacity 220ms ease, transform 300ms var(--ease);
}

.toast-region .toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-region .toast-success {
  border-left-color: var(--success);
}

.toast-region .toast-error {
  border-left-color: var(--danger);
}

.toast-region .toast-warning {
  border-left-color: var(--warning);
}

.lightbox.is-open,
.image-lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox.is-open img,
.image-lightbox.is-open img {
  opacity: 1;
  transform: scale(1);
}

/* Keyframes */

@keyframes cursor-blink {
  0%,
  45% {
    opacity: 1;
  }
  46%,
  100% {
    opacity: 0;
  }
}

@keyframes orbit-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes status-pulse {
  0%,
  100% {
    opacity: 0.62;
    transform: scale(0.92);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

@keyframes ripple-expand {
  0% {
    opacity: 0.75;
    transform: translate(-50%, -50%) scale(0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(8);
  }
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typing-bounce {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-1px) scale(1.0015);
  }
}

@keyframes character-pop {
  0% {
    opacity: 0.45;
    transform: translateY(3px) scale(0.88);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-in {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(16px) scale(0.98);
  }
}

/* Desktop and tablet refinements */

@media (max-width: 1180px) {
  :root {
    --sidebar-width: 270px;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
    gap: 44px;
  }

  .stats-grid,
  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tool-grid,
  .tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .editor-page .editor-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }
}

@media (max-width: 960px) {
  :root {
    --header-height: 66px;
  }

  .layout-grid,
  .content-grid,
  .blog-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar > :first-child:last-child {
    grid-column: 1 / -1;
  }

  .article-layout,
  .post-layout {
    grid-template-columns: minmax(0, var(--reading-width));
  }

  .article-toc,
  .toc,
  .article-rail {
    display: none;
  }

  .editor-page .editor-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .editor-library {
    position: static;
  }

  .editor-article-list {
    max-height: 260px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .about-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .stack-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .editor-meta-panel,
  .editor-settings {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .editor-meta-panel > :first-child,
  .editor-settings > :first-child {
    grid-column: 1 / -1;
  }

  .skills-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .nav-links,
  .nav-menu {
    position: fixed;
    z-index: 990;
    top: var(--header-height);
    right: 18px;
    left: 18px;
    display: grid;
    height: auto;
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px) scale(0.985);
    transition: opacity var(--transition), transform var(--transition);
  }

  .nav-open .nav-links,
  .nav-open .nav-menu,
  .menu-open .nav-links,
  .menu-open .nav-menu,
  .nav-links.open,
  .nav-menu.open,
  .nav-links.is-open,
  .nav-menu.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }

  .nav-links li,
  .nav-menu li {
    width: 100%;
  }

  .nav-links a,
  .nav-link,
  .nav-menu a {
    width: 100%;
    height: 44px;
  }

  .nav-links a::after,
  .nav-link::after,
  .nav-menu a::after {
    top: 12px;
    right: auto;
    bottom: 12px;
    left: 5px;
    width: 2px;
    height: auto;
    transform: scaleY(0.3);
  }

  .nav-links a:hover::after,
  .nav-link:hover::after,
  .nav-menu a:hover::after,
  .nav-links a.active::after,
  .nav-link.active::after,
  .nav-menu a.active::after,
  .nav-links a[aria-current="page"]::after {
    transform: scaleY(1);
  }

  .menu-toggle,
  .nav-toggle {
    display: grid;
  }

  .hero {
    min-height: auto;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero.container {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-visual,
  .hero-card,
  .terminal-card {
    width: min(100%, 620px);
    transform: none;
  }

  .post-card.featured,
  .article-card.featured {
    grid-template-columns: minmax(0, 1fr);
  }

  .post-card.featured .post-card-cover,
  .article-card.featured .article-card-image {
    min-height: 0;
    aspect-ratio: 16 / 9;
  }

  .editor-grid,
  .editor-workspace,
  .editor-split {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
  }

  .editor-pane {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .editor-input,
  #markdown-input,
  .markdown-input,
  .preview-content,
  .editor-preview {
    min-height: 480px;
    height: 480px;
  }

  .editor-panes {
    min-height: 480px;
  }

  .editor-panes .preview-pane {
    height: 480px;
  }

  .about-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-visual,
  .avatar-frame {
    width: min(72vw, 320px);
  }

  .footer-main,
  .footer-shell {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .footer-grid {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .footer-grid > div:first-child {
    grid-column: 1 / -1;
  }

  .contact-banner {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  :root {
    --header-height: 62px;
  }

  body {
    font-size: 15px;
  }

  .container,
  .site-container,
  .nav-shell,
  .page-shell,
  .editor-shell,
  .admin-shell {
    width: min(calc(100% - 28px), var(--content-width));
  }

  .section {
    padding-block: 52px;
  }

  .section-header,
  .section-heading,
  .editor-header,
  .admin-header,
  .page-header,
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-heading > .search-field {
    width: 100%;
    flex-basis: auto;
  }

  .hero {
    padding-block: 62px 52px;
  }

  .hero h1,
  .hero-title {
    font-size: clamp(2.3rem, 11.25vw, 3.2rem);
  }

  .hero-console {
    transform: none;
  }

  .console-body {
    min-height: 260px;
    padding: 22px 18px;
    font-size: 0.7rem;
  }

  .signal-orbit {
    display: none;
  }

  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-strip > div:nth-child(2) {
    border-right: 0;
  }

  .metric-strip > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--border);
  }

  .hero-actions .button,
  .hero-actions .btn {
    flex: 1 1 145px;
  }

  .hero-meta,
  .hero-stats {
    gap: 16px;
  }

  .hero-stat {
    padding-right: 16px;
  }

  .post-grid,
  .article-list,
  .posts-grid,
  .sidebar,
  .tool-grid,
  .tools-grid,
  .stats-grid,
  .admin-stats,
  .skills-grid,
  .converter-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar > :first-child:last-child {
    grid-column: auto;
  }

  .post-card-content,
  .article-card-body,
  .card-body {
    padding: 19px;
  }

  .article-hero,
  .post-header {
    text-align: left;
  }

  .article-hero .article-meta,
  .post-header .post-meta {
    justify-content: flex-start;
  }

  .article-hero h1,
  .post-header h1,
  .article-title,
  .article-header h1 {
    font-size: clamp(2rem, 11vw, 3rem);
  }

  .article-header {
    text-align: left;
  }

  .article-header .post-tags,
  .article-header .article-meta {
    justify-content: flex-start;
  }

  .article-summary {
    margin-left: 0;
  }

  .markdown-body {
    font-size: 0.96rem;
  }

  .markdown-body h1 {
    font-size: 1.75rem;
  }

  .markdown-body h2 {
    font-size: 1.42rem;
  }

  .markdown-body pre,
  .code-wrapper pre,
  .code-block pre {
    padding-right: 16px;
    padding-left: 16px;
    border-radius: 10px;
    font-size: 0.77rem;
  }

  .markdown-body table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .article-navigation,
  .post-navigation,
  .form-row,
  .editor-meta-panel,
  .editor-settings {
    grid-template-columns: minmax(0, 1fr);
  }

  .editor-meta-panel > :first-child,
  .editor-settings > :first-child {
    grid-column: auto;
  }

  .editor-meta-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .editor-meta-grid .wide {
    grid-column: auto;
  }

  .editor-article-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .article-navigation a:last-child,
  .post-navigation a:last-child {
    text-align: left;
  }

  .editor-toolbar,
  .markdown-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .toolbar-group {
    flex: 0 0 auto;
  }

  .editor-input,
  #markdown-input,
  .markdown-input,
  .preview-content,
  .editor-preview {
    min-height: 420px;
    height: 420px;
    padding: 18px;
  }

  .editor-panes {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
  }

  .editor-panes .write-pane {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .editor-panes .preview-pane {
    height: 420px;
    padding: 18px;
  }

  .admin-access {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-access form {
    width: 100%;
    min-width: 0;
  }

  .admin-panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .moderation-item,
  .moderation-list > article,
  .deploy-checklist {
    grid-template-columns: minmax(0, 1fr);
  }

  .tool-card.tool-wide {
    grid-column: auto;
  }

  .tool-head {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .tool-head .local-badge {
    grid-column: 2;
    justify-self: start;
  }

  .tool-actions output {
    width: 100%;
    margin-left: 0;
  }

  .stack-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .journey-section .timeline > article {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }

  .data-panel-header,
  .table-header,
  .log-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-actions button,
  .moderation-actions button {
    width: 36px;
    height: 36px;
  }

  .comment-head,
  .comment-author-row,
  .message-head {
    align-items: flex-start;
  }

  .footer-main,
  .footer-shell {
    width: min(calc(100% - 28px), var(--content-width));
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .footer-brand {
    grid-column: auto;
  }

  .footer-bottom {
    width: min(calc(100% - 28px), var(--content-width));
    align-items: flex-start;
    flex-direction: column;
  }

  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
  }

  .footer-grid > div:first-child {
    grid-column: auto;
  }

  .footer-meta {
    text-align: left;
  }
}

@media (max-width: 420px) {
  .brand-copy small {
    display: none;
  }

  .nav-actions {
    gap: 5px;
  }

  .theme-toggle,
  .menu-toggle,
  .nav-toggle {
    width: 38px;
    height: 38px;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-actions .button,
  .hero-actions .btn {
    width: 100%;
  }

  .hero-stat:nth-child(2) {
    padding-right: 0;
    border-right: 0;
  }

  .post-card-footer,
  .article-card-footer,
  .card-footer,
  .comment-form-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-actions .button,
  .form-actions .btn {
    width: 100%;
  }

  .admin-access form {
    flex-direction: column;
  }

  .about-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  .about-actions .button {
    width: 100%;
  }

  .editor-actions,
  .header-actions {
    width: 100%;
    justify-content: stretch;
  }

  .editor-actions .button,
  .editor-actions .btn,
  .header-actions .button,
  .header-actions .btn {
    flex: 1;
  }

  .toast-container {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }
}

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

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal,
  [data-reveal],
  .lazy-image,
  img[data-src],
  img[loading="lazy"] {
    opacity: 1;
    filter: none;
    transform: none;
  }

  .parallax,
  .parallax-layer,
  [data-parallax] {
    transform: none !important;
  }

  .click-ripple,
  .ripple-effect,
  .global-ripple {
    display: none;
  }
}

@media print {
  body {
    padding-top: 0;
    background: #fff;
    color: #111827;
  }

  body::before,
  body::after,
  .site-header,
  .site-footer,
  .sidebar,
  .article-toc,
  .toc,
  .article-navigation,
  .post-navigation,
  .comment-section,
  .guestbook,
  .reading-progress,
  .copy-code,
  .copy-button,
  .code-copy-btn {
    display: none !important;
  }

  .article-layout,
  .post-layout {
    display: block;
  }

  .markdown-body,
  .markdown-body :is(h1, h2, h3, h4, h5, h6, p, li, strong) {
    color: #111827;
  }

  .markdown-body a {
    color: #1d4ed8;
  }

  .markdown-body pre {
    white-space: pre-wrap;
  }
}
