:root {
  --bg: #0b0e14;
  --card: #111827;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --link: #93c5fd;
  --border: rgba(255, 255, 255, 0.12);
  --radius: 14px;
}

:root[data-theme="light"] {
  --bg: #f7f7f4;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --link: #2563eb;
  --border: rgba(0, 0, 0, 0.12);
}

:root[data-theme="light"] .site-header {
  background: rgba(247, 247, 244, 0.9);
}

:root[data-theme="light"] .hero::after {
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0),
    rgba(0, 0, 0, 0.18)
  );
}

:root[data-theme="light"] .panel,
:root[data-theme="light"] .toc,
:root[data-theme="light"] .series-box,
:root[data-theme="light"] .info-card {
  background: rgba(0, 0, 0, 0.03);
}

:root[data-theme="light"] .badge,
:root[data-theme="light"] .btn,
:root[data-theme="light"] .chip,
:root[data-theme="light"] .search-input {
  background: rgba(0, 0, 0, 0.04);
}
:root[data-theme="light"] .btn:hover,
:root[data-theme="light"] .chip:hover {
  background: rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .search-results {
  background: #ffffff;
}

:root[data-theme="light"] .site-footer {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.03), rgba(0, 0, 0, 0));
}
:root[data-theme="light"] .footer-line {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0));
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f7f7f4;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --link: #2563eb;
    --border: rgba(0, 0, 0, 0.12);
  }

  :root:not([data-theme]) .site-header {
    background: rgba(247, 247, 244, 0.9);
  }

  :root:not([data-theme]) .hero::after {
    background: linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0),
      rgba(0, 0, 0, 0.18)
    );
  }

  :root:not([data-theme]) .panel,
  :root:not([data-theme]) .toc,
  :root:not([data-theme]) .series-box,
  :root:not([data-theme]) .info-card {
    background: rgba(0, 0, 0, 0.03);
  }

  :root:not([data-theme]) .badge,
  :root:not([data-theme]) .btn,
  :root:not([data-theme]) .chip,
  :root:not([data-theme]) .search-input {
    background: rgba(0, 0, 0, 0.04);
  }
  :root:not([data-theme]) .btn:hover,
  :root:not([data-theme]) .chip:hover {
    background: rgba(0, 0, 0, 0.08);
  }

  :root:not([data-theme]) .search-results {
    background: #ffffff;
  }

  :root:not([data-theme]) .site-footer {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.03), rgba(0, 0, 0, 0));
  }
  :root:not([data-theme]) .footer-line {
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0));
  }
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
body {
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    "Noto Sans JP",
    sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ヘッダー */
.site-header {
  position: sticky;
  top: 0;
  background: rgba(11, 14, 20, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* メインコンテナ */
main {
  padding: 28px 0 56px;
  flex: 1;
}
.container {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
}
.container > section {
  margin-top: 32px;
}
.container > section:first-child {
  margin-top: 0;
}
.section-head h1,
.section-head h2 {
  margin: 10px 0 0; /* 上・左右・下 */
}

/* トップ */
.hero {
  margin-top: 0;
  position: relative;
}
.hero-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 18px;
  border: 1px solid var(--border);
  aspect-ratio: 16 / 7; /* 16:9より少し横長が上品 */
  object-fit: cover;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.22));
}
.hero img {
  position: relative;
  z-index: 1;
}
.muted {
  color: var(--muted);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
}
.panel p {
  margin: 0 0 10px;
}
.panel p:last-child {
  margin-bottom: 0;
}

.badge {
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}
.badge-ok {
  color: #a7f3d0;
} /* 色指定が嫌なら消してOK */
.badge-ng {
  color: #fca5a5;
}

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 800px) {
  .cards {
    grid-template-columns: 1fr 1fr;
  }
}
.cards-wide {
  grid-template-columns: 1fr;
}
.cards-tight {
  display: flex;
  gap: 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.series-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}
.series-card-header {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.series-card-thumb {
  flex: 0 0 200px;
  width: 200px;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  /* border: 1px solid var(--border); */
  background: rgba(255, 255, 255, 0.02);
}
.series-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.series-card-body {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 14px;
  align-items: stretch;
  min-width: 0;
  flex: 1;
}
.series-card.no-thumb .series-card-body {
  grid-template-columns: 1fr;
}
.series-card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.series-card-desc {
  margin: 0 0 4px;
}
.series-card-content .mini-list {
  margin: 4px 0 0;
}
.series-card-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.series-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}
.series-count {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px dashed var(--border);
}
.series-card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}
.series-samples-note {
  margin: 0;
}
.series-card-cta {
  margin: 0;
  margin-left: auto;
}
.card-body > h3 {
  margin: 8px 0 4px;
}
.card-wide {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card-short {
  display: flex;
  gap: 12px;
}
.card-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: calc(var(--radius) - 4px);
  position: relative;
}
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.card-thumb.has-title::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.65));
  pointer-events: none;
}
.card-thumb-title {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  z-index: 1;
  color: #ffffff;
  font-weight: 700;
  text-shadow:
    -1px -1px 0 rgba(0, 0, 0, 0.85),
    1px -1px 0 rgba(0, 0, 0, 0.85),
    -1px 1px 0 rgba(0, 0, 0, 0.85),
    1px 1px 0 rgba(0, 0, 0, 0.85),
    0 6px 14px rgba(0, 0, 0, 0.6);
}
@media (min-width: 800px) {
  .cards-wide {
    grid-template-columns: 1fr;
  }
  .card-wide {
    flex-direction: row;
    align-items: flex-start;
  }
  .card-thumb {
    flex: 0 0 220px;
    width: 220px;
    aspect-ratio: auto;
    height: 140px;
  }
  .card-body {
    flex: 1;
  }
}
@media (max-width: 700px) {
  .series-card {
    flex-direction: column;
  }
  .series-card-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }
  .series-card-body {
    grid-template-columns: 1fr;
  }
  .series-card-cta {
    align-self: flex-start;
  }
  .series-card-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

.h3 {
  font-size: 1.1rem;
  margin: 0;
}

.meta {
  font-size: 0.9rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 10px;
}
.sep {
  opacity: 0.7;
}

.prose {
  max-width: 78ch;
}
.prose h2,
.prose h3 {
  scroll-margin-top: 90px;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.95rem;
}
.prose caption {
  caption-side: bottom;
  text-align: left;
  color: var(--muted);
  margin-top: 6px;
  font-size: 0.9rem;
}
.prose th,
.prose td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.prose thead th {
  background: rgba(255, 255, 255, 0.05);
  font-weight: 600;
}
.prose tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.02);
}
.prose tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.article h1 {
  margin-bottom: 6px;
}
.article h2,
.article h3,
.article h4 {
  margin-top: 28px;
  margin-bottom: 10px;
}
.article h2 {
  position: relative;
  padding-left: 14px;
  border-left: 4px solid var(--link);
  background: linear-gradient(
    90deg,
    rgba(147, 197, 253, 0.12),
    rgba(0, 0, 0, 0)
  );
}
.article h3 {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.article h4 {
  color: var(--muted);
}
.article .highlight {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  overflow-x: auto;
  position: relative;
}
.article .highlight pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.article .code-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.75rem;
  line-height: 1.2;
  cursor: pointer;
}
.article .code-copy:hover {
  background: rgba(255, 255, 255, 0.1);
}
.article .code-copy.copied {
  background: rgba(147, 197, 253, 0.18);
  border-color: rgba(147, 197, 253, 0.5);
}
.post-title {
  margin-bottom: 6px;
}
.post-title.has-thumb {
  position: relative;
  padding: 0.7em 0.9em;
  border-radius: 14px;
  background-size: cover;
  background-position: center;
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.post-title.has-thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0.1));
}
.post-title-text {
  position: relative;
  z-index: 1;
}
.article .prose img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

.toc {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  margin: 14px 0;
}
.toc summary {
  cursor: pointer;
  color: var(--text);
}
.toc-inner ul {
  margin: 8px 0 0;
}

.pager {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 22px 0 34px;
  color: var(--muted);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.04),
    rgba(255, 255, 255, 0)
  );
}
.footer-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}
.footer-mark {
  color: var(--text);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.footer-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.35),
    rgba(255, 255, 255, 0)
  );
}

/* search */
.search {
  position: relative;
  padding: 10px 0 4px;
}
.search-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  outline: none;
}
.search-results {
  display: none;
  position: absolute;
  top: 48px;
  left: 0;
  right: 0;
  border: 1px solid var(--border);
  background: #0f1522;
  border-radius: 12px;
  overflow: hidden;
  z-index: 50;
}
.search-hit {
  display: block;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.search-hit:first-child {
  border-top: none;
}
.search-hit-title {
  font-weight: 600;
}
.search-hit-meta {
  font-size: 0.85rem;
  color: var(--muted);
}
.search-hit-snippet {
  font-size: 0.9rem;
  color: var(--muted);
}

.mini-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
}
.mini-list a {
  color: var(--link);
}

.btn {
  display: inline-block;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}
.btn:hover {
  text-decoration: none;
  background: rgba(255, 255, 255, 0.07);
}

.page-head {
  margin-bottom: 14px;
}
.kicker {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.chip {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}
.chip:hover {
  text-decoration: none;
  background: rgba(255, 255, 255, 0.07);
}

.readmore {
  margin-top: 10px;
}

.series-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 12px;
  background: rgba(255, 255, 255, 0.03);
  margin: 14px 0;
}
.series-title {
  font-weight: 600;
  margin-bottom: 8px;
}
.series-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.series-list {
  margin-top: 10px;
}
.series-list ol {
  margin: 8px 0 0;
  padding-left: 22px;
  color: var(--muted);
}

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 6px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.notfound {
  padding: 24px 0;
}
.notfound-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.about {
  max-width: 720px;
}

.info-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.03);
}

.kv {
  display: grid;
  grid-template-columns: 160px 1fr;
  row-gap: 12px;
  column-gap: 16px;
  margin: 0;
}

.kv dt {
  font-size: 0.9rem;
  color: var(--muted);
}

.kv dd {
  margin: 0;
}
