:root {
  /* corporate.css のカラートークンに整合（tertiary のみ AA コントラスト確保のため明度を上げている） */
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface-2: #1a1a24;
  --surface-3: #24242f;
  --text: #ffffff;
  --text-secondary: #a0a0b0;
  --text-tertiary: #8a8a9a;
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --accent-btn: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.18);
  --border: rgba(255, 255, 255, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --max-content: 720px;
  --max-page: 1160px;
  --header-h: 68px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(59, 130, 246, 0.35);
  color: var(--text);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

.container {
  max-width: var(--max-page);
  margin: 0 auto;
  padding: 0 24px;
}

/* Progress bar */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 1001;
  background: var(--bg);
}

.progress-bar__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px var(--accent-glow);
  transition: width 0.1s linear;
}

/* Header */
header.site {
  position: fixed;
  top: 3px;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  transition: transform 0.3s ease;
}

header.site.is-hidden {
  transform: translateY(calc(-100% - 4px));
}

header.site .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.brand:hover {
  text-decoration: none;
}

.brand__mark {
  width: 32px;
  height: 32px;
  display: block;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-group__divider {
  color: var(--text-tertiary);
}

.brand-group__section {
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-group__section:hover {
  color: var(--accent-2);
  text-decoration: none;
}

.site-nav a {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  margin-left: 28px;
  transition: color 0.2s;
}

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

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  background: none;
  border: 0;
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.nav-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

@media (max-width: 900px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 8px 0 16px;
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    margin: 0;
    padding: 12px 24px;
  }
}

/* Layout */
.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 64px;
  align-items: start;
}

.content {
  min-width: 0;
  margin-top: 80px;
}

/* TOC */
.toc {
  position: sticky;
  top: calc(var(--header-h) + 32px);
  max-height: calc(100vh - var(--header-h) - 64px);
  overflow-y: auto;
  padding: 4px 0;
}

.toc__title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin: 0 0 14px 12px;
  font-weight: 700;
}

.toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--border);
}

.toc__list li {
  margin: 0;
}

.toc__list a {
  display: block;
  padding: 7px 14px;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.45;
  border-left: 2px solid transparent;
  margin-left: -1px;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.toc__list a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  text-decoration: none;
}

.toc__list a.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: linear-gradient(90deg, var(--accent-glow), transparent 80%);
}

.toc__list .toc-h3 a {
  padding-left: 28px;
  font-size: 0.86rem;
  color: var(--text-tertiary);
}

.toc-mobile {
  display: none;
  margin-bottom: 36px;
}

.toc-mobile summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.toc-mobile summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.toc-mobile .toc__list {
  margin: 14px 0 0 6px;
}

/* Article header */
.article-header {
  max-width: var(--max-content);
  margin-bottom: 52px;
}

.article-header__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.article-header__tag {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.article-header__readtime {
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.article-header h1 {
  font-size: clamp(2.1rem, 5vw, 3.2rem);
  line-height: 1.1;
  margin: 0 0 26px;
  letter-spacing: -0.03em;
  font-weight: 900;
}

.byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.byline__author {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--bg);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.85rem;
}

.byline__name {
  color: var(--text);
  font-weight: 700;
}

/* Prose */
.prose {
  max-width: var(--max-content);
  font-size: 1.08rem;
}

.prose > p:first-of-type {
  font-size: 1.28rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 30px;
}

.prose h2 {
  font-size: 1.55rem;
  margin: 64px 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.02em;
  position: relative;
}

.prose h3 {
  font-size: 1.2rem;
  margin: 40px 0 14px;
  letter-spacing: -0.01em;
  position: relative;
}

.prose h2 a.anchor,
.prose h3 a.anchor {
  position: absolute;
  left: -26px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 0.85em;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s;
  padding: 0 6px;
  text-decoration: none;
}

.prose h2:hover a.anchor,
.prose h3:hover a.anchor,
.prose h2 a.anchor:focus,
.prose h3 a.anchor:focus {
  opacity: 1;
  color: var(--accent);
}

.prose p {
  margin: 0 0 22px;
}

.prose ul, .prose ol {
  margin: 0 0 22px;
  padding-left: 28px;
}

.prose li {
  margin-bottom: 10px;
}

.prose li::marker {
  color: var(--text-tertiary);
}

.prose strong {
  color: var(--text);
  font-weight: 700;
}

.prose code {
  background: var(--surface-2);
  color: var(--accent-2);
  padding: 3px 7px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.86em;
  border: 1px solid var(--border);
}

.prose pre {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 22px;
  overflow-x: auto;
  margin: 0 0 28px;
}

.prose pre code {
  background: transparent;
  color: var(--text);
  padding: 0;
  border: 0;
  font-size: 0.92rem;
  line-height: 1.65;
}

.code-block__copy {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s, color 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.prose pre:hover .code-block__copy,
.code-block__copy:focus {
  opacity: 1;
}

.code-block__copy:hover {
  background: var(--surface-3);
  color: var(--text);
}

.code-block__copy.is-copied {
  color: var(--accent);
  border-color: var(--accent);
}

.prose blockquote {
  border-left: 3px solid var(--accent);
  margin: 28px 0;
  padding: 8px 0 8px 24px;
  color: var(--text-secondary);
  font-style: italic;
  background: linear-gradient(90deg, var(--accent-glow), transparent 70%);
  border-radius: 0 10px 10px 0;
}

.prose figure {
  margin: 36px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
}

.prose figcaption {
  color: var(--text-tertiary);
  font-size: 0.9rem;
  margin-top: 16px;
  text-align: center;
}

/* Metrics */
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 28px 0;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 24px 16px;
  text-align: center;
  transition: transform 0.2s, border-color 0.2s;
}

.metric:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.metric strong {
  display: block;
  font-size: 1.9rem;
  color: var(--accent);
  margin-bottom: 6px;
  line-height: 1;
}

.metric span {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* Share */
.share {
  max-width: var(--max-content);
  margin-top: 72px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.share__title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 16px;
  font-weight: 700;
}

.share__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.share__btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.share__btn:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-2px);
  text-decoration: none;
}

.share__btn.is-copied {
  border-color: var(--accent);
  color: var(--accent);
}

/* Author card */
.author-card {
  max-width: var(--max-content);
  margin-top: 40px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

.avatar--lg {
  width: 56px;
  height: 56px;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.author-card__name {
  font-weight: 700;
}

.author-card__role {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.author-card__bio {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* CTA */
.cta {
  max-width: var(--max-content);
  margin-top: 24px;
  padding: 28px;
  background: linear-gradient(135deg, var(--accent-glow), transparent 60%), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.cta__title {
  margin: 0 0 6px;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.cta__text {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 52ch;
}

.cta__btn {
  background: var(--accent-btn);
  color: #fff;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: 10px;
  white-space: nowrap;
  transition: background 0.2s;
}

.cta__btn:hover {
  background: var(--accent);
  text-decoration: none;
}

/* Post navigation */
.post-nav {
  max-width: var(--max-content);
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.post-nav__item {
  display: block;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: border-color 0.2s, background 0.2s;
}

.post-nav__item:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  text-decoration: none;
}

.post-nav__item--next {
  text-align: right;
}

.post-nav__label {
  display: block;
  color: var(--text-tertiary);
  font-size: 0.8rem;
  margin-bottom: 6px;
}

.post-nav__title {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.4;
}

/* Back to top */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s, background 0.2s;
  z-index: 999;
  display: grid;
  place-items: center;
}

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

.back-to-top:hover {
  background: var(--surface-2);
  border-color: var(--accent);
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(120%);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  z-index: 2000;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.is-visible {
  transform: translateX(-50%) translateY(0);
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  header.site {
    transition: none;
  }
}

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

  .toc {
    display: none;
  }

  .toc-mobile {
    display: block;
  }
}

@media (max-width: 560px) {
  :root {
    --header-h: 60px;
  }

  body {
    font-size: 16px;
  }

  .brand__name,
  .brand-group__divider {
    display: none;
  }

  .article-header h1 {
    font-size: 1.85rem;
  }

  .prose > p:first-of-type {
    font-size: 1.1rem;
  }

  .prose h2 {
    font-size: 1.35rem;
  }

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

  .share__btn {
    width: 100%;
    justify-content: center;
  }

  .code-block__copy {
    opacity: 1;
  }

  .post-nav {
    grid-template-columns: 1fr;
  }

  .post-nav__item--next {
    text-align: left;
  }
}

/* Article list (index) */
.listing {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 80px 0 60px;
}

.listing-header {
  margin-bottom: 48px;
}

.listing-header h1 {
  font-size: clamp(2rem, 4vw, 2.6rem);
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}

.listing-header p {
  color: var(--text-secondary);
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.6;
}

.post-list {
  display: grid;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 28px;
  color: var(--text);
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.post-card:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-2px);
  text-decoration: none;
}

.post-card__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.post-card__date {
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.post-card__title {
  font-size: 1.3rem;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.post-card__desc {
  color: var(--text-secondary);
  margin: 0 0 14px;
  font-size: 0.98rem;
  line-height: 1.6;
}

.post-card__author {
  color: var(--text-tertiary);
  font-size: 0.88rem;
}
