/* Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Base */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif, "Segoe UI Emoji";
  background: #fff;
  color: rgb(0 0 0 / 82%);
  line-height: 1.8;
}

/* Page wrapper — sticky footer */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.page-wrapper--wide {
  max-width: 1100px;
}

.page-wrapper > main {
  flex: 1;
}

/* Header */
.site-header {
  padding-top: 2.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 2.75rem;
}

.site-title {
  font-size: 1rem;
  font-weight: 700;
  color: #111;
  text-decoration: none;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

/* Post */
.post-header {
  margin-bottom: 2.75rem;
}

.post-header h1 {
  margin-bottom: 1rem;
  font-size: clamp(2.2rem, 1.7rem + 2vw, 3rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: #111;
}

.post-header time {
  display: block;
  font-size: 0.95rem;
  color: #6b7280;
  line-height: 1.6;
}

.post-authors {
  font-size: 0.95rem;
  color: #6b7280;
  margin-top: 0.25rem;
  line-height: 1.6;
}

.post-content {
  font-size: 1rem;
  line-height: 1.95;
}

.post-content p {
  margin-bottom: 2rem;
}

.post-content h2 {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.4;
  margin-top: 4rem;
  margin-bottom: 1.25rem;
  color: #111;
}

.post-content h3 {
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.5;
  margin-top: 2.75rem;
  margin-bottom: 1rem;
  color: #111;
}

.post-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 2.25rem 0;
}

.post-content a {
  color: #111;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.post-content ul,
.post-content ol {
  margin-bottom: 2rem;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.5rem;
}

.post-content blockquote {
  border-left: 3px solid #e5e7eb;
  padding-left: 1.2rem;
  color: #666;
  margin: 2rem 0;
}

.post-content code {
  font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Mono", monospace;
  font-size: 0.9em;
  background: #f5f5f5;
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

.post-content pre {
  background: #f5f5f5;
  padding: 1.2rem;
  overflow-x: auto;
  margin: 2rem 0;
  border-radius: 6px;
}

.post-content pre code {
  background: none;
  padding: 0;
}

/* Table */
.post-content table {
  width: 100%;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.95rem;
}

.post-content th,
.post-content td {
  border: 1px solid #e5e7eb;
  padding: 0.75rem 0.9rem;
  min-width: 140px;
  text-align: left;
}

.post-content th {
  background: #fafafa;
  font-weight: 700;
  color: #111;
}

.post-content tr:hover {
  background: #fafafa;
}

/* Audio Table */
.audio-table audio {
  width: 100%;
  min-width: 200px;
  display: block;
}

/* Audio Player */
.audio-player {
  margin-bottom: 2.5rem;
  padding: 1.2rem;
  background: #fafafa;
  border-radius: 8px;
}

.audio-player audio {
  width: 100%;
  display: block;
}

/* Post with TOC layout */
.post-wrapper {
  display: flex;
  gap: 4rem;
  align-items: flex-start;
}

.post-wrapper .post {
  flex: 1;
  min-width: 0;
  max-width: 760px;
}

/* TOC */
.toc {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 2rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
}

.toc-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.8rem;
}

.toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc li {
  margin-bottom: 0.45rem;
}

.toc li.toc-h3 {
  padding-left: 1rem;
}

.toc a {
  font-size: 0.85rem;
  color: #9ca3af;
  text-decoration: none;
  line-height: 1.6;
  display: block;
  transition: color 0.15s;
}

.toc a:hover {
  color: #374151;
}

.toc a.active {
  color: #111;
  font-weight: 600;
}

/* Footer */
footer {
  margin-top: 5rem;
  padding-top: 1.5rem;
  padding-bottom: 3rem;
  border-top: 1px solid #e5e7eb;
  font-size: 0.85rem;
  color: #9ca3af;
}

/* Post listing */
.post-list-wrapper {
  max-width: 760px;
}

.post-list-title {
  font-size: clamp(2.2rem, 1.7rem + 2vw, 3rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: #111;
  margin-bottom: 2.75rem;
}

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-list li {
  border-bottom: 1px solid #e5e7eb;
}

.post-list-link {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.25rem 0;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.post-list-link:hover {
  background: #fafafa;
}

.post-list-item-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #111;
  line-height: 1.5;
}

.post-list-link time {
  font-size: 0.9rem;
  color: #6b7280;
}

.post-list-authors {
  font-size: 0.9rem;
  color: #9ca3af;
}

/* Responsive */
@media (max-width: 900px) {
  .page-wrapper--wide {
    max-width: 760px;
  }

  .post-wrapper {
    flex-direction: column-reverse;
    gap: 0;
  }

  .post-wrapper .post {
    max-width: 100%;
  }

  .toc {
    display: none;
  }

  .toc-title {
    display: none;
  }
}

@media (max-width: 600px) {
  .page-wrapper {
    padding: 0 1rem;
  }

  .site-header {
    padding-top: 2rem;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
  }

  .post-header {
    margin-bottom: 2rem;
  }

  .post-header h1 {
    font-size: clamp(1.8rem, 1.45rem + 2vw, 2.2rem);
    line-height: 1.3;
    margin-bottom: 0.8rem;
  }

  .post-header time,
  .post-authors {
    font-size: 0.9rem;
  }

  .post-content h2 {
    font-size: 1.4rem;
    margin-top: 3rem;
    margin-bottom: 1rem;
  }

  .post-content h3 {
    font-size: 1.15rem;
    margin-top: 2.2rem;
    margin-bottom: 0.8rem;
  }

  .post-content p,
  .post-content ul,
  .post-content ol,
  .post-content blockquote,
  .post-content pre,
  .post-content table {
    margin-bottom: 1.6rem;
  }

  .post-list li {
    flex-direction: column;
    gap: 0.2rem;
  }
}