/*
Theme Name: Note Style
Theme URI: https://example.com
Author: Your Name
Description: note風デザインのシンプルなWordPressテーマ
Version: 1.0.0
License: GNU General Public License v2 or later
Text Domain: note-style
*/

/* ========================================
   CSS Variables
======================================== */
:root {
  --color-bg: #ffffff;
  --color-text: #1a1a1a;
  --color-text-muted: #717171;
  --color-border: #e0e0e0;
  --color-accent: #1a1a1a;
  --color-tag-bg: #f2f2f2;
  --color-hover: #f7f7f7;

  --font-body: "Noto Serif JP", "Georgia", serif;
  --font-ui: "Noto Sans JP", "Helvetica Neue", sans-serif;

  --content-width: 680px;
  --wide-width: 960px;

  --radius: 4px;
  --transition: 0.2s ease;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.85;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.7; }

/* ========================================
   Header
======================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}

.site-header__inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-family: var(--font-ui);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.site-nav {
  display: flex;
  gap: 24px;
  font-family: var(--font-ui);
  font-size: 0.875rem;
}

/* ========================================
   Single Post Layout
======================================== */
.post-container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ========================================
   Post Header
======================================== */
.post-header {
  padding: 52px 0 32px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 40px;
}

.post-categories {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.post-category {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-tag-bg);
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

.post-title {
  font-family: var(--font-body);
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--color-text);
  margin-bottom: 24px;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.post-meta__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-tag-bg);
  flex-shrink: 0;
}

.post-meta__avatar img { width: 100%; height: 100%; object-fit: cover; }

.post-meta__author {
  font-weight: 500;
  color: var(--color-text);
}

.post-meta__sep { color: var(--color-border); }

/* ========================================
   Featured Image
======================================== */
.post-thumbnail {
  margin: 0 -24px 48px;
}

.post-thumbnail img {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  border-radius: 0;
}

@media (min-width: 728px) {
  .post-thumbnail {
    margin: 0 0 48px;
  }
  .post-thumbnail img {
    border-radius: 8px;
  }
}

/* ========================================
   Table of Contents
======================================== */
.toc {
  background: #fafafa;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 24px 28px;
  margin: 0 0 48px;
}

.toc__title {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 14px;
}

.toc__list {
  list-style: none;
  counter-reset: toc-counter;
}

.toc__list li {
  counter-increment: toc-counter;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  line-height: 1.6;
  padding: 5px 0;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: 10px;
}

.toc__list li:last-child { border-bottom: none; }

.toc__list li::before {
  content: counter(toc-counter);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  min-width: 18px;
  padding-top: 1px;
}

.toc__list a {
  color: var(--color-text);
  transition: color var(--transition);
}

.toc__list a:hover { color: #555; opacity: 1; }

.toc__list--h3 {
  padding-left: 16px;
}

/* ========================================
   Post Content (entry-content)
======================================== */
.entry-content {
  font-size: 1.0625rem;
  line-height: 1.9;
  color: var(--color-text);
}

.entry-content h2 {
  font-family: var(--font-body);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.4;
  margin: 2.8em 0 1em;
  padding-bottom: 0.5em;
  border-bottom: 2px solid var(--color-text);
}

.entry-content h3 {
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.5;
  margin: 2.2em 0 0.8em;
  padding-left: 12px;
  border-left: 3px solid var(--color-text);
}

.entry-content h4 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1.8em 0 0.6em;
}

.entry-content p {
  margin-bottom: 1.6em;
}

.entry-content a {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--color-border);
  transition: text-decoration-color var(--transition);
}

.entry-content a:hover {
  opacity: 1;
  text-decoration-color: var(--color-text);
}

.entry-content ul, .entry-content ol {
  padding-left: 1.5em;
  margin-bottom: 1.6em;
}

.entry-content li {
  margin-bottom: 0.4em;
  line-height: 1.8;
}

.entry-content blockquote {
  border-left: 3px solid #c8c8c8;
  padding: 4px 20px;
  margin: 2em 0;
  color: var(--color-text-muted);
  font-style: italic;
}

.entry-content blockquote p { margin-bottom: 0; }

.entry-content pre {
  background: #f5f5f5;
  border-radius: 6px;
  padding: 20px;
  overflow-x: auto;
  margin-bottom: 1.6em;
  font-size: 0.875rem;
  line-height: 1.7;
}

.entry-content code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.875em;
  background: #f2f2f2;
  padding: 2px 6px;
  border-radius: 3px;
}

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

.entry-content figure {
  margin: 2em 0;
}

.entry-content figcaption {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 8px;
}

.entry-content hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 3em auto;
  width: 60%;
}

/* ========================================
   Post Footer / Tags
======================================== */
.post-footer {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--color-border);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.post-tag {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  background: var(--color-tag-bg);
  padding: 5px 14px;
  border-radius: 20px;
  transition: background var(--transition);
}

.post-tag:hover { background: #e8e8e8; opacity: 1; }

/* ========================================
   Author Profile
======================================== */
.author-profile {
  display: flex;
  gap: 20px;
  background: #fafafa;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 48px;
  align-items: flex-start;
}

.author-profile__avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-tag-bg);
  flex-shrink: 0;
}

.author-profile__avatar img { width: 100%; height: 100%; object-fit: cover; }

.author-profile__name {
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.author-profile__bio {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.7;
}

/* ========================================
   Related Posts
======================================== */
.related-posts {
  margin-top: 64px;
}

.related-posts__title {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 20px;
}

.related-posts__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 540px) {
  .related-posts__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.related-post-card {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.related-post-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  opacity: 1;
}

.related-post-card__thumb {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--color-tag-bg);
}

.related-post-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.related-post-card:hover .related-post-card__thumb img {
  transform: scale(1.04);
}

.related-post-card__body {
  padding: 14px 16px 16px;
}

.related-post-card__title {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-post-card__date {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* ========================================
   Footer
======================================== */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 40px 24px;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* ========================================
   Archive / Home (index)
======================================== */
.archive-container {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.archive-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.archive-item {
  display: flex;
  gap: 20px;
  padding: 24px 0;
  border-bottom: 1px solid var(--color-border);
  align-items: flex-start;
}

.archive-item__thumb {
  width: 120px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background: var(--color-tag-bg);
}

.archive-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.archive-item__body { flex: 1; min-width: 0; }

.archive-item__title {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.archive-item__excerpt {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

.archive-item__meta {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

@media (min-width: 768px) {
  .archive-item__thumb {
    width: 160px;
    height: 106px;
  }
}

/* ========================================
   Pagination
======================================== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 48px;
  font-family: var(--font-ui);
  font-size: 0.875rem;
}

.pagination a,
.pagination .current {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: background var(--transition);
}

.pagination .current {
  background: var(--color-text);
  color: #fff;
  border-color: var(--color-text);
}

.pagination a:hover { background: var(--color-hover); opacity: 1; }

/* ========================================
   Responsive
======================================== */
@media (max-width: 480px) {
  .post-title { font-size: 1.4rem; }
  .author-profile { flex-direction: column; }
  .archive-item__thumb { width: 96px; height: 64px; }
}

/* ========================================
   広告ユニット共通
======================================== */
.ad-unit {
  position: relative;
  text-align: center;
  overflow: hidden;
}

.ad-unit__label {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

/* 記事本文内 */
.ad-unit--ad_content_top,
.ad-unit--ad_content_mid {
  margin: 2em 0;
  padding: 20px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

/* 記事下（著者欄の上） */
.ad-unit--ad_below_post {
  margin: 0 0 32px;
  padding: 20px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

/* サイドバー */
.ad-unit--ad_sidebar {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

/* トップページ カード内広告 */
.fp-card--ad {
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  border: 1px dashed var(--color-border);
}

.fp-card--ad .ad-unit {
  width: 100%;
  padding: 16px;
}
