/* ============================================================
   Feeeiyuuu
   Anthropic warmth x OpenAI restraint x 侘寂 wabi-sabi.
   Ivory paper, sumi ink, bengara clay; large serif calm,
   hairline structure, one imperfect circle.
   ============================================================ */

:root {
  color-scheme: light;
  --bg: #f9f7f0;
  --bg-elevated: #f4f0e6;
  --surface: rgba(243, 239, 230, 0.7);
  --surface-strong: #f2eee3;
  --text: #211d17;
  --text-soft: #44403a;
  --muted: #837a6b;
  --muted-soft: #b3aa97;
  --line: rgba(33, 29, 23, 0.11);
  --line-strong: rgba(33, 29, 23, 0.2);
  --accent: #b4633e;
  --accent-deep: #8a4424;
  --accent-soft: rgba(180, 99, 62, 0.1);
  --green: #6e7a5a;
  --code-bg: rgba(33, 29, 23, 0.055);
  --code-block-bg: #28231d;
  --code-block-text: #ece5d8;
  --selection-bg: rgba(180, 99, 62, 0.22);
  --shadow: 0 18px 50px rgba(33, 29, 23, 0.07);
  --shadow-soft: 0 1px 2px rgba(33, 29, 23, 0.05);
  --header-bg: rgba(249, 247, 240, 0.85);
  --content: 1180px;
  --narrow: 740px;
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --font-serif: "Iowan Old Style", "Charter", "Source Serif Pro", "Songti SC", "Noto Serif SC", Georgia, serif;
  --font-display: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "SF Pro Display", system-ui, sans-serif;
  --font-sans: "Aptos", "SF Pro Text", "Segoe UI", "Noto Sans SC", "PingFang SC", system-ui, sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fast: 150ms;
  --normal: 260ms;
  --slow: 520ms;
  --slower: 900ms;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #201c16;
  --bg-elevated: #262119;
  --surface: rgba(44, 38, 29, 0.7);
  --surface-strong: #2b261d;
  --text: #ece5d6;
  --text-soft: #d3cab8;
  --muted: #9d9381;
  --muted-soft: #6e6555;
  --line: rgba(236, 229, 214, 0.12);
  --line-strong: rgba(236, 229, 214, 0.22);
  --accent: #d9926b;
  --accent-deep: #e7b193;
  --accent-soft: rgba(217, 146, 107, 0.14);
  --green: #97a47c;
  --code-bg: rgba(236, 229, 214, 0.08);
  --code-block-bg: #15110c;
  --code-block-text: #ece5d6;
  --selection-bg: rgba(217, 146, 107, 0.3);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.25);
  --header-bg: rgba(32, 28, 22, 0.85);
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: clip;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Paper grain — a barely-there film of texture over everything */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.045;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="160" height="160"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="2" stitchTiles="stitch"/></filter><rect width="160" height="160" filter="url(%23n)"/></svg>');
}

[data-theme="dark"] body::after {
  opacity: 0.06;
}

body.nav-lock,
body.search-lock {
  overflow: hidden;
}

::selection {
  background: var(--selection-bg);
}

a {
  color: inherit;
  text-decoration: none;
}

p {
  margin: 0;
}

img,
svg {
  display: block;
}

img {
  max-width: 100%;
}

button,
input {
  font: inherit;
}

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

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

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 3px solid transparent;
  border-radius: var(--radius-pill);
  background-clip: content-box;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 500;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-strong);
  color: var(--text);
  transform: translateY(-140%);
  transition: transform var(--normal) var(--ease);
}

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

.reading-progress {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 300;
  width: 0;
  height: 2px;
  background: var(--accent);
}

.site-shell {
  width: min(calc(100% - 2.5rem), var(--content));
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: 4rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 calc(-1 * max(0px, (100vw - var(--content)) / 2));
  padding: 0.9rem clamp(1rem, 4vw, 2.25rem);
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-width: max-content;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.brand::before {
  content: "";
  width: 1.6rem;
  height: 1.6rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background-image: url(/media/logo.jpg);
  background-size: cover;
  background-position: center;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 auto 0 1.75rem;
}

.site-nav a {
  position: relative;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.005em;
  transition: color var(--fast), background var(--fast);
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0.7rem;
  right: 0.7rem;
  bottom: -0.2rem;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--slow) var(--ease);
}

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

.site-nav a:hover::after {
  transform: scaleX(1);
}

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

.site-nav a.active::after {
  background: var(--text);
  transform: scaleX(1);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.25rem;
  padding: 0 1.1rem;
  border: 1px solid var(--text);
  border-radius: var(--radius-pill);
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition:
    background var(--fast),
    color var(--fast),
    transform var(--fast) var(--ease);
}

.nav-cta:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.nav-cta:active {
  transform: translateY(1px);
}

.theme-toggle,
.search-trigger,
.hamburger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition:
    border-color var(--fast),
    color var(--fast),
    background var(--fast),
    transform var(--fast) var(--ease);
}

.theme-toggle:hover,
.search-trigger:hover,
.hamburger:hover {
  border-color: var(--line-strong);
  background: var(--surface-strong);
  color: var(--text);
}

.theme-toggle:active,
.search-trigger:active,
.hamburger:active {
  transform: translateY(1px);
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition:
    border-color var(--fast),
    color var(--fast),
    background var(--fast),
    transform var(--fast) var(--ease);
}

.lang-switch:hover {
  border-color: var(--line-strong);
  background: var(--surface-strong);
  color: var(--text);
}

.lang-switch:active {
  transform: translateY(1px);
}

.mobile-lang {
  margin-top: 0.5rem;
  padding: 0.4rem 1.1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.theme-toggle svg,
.search-trigger svg {
  width: 1rem;
  height: 1rem;
  transition: transform var(--slow) var(--ease);
}

.theme-toggle:hover svg {
  transform: rotate(40deg);
}

.search-trigger:hover svg {
  transform: scale(1.08);
}

.theme-toggle .icon-moon,
[data-theme="dark"] .theme-toggle .icon-sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: block;
}

.hamburger {
  display: none;
}

.hamburger span,
.hamburger span::before,
.hamburger span::after {
  width: 1rem;
  height: 1.5px;
  border-radius: var(--radius-pill);
  background: currentColor;
  transition: transform var(--fast) var(--ease), opacity var(--fast);
}

.hamburger span {
  position: relative;
}

.hamburger span::before,
.hamburger span::after {
  content: "";
  position: absolute;
  left: 0;
}

.hamburger span::before {
  top: -5px;
}

.hamburger span::after {
  top: 5px;
}

.hamburger.open span {
  background: transparent;
}

.hamburger.open span::before {
  transform: translateY(5px) rotate(45deg);
}

.hamburger.open span::after {
  transform: translateY(-5px) rotate(-45deg);
}

.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 2rem;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--normal) var(--ease);
}

.mobile-nav.open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-nav a {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 9vw, 3.4rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
}

main {
  animation: pageEnter var(--slower) var(--ease) both;
}

@keyframes pageEnter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* 墨入 — page openings settle into place like ink on paper */
@keyframes inkIn {
  from {
    opacity: 0;
    transform: translateY(14px);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@keyframes lineDraw {
  from {
    width: 0;
  }
  to {
    width: 1.7rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-copy > *,
  .page-intro > *,
  .article-header > *,
  .not-found > * {
    animation: inkIn 0.9s var(--ease) both;
  }

  .hero-copy > :nth-child(1),
  .page-intro > :nth-child(1),
  .article-header > :nth-child(1),
  .not-found > :nth-child(1) {
    animation-delay: 60ms;
  }

  .hero-copy > :nth-child(2),
  .page-intro > :nth-child(2),
  .article-header > :nth-child(2),
  .not-found > :nth-child(2) {
    animation-delay: 180ms;
  }

  .hero-copy > :nth-child(3),
  .page-intro > :nth-child(3),
  .article-header > :nth-child(3),
  .not-found > :nth-child(3) {
    animation-delay: 300ms;
  }

  .hero-copy > :nth-child(4),
  .page-intro > :nth-child(4),
  .article-header > :nth-child(4),
  .not-found > :nth-child(4) {
    animation-delay: 420ms;
  }

  .hero-copy > :nth-child(n + 5),
  .page-intro > :nth-child(n + 5),
  .article-header > :nth-child(n + 5),
  .not-found > :nth-child(n + 5) {
    animation-delay: 520ms;
  }

  .hero-card {
    animation: inkIn 1.1s var(--ease) 480ms both;
  }

  .eyebrow::before {
    animation: lineDraw 1.2s var(--ease) 250ms both;
  }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 1.7rem;
  height: 1px;
  background: var(--accent);
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.46fr);
  gap: clamp(2.25rem, 7vw, 5.5rem);
  align-items: end;
  padding: clamp(5rem, 12vw, 10rem) 0 clamp(3.5rem, 8vw, 6rem);
  border-bottom: 1px solid var(--line);
}

/* 円相 — one imperfect hand-drawn circle, bleeding off the page */
.hero::after {
  content: "";
  position: absolute;
  top: clamp(-9rem, -10vw, -4rem);
  right: -12rem;
  z-index: -1;
  width: clamp(22rem, 38vw, 36rem);
  aspect-ratio: 1;
  border: 1px solid var(--line-strong);
  border-radius: 51% 49% 53% 47% / 48% 52% 47% 53%;
  transform: rotate(-11deg);
  pointer-events: none;
}

.hero-copy {
  max-width: 49rem;
}

.hero h1,
.page-intro h1,
.article-header h1 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(3.4rem, 7.5vw, 6.5rem);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.02em;
}

.hero-text,
.page-intro p,
.article-summary {
  max-width: 40rem;
  margin-top: 1.6rem;
  color: var(--text-soft);
  font-size: clamp(1.1rem, 2.1vw, 1.3rem);
  line-height: 1.75;
}

.hero-actions,
.article-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 2.6rem;
  padding: 0.66rem 1.05rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 620;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition:
    transform var(--fast) var(--ease),
    background var(--fast),
    color var(--fast),
    border-color var(--fast);
}

.button svg {
  width: 1rem;
  height: 1rem;
  transition: transform var(--slow) var(--ease);
}

.button:hover svg {
  transform: translateX(3px);
}

.button:hover {
  border-color: var(--text);
  background: var(--surface-strong);
  transform: translateY(-1px);
}

.button-primary {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.button-primary:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.hero-card {
  position: relative;
  padding: clamp(1.35rem, 3vw, 1.75rem);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: clamp(1.35rem, 3vw, 1.75rem);
  width: 2rem;
  height: 1px;
  background: var(--accent);
  pointer-events: none;
  z-index: 1;
}

.card-label {
  position: relative;
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-card h2 {
  position: relative;
  margin: 0;
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 750;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.hero-card > p {
  position: relative;
  margin-top: 0.8rem;
  color: var(--text-soft);
}

.signal-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 1.35rem -0.25rem 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--line);
  overflow: hidden;
}

.signal-grid span {
  display: grid;
  gap: 0.2rem;
  padding: 0.85rem 0.7rem;
  background: color-mix(in srgb, var(--surface-strong) 88%, transparent);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.15;
  text-transform: uppercase;
}

.signal-grid strong {
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.meta-list {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.meta-list li {
  padding: 0.35rem 0.58rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.section-block {
  padding: clamp(3.5rem, 8vw, 6rem) 0;
  border-bottom: 1px solid var(--line);
}

.section-block:last-of-type {
  border-bottom: 0;
}

.section-title,
.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4.5vw, 3.3rem);
  font-weight: 780;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.7rem;
}

.section-head-left {
  display: grid;
  gap: 0.15rem;
}

.more {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 650;
  transition: color var(--fast);
}

.more svg {
  width: 1rem;
  height: 1rem;
  transition: transform var(--slow) var(--ease);
}

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

.more:hover svg {
  transform: translateX(4px);
}

.entry-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.entry-row {
  display: grid;
  grid-template-columns: 8.2rem minmax(0, 1fr) minmax(9rem, auto);
  gap: clamp(1rem, 4vw, 2.6rem);
  align-items: start;
  padding: 1.45rem 0;
  border-bottom: 1px solid var(--line);
  transition: padding var(--slow) var(--ease), color var(--fast);
}

.entry-row:hover {
  padding-left: 0.65rem;
}

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

.entry-meta {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.entry-status {
  color: var(--muted-soft);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.entry-body {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}

.entry-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  font-weight: 750;
  line-height: 1.22;
  letter-spacing: -0.015em;
  transition: color var(--fast);
}

.entry-summary {
  max-width: 44rem;
  color: var(--muted);
  font-size: 0.97rem;
  line-height: 1.62;
}

.entry-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.42rem;
  max-width: 18rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.65rem;
  padding: 0.18rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1;
  transition: color var(--fast), border-color var(--fast);
}

a.tag:hover {
  color: var(--text);
  border-color: var(--text);
}

.entry-empty {
  padding: 2rem 0;
  color: var(--muted);
  font-family: var(--font-mono);
}

.page-intro {
  padding: clamp(4rem, 9vw, 7rem) 0 clamp(2.5rem, 5vw, 3.5rem);
  border-bottom: 1px solid var(--line);
}

.page-intro h1 {
  font-size: clamp(3.1rem, 7vw, 5.6rem);
}

.collection-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.7rem;
}

.collection-meta span {
  padding: 0.34rem 0.62rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.article-shell {
  padding: clamp(3rem, 7vw, 5.5rem) 0 0;
}

.article-header {
  max-width: var(--narrow);
  padding-bottom: 2rem;
}

.article-header h1 {
  font-size: clamp(2.5rem, 5.5vw, 4.2rem);
  line-height: 1.12;
}

.back-link {
  display: inline-flex;
  margin-bottom: 2rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 650;
  transition: color var(--fast), transform var(--slow) var(--ease);
}

.back-link:hover {
  color: var(--accent);
  transform: translateX(-3px);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  margin-top: 1.5rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.article-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.reading-time svg {
  width: 0.9rem;
  height: 0.9rem;
}

.entry-cover-article {
  position: relative;
  min-height: clamp(14rem, 38vw, 28rem);
  margin: 1rem 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}

.entry-cover-article img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.entry-cover-placeholder {
  display: flex;
  align-items: flex-end;
  padding: clamp(1.2rem, 4vw, 2rem);
  background:
    radial-gradient(circle at 16% 28%, var(--accent-soft), transparent 22rem),
    var(--surface);
}

.entry-cover-placeholder span {
  position: relative;
  max-width: 42rem;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 4.5vw, 3.4rem);
  font-weight: 460;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, var(--narrow)) minmax(12rem, 14rem);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
  padding: clamp(2.4rem, 5vw, 3.8rem) 0 0;
}

.article-layout .article-body {
  grid-column: 1;
  grid-row: 1;
  padding-top: 0;
}

.article-layout .article-toc {
  grid-column: 2;
  grid-row: 1;
}

.article-toc {
  position: sticky;
  top: 5.5rem;
  display: grid;
  gap: 0.6rem;
  padding: 1rem 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  max-height: calc(100vh - 7rem);
  overflow: auto;
}

.toc-label {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-toc ol {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.article-toc a {
  color: var(--muted);
  line-height: 1.4;
  transition: color var(--fast);
}

.article-toc a:hover,
.article-toc li.active a {
  color: var(--text);
}

.article-toc .toc-l3 {
  padding-left: 0.85rem;
  font-size: 0.8rem;
}

.article-body {
  max-width: var(--narrow);
  padding: clamp(2.4rem, 5vw, 3.8rem) 0 0;
  color: var(--text-soft);
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 1.9vw, 1.15rem);
  line-height: 1.85;
  letter-spacing: 0.01em;
  transition: font-family var(--fast);
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4 {
  position: relative;
  margin: 2.7rem 0 0.85rem;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 740;
  line-height: 1.28;
  letter-spacing: -0.01em;
  scroll-margin-top: 5rem;
}

.heading-anchor {
  position: absolute;
  top: 0.05em;
  left: -1.1em;
  padding: 0 0.25em;
  color: var(--muted-soft);
  font-family: var(--font-mono);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
  transition: opacity var(--fast), color var(--fast);
}

.article-body h1:hover .heading-anchor,
.article-body h2:hover .heading-anchor,
.article-body h3:hover .heading-anchor,
.article-body h4:hover .heading-anchor,
.heading-anchor:focus-visible {
  opacity: 1;
  color: var(--accent);
}

.article-body h1 {
  font-size: 2.3rem;
}

.article-body h2 {
  font-size: 1.8rem;
}

.article-body h3 {
  font-size: 1.4rem;
}

.article-body h4 {
  font-size: 1.15rem;
}

.article-body p,
.article-body ul,
.article-body ol,
.article-body pre,
.article-body blockquote,
.article-body img {
  margin: 1.05rem 0;
}

.article-body ul,
.article-body ol {
  padding-left: 1.45rem;
}

.article-body li {
  margin: 0.36rem 0;
}

.article-body a {
  color: var(--text);
  text-decoration: none;
  background-image:
    linear-gradient(var(--muted-soft), var(--muted-soft)),
    linear-gradient(var(--accent), var(--accent));
  background-size: 100% 1px, 0% 1px;
  background-position: 0 100%, 0 100%;
  background-repeat: no-repeat;
  transition: background-size var(--slow) var(--ease), color var(--fast);
}

.article-body a:hover {
  color: var(--accent);
  background-size: 100% 1px, 100% 1px;
}

.article-body code {
  padding: 0.12rem 0.38rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--code-bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.84em;
}

.article-body pre {
  position: relative;
  overflow: auto;
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--code-block-bg);
  color: var(--code-block-text);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.65;
}

.article-body pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
}

.copy-code {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  padding: 0.25rem 0.55rem;
  border: 1px solid rgba(245, 239, 227, 0.18);
  border-radius: var(--radius-pill);
  background: rgba(245, 239, 227, 0.08);
  color: rgba(245, 239, 227, 0.78);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--fast), color var(--fast), border-color var(--fast);
}

.article-body pre:hover .copy-code,
.copy-code:focus-visible {
  opacity: 1;
}

.copy-code:hover {
  border-color: rgba(245, 239, 227, 0.4);
  color: rgba(245, 239, 227, 0.98);
}

/* Prism token colors — minimal, OpenAI doc inspired */
.token.comment,
.token.prolog,
.token.cdata { color: #7a7468; font-style: italic; }
.token.punctuation { color: #c2bba9; }
.token.namespace { opacity: 0.7; }
.token.property,
.token.tag,
.token.constant,
.token.symbol,
.token.deleted { color: #df7b57; }
.token.boolean,
.token.number { color: #e0a06d; }
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted { color: #8ac7a8; }
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string,
.token.variable { color: #c2bba9; }
.token.atrule,
.token.attr-value,
.token.keyword { color: #f1a07e; }
.token.function,
.token.class-name { color: #f5efe3; font-weight: 600; }
.token.regex,
.token.important { color: #df7b57; }
.token.important,
.token.bold { font-weight: 700; }
.token.italic { font-style: italic; }

.article-body blockquote {
  margin: 1.8rem 0;
  padding: 0.2rem 0 0.2rem 1.2rem;
  border-left: 2px solid var(--accent);
  color: var(--text-soft);
  font-size: 1.08rem;
  font-style: normal;
  line-height: 1.8;
}

.article-body blockquote p {
  margin: 0.5rem 0;
}

.article-body .table-wrap {
  overflow-x: auto;
  margin: 1.4rem 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface-strong) 90%, transparent);
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 0.95rem;
}

.article-body th,
.article-body td {
  padding: 0.7rem 0.95rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.article-body th {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

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

.article-body ul.task-list,
.article-body ol.task-list {
  padding-left: 0.4rem;
  list-style: none;
}

.article-body .task-item {
  display: grid;
  grid-template-columns: 1.2rem 1fr;
  gap: 0.55rem;
  align-items: start;
}

.article-body .task-item input[type="checkbox"] {
  margin-top: 0.55em;
  accent-color: var(--accent);
}

.article-body del {
  color: var(--muted);
  text-decoration-color: var(--muted-soft);
}

.article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 3rem 0 0;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.article-nav-cell {
  display: grid;
  gap: 0.35rem;
  padding: 1.05rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  transition: border-color var(--fast), transform var(--fast) var(--ease);
}

.article-nav-empty {
  visibility: hidden;
}

.article-nav-cell:hover {
  border-color: var(--text);
  transform: translateY(-1px);
}

.article-nav-older {
  text-align: right;
}

.article-nav-label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.article-nav-title {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 680;
  letter-spacing: 0.005em;
  line-height: 1.3;
}

.related-block {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.related-block .eyebrow {
  margin-bottom: 1.2rem;
}

.related-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.related-item {
  display: grid;
  gap: 0.35rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  transition: border-color var(--fast), transform var(--fast) var(--ease);
}

.related-item:hover {
  border-color: var(--text);
  transform: translateY(-1px);
}

.related-date {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.related-item h4 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 680;
  letter-spacing: 0.005em;
  line-height: 1.3;
}

.related-item p {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

@media (max-width: 1100px) {
  .article-layout {
    grid-template-columns: 1fr;
  }

  .article-toc {
    position: static;
    max-height: none;
  }

  .related-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .article-nav {
    grid-template-columns: 1fr;
  }

  .article-nav-older {
    text-align: left;
  }
}

.article-body img {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.article-body hr {
  height: 1px;
  margin: 2.4rem 0;
  border: 0;
  background: var(--line);
}

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 15vh 1rem 1rem;
  background: rgba(16, 16, 14, 0.36);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--normal) var(--ease);
}

.search-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.search-box {
  width: min(42rem, 100%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  overflow: hidden;
  transform: translateY(-0.6rem) scale(0.98);
  transition: transform var(--normal) var(--ease);
}

.search-overlay.open .search-box {
  transform: translateY(0) scale(1);
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
}

.search-input-wrap svg {
  width: 1.1rem;
  height: 1.1rem;
  color: var(--muted);
  flex: 0 0 auto;
}

.search-input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
}

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

.search-results {
  max-height: 26rem;
  padding: 0.5rem;
  overflow: auto;
}

.search-result-item {
  display: grid;
  gap: 0.2rem;
  padding: 0.85rem 0.9rem;
  border-radius: var(--radius-sm);
  transition: background var(--fast);
}

.search-result-item:hover,
.search-result-item.active {
  background: var(--bg);
}

.search-result-item span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.search-result-item h4 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 680;
  letter-spacing: 0.005em;
}

.search-result-item p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.search-result-item mark,
.search-result-item h4 mark {
  padding: 0 0.15em;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--text);
}

.search-empty {
  padding: 2.8rem 1rem;
  color: var(--muted);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.search-hint {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted-soft);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  min-height: 1.25rem;
  padding: 0 0.32rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.back-to-top {
  position: fixed;
  right: 1.3rem;
  bottom: 1.3rem;
  z-index: 130;
  display: grid;
  place-items: center;
  width: 2.45rem;
  height: 2.45rem;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--muted);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.5rem);
  transition:
    opacity var(--normal) var(--ease),
    transform var(--normal) var(--ease),
    color var(--fast),
    border-color var(--fast);
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  border-color: var(--text);
  color: var(--text);
}

.back-to-top svg {
  width: 1rem;
  height: 1rem;
}

.site-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

.footer-muted {
  margin-top: 0.25rem;
  color: var(--muted-soft);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem 0.9rem;
}

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

.not-found {
  display: grid;
  place-items: center;
  min-height: 64vh;
  padding: clamp(4rem, 10vw, 7rem) 1rem;
  text-align: center;
}

.not-found h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(5.5rem, 16vw, 10rem);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.03em;
}

.not-found p:not(.eyebrow) {
  max-width: 28rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.not-found .button {
  margin-top: 1rem;
}

.not-found-recent {
  margin-top: 3rem;
  width: min(28rem, 100%);
  text-align: left;
}

.not-found-recent ul {
  display: grid;
  gap: 0.45rem;
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
}

.not-found-recent a {
  display: block;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.02rem;
  transition: border-color var(--fast);
}

.not-found-recent a:hover {
  border-color: var(--text);
}

.tag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.7rem;
}

.tag-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  transition: border-color var(--fast), transform var(--fast) var(--ease);
}

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

.tag-card-name {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 680;
  letter-spacing: 0.005em;
}

.tag-card-count {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

/* Scroll reveal — only hides content when JS is on and motion is allowed,
   so no-JS and reduced-motion visitors always see everything. */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(18px);
    filter: blur(5px);
    transition:
      opacity var(--slower) var(--ease),
      transform var(--slower) var(--ease),
      filter var(--slower) var(--ease);
    will-change: opacity, transform, filter;
  }

  .js .reveal.in {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

/* Archive timeline */
.archive-year {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: clamp(1rem, 5vw, 3rem);
  padding: clamp(1.6rem, 3.5vw, 2.6rem) 0;
  border-top: 1px solid var(--line);
}

.archive-year:first-child {
  border-top: 0;
  padding-top: 0;
}

.archive-year-head {
  position: sticky;
  top: 5.5rem;
  align-self: start;
  display: grid;
  gap: 0.3rem;
  height: max-content;
}

.archive-year-num {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.2vw, 2.8rem);
  font-weight: 720;
  line-height: 1;
  letter-spacing: -0.01em;
}

.archive-year-count {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.archive-items {
  display: grid;
}

.archive-item {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: baseline;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
  transition: padding var(--slow) var(--ease);
}

.archive-item:hover {
  padding-left: 0.6rem;
}

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

.archive-date {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.archive-title {
  min-width: 0;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 1.9vw, 1.35rem);
  font-weight: 680;
  line-height: 1.4;
  letter-spacing: 0.005em;
  transition: color var(--fast);
}

.archive-kind {
  color: var(--muted-soft);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-card {
    max-width: 38rem;
  }

  .entry-row {
    grid-template-columns: 7.5rem minmax(0, 1fr);
  }

  .entry-tags {
    grid-column: 2;
    justify-content: flex-start;
    max-width: none;
  }
}

@media (max-width: 880px) {
  .site-nav,
  .lang-switch {
    display: none;
  }

  .hamburger {
    display: inline-flex;
  }
}

@media (max-width: 700px) {
  .site-shell {
    width: min(calc(100% - 1.35rem), var(--content));
    padding-bottom: 2.5rem;
  }

  .site-header {
    padding: 0.75rem 0.8rem;
  }

  .nav-cta {
    display: none;
  }

  .hero {
    padding-top: 3.4rem;
  }

  .hero-actions,
  .article-links {
    width: 100%;
  }

  .button {
    flex: 1;
  }

  .signal-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }

  .entry-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 1.25rem 0;
  }

  .entry-row:hover {
    padding-left: 0;
  }

  .entry-meta {
    display: flex;
    gap: 0.75rem;
  }

  .entry-tags {
    grid-column: auto;
  }

  .page-intro {
    padding-top: 3.4rem;
  }

  .article-shell {
    padding-top: 3rem;
  }

  .article-body {
    font-size: 1.05rem;
  }

  .search-overlay {
    padding-top: 5rem;
  }

  .site-footer {
    align-items: start;
    flex-direction: column;
  }

  .footer-links {
    justify-content: flex-start;
  }

  .archive-year {
    grid-template-columns: 1fr;
    gap: 0.85rem;
    padding: 1.4rem 0;
  }

  .archive-year-head {
    position: static;
    display: flex;
    align-items: baseline;
    gap: 0.7rem;
  }

  .archive-item {
    grid-template-columns: 5rem minmax(0, 1fr);
    gap: 0.7rem;
  }

  .archive-item:hover {
    padding-left: 0;
  }

  .archive-kind {
    display: none;
  }
}

/* ── Math (KaTeX, pre-rendered at build time) ──────────────── */
.katex-display {
  margin: 1.4rem 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.2rem 0;
}

/* ── 小さな生き物 — quiet companions ───────────────────────── */
.fauna {
  position: absolute;
  z-index: -1;
  pointer-events: none;
  color: var(--text);
}

.fauna svg {
  width: 100%;
  height: 100%;
}

/* Koi — drifts across the hero pond about twice a minute */
.fauna-koi {
  bottom: clamp(4rem, 9vw, 7rem);
  left: 0;
  width: 58px;
  height: 29px;
  color: var(--accent);
  opacity: 0;
  animation: koiPass 34s linear 2s infinite;
}

.fauna-koi svg {
  animation: koiWag 1.7s ease-in-out infinite;
}

@keyframes koiPass {
  0% {
    transform: translate(-6vw, 0) rotate(4deg);
    opacity: 0;
  }
  6% {
    opacity: 0.5;
  }
  30% {
    transform: translate(22vw, -2.5rem) rotate(-8deg);
  }
  55% {
    transform: translate(46vw, -1rem) rotate(6deg);
  }
  80% {
    transform: translate(70vw, -3rem) rotate(-4deg);
    opacity: 0.5;
  }
  100% {
    transform: translate(88vw, -2rem) rotate(2deg);
    opacity: 0;
  }
}

@keyframes koiWag {
  0%,
  100% {
    transform: rotate(2.5deg);
  }
  50% {
    transform: rotate(-2.5deg);
  }
}

/* Dragonfly — perched by the enso, trembles its wings now and then */
.fauna-dragonfly {
  top: clamp(1rem, 4vw, 3.5rem);
  right: clamp(2rem, 12vw, 11rem);
  width: 44px;
  height: 30px;
  color: var(--muted);
  opacity: 0.85;
  animation: perchTremble 9s var(--ease) infinite;
}

.fauna-dragonfly .wing {
  transform-box: fill-box;
  transform-origin: center;
  animation: wingFlutter 9s ease-in-out infinite;
}

@keyframes perchTremble {
  0%,
  86%,
  96%,
  100% {
    transform: rotate(0);
  }
  88% {
    transform: rotate(-2deg) translateY(-1px);
  }
  92% {
    transform: rotate(1.5deg);
  }
}

@keyframes wingFlutter {
  0%,
  84%,
  100% {
    transform: scaleY(1);
  }
  86%,
  90%,
  94% {
    transform: scaleY(0.35);
  }
  88%,
  92% {
    transform: scaleY(1);
  }
}

/* Sparrow — sits on the footer hairline, pecks occasionally */
.site-footer {
  position: relative;
}

.fauna-sparrow {
  top: -23px;
  right: 16%;
  z-index: 0;
  width: 34px;
  height: 23px;
  color: var(--text);
  opacity: 0.9;
  transform-origin: 50% 100%;
  animation: sparrowPeck 7s var(--ease) infinite;
}

/* Dog — stands on the footer hairline, watching the sparrow */
.fauna-dog {
  top: 1px;
  left: 10%;
  z-index: 0;
  width: 64px;
  transform: translateY(-100%);
  opacity: 0.9;
}

.fauna-dog img {
  display: block;
  width: 100%;
  height: auto;
}

[data-theme="dark"] .fauna-dog img {
  filter: invert(1) sepia(0.3);
}

.fauna .eye {
  fill: var(--bg);
}


@keyframes sparrowPeck {
  0%,
  78%,
  84%,
  90%,
  100% {
    transform: none;
  }
  81% {
    transform: rotate(-9deg) translateY(1px);
  }
  87% {
    transform: rotate(-7deg) translateY(1px);
  }
}


/* Butterfly — a hand-drawn flutter that meanders across the
   collection intro, three motion layers deep:
   journey (slow zigzag) x bob (quick rise-dip) x wingbeat */
.page-intro {
  position: relative;
}

.fauna-butterfly {
  top: 52%;
  left: 0;
  width: 36px;
  height: 26px;
  color: var(--accent);
  opacity: 0;
  animation: butterflyFly 26s linear 1s infinite;
}

.b-bob {
  display: block;
  width: 100%;
  height: 100%;
  animation: bBob 1.1s ease-in-out infinite;
}

.fauna-butterfly .wing {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: wingBeat 0.55s ease-in-out infinite;
}

.fauna-butterfly g[opacity] .wing {
  animation-delay: -0.07s;
}

@keyframes wingBeat {
  0%,
  100% {
    transform: scaleY(1);
  }
  50% {
    transform: scaleY(0.22);
  }
}

@keyframes bBob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-0.45rem);
  }
}

@keyframes butterflyFly {
  0% {
    transform: translate(-6vw, 0.5rem) rotate(6deg);
    opacity: 0;
  }
  5% {
    opacity: 0.8;
  }
  16% {
    transform: translate(11vw, -2rem) rotate(-8deg);
  }
  30% {
    transform: translate(24vw, 0.4rem) rotate(7deg);
  }
  46% {
    transform: translate(40vw, -3rem) rotate(-7deg);
  }
  60% {
    transform: translate(52vw, -0.8rem) rotate(8deg);
  }
  76% {
    transform: translate(67vw, -3.4rem) rotate(-6deg);
  }
  94% {
    opacity: 0.8;
  }
  100% {
    transform: translate(84vw, -1.4rem) rotate(4deg);
    opacity: 0;
  }
}

@media (max-width: 980px) {
  .fauna-koi,
  .fauna-dragonfly {
    display: none;
  }
}
