/* ===========================
   Blog "Kotonoha" - Main Stylesheet
   =========================== */

:root {
  --color-primary: #6366f1;
  --color-primary-dark: #4f46e5;
  --color-text: #1e1b2e;
  --color-text-light: #6b7280;
  --color-bg: #fafaf9;
  --color-surface: #ffffff;
  --color-border: #e5e7eb;
  --color-stationery: #e11d48;
  --color-gadget: #6366f1;
  --font-serif: 'Noto Serif JP', serif;
  --font-sans: 'Noto Sans JP', sans-serif;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
  --radius: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-decoration: none; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

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

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
}

.site-logo i {
  color: var(--color-primary);
  font-size: 1.3rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 32px;
}

.main-nav a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text-light);
  transition: color 0.2s;
  position: relative;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--color-primary);
}

.nav-search {
  display: flex;
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 8px 16px;
  gap: 8px;
  min-width: 220px;
}

.nav-search input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.9rem;
  width: 100%;
  font-family: var(--font-sans);
}

.nav-search i { color: var(--color-text-light); }

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--color-text);
}

/* ---------- Hero ---------- */
.hero {
  padding: 64px 24px 40px;
  text-align: center;
  background: linear-gradient(135deg, #f5f3ff 0%, #fef3f2 50%, #fffbeb 100%);
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 0 0 12px;
  font-weight: 700;
}

.hero p {
  color: var(--color-text-light);
  font-size: 1.1rem;
  max-width: 560px;
  margin: 0 auto;
}

.hero-accent {
  color: var(--color-primary);
}

/* ---------- Section Titles ---------- */
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 56px 0 28px;
}

.section-title h2 {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title h2::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 24px;
  background: var(--color-primary);
  border-radius: 3px;
}

.section-title a {
  font-size: 0.9rem;
  color: var(--color-primary);
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Featured Grid ---------- */
.featured-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
}

.featured-main {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 420px;
  box-shadow: var(--shadow-md);
}

.featured-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  transition: transform 0.4s;
}

.featured-main:hover img { transform: scale(1.04); }

.featured-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.1) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 32px;
  color: #fff;
}

.featured-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.featured-side-card {
  display: flex;
  gap: 16px;
  background: var(--color-surface);
  border-radius: 12px;
  padding: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  flex: 1;
}

.featured-side-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.featured-side-card img {
  width: 110px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.featured-side-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.featured-side-info h3 {
  font-size: 0.98rem;
  margin: 0;
  font-weight: 600;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ---------- Category Badge ---------- */
.category-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  width: fit-content;
}

.category-badge-dynamic { /* color applied inline per-category */ }

.post-meta {
  font-size: 0.8rem;
  color: var(--color-text-light);
  display: flex;
  align-items: center;
  gap: 10px;
}

.featured-overlay .post-meta { color: rgba(255,255,255,0.85); }

/* ---------- Category Chips ---------- */
.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.category-chip {
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.category-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-2px);
}

.category-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ---------- Post Grid ---------- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 28px;
}

.post-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s, box-shadow 0.25s;
  display: flex;
  flex-direction: column;
}

.post-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.post-card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.post-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.post-card-body h3 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.5;
}

.post-card-excerpt {
  color: var(--color-text-light);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  flex: 1;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-sans);
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--color-border);
  color: var(--color-text);
}

.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-danger {
  background: #fef2f2;
  color: #dc2626;
}
.btn-danger:hover { background: #fee2e2; }

.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Load more center ---------- */
.load-more-wrap {
  text-align: center;
  margin: 40px 0;
}

/* ---------- Footer ---------- */
.site-footer {
  background: #1e1b2e;
  color: #d1d5db;
  margin-top: 80px;
  padding: 56px 24px 28px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-brand .site-logo { color: #fff; }
.footer-brand p {
  color: #9ca3af;
  font-size: 0.9rem;
  margin-top: 12px;
  max-width: 320px;
}

.footer-social {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.footer-social a {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.footer-social a:hover { background: var(--color-primary); }

.footer-col h4 {
  color: #fff;
  font-size: 1rem;
  margin: 0 0 16px;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-col a {
  color: #9ca3af;
  font-size: 0.9rem;
  transition: color 0.2s;
}
.footer-col a:hover { color: #fff; }

.footer-bottom {
  max-width: 1200px;
  margin: 40px auto 0;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center;
  font-size: 0.85rem;
  color: #6b7280;
}

/* ---------- Post Detail Page ---------- */
.post-hero {
  padding: 48px 24px 0;
  max-width: 860px;
  margin: 0 auto;
}

.breadcrumb {
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.breadcrumb a { color: var(--color-primary); }

.post-title {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1.4;
  margin: 16px 0;
}

.post-hero-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--color-text-light);
  font-size: 0.9rem;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}

.author-info { display: flex; align-items: center; gap: 12px; }
.author-name { color: var(--color-text); font-weight: 600; }

.post-cover {
  max-width: 900px;
  margin: 0 auto 40px;
  padding: 0 24px;
}

.post-cover img {
  width: 100%;
  height: 420px;
  object-fit: cover;
  border-radius: var(--radius);
}

.post-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px 40px;
  font-size: 1.08rem;
}

.post-body h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  margin: 40px 0 16px;
}

.post-body p { margin: 0 0 20px; color: #333; }

.post-tags {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px 40px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tag-pill {
  padding: 6px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--color-text-light);
}

.post-share {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px 40px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding-top: 24px;
  padding-bottom: 24px;
}

.post-share span { font-weight: 600; color: var(--color-text-light); font-size: 0.9rem; }

.share-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.share-btn:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ---------- Comments ---------- */
.comments-section {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

.comments-section h3 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  margin-bottom: 24px;
}

.comment-form {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 32px;
}

.form-row { margin-bottom: 16px; }

.form-row label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.form-row input,
.form-row textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  outline: none;
  resize: vertical;
  transition: border-color 0.2s;
}

.form-row input:focus,
.form-row textarea:focus { border-color: var(--color-primary); }

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.comment-item {
  display: flex;
  gap: 14px;
}

.comment-body {
  background: var(--color-surface);
  border-radius: 12px;
  padding: 14px 18px;
  flex: 1;
  box-shadow: var(--shadow-sm);
}

.comment-body .comment-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.comment-author { font-weight: 700; font-size: 0.9rem; }
.comment-date { font-size: 0.78rem; color: var(--color-text-light); }
.comment-text { font-size: 0.92rem; color: #333; margin: 0; }

.empty-comments {
  text-align: center;
  color: var(--color-text-light);
  padding: 20px;
  font-size: 0.9rem;
}

/* ---------- Related Posts ---------- */
.related-posts {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

/* ---------- Category / Search page ---------- */
.page-header {
  padding: 56px 24px 32px;
  text-align: center;
  background: linear-gradient(135deg, #f5f3ff 0%, #fef3f2 100%);
}

.page-header h1 {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  margin: 0 0 8px;
}

.page-header p { color: var(--color-text-light); }

.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 24px 0 40px;
}

.filter-chip {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-chip.active,
.filter-chip:hover {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.result-count {
  color: var(--color-text-light);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.no-results {
  text-align: center;
  padding: 80px 24px;
  color: var(--color-text-light);
}

.no-results i { font-size: 3rem; margin-bottom: 16px; opacity: 0.3; }

/* ---------- Admin ---------- */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 240px;
  background: #1e1b2e;
  color: #fff;
  padding: 24px 16px;
  flex-shrink: 0;
}

.admin-sidebar .site-logo { color: #fff; margin-bottom: 32px; padding: 0 8px; }

.admin-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  color: #b3b0c4;
  font-weight: 500;
  margin-bottom: 4px;
  transition: all 0.2s;
  cursor: pointer;
}

.admin-nav a:hover,
.admin-nav a.active {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.admin-main {
  flex: 1;
  padding: 32px 40px;
  background: var(--color-bg);
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.admin-header h1 {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  margin: 0;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--color-surface);
  border-radius: 14px;
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #fff;
  flex-shrink: 0;
}

.stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-label { font-size: 0.82rem; color: var(--color-text-light); }

.admin-table-wrap {
  background: var(--color-surface);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  text-align: left;
  padding: 14px 20px;
  background: #f9fafb;
  font-size: 0.8rem;
  color: var(--color-text-light);
  border-bottom: 1px solid var(--color-border);
  font-weight: 700;
}

.admin-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
  vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }

.table-thumb {
  width: 56px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
}

.status-pill {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.status-published { background: #dcfce7; color: #16a34a; }
.status-draft { background: #f3f4f6; color: #6b7280; }

.action-icons {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--color-text-light);
}

.icon-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.icon-btn.delete:hover { border-color: #dc2626; color: #dc2626; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal-overlay.active { display: flex; }

.modal-box {
  background: #fff;
  border-radius: 16px;
  max-width: 700px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 32px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-header h2 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--color-text-light);
}

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

.form-grid .full { grid-column: 1 / -1; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

/* ---------- Cover image upload box (admin) ---------- */
.cover-upload-box {
  border: 1px dashed var(--color-border);
  border-radius: 12px;
  padding: 16px;
  background: #fafafa;
}

.cover-preview {
  display: block;
  width: 100%;
  max-width: 320px;
  height: 160px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.cover-upload-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.cover-upload-btn {
  cursor: pointer;
  margin: 0;
}

.cover-upload-hint {
  font-size: 0.8rem;
  color: var(--color-text-light);
  margin: 8px 0 0;
}

.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: #1e1b2e;
  color: #fff;
  padding: 14px 24px;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: #dc2626; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .main-nav { display: none; }
  .menu-toggle { display: block; }
  .featured-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .admin-sidebar { display: none; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .main-nav.mobile-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border);
    gap: 16px;
  }
  .nav-search { min-width: 0; width: 100%; }
}

@media (max-width: 600px) {
  .featured-side-card { flex-direction: column; }
  .featured-side-card img { width: 100%; height: 140px; }
  .post-cover img { height: 240px; }
}
