/* ── Design Tokens ── */
:root {
  --color: #3d3630;
  --color-soft: #6b6058;
  --color-muted: #a89e94;
  --color-faint: #d4ccc4;
  --bg: #faf6f0;
  --bg-warm: #f5efe6;
  --bg-card: #fffcf8;
  --bg-card-hover: #fff9f2;
  --border: rgba(168, 158, 148, 0.25);
  --border-strong: rgba(168, 158, 148, 0.45);
  --accent: #b8860b;
  --accent-soft: rgba(184, 134, 11, 0.12);
  --accent-hover: #9a7209;
  --sage: #7a8c6e;
  --sage-soft: rgba(122, 140, 110, 0.12);
  --rose: #c47d7d;
  --rose-soft: rgba(196, 125, 125, 0.1);
  --shadow-sm: 0 1px 3px rgba(61, 54, 48, 0.06);
  --shadow-md: 0 4px 16px rgba(61, 54, 48, 0.08);
  --shadow-lg: 0 12px 40px rgba(61, 54, 48, 0.1);
  --shadow-hover: 0 8px 30px rgba(61, 54, 48, 0.12);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 32px;
  --selection-bg: rgba(184, 134, 11, 0.18);
  --selection-color: #3d3630;
  --link-color: #6b6058;
  --link-hover: #3d3630;
  --link-underline: rgba(168, 158, 148, 0.35);
  --link-underline-hover: rgba(61, 54, 48, 0.6);
  --nav-bg: rgba(250, 246, 240, 0.82);
  --code-bg: #f5f0e8;
  --code-text: #3b3128;
  --code-block-bg: #f8f4ec;
  --code-block-border: rgba(168, 158, 148, 0.2);
  --code-comment: #8b7f72;
  --code-keyword: #9a3412;
  --code-operator: #7c5c3b;
  --code-string: #21633f;
  --code-number: #b45309;
  --code-name: #1d4ed8;
  --code-function: #155e75;
  --code-tag: #7c2d12;
  --code-variable: #0f766e;
  --code-error: #b42318;
  --spotlight-x: 50%;
  --spotlight-y: 50%;
  --paper-grain: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
}

html[data-theme="dark"] {
  --color: #dde2ec;
  --color-soft: #a8b2c8;
  --color-muted: #6e7a92;
  --color-faint: #3e4860;
  --bg: #0e1219;
  --bg-warm: #141922;
  --bg-card: #192030;
  --bg-card-hover: #1f2840;
  --border: rgba(110, 122, 146, 0.2);
  --border-strong: rgba(110, 122, 146, 0.35);
  --accent: #6ba3d6;
  --accent-soft: rgba(107, 163, 214, 0.12);
  --accent-hover: #8abde6;
  --sage: #7a9c88;
  --sage-soft: rgba(122, 156, 136, 0.1);
  --rose: #c0909a;
  --rose-soft: rgba(192, 144, 154, 0.08);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.4);
  --selection-bg: rgba(107, 163, 214, 0.2);
  --selection-color: #dde2ec;
  --link-color: #a8b2c8;
  --link-hover: #dde2ec;
  --link-underline: rgba(110, 122, 146, 0.3);
  --link-underline-hover: rgba(221, 226, 236, 0.5);
  --nav-bg: rgba(14, 18, 25, 0.88);
  --code-bg: #192030;
  --code-text: #d8dde8;
  --code-block-bg: #121824;
  --code-block-border: rgba(110, 122, 146, 0.15);
  --code-comment: #6e7a92;
  --code-keyword: #e0a060;
  --code-operator: #d4b896;
  --code-string: #8bc8a0;
  --code-number: #e0a0a0;
  --code-name: #7cc0e8;
  --code-function: #8ac4f0;
  --code-tag: #d0a878;
  --code-variable: #60c8b8;
  --code-error: #e09098;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
::selection { background: var(--selection-bg); color: var(--selection-color); }
html {
  color-scheme: light;
}
html[data-theme="dark"] {
  color-scheme: dark;
}
html, body { margin: 0; padding: 0; width: 100%; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--color);
  font-family: 'Spectral', Georgia, 'Times New Roman', serif;
  font-size: 18px;
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  text-align: left;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Paper grain texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: var(--paper-grain);
  background-repeat: repeat;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.5;
}

/* ── Navigation ── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: clamp(1rem, 3vw, 2.5rem);
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  font-family: 'Jost', sans-serif;
  font-size: 14px;
}
.brand {
  color: var(--color-soft);
  justify-self: start;
}
.serif-brand {
  font-family: 'Jost', sans-serif;
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--color-muted);
  letter-spacing: 0.02em;
  transition: color 0.25s ease;
}
.serif-brand:hover {
  color: var(--color);
}
.brand-sign {
  font-family: 'Caveat', cursive;
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--color-muted);
  letter-spacing: 0.02em;
}
.brand-link {
  text-decoration: none;
  color: inherit;
  border-bottom: none;
}
.brand-link:hover {
  color: var(--color);
}
.nav-links {
  display: flex;
  align-items: center;
  justify-self: center;
  gap: clamp(1.2rem, 2.6vw, 2.4rem);
  max-width: 100%;
}
.nav-links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 0.2rem;
  text-decoration: none;
  color: var(--color-muted);
  font-size: 15px;
  font-family: 'Jost', sans-serif;
  letter-spacing: 0.03em;
  transition: color 0.25s ease;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -0.1rem;
  width: 0;
  height: 1.5px;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1), left 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.nav-links a[aria-current="page"] {
  color: var(--color);
}
.nav-links a[aria-current="page"]::after {
  width: 100%;
  left: 0;
}
.nav-links a:hover {
  color: var(--color);
}
.nav-links a:hover::after {
  width: 100%;
  left: 0;
}
.nav-actions {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 12px;
}
.icon-link,
.search-link,
.theme-btn {
  border: 0;
  background: transparent;
  color: var(--color-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  font-family: 'Jost', sans-serif;
  transition: color 0.25s ease, transform 0.25s ease;
}
.icon-link:hover,
.search-link:hover,
.theme-btn:hover {
  color: var(--color);
  transform: scale(1.08);
}
.icon-link svg,
.search-link svg,
.theme-icon {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}
.theme-btn, .search-link {
  width: 24px;
  height: 24px;
}

.icon-link:focus-visible,
.search-link:focus-visible,
.theme-btn:focus-visible,
.nav-links a:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

/* ── Home Page ── */
.home-page {
  position: relative;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(184, 134, 11, 0.06), transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(122, 140, 110, 0.05), transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-warm) 100%);
  min-height: 100vh;
}
html[data-theme="dark"] .home-page {
  background:
    radial-gradient(ellipse at 30% 20%, rgba(107, 163, 214, 0.04), transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(122, 156, 136, 0.03), transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-warm) 100%);
}

/* Cursor spotlight */
.home-spotlight {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(
    600px circle at var(--spotlight-x) var(--spotlight-y),
    rgba(184, 134, 11, 0.04),
    transparent 60%
  );
  transition: opacity 0.3s ease;
}
html[data-theme="dark"] .home-spotlight {
  background: radial-gradient(
    600px circle at var(--spotlight-x) var(--spotlight-y),
    rgba(107, 163, 214, 0.06),
    transparent 60%
  );
}

/* Bubble canvas — glowing particle background */
.bubble-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  width: 100%;
  height: 100%;
}

/* Hero section */
.home-hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 6rem 2rem 4rem;
  overflow: hidden;
}

/* ── Sky effects ── */
.sky-effects {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Stars — dark mode only */
.sky-star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(200, 215, 240, 0.8);
  border-radius: 50%;
  opacity: 0;
  animation: star-twinkle ease-in-out infinite alternate;
}
.sky-star--large {
  width: 3px;
  height: 3px;
  background: rgba(220, 230, 250, 0.9);
  box-shadow: 0 0 4px 1px rgba(200, 220, 255, 0.3);
}

html[data-theme="dark"] .sky-star { display: block; }
html:not([data-theme="dark"]) .sky-star { display: none; }

@keyframes star-twinkle {
  0%   { opacity: 0.15; transform: scale(0.8); }
  100% { opacity: 1;   transform: scale(1.2); }
}

/* Dandelion petals — light mode only */
.petal {
  position: absolute;
  top: -20px;
  width: 6px;
  height: 6px;
  opacity: 0;
  animation: petal-fall linear infinite;
}
/* each petal is a soft elongated shape */
.petal::before {
  content: '';
  display: block;
  width: 100%;
  height: 100%;
  background: rgba(180, 160, 130, 0.35);
  border-radius: 50% 0 50% 0;
  transform: rotate(45deg);
}
/* thin filament trailing behind */
.petal::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 100%;
  width: 10px;
  height: 1px;
  background: linear-gradient(to right, rgba(180, 160, 130, 0.2), transparent);
  transform: translateY(-50%);
}

html[data-theme="dark"] .petal { display: none; }
html:not([data-theme="dark"]) .petal { display: block; }

@keyframes petal-fall {
  0%   { opacity: 0; transform: translate(0, 0) rotate(0deg); }
  10%  { opacity: 0.7; }
  50%  { opacity: 0.6; }
  90%  { opacity: 0.4; }
  100% { opacity: 0; transform: translate(var(--petal-drift), calc(100vh + 40px)) rotate(var(--petal-spin)); }
}

@media (prefers-reduced-motion: reduce) {
  .sky-star, .petal { animation: none; opacity: 0; }
}
.home-hero__name {
  font-family: 'Spectral', Georgia, serif;
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--color);
  margin: 0 0 1.2rem;
  opacity: 0;
  transform: translateY(24px);
  animation: fadeInUp 1s cubic-bezier(0.22, 1, 0.36, 1) 0.2s forwards;
}
.home-hero__tagline {
  font-family: 'Jost', sans-serif;
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  font-weight: 300;
  color: var(--color-soft);
  letter-spacing: 0.04em;
  margin: 0 0 0.6rem;
  min-height: 1.8em;
  opacity: 0;
  animation: fadeIn 0.8s ease 0.8s forwards;
}
.home-hero__cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}
.home-hero__subtitle {
  font-family: 'Spectral', Georgia, serif;
  font-size: clamp(0.95rem, 1.8vw, 1.1rem);
  font-style: italic;
  color: var(--color-muted);
  max-width: 480px;
  margin: 0.8rem 0 0;
  opacity: 0;
  animation: fadeIn 0.8s ease 1.4s forwards;
}

html.fonts-loading .home-hero__name,
html.fonts-loading .home-hero__tagline,
html.fonts-loading .home-hero__subtitle,
html.fonts-loading .home-hero__scroll-hint {
  animation: none;
  opacity: 0;
}

html.fonts-loading .home-hero__name {
  transform: translateY(18px);
}
.home-hero__scroll-hint {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-faint);
  font-family: 'Jost', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0;
  animation: fadeIn 0.8s ease 2s forwards;
}
.home-hero__scroll-hint svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  animation: float 2.5s ease-in-out infinite;
}

/* Constellation label */
.constellation-label {
  font-family: 'Jost', sans-serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--color-muted);
  text-align: center;
  margin: 4rem 0 -2rem;
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

/* Constellation canvas — floats on page bg, no frame */
.constellation-canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 50vh;
  min-height: 360px;
  max-height: 560px;
  pointer-events: auto;
  background: transparent;
}

/* Thinking cards — poker card style */
.home-thinking {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 2rem 2rem;
}
.home-thinking__title {
  font-family: 'Jost', sans-serif;
  font-size: 0.72rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--color-muted);
  margin: 0 0 2rem;
  text-align: center;
}
.thinking-cards {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 340px;
  position: relative;
}
.thinking-card {
  position: relative;
  width: 180px;
  height: 260px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1rem;
  transform: rotate(var(--card-rotate, 0deg)) translateY(var(--card-y, 0px));
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease, z-index 0s;
  display: flex;
  flex-direction: column;
  margin-left: -40px;
  z-index: var(--card-z, 1);
}
.thinking-card:first-child {
  margin-left: 0;
}
.thinking-card:hover {
  transform: rotate(0deg) translateY(-30px);
  box-shadow: var(--shadow-lg);
  z-index: 10;
}
.thinking-card:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 6px;
}
.thinking-card__corner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1;
}
.thinking-card__corner--tl {
  position: absolute;
  top: 0.8rem;
  left: 0.8rem;
}
.thinking-card__corner--br {
  position: absolute;
  bottom: 0.8rem;
  right: 0.8rem;
  transform: rotate(180deg);
}
.thinking-card__rank {
  font-family: 'Jost', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-soft);
  letter-spacing: 0.02em;
}
.thinking-card__suit {
  width: 14px;
  height: 14px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 1.6;
}
.thinking-card__center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.thinking-card__icon-lg {
  width: 44px;
  height: 44px;
  stroke: var(--color-faint);
  fill: none;
  stroke-width: 1.2;
  transition: stroke 0.3s ease;
}
.thinking-card:hover .thinking-card__icon-lg {
  stroke: var(--accent);
}
.thinking-card__label {
  font-family: 'Jost', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color);
  text-align: center;
  margin-top: auto;
  letter-spacing: 0.02em;
}
.thinking-card__desc {
  font-size: 0.78rem;
  color: var(--color-muted);
  text-align: center;
  margin: 0.3rem 0 0;
  line-height: 1.5;
}

/* Card overlay */
.card-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(61, 54, 48, 0.15);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.card-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.card-overlay .thinking-card {
  box-shadow: var(--shadow-lg), 0 0 60px rgba(61, 54, 48, 0.08);
}
.card-overlay .thinking-card__icon-lg {
  width: 56px;
  height: 56px;
}
.card-overlay .thinking-card__label {
  font-size: 1.05rem;
}
.card-overlay .thinking-card__desc-expanded {
  font-family: 'Spectral', Georgia, serif;
  font-size: 1rem;
  font-style: italic;
  color: var(--color-soft);
  line-height: 1.7;
  margin: 0;
  padding: 0 0.5rem;
  text-align: center;
}

/* ── Generic Container ── */
.container {
  width: min(1000px, calc(100vw - 36px));
  max-width: 1000px;
  margin-top: 12vh;
  position: relative;
  z-index: 1;
  padding-bottom: 48px;
}

/* ── Hero (sub-pages) ── */
.hero {
  padding: 0;
  border: 0;
  background: transparent;
}
.hero h1 {
  font-family: 'Spectral', Georgia, serif;
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  font-weight: 400;
  line-height: 1.15;
  margin: 0 0 0.8em;
  color: var(--color);
}
.hero p {
  margin: 0 0 1em;
  color: var(--color-soft);
}

/* Eyebrow label */
.eyebrow, .section-label {
  font-family: 'Jost', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.76rem;
  color: var(--color-muted);
}
.eyebrow {
  margin-bottom: 0.8rem;
  display: inline-block;
  padding: 0.3em 0.8em;
  background: var(--accent-soft);
  border-radius: 999px;
  color: var(--accent);
  font-weight: 500;
}
.section-label {
  margin-bottom: 0.8rem;
}

/* ── Sub-page Components ── */

/* About page - Gallery + Text layout */
.about-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: clamp(2.5rem, 5vw, 4rem);
  align-items: stretch;
}
.about-gallery-wrap {
  position: relative;
  min-height: 100%;
  display: flex;
}
.about-gallery {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  gap: clamp(1rem, 3.5vh, 3rem);
  width: 100%;
  min-height: 100%;
}
.about-gallery__item {
  position: relative;
  width: min(96%, 250px);
  aspect-ratio: 3 / 4;
  cursor: pointer;
  border-radius: 3px;
  background:
    linear-gradient(135deg, var(--accent-soft), var(--sage-soft)),
    linear-gradient(45deg, var(--bg-warm), var(--bg-card));
  border: 8px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12), 0 1px 3px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(var(--img-rotate, 0deg));
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  min-height: 80px;
  overflow: hidden;
}
.about-gallery__item:nth-child(even) {
  align-self: flex-end;
}
.about-gallery__item:nth-child(3) {
  align-self: center;
}
.about-gallery__item:hover {
  transform: rotate(0deg) scale(1.04);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 1;
}
.about-gallery__item:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 6px;
}
.about-gallery__item svg {
  width: 36px;
  height: 36px;
  stroke: var(--color-faint);
  fill: none;
  stroke-width: 1.2;
}
.about-gallery__item img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.about-gallery__item img.is-loaded {
  opacity: 1;
}
.about-text h1 {
  font-family: 'Spectral', Georgia, serif;
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  font-weight: 400;
  line-height: 1.2;
  margin: 0 0 1.2rem;
  color: var(--color);
}
.about-text h2 {
  font-family: 'Jost', sans-serif;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-muted);
  margin: 2.2rem 0 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.about-text p {
  color: var(--color-soft);
  margin: 0 0 1em;
  line-height: 1.8;
}
.about-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.3rem;
}
.about-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: 'Jost', sans-serif;
  font-size: 0.85rem;
  color: var(--color-soft);
  text-decoration: none;
  transition: all 0.25s ease;
}
.about-link:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}
.about-link svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

/* About page - Image lightbox */
.about-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  cursor: pointer;
}
.about-lightbox.active {
  opacity: 1;
  visibility: visible;
}
.about-lightbox__img {
  width: min(600px, 85vw);
  aspect-ratio: 4/3;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  transform: scale(0.9);
  transition: transform 0.3s ease;
  background:
    linear-gradient(135deg, var(--accent-soft), var(--sage-soft)),
    linear-gradient(45deg, var(--bg-warm), var(--bg-card));
  border: 10px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.about-lightbox.active .about-lightbox__img {
  transform: scale(1);
}
.about-lightbox__img svg {
  width: 80px;
  height: 80px;
  stroke: var(--color-muted);
  fill: none;
  stroke-width: 1;
}
.about-lightbox__img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: calc(var(--radius-md) - 6px);
}

/* Contact page - Postcard layout */
/* ── Contact: Particles Background ── */
#particles-js {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}
#particles-js canvas {
  display: block;
}
body:has(#particles-js) .page-content,
body:has(#particles-js) .nav {
  position: relative;
  z-index: 1;
  pointer-events: auto;
}
body:has(#particles-js) .container.page-content,
body:has(#particles-js) .container.page-content .hero,
body:has(#particles-js) .letter-scene {
  pointer-events: none;
}
body:has(#particles-js) .letter-paper,
body:has(#particles-js) .letter-link {
  pointer-events: auto;
}
/* Contact page — tighter top spacing */
body:has(#particles-js) .container.page-content {
  margin-top: 6vh;
}

/* ── Contact: Letter Scene ── */
.letter-scene {
  max-width: 620px;
  margin: 3rem auto 0;
  position: relative;
  padding-bottom: 2rem;
}
.letter-pen {
  position: absolute;
  bottom: 15px;
  right: 10px;
  width: 48px;
  height: auto;
  transform: rotate(25deg);
  z-index: 2;
  opacity: 0.9;
  filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.18));
}
.letter-paper {
  position: relative;
  background:
    repeating-linear-gradient(
      transparent,
      transparent 31px,
      rgba(100, 140, 180, 0.12) 31px,
      rgba(100, 140, 180, 0.12) 32px
    ),
    linear-gradient(135deg, #fdfaf4 0%, #f8f3ea 100%);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 2.8rem 2.5rem 2.5rem 3.5rem;
  box-shadow:
    2px 3px 12px rgba(0,0,0,0.08),
    0 1px 3px rgba(0,0,0,0.06),
    inset 0 0 60px rgba(200, 180, 150, 0.08);
  min-height: 420px;
  -webkit-user-select: none;
  user-select: none;
}
.letter-paper::before {
  content: "";
  position: absolute;
  top: 0;
  left: 2.8rem;
  bottom: 0;
  width: 1px;
  background: rgba(200, 80, 80, 0.2);
}
.letter-date {
  font-family: 'Jost', sans-serif;
  font-size: 0.82rem;
  color: var(--color-muted);
  text-align: right;
  margin-bottom: 1.8rem;
}
.letter-greeting {
  font-family: 'Spectral', Georgia, serif;
  font-size: 1.5rem;
  font-style: italic;
  color: var(--color);
  margin: 0 0 1.4rem;
}
.letter-paper p {
  font-family: 'Spectral', Georgia, serif;
  font-size: 1.02rem;
  line-height: 2; /* match the ruled lines */
  color: var(--color);
  margin: 0 0 0.8rem;
}
.letter-paper a {
  color: var(--accent);
  border-bottom: 1px solid var(--accent-soft);
  text-decoration: none;
  transition: border-color 0.2s ease;
}
.letter-paper a:hover {
  border-bottom-color: var(--accent);
}
.letter-links {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 1.6rem 0;
}
.letter-link {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.9rem;
  background: rgba(200, 180, 150, 0.08);
  border: 1px solid rgba(200, 180, 150, 0.2);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--color);
  font-family: 'Jost', sans-serif;
  font-size: 0.92rem;
  transition: all 0.25s ease;
  width: fit-content;
}
.letter-link:hover {
  background: rgba(200, 180, 150, 0.15);
  border-color: var(--accent-soft);
  transform: translateX(4px);
}
.letter-link svg {
  width: 18px;
  height: 18px;
  stroke: var(--color-muted);
  fill: none;
  stroke-width: 1.6;
  flex-shrink: 0;
}
.letter-link:hover svg {
  stroke: var(--accent);
}
.letter-link__handle {
  color: var(--color-muted);
  font-size: 0.78rem;
  margin-left: 0.2rem;
}
.letter-sign {
  margin-top: 2rem !important;
  font-style: italic;
}
.letter-signature {
  font-family: 'Spectral', Georgia, serif;
  font-size: 1.4rem;
  font-style: italic;
  font-weight: 600;
  color: var(--color);
}
.letter-ink {
  position: absolute;
  bottom: -10px;
  right: -15px;
  width: 55px;
  height: 55px;
  color: var(--color);
  pointer-events: none;
}

/* Dark mode letter paper */
html[data-theme="dark"] .letter-paper {
  background:
    repeating-linear-gradient(
      transparent,
      transparent 31px,
      rgba(107, 163, 214, 0.08) 31px,
      rgba(107, 163, 214, 0.08) 32px
    ),
    linear-gradient(135deg, #161a22 0%, #1a1e28 100%);
  box-shadow:
    2px 3px 16px rgba(0,0,0,0.25),
    0 1px 4px rgba(0,0,0,0.2),
    inset 0 0 60px rgba(107, 163, 214, 0.03);
}
html[data-theme="dark"] .letter-paper::before {
  background: rgba(200, 100, 100, 0.15);
}
html[data-theme="dark"] .letter-link {
  background: rgba(107, 163, 214, 0.06);
  border-color: rgba(107, 163, 214, 0.15);
}
html[data-theme="dark"] .letter-link:hover {
  background: rgba(107, 163, 214, 0.12);
}
html[data-theme="dark"] .letter-pen {
  opacity: 0.75;
  filter: drop-shadow(2px 4px 8px rgba(0,0,0,0.35)) brightness(0.85);
}

/* Gallery page - Wall layout */
.gallery-wall {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3rem 2.5rem;
  margin-top: 2rem;
  padding-bottom: 3rem;
}

/* Painting */
.gw-painting {
  margin: 0;
  cursor: pointer;
  transform: rotate(var(--r, 0deg)) translateX(var(--x, 0));
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), filter 0.3s ease;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.08));
}
.gw-painting:hover {
  transform: rotate(0deg) translateX(0) scale(1.03);
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.15));
}
.gw-painting:focus-visible,
.gw-sculpture:focus-visible,
.gw-music__play:focus-visible,
.pj-terminal:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 6px;
}
.gw-painting__img {
  aspect-ratio: 4/3;
  border-radius: 40% 5% 35% 10% / 10% 35% 5% 40%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  transition: border-radius 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.gw-painting:hover .gw-painting__img {
  border-radius: 6px;
}
.gw-painting__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gw-painting--wide {
  grid-column: span 2;
}
.gw-painting--wide .gw-painting__img {
  aspect-ratio: 2/1;
}
.gw-painting__img svg {
  width: 28px;
  height: 28px;
  stroke: rgba(255,255,255,0.5);
  fill: none;
  stroke-width: 1.2;
}
.gw-painting figcaption {
  font-family: 'Jost', sans-serif;
  font-size: 0.85rem;
  color: var(--color);
  padding: 0.5rem 0.2rem 0;
  position: relative;
}
.gw-painting__title {
  display: block;
}
.gw-painting__title > span {
  display: inline;
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-left: 0.3rem;
}
.gw-painting__desc {
  display: block;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--color-muted);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease, margin-top 0.3s ease;
  margin-top: 0;
}
.gw-painting:hover .gw-painting__desc {
  max-height: 8rem;
  opacity: 1;
  margin-top: 0.35rem;
}

/* Sculpture */
.gw-sculpture {
  margin: 0;
  cursor: pointer;
  transform: rotate(var(--r, 0deg)) translateX(var(--x, 0));
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), filter 0.3s ease;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.08));
}
.gw-sculpture:hover {
  transform: rotate(0deg) translateX(0) scale(1.03);
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.15));
}
.gw-sculpture__img {
  aspect-ratio: 4/3;
  border-radius: 10% 40% 5% 35% / 35% 5% 40% 10%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  transition: border-radius 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.gw-sculpture:hover .gw-sculpture__img {
  border-radius: 6px;
}
.gw-sculpture__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  display: block;
}
.gw-sculpture--tall .gw-sculpture__img {
  aspect-ratio: 3/4;
}
.gw-sculpture__img svg {
  width: 28px;
  height: 28px;
  stroke: rgba(100,90,80,0.3);
  fill: none;
  stroke-width: 1.2;
}
.gw-sculpture figcaption {
  font-family: 'Jost', sans-serif;
  font-size: 0.85rem;
  color: var(--color);
  padding: 0.5rem 0.2rem 0;
}
.gw-sculpture figcaption span {
  display: block;
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-top: 0.1rem;
}

/* Music */
.gw-music {
  margin: 0;
  transform: rotate(var(--r, 0deg)) translateX(var(--x, 0));
  transition: transform 0.3s ease;
}
.gw-music:hover {
  transform: rotate(0deg) translateX(0) scale(1.04);
}
.gw-music__cover {
  width: clamp(140px, 18vw, 200px);
  aspect-ratio: 1;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  background: var(--bg-secondary, #e8e4df);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.gw-music__art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.gw-music__art.is-loaded {
  opacity: 1;
}
.gw-music__play {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
  background: rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.25s ease;
  padding: 0;
}
.gw-music:hover .gw-music__play,
.gw-music.is-playing .gw-music__play {
  opacity: 1;
}
.gw-music__play svg {
  width: 36px;
  height: 36px;
  fill: rgba(255,255,255,0.95);
  stroke: none;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.35));
}
.gw-music__icon-pause { display: none; }
.gw-music.is-playing .gw-music__icon-play { display: none; }
.gw-music.is-playing .gw-music__icon-pause { display: block; }
.gw-music.is-playing .gw-music__cover::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 11px;
  border: 2px solid var(--accent);
  animation: pulse-ring 1.5s ease-out infinite;
  pointer-events: none;
}
@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.1); opacity: 0; }
}
.gw-music__frame {
  width: 100%;
  height: 0;
  border: none;
  overflow: hidden;
  transition: height 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  border-radius: 0;
}
.gw-music.is-playing .gw-music__frame {
  height: 80px;
  border-radius: 8px;
  margin-top: 0.6rem;
}
.gw-music__info {
  padding: 0.5rem 0.15rem 0;
}
.gw-music__title {
  display: block;
  font-family: 'Jost', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color);
  line-height: 1.25;
}
.gw-music__artist {
  display: block;
  font-family: 'Jost', sans-serif;
  font-size: 0.72rem;
  color: var(--color-muted);
  margin-top: 0.1rem;
}

/* Quote */
.gw-quote {
  margin: 0;
  padding: 1rem 0;
  transform: translateX(var(--x, 0));
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.gw-quote:hover {
  transform: translateX(0) scale(1.02);
}
.gw-quote p {
  font-family: 'Spectral', Georgia, serif;
  font-size: clamp(0.95rem, 1.8vw, 1.2rem);
  font-weight: 400;
  font-style: italic;
  line-height: 1.7;
  color: var(--color);
  margin: 0 0 0.6rem;
}
.gw-quote footer {
  font-family: 'Jost', sans-serif;
  font-size: 0.78rem;
  color: var(--color-muted);
  letter-spacing: 0.02em;
}
.gw-quote em {
  font-style: normal;
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 3px;
}

/* Gallery lightbox */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  cursor: pointer;
}
.gallery-lightbox.active {
  opacity: 1;
  visibility: visible;
}
.gallery-lightbox__content {
  max-width: 85vw;
  max-height: 85vh;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.gallery-lightbox.active .gallery-lightbox__content {
  transform: scale(1);
}
.gallery-lightbox__content .gw-painting__img,
.gallery-lightbox__content .gw-sculpture__img {
  width: min(700px, 85vw);
  aspect-ratio: auto;
  border-radius: 6px;
}
.gallery-lightbox__content .gw-painting__img img,
.gallery-lightbox__content .gw-sculpture__img img {
  object-fit: contain;
  max-height: 75vh;
  width: auto;
}
.gallery-lightbox__content figcaption {
  display: none;
}

/* Responsive */
@media (max-width: 980px) {
  .gallery-wall {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem 1.5rem;
  }
  .gw-painting--wide {
    grid-column: span 1;
  }
  .gw-painting--wide .gw-painting__img {
    aspect-ratio: 4/3;
  }
}
@media (max-width: 768px) {
  .gallery-wall {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Projects page - Workbench */
/* ── Projects Terminal Hero ── */
.pj-terminal {
  background: #f5f0e8;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
  cursor: pointer;
}
.pj-terminal__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.7rem 1rem;
  background: rgba(0,0,0,0.04);
}
.pj-terminal__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.pj-terminal__dot--red { background: #ff5f57; }
.pj-terminal__dot--yellow { background: #febc2e; }
.pj-terminal__dot--green { background: #28c840; }
.pj-terminal__tab {
  margin-left: 0.8rem;
  font-family: 'Jost', sans-serif;
  font-size: 0.72rem;
  color: var(--color-muted);
  letter-spacing: 0.03em;
}
.pj-terminal__body {
  padding: 1.2rem 1.2rem 0.6rem;
  font-family: 'Spectral', Georgia, serif;
  font-size: 1.3rem;
  color: var(--color);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.pj-terminal__prompt {
  color: var(--sage);
  font-weight: 600;
}
.pj-terminal__cmd {
  color: var(--color);
}
.pj-terminal__cursor {
  display: inline-block;
  width: 0.5em;
  height: 1.1em;
  background: var(--color);
  opacity: 0.6;
  animation: termBlink 1s step-end infinite;
  vertical-align: text-bottom;
}
@keyframes termBlink {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0; }
}
.pj-terminal__hint {
  padding: 0 1.2rem 1rem;
  font-family: 'Jost', sans-serif;
  font-size: 0.78rem;
  color: var(--color-muted);
  margin: 0;
  opacity: 0.7;
  animation: hintPulse 2s ease-in-out infinite;
}
@keyframes hintPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0.35; }
}
.pj-terminal.is-done .pj-terminal__hint { display: none; }
html[data-theme="dark"] .pj-terminal {
  background: #1e1e2e;
  border-color: rgba(255,255,255,0.08);
}
html[data-theme="dark"] .pj-terminal__bar {
  background: rgba(255,255,255,0.06);
}
html[data-theme="dark"] .pj-terminal__tab { color: rgba(255,255,255,0.4); }
html[data-theme="dark"] .pj-terminal__body { color: #cdd6f4; }
html[data-theme="dark"] .pj-terminal__prompt { color: #a6e3a1; }
html[data-theme="dark"] .pj-terminal__cmd { color: #cdd6f4; }
html[data-theme="dark"] .pj-terminal__cursor { background: #cdd6f4; opacity: 0.7; }
html[data-theme="dark"] .pj-terminal__hint { color: rgba(255,255,255,0.35); }

/* ── Projects Output (hidden until terminal runs) ── */
.pj-output {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}
.pj-output.is-revealed {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ── Projects Language Bar ── */
.pj-lang-bar {
  margin-bottom: 2rem;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.pj-lang-bar.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.pj-lang-bar__track {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  gap: 2px;
}
.pj-lang-bar__seg {
  height: 100%;
  width: var(--w);
  border-radius: 999px;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.pj-lang-bar__seg[data-lang="Python"] { background: #3572a5; }
.pj-lang-bar__seg[data-lang="JavaScript"] { background: #c9a427; }
.pj-lang-bar__seg[data-lang="TypeScript"] { background: #3178c6; }
.pj-lang-bar__seg[data-lang="Go"] { background: #00add8; }
.pj-lang-bar__seg[data-lang="C++"] { background: #f34b7d; }
.pj-lang-bar__seg[data-lang="HTML"] { background: #e34c26; }
.pj-lang-bar__seg[data-lang="C"] { background: #555555; }
html[data-theme="dark"] .pj-lang-bar__seg[data-lang="Python"] { background: #6ba3d6; }
html[data-theme="dark"] .pj-lang-bar__seg[data-lang="JavaScript"] { background: #e0c040; }
html[data-theme="dark"] .pj-lang-bar__seg[data-lang="TypeScript"] { background: #5a9fd4; }
html[data-theme="dark"] .pj-lang-bar__seg[data-lang="Go"] { background: #40c4e8; }
html[data-theme="dark"] .pj-lang-bar__seg[data-lang="C++"] { background: #f580a0; }
html[data-theme="dark"] .pj-lang-bar__seg[data-lang="HTML"] { background: #f07050; }
html[data-theme="dark"] .pj-lang-bar__seg[data-lang="C"] { background: #999; }
.pj-lang-bar__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.2rem;
  margin-top: 0.6rem;
}
.pj-lang-bar__item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: 'Jost', sans-serif;
  font-size: 0.72rem;
  color: var(--color-muted);
}
.pj-lang-bar__item i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.pj-lang-bar__item[data-lang="Python"] i { background: #3572a5; }
.pj-lang-bar__item[data-lang="JavaScript"] i { background: #c9a427; }
.pj-lang-bar__item[data-lang="TypeScript"] i { background: #3178c6; }
.pj-lang-bar__item[data-lang="Go"] i { background: #00add8; }
.pj-lang-bar__item[data-lang="C++"] i { background: #f34b7d; }
.pj-lang-bar__item[data-lang="HTML"] i { background: #e34c26; }
.pj-lang-bar__item[data-lang="C"] i { background: #555555; }
html[data-theme="dark"] .pj-lang-bar__item[data-lang="Python"] i { background: #6ba3d6; }
html[data-theme="dark"] .pj-lang-bar__item[data-lang="JavaScript"] i { background: #e0c040; }
html[data-theme="dark"] .pj-lang-bar__item[data-lang="TypeScript"] i { background: #5a9fd4; }
html[data-theme="dark"] .pj-lang-bar__item[data-lang="Go"] i { background: #40c4e8; }
html[data-theme="dark"] .pj-lang-bar__item[data-lang="C++"] i { background: #f580a0; }
html[data-theme="dark"] .pj-lang-bar__item[data-lang="HTML"] i { background: #f07050; }
html[data-theme="dark"] .pj-lang-bar__item[data-lang="C"] i { background: #999; }

/* ── Projects Grid ── */
.pj-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
  margin-top: 2rem;
}
.pj-card {
  display: flex;
  flex-direction: column;
  padding: 1.4rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: inherit;
  text-decoration: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1), transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}
.pj-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.pj-card:hover {
  transform: translateY(-3px) !important;
  box-shadow: var(--shadow-hover);
  border-color: var(--border-strong);
}
.pj-card--featured {
  grid-column: span 1;
  border-left: 3px solid var(--accent-soft);
}
.pj-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.7rem;
}
.pj-card__lang {
  font-family: 'Jost', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.15em 0.55em;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--color-muted);
}
.pj-card__lang[data-lang="TypeScript"] { color: #3178c6; border-color: rgba(49,120,198,0.3); }
.pj-card__lang[data-lang="Python"] { color: #3572a5; border-color: rgba(53,114,165,0.3); }
.pj-card__lang[data-lang="JavaScript"] { color: #c9a427; border-color: rgba(201,164,39,0.3); }
.pj-card__lang[data-lang="Go"] { color: #00add8; border-color: rgba(0,173,216,0.3); }
.pj-card__lang[data-lang="C++"] { color: #f34b7d; border-color: rgba(243,75,125,0.3); }
.pj-card__lang[data-lang="C"] { color: #555555; border-color: rgba(85,85,85,0.3); }
.pj-card__lang[data-lang="HTML"] { color: #e34c26; border-color: rgba(227,76,38,0.3); }
html[data-theme="dark"] .pj-card__lang[data-lang="TypeScript"] { color: #5a9fd4; }
html[data-theme="dark"] .pj-card__lang[data-lang="Python"] { color: #6ba3d6; }
html[data-theme="dark"] .pj-card__lang[data-lang="JavaScript"] { color: #e0c040; }
html[data-theme="dark"] .pj-card__lang[data-lang="Go"] { color: #40c4e8; }
html[data-theme="dark"] .pj-card__lang[data-lang="C++"] { color: #f580a0; }
html[data-theme="dark"] .pj-card__lang[data-lang="C"] { color: #999; }
html[data-theme="dark"] .pj-card__lang[data-lang="HTML"] { color: #f07050; }
.pj-card__stars {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: 'Jost', sans-serif;
  font-size: 0.78rem;
  color: var(--color-muted);
}
.pj-card__stars svg { color: var(--accent); }
.pj-card__title {
  font-family: 'Jost', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color);
  margin: 0 0 0.4rem;
}
.pj-card__desc {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--color-muted);
  margin: 0 0 auto;
  padding-bottom: 1rem;
}
.pj-card__link {
  font-family: 'Jost', sans-serif;
  font-size: 0.75rem;
  color: var(--color-faint);
  margin-top: auto;
}

/* ── Ferris Wheel ── */
.ferris-ride {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(var(--radius) * 2 + 180px);
  padding: 2.5rem 0 3.5rem;
  overflow: hidden;
  isolation: isolate;
}
.ferris-ride::before {
  content: '';
  position: absolute;
  bottom: 3.05rem;
  left: 50%;
  width: min(40rem, 84vw);
  height: 18px;
  transform: translateX(-50%);
  background:
    linear-gradient(90deg, transparent, rgba(130, 112, 92, 0.3), transparent),
    linear-gradient(180deg, transparent 45%, rgba(130, 112, 92, 0.12) 46% 54%, transparent 55%);
  opacity: 0.9;
  z-index: -1;
}
.ferris-ride::after {
  content: none;
}

/* Stand */
.ferris-stand {
  position: absolute;
  top: calc(50% - 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  width: calc(var(--radius) * 1.62);
  height: calc(var(--radius) + 82px);
  z-index: 0;
  pointer-events: none;
}
.ferris-stand__leg {
  position: absolute;
  top: 0;
  left: 50%;
  width: 7px;
  height: calc(107.2% - 9px);
  background:
    linear-gradient(90deg, rgba(255,255,255,0.42), transparent 36%),
    linear-gradient(180deg, var(--border-strong), rgba(125, 111, 96, 0.5));
  border-radius: 999px;
  box-shadow:
    inset 1px 0 rgba(255,255,255,0.38),
    0 2px 6px rgba(80, 66, 52, 0.08);
  opacity: 0.62;
}
.ferris-stand__leg:first-child {
  transform-origin: top center;
  transform: translateX(-50%) rotate(21deg);
}
.ferris-stand__leg:nth-child(2) {
  transform-origin: top center;
  transform: translateX(-50%) rotate(-21deg);
}
.ferris-stand__crossbar {
  position: absolute;
  top: 54%;
  left: 24%;
  right: 24%;
  height: 5px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.5), transparent 45%),
    linear-gradient(90deg, transparent, var(--border-strong), transparent);
  border-radius: 999px;
  opacity: 0.42;
}
.ferris-stand__brace {
  position: absolute;
  top: 17%;
  left: 50%;
  width: 3px;
  height: 50%;
  transform-origin: top center;
  background: linear-gradient(180deg, rgba(142, 126, 108, 0.12), var(--border));
  border-radius: 999px;
  opacity: 0.5;
}
.ferris-stand__brace--left {
  transform: translateX(-50%) rotate(33deg);
}
.ferris-stand__brace--right {
  transform: translateX(-50%) rotate(-33deg);
}
.ferris-stand__axle {
  position: absolute;
  top: -24px;
  left: 50%;
  width: 48px;
  height: 48px;
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255,255,255,0.88), transparent 31%),
    radial-gradient(circle, var(--bg-card) 0 42%, var(--accent-soft) 43% 62%, var(--border-strong) 63% 100%);
  border: 2px solid var(--border-strong);
  box-shadow:
    0 0 0 7px rgba(151, 130, 102, 0.08),
    0 4px 14px rgba(91, 74, 58, 0.12);
}
.ferris-platform {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: calc(var(--radius) * 1.7);
  height: 20px;
  transform: translateX(-50%);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.54), transparent 42%),
    repeating-linear-gradient(90deg, rgba(122, 101, 78, 0.13) 0 1px, transparent 1px 22px),
    linear-gradient(180deg, var(--bg-card), rgba(128, 113, 96, 0.17));
  border: 1px solid var(--border);
  border-radius: 999px 999px 12px 12px;
  box-shadow:
    inset 0 1px rgba(255,255,255,0.46),
    0 8px 20px rgba(89, 72, 56, 0.08);
}
.ferris-platform::before {
  content: '';
  position: absolute;
  left: 9%;
  right: 9%;
  top: -5px;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--bg-card), rgba(130, 112, 92, 0.18));
  border: 1px solid var(--border);
}

/* Wheel */
.ferris-wheel {
  position: relative;
  width: calc(var(--radius) * 2);
  height: calc(var(--radius) * 2);
  animation: ferris-spin var(--speed) linear infinite;
  will-change: transform;
  z-index: 1;
}
.ferris-wheel:hover {
  animation-play-state: paused;
}
.ferris-wheel:hover .ferris-cabin-inner {
  animation-play-state: paused;
}
.ferris-wheel:hover .ferris-cabin-swing {
  animation-play-state: paused;
}
.ferris-wheel:hover .ferris-cabin:hover .ferris-cabin-swing {
  box-shadow: var(--shadow-hover);
  border-color: var(--accent-soft);
}

.ferris-rim {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}
.ferris-rim--outer {
  border: 4px double var(--border-strong);
  box-shadow:
    inset 0 0 0 8px rgba(180, 158, 126, 0.055),
    inset 0 0 0 15px rgba(255,255,255,0.14),
    0 0 0 1px rgba(111, 96, 82, 0.08),
    0 12px 32px rgba(89, 72, 56, 0.06);
}
.ferris-rim--middle {
  inset: 9%;
  border: 2px dashed rgba(139, 121, 99, 0.38);
}
.ferris-rim--inner {
  inset: 28%;
  border: 2px solid var(--border);
  box-shadow: 0 0 0 7px rgba(174, 153, 124, 0.035);
  opacity: 0.86;
}
.ferris-light-ring {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.ferris-light {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,0.9), transparent 34%),
    #d7a85b;
  border: 1px solid rgba(111, 83, 44, 0.22);
  box-shadow: 0 0 0 3px rgba(215, 168, 91, 0.07), 0 0 11px rgba(215, 168, 91, 0.18);
  transform: rotate(var(--angle)) translateY(calc(-1 * var(--radius))) rotate(calc(-1 * var(--angle)));
  opacity: 0.72;
}

/* Hub */
.ferris-hub {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 62px;
  height: 62px;
  margin: -31px;
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,0.85), transparent 28%),
    radial-gradient(circle, var(--bg-card) 0 38%, var(--accent-soft) 39% 58%, var(--border-strong) 59% 100%);
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  box-shadow: 0 0 0 9px rgba(148, 129, 106, 0.08), var(--shadow-sm);
  z-index: 4;
  pointer-events: none;
}
.ferris-hub__ring,
.ferris-hub__cap {
  position: absolute;
  border-radius: 50%;
}
.ferris-hub__ring {
  inset: 12px;
  border: 1px dashed rgba(99, 84, 71, 0.42);
}
.ferris-hub__cap {
  inset: 22px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-soft);
}

/* Spokes and trusswork */
.ferris-truss,
.ferris-cabin-arm {
  position: absolute;
  top: 50%;
  left: calc(50% - 1px);
  width: 2px;
  height: var(--radius);
  background: linear-gradient(180deg, var(--border-strong), rgba(126, 110, 92, 0.12));
  transform-origin: 50% 0;
  transform: rotate(calc(var(--angle) + 180deg));
  pointer-events: none;
}
.ferris-truss {
  opacity: 0.32;
}
.ferris-truss::before,
.ferris-truss::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 1px;
  height: 47%;
  transform-origin: top center;
  background: rgba(139, 121, 99, 0.45);
}
.ferris-truss::before {
  top: 0;
  transform: rotate(9deg);
}
.ferris-truss::after {
  top: 27%;
  transform: rotate(-11deg);
}
.ferris-cabin-arm {
  width: 2px;
  left: calc(50% - 1px);
  height: calc(var(--radius) - 38px);
  opacity: 0.66;
  z-index: 2;
}
.ferris-cabin-arm::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: -5px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(152, 130, 101, 0.08);
}

/* Cabin positioning */
.ferris-cabin {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: 150px;
  height: 62px;
  margin-left: -75px;
  margin-top: -31px;
  text-decoration: none;
  color: inherit;
  transform: rotate(var(--angle)) translateY(calc(-1 * var(--radius)));
  z-index: 3;
}
/* Counter-rotation */
.ferris-cabin-inner {
  width: 100%;
  height: 100%;
  animation: ferris-counter var(--speed) linear infinite;
  will-change: transform;
  transform: rotate(calc(-1 * var(--angle)));
}

/* Gondola swing + visual */
.ferris-cabin-swing {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.72rem 0.78rem 0.58rem;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.64), transparent 30%),
    linear-gradient(180deg, var(--bg-card), rgba(181, 164, 140, 0.14));
  border: 1px solid var(--border);
  border-radius: 9px 9px 14px 14px;
  box-shadow:
    inset 0 1px rgba(255,255,255,0.48),
    0 6px 16px rgba(89, 72, 56, 0.09);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
  animation: pendulum 4s ease-in-out infinite;
  animation-delay: calc(var(--angle) * -0.02s);
  position: relative;
  overflow: hidden;
}
/* Roof cap */
.ferris-cabin-swing::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 12px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.26) 0 8px, transparent 8px 16px),
    var(--accent-soft);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}
.ferris-cabin-swing::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 7px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  opacity: 0.7;
}
.ferris-cabin-bar {
  position: absolute;
  top: 20px;
  left: 8px;
  right: 8px;
  height: 1px;
  background: var(--border);
  opacity: 0.6;
}

/* Avatar */
.ferris-avatar {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--border);
  z-index: 1;
}

/* Info */
.ferris-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
  z-index: 1;
}
.ferris-name {
  font-family: 'Jost', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.ferris-desc {
  font-size: 0.65rem;
  color: var(--color-muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ferris-cabin:hover .ferris-name {
  font-size: 1.2rem;
}
.ferris-cabin:hover .ferris-desc {
  font-size: 1rem;
  white-space: normal;
  overflow: visible;
}
.ferris-cabin:hover .ferris-info {
  background: var(--bg-card, rgba(255,255,255,0.95));
  border-radius: 8px;
  padding: 6px 12px;
  margin: -6px -12px;
  min-width: 180px;
}

/* Empty state */
.ferris-empty {
  text-align: center;
  color: var(--color-muted);
  font-style: italic;
  padding: 4rem 0;
}

/* Animations */
@keyframes ferris-spin {
  to { transform: rotate(360deg); }
}
@keyframes ferris-counter {
  from { transform: rotate(calc(-1 * var(--angle))); }
  to { transform: rotate(calc(-1 * var(--angle) - 360deg)); }
}
@keyframes pendulum {
  0%, 100% { transform: rotate(-2.5deg); }
  50% { transform: rotate(2.5deg); }
}

/* ── Section box ── */
.home-section {
  padding: 1.2rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  margin-top: 1.5rem;
}

/* ── Links ── */
.container a,
.post-article a {
  text-decoration: none;
  color: var(--accent);
  border-bottom: 1px solid var(--accent-soft);
  transition: border-color 0.25s ease, color 0.25s ease;
}
.container a:hover,
.post-article a:hover {
  color: var(--accent-hover);
  border-bottom-color: var(--accent);
}

/* ── Lists ── */
ul {
  list-style-type: none;
  padding-left: 0;
}
ul > li {
  position: relative;
  padding-left: 1.2em;
  margin-bottom: 0.5em;
}
ul > li::before {
  content: "\2022";
  color: var(--color-faint);
  position: absolute;
  left: 0;
  font-size: 1.2em;
  line-height: 1.4;
}

/* ── Post Meta ── */
.post-meta {
  color: var(--color-muted);
  font-size: 14px;
  font-family: 'Jost', sans-serif;
  margin: 0 0 12px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 18px 0;
}
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-family: 'Jost', sans-serif;
  color: var(--color-muted);
  background: var(--bg-card);
}

/* ── Post Layout ── */
.post-page-body .post-container {
  width: min(1140px, calc(100vw - 36px));
  max-width: 1140px;
  padding-left: 20px;
  padding-right: 20px;
}
.post-page-body .post-body :is(h1, h2, h3, h4, h5, h6)[id] {
  scroll-margin-top: 8.5rem;
}
.post-shell {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 820px);
  justify-content: center;
}
.post-shell.has-toc {
  grid-template-columns: minmax(200px, 250px) minmax(0, 820px);
  grid-template-areas: "sidebar main";
  column-gap: clamp(2.5rem, 5vw, 4rem);
  justify-content: start;
}
.post-main {
  grid-area: main;
  min-width: 0;
  max-width: 820px;
}
.post-body { min-width: 0; }
.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6rem 0;
  font-size: 0.92rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.post-body thead th {
  text-align: left;
  font-weight: 600;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  background: var(--bg-warm);
  color: var(--color);
}
.post-body tbody td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  color: var(--color-soft);
}
.post-body tbody tr:nth-child(even) {
  background: var(--bg-warm);
}
.post-body tbody tr:hover {
  background: var(--accent-soft);
}
.post-sidebar {
  grid-area: sidebar;
  align-self: start;
  position: sticky;
  top: 7.9rem;
  min-width: 0;
}
.post-sidebar-title {
  margin: 0 0 0.9rem 0;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  color: var(--color-muted);
  font-family: 'Jost', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ── Post Back Link ── */
.post-back {
  margin: 0 0 1.6rem 0;
}
.post-back a {
  font-family: 'Jost', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-muted);
  border-bottom: none;
  letter-spacing: 0.02em;
  transition: color 0.2s ease;
}
.post-back a:hover {
  color: var(--accent);
  border-bottom: none;
}

/* ── Post Article ── */
.post-article {
  color: var(--color);
}
.post-article h1 {
  margin-bottom: 0.4rem;
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  line-height: 1.2;
}
.post-article h2, .post-article h3 {
  margin-top: 1.8em;
  margin-bottom: .5em;
}
.post-article .toc {
  margin: 0;
  padding: 0.6rem 0;
  border-left: 2px solid var(--accent-soft);
  max-height: calc(100vh - 10rem);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.post-article .toc > ul {
  margin: 0;
  display: grid;
  gap: 0.1rem;
}
.post-article .toc ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}
.post-article .toc ul ul {
  margin-top: 0.1rem;
  margin-left: 0;
  padding-left: 0;
  border-left: none;
}
.post-article .toc li {
  position: static;
  padding-left: 0;
  margin: 0;
}
.post-article .toc li:last-child { margin-bottom: 0; }
.post-article .toc ul > li::before { content: none; }
.post-article .toc a {
  display: block;
  padding: 0.35rem 0.8rem;
  border-radius: 0;
  border-bottom: none;
  border-left: 2px solid transparent;
  margin-left: -2px;
  color: var(--color-muted);
  font-family: 'Jost', sans-serif;
  font-size: 0.85rem;
  line-height: 1.5;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.post-article .toc > ul > li > a { font-weight: 500; }
.post-article .toc ul ul a {
  padding: 0.25rem 0.8rem 0.25rem 1.4rem;
  font-size: 0.8rem;
  color: var(--color-soft);
}
.post-article .toc a:hover,
.post-article .toc a:focus-visible {
  color: var(--color);
  border-bottom: none;
  border-left-color: var(--accent);
  background: none;
}
.post-article .toc a.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}

/* Code */
.post-article code,
.post-article pre,
.post-article .codehilite {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}
.post-article code {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.08em 0.35em;
  border-radius: 4px;
  font-size: 0.92em;
}
.post-article pre {
  margin: 1.4rem 0;
  background: var(--code-bg);
  padding: 14px 16px;
  overflow: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.post-article .codehilite {
  margin: 1.4rem 0;
  border-radius: var(--radius-md);
  background: var(--code-block-bg);
  border: 1px solid var(--code-block-border);
  overflow: hidden;
}
.post-article .codehilite pre {
  margin: 0;
  padding: 1rem 1.1rem;
  background: transparent;
  border: 0;
  color: var(--code-text);
  line-height: 1.65;
}
.post-article .codehilite pre > span:first-child:empty { display: none; }
.post-article pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  border-radius: 0;
}
.post-article .codehilite .hll {
  display: block;
  margin: 0 -1.1rem;
  padding: 0 1.1rem;
  background: rgba(184, 134, 11, 0.08);
}
.post-article .codehilite .c,
.post-article .codehilite .ch,
.post-article .codehilite .cm,
.post-article .codehilite .cpf,
.post-article .codehilite .c1,
.post-article .codehilite .cs,
.post-article .codehilite .go,
.post-article .codehilite .gp,
.post-article .codehilite .w {
  color: var(--code-comment);
}
.post-article .codehilite .c,
.post-article .codehilite .ch,
.post-article .codehilite .cm,
.post-article .codehilite .cpf,
.post-article .codehilite .c1,
.post-article .codehilite .cs {
  font-style: italic;
}
.post-article .codehilite .k,
.post-article .codehilite .kc,
.post-article .codehilite .kd,
.post-article .codehilite .kn,
.post-article .codehilite .kp,
.post-article .codehilite .kr,
.post-article .codehilite .kt,
.post-article .codehilite .ow {
  color: var(--code-keyword);
  font-weight: 600;
}
.post-article .codehilite .o { color: var(--code-operator); }
.post-article .codehilite .p,
.post-article .codehilite .pi {
  color: color-mix(in srgb, var(--code-text) 78%, var(--code-comment) 22%);
}
.post-article .codehilite .m,
.post-article .codehilite .mb,
.post-article .codehilite .mf,
.post-article .codehilite .mh,
.post-article .codehilite .mi,
.post-article .codehilite .mo,
.post-article .codehilite .il {
  color: var(--code-number);
}
.post-article .codehilite .s,
.post-article .codehilite .sa,
.post-article .codehilite .sb,
.post-article .codehilite .sc,
.post-article .codehilite .dl,
.post-article .codehilite .sd,
.post-article .codehilite .s2,
.post-article .codehilite .se,
.post-article .codehilite .sh,
.post-article .codehilite .si,
.post-article .codehilite .sx,
.post-article .codehilite .sr,
.post-article .codehilite .s1,
.post-article .codehilite .ss {
  color: var(--code-string);
}
.post-article .codehilite .na,
.post-article .codehilite .nb,
.post-article .codehilite .bp,
.post-article .codehilite .nc,
.post-article .codehilite .nd,
.post-article .codehilite .ne,
.post-article .codehilite .nl,
.post-article .codehilite .nn,
.post-article .codehilite .no {
  color: var(--code-name);
}
.post-article .codehilite .nf,
.post-article .codehilite .fm { color: var(--code-function); }
.post-article .codehilite .nt { color: var(--code-tag); }
.post-article .codehilite .nv,
.post-article .codehilite .vc,
.post-article .codehilite .vg,
.post-article .codehilite .vi,
.post-article .codehilite .vm {
  color: var(--code-variable);
}
.post-article .codehilite .err,
.post-article .codehilite .gr,
.post-article .codehilite .gt { color: var(--code-error); }

/* Inline elements */
.post-article del {
  color: var(--color-muted);
  text-decoration-thickness: 0.08em;
}
.post-article blockquote {
  margin: 1.6rem 0;
  padding: 1rem 1.2rem 1rem 1.3rem;
  border-left: 3px solid var(--accent-soft);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--bg-warm);
  color: var(--color-soft);
}
.post-article blockquote p:last-child { margin-bottom: 0; }

/* Images */
.post-article .post-body img {
  display: block;
  max-width: min(100%, 34rem);
  height: auto;
  margin: 1.6rem auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
}

/* Gallery in posts */
.post-article .post-gallery {
  --gallery-card-collapsed: clamp(5.5rem, 7vw, 6.5rem);
  --gallery-card-expanded: clamp(15rem, 24vw, 17rem);
  display: flex;
  align-items: stretch;
  gap: 0.85rem;
  margin: 1.8rem 0 2rem;
  padding: 0.25rem 0.1rem 0.35rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 0.1rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.post-article .post-gallery.is-wheel-scrolling { scroll-snap-type: none; }
.post-article .post-gallery:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 0.3rem;
}
.post-article .post-gallery::-webkit-scrollbar { width: 0; height: 0; display: none; }
.post-article .post-gallery-item {
  position: relative;
  margin: 0;
  flex: 0 0 var(--gallery-card-collapsed);
  height: clamp(17rem, 28vw, 23rem);
  min-width: 0;
  scroll-snap-align: start;
  overflow: hidden;
  border-radius: var(--radius-lg);
  transition: flex-basis 340ms cubic-bezier(0.22, 1, 0.36, 1), transform 260ms ease, filter 260ms ease, opacity 260ms ease;
  outline: none;
}
.post-article .post-gallery-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 10, 18, 0) 0%, rgba(8, 10, 18, 0.03) 48%, rgba(8, 10, 18, 0.42) 100%);
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 260ms ease;
}
.post-article .post-gallery-item img {
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
  object-fit: cover;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transform: scale(1.01);
  transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1), filter 260ms ease;
}
.post-article .post-gallery-item figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: grid;
  gap: 0.28rem;
  margin: 0;
  padding: 1rem 1rem 1.05rem;
  color: #fffaf2;
  text-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  pointer-events: none;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 240ms ease, transform 300ms ease;
}
.post-article .post-gallery-caption-title {
  font-family: 'Jost', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.2;
}
.post-article .post-gallery-caption-meta {
  font-family: 'Jost', sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 250, 242, 0.8);
}
.post-article .post-gallery:not(.has-active) .post-gallery-item:first-child,
.post-article .post-gallery-item.is-active {
  flex-basis: var(--gallery-card-expanded);
  transform: translateY(-3px);
  filter: saturate(1) brightness(1);
}
.post-article .post-gallery.has-active .post-gallery-item:not(.is-active) {
  filter: saturate(0.9) brightness(0.94);
}
.post-article .post-gallery:not(.has-active) .post-gallery-item:first-child figcaption,
.post-article .post-gallery-item.is-active figcaption {
  opacity: 1;
  transform: translateY(0);
}
.post-article .post-gallery.has-active .post-gallery-item:not(.is-active)::after { opacity: 0.54; }
.post-article .post-gallery:not(.has-active) .post-gallery-item:first-child::after,
.post-article .post-gallery-item.is-active::after { opacity: 0.82; }
.post-article .post-gallery:not(.has-active) .post-gallery-item:first-child img,
.post-article .post-gallery-item.is-active img { transform: scale(1.04); }
.post-article .post-gallery--few {
  --gallery-card-collapsed: clamp(8rem, 12vw, 10rem);
  --gallery-card-expanded: clamp(18rem, 28vw, 22rem);
  justify-content: center;
}

/* Tables */
.post-article table {
  display: table;
  table-layout: fixed;
  width: 100%;
  max-width: 100%;
  margin: 1.5rem 0 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-card);
  font-size: 0.95rem;
}
.post-article thead {
  background: var(--bg-warm);
}
.post-article th, .post-article td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.post-article tbody tr:last-child td { border-bottom: 0; }
.post-article th {
  font-family: 'Jost', sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* Task lists */
.post-article .task-list { padding-left: 0; }
.post-article .task-list > .task-list-item { padding-left: 0; }
.post-article .task-list > .task-list-item::before,
.post-article .task-list-item::before { content: none; }
.post-article .task-list-item > .task-list-item-checkbox,
.post-article .task-list-item p > .task-list-item-checkbox {
  margin: 0.35rem 0.7rem 0 0;
  accent-color: var(--accent);
  pointer-events: none;
  vertical-align: top;
}

/* Details/Summary */
.post-article details {
  margin: 1.5rem 0;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}
.post-article summary {
  cursor: pointer;
  font-family: 'Jost', sans-serif;
}

/* Footnotes */
.post-article .footnote {
  margin-top: 2.2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  color: var(--color-muted);
  font-size: 0.92rem;
}
.post-article .footnote hr { display: none; }
.post-article .footnote ol {
  margin: 0.85rem 0 0;
  padding-left: 1.35rem;
}
.post-article .footnote li { margin-bottom: 0.75rem; }
.post-article .footnote p { margin: 0; }
.post-article .footnote-ref,
.post-article .footnote-backref {
  border-bottom: none;
  font-family: 'Jost', sans-serif;
}
.post-article .footnote-ref:hover,
.post-article .footnote-backref:hover { border-bottom: none; }
.post-article .footnote-backref { margin-left: 0.3rem; }

/* ── Search Modal ── */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  background: rgba(61, 54, 48, 0.15);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.search-modal.open { display: flex; }
.search-panel {
  width: min(620px, calc(100vw - 32px));
  max-height: 72vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
  padding: 16px;
}
.search-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font: inherit;
  font-family: 'Jost', sans-serif;
  background: transparent;
  color: var(--color);
  outline: none;
  transition: border-color 0.25s ease;
}
.search-input:focus {
  border-color: var(--accent);
}
.search-results {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}
.search-result {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  transition: all 0.25s ease;
}
.search-result:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.search-result-title {
  font-size: 17px;
  margin-bottom: 3px;
  color: var(--color);
}
.search-result-meta {
  font-size: 13px;
  color: var(--color-muted);
  margin-bottom: 5px;
  font-family: 'Jost', sans-serif;
}
.search-result .search-result-summary {
  color: var(--color-soft);
}
.search-empty {
  color: var(--color-muted);
  padding: 10px 2px 4px;
  font-family: 'Jost', sans-serif;
}

/* ── Footer ── */
.footer {
  color: var(--color-muted);
  font-size: 13px;
  margin-top: 1.5rem;
  padding-bottom: 2rem;
  font-family: 'Jost', sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  text-align: center;
  letter-spacing: 0.02em;
}
.home-page .footer {
  flex-shrink: 0;
}

/* ── Page content wrapper ── */
.page-content {
  position: relative;
  z-index: 1;
}

/* ── Reveal animation ── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1), transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Keyframes ── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ── Responsive ── */
@media (max-width: 980px) {
  .post-shell.has-toc {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "main" "sidebar";
    row-gap: 1.75rem;
  }
  .post-sidebar { position: static; top: auto; }
  .post-sidebar-title { margin: 0 0 0.7rem; }
  .post-article .toc { max-height: none; }
  .about-layout {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .about-gallery-wrap {
    min-height: 0;
    display: block;
  }
  .about-gallery {
    flex-direction: row;
    justify-content: flex-start;
    overflow-x: auto;
    gap: 0.8rem;
    padding-bottom: 0.5rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .about-gallery__item {
    flex: 0 0 200px;
    aspect-ratio: 3/2;
    width: auto;
    align-self: auto;
    transform: none !important;
    margin-left: 0 !important;
    scroll-snap-align: center;
  }
  .gallery-wall {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem 1.5rem;
  }
  .gw-painting--wide {
    grid-column: span 1;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 16px;
  }
  .container {
    width: min(100% - 32px, 680px);
    margin-top: 112px;
    padding: 0 0 2rem;
  }
  .post-page-body .post-container {
    width: min(100%, calc(100vw - 20px));
  }
  .post-page-body .post-body :is(h1, h2, h3, h4, h5, h6)[id] {
    scroll-margin-top: 12rem;
  }
  .nav {
    background: var(--nav-bg);
  }
  .nav-inner {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    padding: 10px 14px 12px;
    min-height: auto;
  }
  .brand {
    min-width: 0;
    margin-bottom: 0;
  }
  .serif-brand { font-size: 1.25rem; }
  .nav-links {
    grid-column: 1 / -1;
    justify-content: flex-start;
    gap: 18px;
    flex-wrap: nowrap;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a {
    flex: 0 0 auto;
    font-size: 14px;
    white-space: nowrap;
  }
  .nav-actions {
    justify-content: flex-end;
    gap: 10px;
  }
  .icon-link,
  .search-link,
  .theme-btn {
    width: 34px;
    height: 34px;
  }

  .home-hero {
    min-height: 100svh;
    padding: 6.2rem 1.25rem 3.4rem;
  }
  .home-hero__name {
    font-size: clamp(2.4rem, 10vw, 3.5rem);
  }
  .constellation-canvas {
    height: 300px;
  }
  .home-thinking {
    padding: 0 1.5rem 2rem;
  }
  .thinking-cards {
    height: 280px;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: visible;
    padding: 1.6rem 1.2rem 2rem;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .thinking-cards::-webkit-scrollbar { display: none; }
  .thinking-card {
    flex: 0 0 auto;
    width: 140px;
    height: 210px;
    margin-left: -30px;
    padding: 0.8rem;
    scroll-snap-align: center;
  }
  .thinking-card:first-child { margin-left: 0; }

  .gallery-wall {
    grid-template-columns: 1fr;
    gap: 1.8rem 0;
  }
  .gw-painting--wide {
    grid-column: span 1;
  }

  .post-article .toc {
    padding: 0.7rem;
    border-radius: var(--radius-md);
  }
  .post-article .toc a {
    padding: 0.4rem 0.55rem;
    font-size: 0.85rem;
  }
  .post-article .toc ul ul {
    margin-left: 0.5rem;
    padding-left: 0.6rem;
  }
  .post-article .post-body img {
    max-width: min(100%, 28rem);
    border-radius: var(--radius-md);
  }
  .post-article .post-gallery {
    --gallery-card-collapsed: clamp(14rem, calc(100vw - 4rem), 18rem);
    --gallery-card-expanded: clamp(14rem, calc(100vw - 4rem), 18rem);
    gap: 0.85rem;
  }
  .post-article .post-gallery--few {
    --gallery-card-collapsed: clamp(10rem, calc(50vw - 2rem), 14rem);
    --gallery-card-expanded: clamp(10rem, calc(50vw - 2rem), 14rem);
  }
  .post-article .post-gallery-item {
    height: clamp(13rem, 62vw, 17rem);
    border-radius: var(--radius-md);
  }
  .post-article .post-gallery-item img { border-radius: 0; }
  .post-article .post-gallery-item figcaption {
    padding: 0.85rem 0.85rem 0.9rem;
  }
  .post-article .post-gallery-caption-title { font-size: 0.92rem; }
  .post-article .post-gallery-caption-meta { font-size: 0.72rem; }
  .post-article table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .pj-grid {
    grid-template-columns: 1fr;
  }
  .pj-card--featured {
    grid-column: span 1;
  }

  .ferris-ride {
    transform: scale(0.55);
    transform-origin: center center;
    min-height: 300px;
    width: calc(100% / 0.55);
    margin-left: calc((100% - (100% / 0.55)) / 2);
  }

  .letter-paper {
    padding: 2rem 1.5rem 2rem 2.2rem;
  }
  .letter-pen {
    width: 36px;
    bottom: 10px;
    right: 8px;
  }
}

@media (max-width: 480px) {
  .container {
    width: min(100% - 24px, 420px);
    margin-top: 106px;
  }
  .nav-inner {
    padding-inline: 12px;
  }
  .brand-sign,
  .serif-brand {
    font-size: 1.08rem;
  }
  .nav-links {
    gap: 14px;
  }
  .nav-links a {
    font-size: 13px;
  }
  .icon-link,
  .search-link,
  .theme-btn {
    width: 32px;
    height: 32px;
  }
  .home-hero__tagline {
    max-width: 20rem;
  }
  .home-hero__subtitle {
    max-width: 18rem;
  }
  .constellation-label {
    margin-top: 2.5rem;
  }
  .constellation-canvas {
    min-height: 260px;
    height: 280px;
  }
  .thinking-card {
    width: 128px;
    height: 196px;
    margin-left: -24px;
  }
  .about-gallery__item {
    flex-basis: 72vw;
  }
  .letter-scene {
    margin-top: 1.5rem;
  }
  .letter-paper {
    padding: 1.7rem 1rem 1.6rem 1.55rem;
    min-height: 360px;
  }
  .letter-paper::before {
    left: 1.15rem;
  }
  .letter-link {
    width: 100%;
    align-items: flex-start;
    overflow-wrap: anywhere;
  }
  .search-modal {
    padding-top: 92px;
  }
  .search-panel {
    width: calc(100vw - 20px);
    max-height: calc(100svh - 112px);
    padding: 12px;
    border-radius: var(--radius-md);
  }
}

/* ── Post Image Lightbox ── */
.post-image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.post-image-lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.post-image-lightbox__img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
  transform: scale(0.92);
  transition: transform 0.25s ease;
}

.post-image-lightbox.active .post-image-lightbox__img {
  transform: scale(1);
}

.post-image-lightbox__close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s;
  line-height: 1;
  padding: 4px 8px;
}

.post-image-lightbox__close:hover {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .home-hero__name,
  .home-hero__tagline,
  .home-hero__subtitle,
  .home-hero__scroll-hint,
  .reveal {
    opacity: 1;
    transform: none;
    animation: none;
    transition: none;
  }
  .home-hero__cursor { animation: none; }
  .home-hero__scroll-hint svg { animation: none; }
  .contact-dot { animation: none; }
  .thinking-card { transform: none; }
  .thinking-card:hover { transform: none; }
  .pj-card,
  .pj-lang-bar { opacity: 1; transform: none; transition: none; }
  .pj-output { opacity: 1; transform: none; pointer-events: auto; }
  .pj-terminal__hint { animation: none; }
}
