:root {
  --bg: #eef1f4;
  --bg-elevated: #e3e8ed;
  --bg-card: #fafbfc;
  --text: #2b333b;
  --text-muted: #687583;
  --border: #d4dce3;
  --accent: #5b7488;
  --accent-hover: #41596b;
  --accent-soft: rgba(91, 116, 136, 0.12);
  --shadow: 0 1px 2px rgba(16, 22, 26, 0.05), 0 6px 20px rgba(16, 22, 26, 0.06);
  --shadow-hover: 0 4px 10px rgba(16, 22, 26, 0.08), 0 16px 40px rgba(16, 22, 26, 0.12);
  --gradient: linear-gradient(135deg, #7e93a4 0%, #b4c2cd 100%);
  --max-width: 1080px;
  --content-width: 720px;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-xs: 5px;
  --on-accent: #fff;
  --fs-meta: 0.8rem;
  --ratio-thumb: 16 / 10;
  --ratio-cover: 16 / 9;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
    "Noto Sans JP", Meiryo, sans-serif;
  --font-serif: Georgia, "Times New Roman", "Hiragino Mincho ProN",
    "Yu Mincho", "Noto Serif JP", serif;
  --font-mono: "SFMono-Regular", "Menlo", "Consolas", monospace;
}

[data-theme="dark"] {
  --bg: #11161b;
  --bg-elevated: #1b242d;
  --bg-card: #161d25;
  --text: #e2e8ed;
  --text-muted: #909da8;
  --border: #2a333d;
  --accent: #8fabbe;
  --accent-hover: #afc6d6;
  --accent-soft: rgba(143, 171, 190, 0.16);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 4px 10px rgba(0, 0, 0, 0.45), 0 16px 40px rgba(0, 0, 0, 0.5);
  --gradient: linear-gradient(135deg, #3c4d5a 0%, #6a8392 100%);
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  height: 64px;
}
.site-title {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.site-title:hover {
  color: var(--accent);
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex: 1;
}
.site-nav .nav-link {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
}
.site-nav .nav-link:hover,
.site-nav .nav-link-active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.site-nav .search-box {
  margin-left: auto;
}

/* Category dropdown (native <details>) */
.nav-dropdown {
  position: relative;
}
.nav-dropdown-toggle {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
  user-select: none;
}
.nav-dropdown-toggle::-webkit-details-marker {
  display: none;
}
.nav-dropdown-toggle::after {
  content: "";
  width: 0.45em;
  height: 0.45em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.18s ease;
}
.nav-dropdown[open] .nav-dropdown-toggle::after {
  transform: rotate(-135deg) translateY(0);
}
.nav-dropdown-toggle:hover,
.nav-dropdown-active .nav-dropdown-toggle {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  min-width: 200px;
  display: grid;
  gap: 0.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  padding: 0.4rem;
  z-index: 30;
}
.nav-dropdown-menu a {
  display: block;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
}
.nav-dropdown-menu a:hover {
  background: var(--bg-elevated);
  color: var(--accent);
}
.header-tools {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Mobile nav toggle (hamburger) */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 38px;
  height: 38px;
  cursor: pointer;
}
.nav-toggle-icon,
.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: "";
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle-icon {
  position: relative;
}
.nav-toggle-icon::before {
  position: absolute;
  left: 0;
  top: -5px;
}
.nav-toggle-icon::after {
  position: absolute;
  left: 0;
  top: 5px;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-icon {
  background: transparent;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before {
  transform: translateY(5px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::after {
  transform: translateY(-5px) rotate(-45deg);
}
.search-box {
  position: relative;
}
#search-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  width: 170px;
  transition: width 0.2s ease, border-color 0.2s ease;
}
#search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  width: 220px;
}
.search-results {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 340px;
  max-width: 80vw;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  padding: 0.4rem;
}
.search-results a {
  display: block;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--text);
}
.search-results a:hover {
  background: var(--bg-elevated);
}
.search-results .sr-title {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
}
.search-results .sr-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.search-results .sr-empty {
  padding: 0.7rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.theme-toggle {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: border-color 0.2s ease, transform 0.15s ease;
}
.theme-toggle:hover {
  border-color: var(--accent);
  transform: rotate(-15deg);
}

/* ---------- Main ---------- */
main.container {
  padding-top: 2.5rem;
  padding-bottom: 4rem;
}
.hero {
  padding: 0.5rem 0 2rem;
  margin-bottom: 2.5rem;
  border-bottom: 2px solid var(--text);
}
.hero h1 {
  font-family: var(--font-serif);
  font-size: 2.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
  color: var(--text);
}
.hero p {
  color: var(--text-muted);
  margin: 0;
  max-width: 40rem;
}

/* ---------- Home layout ---------- */
.home-layout {
  display: block;
}
.block {
  margin-bottom: 2.5rem;
}
.block-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.block-title::before {
  content: "";
  width: 4px;
  height: 1.05em;
  border-radius: 2px;
  background: var(--gradient);
}
.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.block-head .block-title {
  margin-bottom: 0;
}
.feed-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

/* View toggle (card / list) */
.view-toggle {
  display: inline-flex;
  gap: 0.15rem;
  padding: 0.2rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.view-btn svg {
  fill: currentColor;
}
.view-btn:hover {
  color: var(--text);
}
.view-btn[aria-pressed="true"] {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: var(--shadow);
}

/* ---------- Post feed (blog list) ---------- */
.post-feed {
  list-style: none;
  padding: 0;
  margin: 0;
}
.post-item {
  display: flex;
  gap: 1.75rem;
  padding: 1.85rem 0;
  border-bottom: 1px solid var(--border);
}
.post-item:first-child {
  padding-top: 0;
}
.post-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.post-item-meta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: var(--fs-meta);
  color: var(--text-muted);
}
.post-item-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.post-item-title a {
  color: var(--text);
}
.post-item-title a:hover {
  color: var(--accent);
}
.post-item-summary {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-item-thumb {
  flex: none;
  align-self: flex-start;
  width: 200px;
  aspect-ratio: var(--ratio-thumb);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elevated);
}
.post-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.post-item:hover .post-item-thumb img {
  transform: scale(1.04);
}

/* Card view overrides (same markup, different layout) */
[data-view="card"] .post-feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
[data-view="card"] .post-item {
  flex-direction: column;
  gap: 0;
  padding: 0;
  border-bottom: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
[data-view="card"] .post-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
[data-view="card"] .post-item-thumb {
  order: -1;
  align-self: stretch;
  width: 100%;
  aspect-ratio: var(--ratio-cover);
  border-radius: 0;
}
[data-view="card"] .post-item-body {
  padding: 1.1rem 1.2rem 1.3rem;
  gap: 0.5rem;
}
[data-view="card"] .post-item-title {
  font-size: 1.15rem;
  line-height: 1.45;
}
[data-view="card"] .post-item-summary {
  font-size: 0.9rem;
  line-height: 1.7;
  -webkit-line-clamp: 3;
}

.post-cat {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.1rem 0.65rem;
  font-size: 0.74rem;
  font-weight: 600;
}
.post-cat:hover {
  color: var(--accent-hover);
}
.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0;
  margin: 0.2rem 0 0;
}
.tag-list a {
  font-size: 0.76rem;
  color: var(--text-muted);
}
.tag-list a:hover {
  color: var(--accent);
}

/* ---------- Popular & Categories sections ---------- */
.popular,
.categories {
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.popular-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: rank;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0 1.8rem;
}
.popular-list li {
  counter-increment: rank;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
}
.popular-list li:last-child {
  border-bottom: none;
}
.popular-list li::before {
  content: counter(rank);
  flex: none;
  width: 1.4rem;
  height: 1.4rem;
  line-height: 1.4rem;
  text-align: center;
  border-radius: 50%;
  background: var(--gradient);
  color: var(--on-accent);
  font-size: 0.75rem;
  font-weight: 700;
}
.popular-list a {
  color: var(--text);
  font-size: 0.92rem;
}
.popular-list a:hover {
  color: var(--accent);
}
.category-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}
.category-list a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.9rem;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.category-list a:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.cat-count {
  color: var(--text-muted);
  font-size: 0.78rem;
  background: var(--bg-elevated);
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
}

/* ---------- Article ---------- */
.article,
.page,
.listing,
.magazine-detail,
.not-found {
  max-width: var(--content-width);
  margin: 0 auto;
}

/* ---------- 404 ---------- */
.not-found {
  padding: 3rem 0 4rem;
  text-align: center;
}
.not-found-code {
  font-family: var(--font-serif);
  font-size: clamp(4rem, 18vw, 7rem);
  font-weight: 700;
  line-height: 1;
  margin: 0 0 1rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.04em;
}
.not-found-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 0.75rem;
}
.not-found-lead {
  color: var(--text-muted);
  margin: 0 0 1.75rem;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}
.not-found-actions {
  margin: 0 0 2.5rem;
}
.not-found-home {
  display: inline-block;
  padding: 0.55rem 1.35rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--bg-card);
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}
.not-found-home:hover {
  background: var(--accent-hover);
  color: var(--bg-card);
}
.not-found-nav {
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.not-found-nav-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}
.not-found-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.25rem;
}
.not-found-links a {
  font-size: 0.95rem;
}
.article-header {
  margin-bottom: 1.5rem;
}
.post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: var(--fs-meta);
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}
.article-title,
.listing-header h1 {
  font-family: var(--font-serif);
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 0.4rem 0;
}
.article-cover {
  margin: 1.5rem 0 2rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.article-cover img {
  width: 100%;
  display: block;
  aspect-ratio: var(--ratio-cover);
  object-fit: cover;
}
.article-body {
  font-size: 1.02rem;
}
.article-body > * + * {
  margin-top: 1.2rem;
}
.article-body h2 {
  margin-top: 2.4rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-serif);
  font-size: 1.5rem;
}
.article-body h3 {
  margin-top: 1.8rem;
  font-family: var(--font-serif);
  font-size: 1.2rem;
}
.article-body p {
  line-height: 1.9;
}
.article-body figure {
  margin: 1.6rem 0;
  text-align: center;
}
.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}
.article-body figcaption {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}
.article-body pre {
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.6;
  box-shadow: var(--shadow);
}
.article-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
}
.article-body :not(pre) > code {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.1rem 0.4rem;
}
.article-body blockquote {
  margin: 1.4rem 0;
  padding: 0.6rem 1.1rem;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.article-body blockquote p {
  margin: 0;
}
.article-body ul,
.article-body ol {
  padding-left: 1.4rem;
}
.article-body li + li {
  margin-top: 0.3rem;
}
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.4rem 0;
  font-size: 0.92rem;
  overflow: hidden;
  border-radius: var(--radius-sm);
}
.article-body th,
.article-body td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.8rem;
  text-align: left;
}
.article-body th {
  background: var(--bg-elevated);
  font-weight: 700;
}
.article-body a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- AboutMe ---------- */
.about-page {
  max-width: var(--content-width);
  margin: 0 auto;
}
.about-hero {
  margin-bottom: 2.5rem;
}
.about-body {
  font-size: 1.02rem;
}
.about-body > * + * {
  margin-top: 1.2rem;
}
.about-body h2 {
  margin-top: 2.4rem;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.about-body h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 1.05em;
  border-radius: 2px;
  background: var(--gradient);
  flex-shrink: 0;
}
.about-body h3 {
  margin-top: 1.6rem;
  font-family: var(--font-serif);
  font-size: 1.1rem;
}
.about-body p {
  line-height: 1.9;
}
.about-body ul,
.about-body ol {
  padding-left: 1.4rem;
}
.about-body li + li {
  margin-top: 0.3rem;
}
.about-body a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.related {
  margin-top: 3rem;
  padding: 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.related h2 {
  margin: 0 0 0.8rem;
  font-family: var(--font-serif);
  font-size: 1.1rem;
}
.related-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.related-list li {
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--border);
}
.related-list li:last-child {
  border-bottom: none;
}

/* ---------- Listing header ---------- */
.listing-header {
  margin-bottom: 2rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
}
.listing-kind {
  color: var(--accent);
  font-size: var(--fs-meta);
  font-weight: 700;
  margin: 0;
}
.listing-desc {
  color: var(--text-muted);
  margin: 0.5rem 0;
}
.listing-count {
  color: var(--text-muted);
  font-size: var(--fs-meta);
  margin: 0;
}
.empty {
  color: var(--text-muted);
}
.block-page {
  font-size: var(--fs-meta);
  font-weight: 500;
  color: var(--text-muted);
}
.block-lead {
  margin: -0.5rem 0 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.pagination-prev,
.pagination-next {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--accent);
}
.pagination-disabled {
  color: var(--text-muted);
  opacity: 0.5;
}
.pagination-pages {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0;
  margin: 0;
}
.pagination-pages a,
.pagination-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
.pagination-pages a {
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.pagination-pages a:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.pagination-current {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

/* ---------- Magazine ---------- */
.magazines-home {
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.magazine-card-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.magazine-card-list a {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  color: var(--text);
}
.magazine-card-list a:hover .magazine-card-name {
  color: var(--accent);
}
.magazine-card-name {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
}
.magazine-card-count {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.magazine-card-desc {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.magazine-more {
  margin: 1rem 0 0;
  font-size: 0.9rem;
}
.magazine-index-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.magazine-index-item {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}
.magazine-index-item:first-child {
  padding-top: 0;
}
.magazine-index-item a {
  color: var(--text);
}
.magazine-index-item a:hover .magazine-index-title {
  color: var(--accent);
}
.magazine-index-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.4rem;
  display: inline;
}
.magazine-index-count {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}
.magazine-index-desc {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}
.magazine-article-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: mag;
}
.magazine-article-item {
  display: flex;
  gap: 1.25rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.magazine-article-num {
  flex: none;
  width: 2rem;
  height: 2rem;
  line-height: 2rem;
  text-align: center;
  border-radius: 50%;
  background: var(--gradient);
  color: var(--on-accent);
  font-size: 0.85rem;
  font-weight: 700;
}
.magazine-article-body {
  flex: 1;
  min-width: 0;
}
.magazine-article-title {
  margin: 0 0 0.4rem;
  font-family: var(--font-serif);
  font-size: 1.25rem;
}
.magazine-article-title a {
  color: var(--text);
}
.magazine-article-title a:hover {
  color: var(--accent);
}
.magazine-article-summary {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
}
.magazine-article-thumb {
  flex: none;
  width: 120px;
  aspect-ratio: var(--ratio-thumb);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.magazine-article-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.magazine-article-item:hover .magazine-article-thumb img {
  transform: scale(1.04);
}
.magazine-nav {
  margin-top: 2.5rem;
  padding: 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.magazine-nav-label {
  margin: 0 0 0.75rem;
  font-size: var(--fs-meta);
}
.magazine-nav-label a {
  font-weight: 700;
}
.magazine-nav-pos {
  color: var(--text-muted);
  margin-left: 0.5rem;
}
.magazine-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  font-size: 0.9rem;
}
.magazine-nav-prev,
.magazine-nav-next {
  color: var(--accent);
  font-weight: 500;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

/* ---------- Notes (feed, aligned with post-feed) ---------- */
.notes-page {
  max-width: var(--content-width);
  margin: 0 auto;
}
.note-feed {
  list-style: none;
  padding: 0;
  margin: 0;
}
.note-item {
  padding: 1.85rem 0;
  border-bottom: 1px solid var(--border);
}
.note-item:first-child {
  padding-top: 0;
}
.note-item-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.note-item-meta {
  font-size: var(--fs-meta);
  color: var(--text-muted);
}
.note-item-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.note-item-title a {
  color: var(--text);
}
.note-item-title a:hover {
  color: var(--accent);
}
.note-item-summary {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.note-single {
  max-width: var(--content-width);
  margin: 0 auto;
}
.note-nav {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.note-nav-back {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .popular-list {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  .nav-toggle {
    display: inline-flex;
  }
  .header-inner {
    gap: 0.6rem;
  }
  .site-title {
    flex: 1;
  }
  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 0.8rem 1.25rem 1rem;
    display: none;
  }
  .site-nav.open {
    display: flex;
  }
  .site-nav .search-box {
    margin-left: 0;
    order: -1;
  }
  #search-input,
  #search-input:focus {
    width: 100%;
  }
  .search-results {
    width: 100%;
    max-width: none;
    left: 0;
    right: 0;
  }
  .nav-dropdown {
    width: 100%;
  }
  .nav-dropdown-menu {
    position: static;
    min-width: 0;
    border: none;
    box-shadow: none;
    padding: 0.2rem 0 0.2rem 0.85rem;
  }
}
@media (max-width: 640px) {
  .hero h1 {
    font-size: 1.9rem;
  }
  .not-found-title {
    font-size: 1.45rem;
  }
  .article-title,
  .listing-header h1 {
    font-size: 1.6rem;
  }
  [data-view="list"] .post-item {
    flex-direction: column;
    gap: 0.9rem;
  }
  [data-view="list"] .post-item-thumb {
    order: -1;
    width: 100%;
    aspect-ratio: var(--ratio-cover);
  }
  [data-view="list"] .post-item-title,
  .note-item-title {
    font-size: 1.3rem;
  }
}

/* ---------- TOC ---------- */
.toc {
  margin: 1.5rem 0 2rem;
  padding: 1rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}
.toc::before {
  content: "目次";
  display: block;
  font-weight: 700;
  font-family: var(--font-serif);
  margin-bottom: 0.6rem;
  font-size: 0.92rem;
}
.toc-list {
  margin: 0;
  padding: 0 0 0 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.toc-item a {
  color: var(--text-muted);
  text-decoration: none;
}
.toc-item a:hover {
  color: var(--accent);
}
.toc-item-h3 {
  padding-left: 1rem;
  font-size: 0.85rem;
}

/* ---------- Share buttons ---------- */
.share-buttons {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.share-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  height: 2.2rem;
  padding: 0 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  transition: opacity 0.15s ease;
}
.share-btn:hover {
  opacity: 0.82;
}
.share-x {
  background: #000;
  color: #fff;
}
[data-theme="dark"] .share-x {
  background: #fff;
  color: #000;
}
.share-hatena {
  background: #00a4de;
  color: #fff;
}
.copy-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
  margin-left: 0.2rem;
}
.copy-page-btn:hover {
  color: var(--accent);
  background: var(--accent-soft);
}
.copy-page-btn.copied {
  color: var(--accent);
  background: var(--accent-soft);
}
.copy-page-icon--check {
  display: none;
}
.copy-page-btn.copied .copy-page-icon--default {
  display: none;
}
.copy-page-btn.copied .copy-page-icon--check {
  display: block;
}

/* ---------- Code copy button ---------- */
.code-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-family: var(--font-sans);
  font-weight: 600;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}
pre:hover .code-copy-btn,
.code-copy-btn:focus {
  opacity: 1;
}
.code-copy-btn.copied {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  opacity: 1;
}
