/* ============================================================
   CSS Custom Properties — Light theme (default)
   ============================================================ */
:root {
  color-scheme: light;
  --bg:           #ffffff;
  --bg-secondary: #f7f7f7;
  --text:         #1a1a1a;
  --text-muted:   #6b7280;
  --border:       #e5e7eb;
  --accent:       #15803d;
  --accent-hover: #166534;
  --tag-bg:       #dcfce7;
  --tag-text:     #15803d;
  --code-bg:      #f3f4f6;
  --code-text:    #1f2937;
  --selection-bg:   #ff2e88;
  --selection-text: #ffffff;
  --stain:          #8b5a2b;

  /* Syntax highlighting */
  --sh-bg:          #f8f9fa;
  --sh-border:      #e5e7eb;
  --sh-comment:     #6b7280;
  --sh-keyword:     #7c3aed;
  --sh-string:      #059669;
  --sh-number:      #dc2626;
  --sh-function:    #2563eb;
  --sh-punctuation: #374151;
  --sh-operator:    #374151;
}

/* Dark theme via media query (auto) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg:           #111111;
    --bg-secondary: #1c1c1c;
    --text:         #e5e7eb;
    --text-muted:   #9ca3af;
    --border:       #2d2d2d;
    --accent:       #4ade80;
    --accent-hover: #86efac;
    --tag-bg:       #14532d;
    --tag-text:     #86efac;
    --code-bg:      #1e1e1e;
    --code-text:    #e5e7eb;
    --selection-bg:   #ff2e88;
    --selection-text: #ffffff;
    --stain:          #d9a066;

    --sh-bg:          #1a1a1a;
    --sh-border:      #2d2d2d;
    --sh-comment:     #8b949e;
    --sh-keyword:     #c084fc;
    --sh-string:      #34d399;
    --sh-number:      #f87171;
    --sh-function:    #60a5fa;
    --sh-punctuation: #d1d5db;
    --sh-operator:    #d1d5db;
  }
}

/* Dark theme via manual toggle */
[data-theme="dark"] {
  color-scheme: dark;
  --bg:           #111111;
  --bg-secondary: #1c1c1c;
  --text:         #e5e7eb;
  --text-muted:   #9ca3af;
  --border:       #2d2d2d;
  --accent:       #4ade80;
  --accent-hover: #86efac;
  --tag-bg:       #14532d;
  --tag-text:     #86efac;
  --code-bg:      #1e1e1e;
  --code-text:    #e5e7eb;
  --selection-bg:   #ff2e88;
  --selection-text: #ffffff;
  --stain:          #d9a066;

  --sh-bg:          #1a1a1a;
  --sh-border:      #2d2d2d;
  --sh-comment:     #8b949e;
  --sh-keyword:     #c084fc;
  --sh-string:      #34d399;
  --sh-number:      #f87171;
  --sh-function:    #60a5fa;
  --sh-punctuation: #d1d5db;
  --sh-operator:    #d1d5db;
}

/* Light theme forced via toggle */
[data-theme="light"] {
  color-scheme: light;
  --bg:           #ffffff;
  --bg-secondary: #f7f7f7;
  --text:         #1a1a1a;
  --text-muted:   #6b7280;
  --border:       #e5e7eb;
  --accent:       #15803d;
  --accent-hover: #166534;
  --tag-bg:       #dcfce7;
  --tag-text:     #15803d;
  --code-bg:      #f3f4f6;
  --code-text:    #1f2937;
  --selection-bg:   #ff2e88;
  --selection-text: #ffffff;

  --sh-bg:          #f8f9fa;
  --sh-border:      #e5e7eb;
  --sh-comment:     #6b7280;
  --sh-keyword:     #7c3aed;
  --sh-string:      #059669;
  --sh-number:      #dc2626;
  --sh-function:    #2563eb;
  --sh-punctuation: #374151;
  --sh-operator:    #374151;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  transition: background 0.2s ease, color 0.2s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-style: dashed;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  background-image: linear-gradient(to top, var(--accent), var(--accent));
  background-size: 100% 0%;
  background-position: bottom;
  background-repeat: no-repeat;
  transition: background-size 0.2s ease, color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover {
  color: var(--bg);
  text-decoration-color: transparent;
  background-size: 100% 100%;
}

/* Visually hidden until keyboard-focused */
.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 200;
  background: var(--accent);
  color: var(--bg);
  padding: 0.5rem 1rem;
  border-radius: 0 0 8px 0;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
  top: 0;
}

/* ============================================================
   Layout
   ============================================================ */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-title {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  background-image: none;
  letter-spacing: -0.01em;
}

.site-title:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  background-image: none;
  font-size: 0.875rem;
  position: relative;
}

.nav-links a:hover {
  color: var(--text);
}

.nav-links a.nav-active {
  color: var(--text);
}

.nav-links a.nav-active::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
}

.theme-toggle {
  width: 2.1rem;
  height: 2.1rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: border-color 0.15s, color 0.15s;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================================
   Main & Footer
   ============================================================ */
.site-main {
  flex: 1;
  padding: 3rem 0;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer-socials {
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.75rem;
}

/* Hands pointing at the socials, nudging inward */
.footer-point {
  font-size: 1rem;
  user-select: none;
  animation: footer-point 1.4s ease-in-out infinite;
}

.footer-point-back {
  animation-name: footer-point-back;
}

@keyframes footer-point {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(5px); }
}

@keyframes footer-point-back {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-5px); }
}

.footer-socials a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  background-image: none;
  transition: color 0.15s;
}

.footer-socials a:hover {
  color: var(--accent);
}

.footer-socials svg {
  display: block;
}

/* ============================================================
   Homepage
   ============================================================ */
.home-header {
  margin-bottom: 3rem;
}

.home-header h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 0.4rem;
}

.site-description {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ============================================================
   Post list / cards
   ============================================================ */
.posts-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.post-card {
  border-bottom: 1px solid var(--border);
  padding: 2rem 0;
}

.post-card:first-child,
.post-card.is-first-visible {
  padding-top: 0;
}

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

.post-card-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.post-card-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.post-card-title a {
  color: var(--text);
  text-decoration: none;
  background-image: none;
}

.post-card-title a:hover {
  color: var(--accent);
}

.post-card-excerpt {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

/* ============================================================
   Tags
   ============================================================ */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.15s;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.tag:hover {
  opacity: 0.75;
  color: var(--tag-text);
}

.tag-count {
  opacity: 0.65;
}

.separator {
  opacity: 0.4;
}

/* ============================================================
   Tag filter bar
   ============================================================ */
.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.tag-filter {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.15s;
  font-family: inherit;
}

.tag-filter:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* var(--bg) instead of #fff: the dark-theme accent is a light green,
   so fixed white text would wash out on it */
.tag-filter.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.back-link {
  display: inline-block;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

/* ============================================================
   Single post
   ============================================================ */
.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-title {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* Post body — Georgia for reading comfort */
.post-content {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
  position: relative;
}

.post-content h2,
.post-content h3,
.post-content h4 {
  font-family: 'Fraunces', Georgia, serif;
  font-optical-sizing: auto;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 2rem;
  margin-bottom: 0.65rem;
  line-height: 1.3;
}

.post-content h2 { font-size: 1.35rem; }
.post-content h3 { font-size: 1.15rem; }
.post-content h4 { font-size: 1rem; }

.post-content p {
  margin-bottom: 1.25rem;
}

.post-content ul,
.post-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

.post-content li {
  margin-bottom: 0.35rem;
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.1rem 0 0.1rem 1rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 1.5rem 0;
}

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

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
}

/* ============================================================
   Code
   ============================================================ */
.post-content code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;
  font-size: 0.84em;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.15em 0.45em;
  border-radius: 4px;
}

.post-content pre {
  background: var(--sh-bg);
  border: 1px solid var(--sh-border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.875rem;
  line-height: 1.65;
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: var(--sh-punctuation);
  border-radius: 0;
}

/* ============================================================
   Table of Contents
   ============================================================ */
.toc {
  display: none;
}

/* Wide screens: pin the TOC in the margin left of the centered
   680px container (50% - 340px content edge - 20px gap - 180px width) */
@media (min-width: 1100px) {
  .toc {
    display: block;
    position: fixed;
    top: 7rem;
    left: calc(50% - 540px);
    width: 180px;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    scrollbar-width: none;
    font-size: 0.76rem;
    line-height: 1.4;
  }
}

.toc::-webkit-scrollbar {
  display: none;
}

.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-item {
  margin-bottom: 0.45rem;
}

.toc-h3 {
  padding-left: 0.75rem;
}

.toc-h4 {
  padding-left: 1.5rem;
}

.toc-link {
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  background-image: none;
  transition: color 0.15s;
  opacity: 0.6;
}

.toc-link:hover {
  color: var(--text);
  opacity: 1;
}

.toc-link.toc-active {
  color: var(--accent);
  font-weight: 500;
  opacity: 1;
}

/* ============================================================
   Footnotes
   ============================================================ */
.footnote-ref a {
  text-decoration: none;
  color: var(--accent);
  font-size: 0.75em;
  font-weight: 600;
}

/* Base color above outranks the global a:hover — without this the
   marker turns accent-on-accent inside the hover fill */
.footnote-ref a:hover {
  color: var(--bg);
}

/* Footnotes render as sidenotes/inline toggles via JS; keep the
   bottom list visible when JS is unavailable. */
.js .footnotes {
  display: none;
}

/* Desktop sidenotes */
.footnote-sidenote {
  position: absolute;
  left: calc(100% + 24px);
  width: 200px;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  opacity: 0.3;
  transition: opacity 0.2s;
}

.footnote-sidenote:hover {
  opacity: 1;
}

.footnote-sidenote-num {
  color: var(--accent);
  font-weight: 700;
  line-height: 1.5;
  flex-shrink: 0;
  align-self: stretch;
  border-right: 1px solid var(--border);
  padding-right: 0.5rem;
}

.footnote-sidenote-body {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
}

/* Mobile inline toggle */
.footnote-inline {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
  color: var(--text-muted);
}

.footnote-inline-num {
  font-size: 2.5rem;
  line-height: 1;
  color: var(--accent);
  opacity: 0.4;
  font-weight: 700;
  flex-shrink: 0;
}

.footnote-inline-body {
  font-size: 0.875rem;
  line-height: 1.6;
}

.footnote-inline-body p,
.footnote-sidenote-body p {
  margin: 0;
}

/* ============================================================
   Syntax highlighting (PrismJS token classes)
   ============================================================ */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: var(--sh-comment);
  font-style: italic;
}

.token.keyword,
.token.atrule,
.token.attr-name {
  color: var(--sh-keyword);
}

.token.string,
.token.attr-value,
.token.char,
.token.builtin,
.token.inserted {
  color: var(--sh-string);
}

.token.number,
.token.boolean,
.token.constant,
.token.symbol,
.token.variable {
  color: var(--sh-number);
}

.token.function,
.token.deleted,
.token.class-name {
  color: var(--sh-function);
}

.token.punctuation {
  color: var(--sh-punctuation);
}

.token.operator,
.token.entity,
.token.url {
  color: var(--sh-operator);
}

.token.tag,
.token.selector {
  color: var(--sh-keyword);
}

.token.important,
.token.bold {
  font-weight: 600;
}

.token.italic {
  font-style: italic;
}

.token.namespace {
  opacity: 0.7;
}

/* ============================================================
   404 page
   ============================================================ */
.error-page {
  text-align: center;
  padding: 5rem 0;
}

.error-page h1 {
  font-size: 6rem;
  font-weight: 700;
  letter-spacing: -0.05em;
  color: var(--border);
  margin-bottom: 1rem;
  line-height: 1;
}

.error-page p {
  font-size: 1.05rem;
  color: var(--text-muted);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 640px) {
  .home-header h1 {
    font-size: 1.6rem;
  }

  .post-title {
    font-size: 1.5rem;
  }

  .site-main {
    padding: 2rem 0;
  }

  .error-page h1 {
    font-size: 4rem;
  }
}

/* ============================================================
   Toys — grid page
   ============================================================ */
.toys-page .home-header {
  margin-bottom: 2.5rem;
}

.toys-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.25rem;
}

.toy-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.toy-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--text);
}

/* Square thumbnail */
.toy-card-image-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.toy-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.toy-card:hover .toy-card-image {
  transform: scale(1.04);
}

.toy-card-no-image {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--bg-secondary), color-mix(in srgb, var(--accent) 12%, var(--bg-secondary)));
}

.toy-card-body {
  padding: 0.85rem 1rem 1rem;
}

.toy-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
}

.toy-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
   Toys — individual post
   ============================================================ */
.toy-hero {
  margin-bottom: 2rem;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 16 / 9;
}

.toy-hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Back link reused from tag page is already defined above */

/* ============================================================
   Me page
   ============================================================ */
.me-page {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Hero card */
.me-hero {
  text-align: center;
  padding: 3.5rem 2rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.me-hero-title {
  font-size: clamp(1.5rem, 4.5vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 1.25rem;
}

.me-hero-bio {
  color: var(--text-muted);
  line-height: 1.75;
  font-size: 0.95rem;
}

/* Resume card */
.me-resume {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem 2.25rem;
}

.me-resume-text {
  flex: 1 1 0;
  min-width: 0;
}

.me-resume-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.3rem;
}

.me-resume-sub {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.me-resume-updated {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--tag-text);
  background: var(--tag-bg);
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

.me-resume-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.6rem 1.15rem;
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease;
}

.me-resume-btn:hover {
  background: var(--accent-hover);
  color: var(--bg);
  transform: translateY(-2px);
}

.me-resume-btn svg {
  display: block;
}

/* About card */
.me-about {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.25rem;
}

.me-about-header {
  text-align: center;
  padding-bottom: 1.75rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.me-about-title {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

.me-about-subtitle {
  display: block;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.me-about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
}

.me-col-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.me-bio-text {
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 0.875rem;
  font-size: 0.875rem;
}

/* Skills */
.me-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.me-skill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
  line-height: 1;
}

.skill-emoji {
  display: inline-block;
  line-height: 1;
  transition: opacity 0.12s ease;
}

/* Find me card */
.me-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem 2.25rem;
}

.me-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.me-socials {
  display: flex;
  gap: 1.25rem;
}

.me-social-link {
  font-size: 1.4rem;
  color: var(--text-muted);
  text-decoration: none;
  background-image: none;
  transition: color 0.15s, transform 0.15s;
}

.me-social-link:hover {
  color: var(--accent);
  transform: translateY(-2px);
}

@media (max-width: 640px) {
  .me-hero {
    padding: 2.5rem 1.25rem;
  }

  .me-resume {
    padding: 1.5rem;
    align-items: flex-start;
  }

  .me-resume-btn {
    width: 100%;
    justify-content: center;
  }

  .me-about {
    padding: 1.5rem;
  }

  .me-about-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .me-section {
    padding: 1.5rem;
  }
}

@media (max-width: 640px) {
  .toys-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.875rem;
  }
}

/* ============================================================
   Reading progress bar
   ============================================================ */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  z-index: 150;
  pointer-events: none;
}

/* ============================================================
   Copy-code button
   ============================================================ */
.code-block {
  position: relative;
  margin: 1.5rem 0;
}

.code-block pre {
  margin: 0;
}

.copy-code {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}

.code-block:hover .copy-code,
.copy-code:focus-visible {
  opacity: 1;
}

/* No hover on touch screens — keep the button visible */
@media (hover: none) {
  .copy-code {
    opacity: 1;
  }
}

.copy-code:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.copy-code.copied {
  color: var(--accent);
  border-color: var(--accent);
  opacity: 1;
}

/* ============================================================
   Draft / Scheduled badge (dev builds only)
   ============================================================ */
.draft-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #92400e;
  background: #fef3c7;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
}

[data-theme="dark"] .draft-badge {
  color: #fcd34d;
  background: #451a03;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .draft-badge {
    color: #fcd34d;
    background: #451a03;
  }
}

/* ============================================================
   Series box
   ============================================================ */
.series-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 1.1rem 1.4rem;
  margin-bottom: 2rem;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.875rem;
}

.series-box-title {
  font-weight: 600;
  margin-bottom: 0.6rem;
}

.series-box-count {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.8rem;
}

.series-list {
  margin: 0;
  padding-left: 1.4rem;
}

.series-list li {
  margin-bottom: 0.3rem;
}

.series-list li:last-child {
  margin-bottom: 0;
}

.series-current {
  font-weight: 600;
}

/* ============================================================
   Read next / related posts
   ============================================================ */
.section-heading {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.read-next {
  margin-top: 3rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.read-next-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.read-next-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  background-image: none;
  transition: border-color 0.15s, transform 0.15s;
}

.read-next-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  color: var(--text);
}

.read-next-title {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.read-next-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ============================================================
   Comments (giscus)
   ============================================================ */
.post-comments {
  margin-top: 3rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

/* ============================================================
   Search (posts & toys index pages)
   ============================================================ */
.list-search {
  position: relative;
  margin-bottom: 1.25rem;
}

.list-search .search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.list-search input {
  width: 100%;
  padding: 0.6rem 0.9rem 0.6rem 2.4rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s;
}

.list-search input:focus {
  border-color: var(--accent);
}

.list-search input::placeholder {
  color: var(--text-muted);
}

/* Matched search text on cards — .search-mark is added by tag-filter.js,
   plain <mark> comes from Pagefind excerpts swapped into the card. */
.search-mark,
.search-excerpt mark {
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 3px;
  padding: 0 0.15em;
}

.list-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem 0;
}

/* ============================================================
   Selection
   ============================================================ */
::selection {
  background: var(--selection-bg);
  color: var(--selection-text);
}

/* ============================================================
   Theme toggle — View Transitions circular reveal
   ============================================================ */
/* The JS animates a clip-path circle on ::view-transition-new(root);
   the defaults (cross-fade) must be off or they fight the clip. */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

.theme-toggle svg {
  display: block;
}

/* ============================================================
   Display font — Fraunces for titles
   ============================================================ */
.post-title,
.home-header h1,
.post-card-title,
.toy-card-title,
.me-hero-title {
  font-family: 'Fraunces', Georgia, serif;
  font-optical-sizing: auto;
}

/* ============================================================
   Me page — waving hand
   ============================================================ */
.wave-hand {
  display: inline-block;
  transform-origin: 70% 70%;
  animation: wave 1.8s ease 0.4s 1;
}

@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  15% { transform: rotate(24deg); }
  30% { transform: rotate(-12deg); }
  45% { transform: rotate(20deg); }
  60% { transform: rotate(-8deg); }
  75% { transform: rotate(10deg); }
}

/* ============================================================
   404 — Graveyard
   ============================================================ */
.grave {
  margin: 2.5rem auto 2rem;
}

.tombstone {
  width: min(260px, 100%);
  margin: 0 auto;
  padding: 2.4rem 1.4rem 2rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-bottom-width: 4px;
  border-radius: 120px 120px 6px 6px;
}

.error-page .tombstone-lies {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  margin-bottom: 0.5rem;
}

.tombstone-path code {
  font-size: 0.85rem;
  word-break: break-all; /* long dead URLs still fit on the stone */
}

.error-page .tombstone-epitaph {
  font-size: 0.8rem;
  margin-top: 0.6rem;
}

.grave-flowers {
  font-size: 1.1rem;
  margin-top: 0.5rem;
}

.escape-hatch {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.escape-hatch:hover,
.escape-hatch:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.did-you-mean {
  margin: 1.5rem 0 2rem;
}

.did-you-mean ul {
  list-style: none;
  padding: 0;
}

.did-you-mean li {
  margin-bottom: 0.4rem;
}

/* ============================================================
   Heading anchors
   ============================================================ */
/* The "#" lives in CSS content so it never shows up in the TOC
   filter's text extraction or the Pagefind index. */
.post-content .heading-anchor {
  margin-left: 0.4em;
  color: var(--accent);
  text-decoration: none;
  background-image: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.post-content .heading-anchor::after {
  content: '#';
}

.post-content h2:hover .heading-anchor,
.post-content h3:hover .heading-anchor,
.post-content h4:hover .heading-anchor,
.post-content .heading-anchor:focus-visible {
  opacity: 1;
}

.post-content .heading-anchor:hover {
  color: var(--accent-hover);
}

.post-content .heading-anchor:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ============================================================
   Footer pet
   ============================================================ */
.footer-pet {
  background: none;
  border: none;
  padding: 0;
  margin-left: 0.6rem;
  cursor: pointer;
  line-height: 0;
  display: inline-block;
  vertical-align: middle;
}

.footer-pet svg {
  display: block;
}

.footer-pet.pet-bounce {
  animation: pet-bounce 0.5s ease;
}

@keyframes pet-bounce {
  0%, 100% { transform: none; }
  30% { transform: translateY(-9px) scale(1.15); }
  60% { transform: translateY(0) scale(0.9); }
}

/* ============================================================
   Moods — footer snow & birthday confetti
   ============================================================ */
.site-footer.snowing {
  position: relative;
  overflow: hidden;
}

.snowflake {
  position: absolute;
  top: -1.5rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.7;
  pointer-events: none;
  animation: snow-fall linear infinite;
}

@keyframes snow-fall {
  to { transform: translateY(12rem); }
}

.confetti {
  position: fixed;
  top: 0;
  width: 8px;
  height: 13px;
  border-radius: 2px;
  z-index: 400;
  pointer-events: none;
}

/* ============================================================
   Professional mode — the punishment
   ============================================================ */
.boring-toggle {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dashed;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

.boring-toggle:hover {
  color: var(--accent);
}

.me-glimpse-corporate {
  display: none;
}

/* :root[data-boring] outguns the auto-dark block's
   :root:not([data-theme="light"]) — plain [data-boring] would lose to it */
:root[data-boring] {
  --accent:       #1e3a8a;
  --accent-hover: #16307a;
  --tag-bg:       #dbe3f4;
  --tag-text:     #1e3a8a;
  --selection-bg: #1e3a8a;
}

/* filter on the ROOT element specifically: anywhere lower would turn
   position:fixed descendants (progress bar, TOC) into scroll-along ghosts */
html[data-boring] {
  filter: grayscale(1);
}

[data-boring] body,
[data-boring] * {
  font-family: 'Times New Roman', Times, serif !important;
}

[data-boring] *,
[data-boring] *::before,
[data-boring] *::after {
  animation: none !important;
  transition: none !important;
}

[data-boring] .footer-pet {
  display: none !important;
}

[data-boring] .me-glimpse-fun {
  display: none;
}

[data-boring] .me-glimpse-corporate {
  display: block;
}

/* ============================================================
   Sticker energy — everything slapped on slightly crooked
   ============================================================ */
/* Tags and badges tilt like hand-placed stickers; hovering
   presses them flat. */
.tag,
.draft-badge {
  transform: rotate(var(--sticker-tilt, 0deg));
}

.tag:nth-child(3n+1) { --sticker-tilt: -2deg; }
.tag:nth-child(3n+2) { --sticker-tilt: 1.5deg; }
.tag:nth-child(3n)   { --sticker-tilt: 2.5deg; }

/* Post header and home post-preview tags sit flat */
.post-tags .tag,
.post-card-tags .tag { --sticker-tilt: 0deg; }

.draft-badge { --sticker-tilt: -2deg; }

.tag:hover {
  --sticker-tilt: 0deg;
}

/* NEW starburst — posts & toys younger than 14 days */
.new-sticker {
  position: absolute;
  display: inline-grid;
  place-items: center;
  width: 3.2rem;
  height: 3.2rem;
  background: var(--selection-bg);
  color: var(--selection-text);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  clip-path: polygon(100% 50%, 86.7% 59.8%, 93.3% 75%, 76.9% 76.9%, 75% 93.3%, 59.8% 86.7%, 50% 100%, 40.2% 86.7%, 25% 93.3%, 23.1% 76.9%, 6.7% 75%, 13.3% 59.8%, 0% 50%, 13.3% 40.2%, 6.7% 25%, 23.1% 23.1%, 25% 6.7%, 40.2% 13.3%, 50% 0%, 59.8% 13.3%, 75% 6.7%, 76.9% 23.1%, 93.3% 25%, 86.7% 40.2%);
  transform: rotate(12deg);
  z-index: 1;
  pointer-events: none;
}

.post-card {
  position: relative;
}

.post-card .new-sticker {
  top: 1.8rem;
  right: 0;
}

.post-card:first-child .new-sticker,
.post-card.is-first-visible .new-sticker {
  top: -0.2rem;
}

.toy-card {
  position: relative;
}

.toy-card .new-sticker {
  top: 0.5rem;
  right: 0.5rem;
}

/* Coffee stain — posts older than a year get one, plus the expiry note */
.post-header {
  position: relative;
}

.coffee-stain {
  position: absolute;
  top: -1.5rem;
  right: -0.75rem;
  width: 96px;
  height: 92px;
  border: solid var(--stain);
  border-width: 9px 5px 7px 8px;
  border-radius: 48% 52% 50% 47%;
  transform: rotate(-12deg);
  opacity: 0.3;
  pointer-events: none;
}

/* drips */
.coffee-stain::after {
  content: '';
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--stain);
  bottom: -14px;
  left: -8px;
  box-shadow: 18px 8px 0 -2px var(--stain), 60px -2px 0 -3px var(--stain);
}

.stale-note {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-muted);
}

/* Professional mode straightens the stickers and files the fun away */
[data-boring] .tag,
[data-boring] .draft-badge {
  --sticker-tilt: 0deg;
}

[data-boring] .new-sticker,
[data-boring] .coffee-stain,
[data-boring] .stale-note,
[data-boring] .footer-point {
  display: none !important;
}

/* ============================================================
   Patch notes (/changelog/)
   ============================================================ */
.release {
  border-bottom: 1px solid var(--border);
  padding: 2rem 0;
}

.release:first-of-type {
  padding-top: 0;
}

.release:last-of-type {
  border-bottom: none;
}

.release-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}

.release-version {
  display: inline-block;
  background: var(--accent);
  color: var(--bg);
  font-weight: 800;
  font-size: 0.8rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  transform: rotate(-2deg);
}

.release-name {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: 1.05rem;
}

.release-date {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.release-kind {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin: 1.1rem 0 0.4rem;
  color: var(--text-muted);
}

.release-kind-new    { color: var(--selection-bg); }
.release-kind-buffed { color: var(--accent); }
.release-kind-nerfed { color: var(--sh-number); }
.release-kind-fixed  { color: var(--sh-keyword); }

.release-list {
  margin: 0;
  padding-left: 1.3rem;
  font-size: 0.9rem;
  line-height: 1.65;
}

.release-list li {
  margin-bottom: 0.3rem;
}

.release-list li::marker {
  color: var(--accent);
}

/* ============================================================
   Reduced motion — nothing moves, everywhere
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }
}

