/*
 * if(塾) Blog - Premium Design System
 *
 * A modern, elegant blog design that makes visitors want to return daily.
 * Design Principles:
 * - No emojis
 * - No purple colors
 * - Clean, professional, sophisticated
 * - Focus on readability and visual hierarchy
 */

/* ========================================
   CSS Variables - Design Tokens
   ======================================== */
:root {
  /* Primary Colors - Deep Navy (Trust & Intelligence) */
  --color-primary: #0a192f;
  --color-primary-light: #112240;
  --color-primary-dark: #020c1b;

  /* Accent Colors - Teal/Cyan (Modern & Fresh) */
  --color-accent: #64ffda;
  --color-accent-dark: #4fd1c7;
  --color-accent-light: rgba(100, 255, 218, 0.1);

  /* Secondary Accent - Coral/Salmon (Warmth) */
  --color-secondary: #ff6b6b;
  --color-secondary-light: rgba(255, 107, 107, 0.1);

  /* Text Colors */
  --color-text: #1a202c;
  --color-text-secondary: #4a5568;
  --color-text-light: #718096;
  --color-text-muted: #a0aec0;
  --color-text-inverse: #ffffff;

  /* Background Colors */
  --color-bg: #ffffff;
  --color-bg-warm: #fffaf5;
  --color-bg-cool: #f8fafc;
  --color-bg-dark: #0a192f;
  --color-bg-card: #ffffff;
  --color-bg-elevated: #ffffff;

  /* Gradients */
  --gradient-hero: linear-gradient(135deg, #0a192f 0%, #112240 50%, #1a365d 100%);
  --gradient-card: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(248,250,252,1) 100%);
  --gradient-accent: linear-gradient(135deg, #64ffda 0%, #4fd1c7 100%);
  --gradient-warm: linear-gradient(135deg, #ff6b6b 0%, #ffa07a 100%);

  /* Border & Shadows */
  --color-border: #e2e8f0;
  --color-border-light: #edf2f7;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.15);
  --shadow-glow: 0 0 40px rgba(100, 255, 218, 0.15);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.08);

  /* Category Colors */
  --color-psychology: #3182ce;
  --color-education: #38a169;
  --color-startup: #dd6b20;
  --color-investment: #805ad5;
  --color-ai: #0891b2;
  --color-school: #319795;
  --color-neuro: #2b6cb0;

  /* Spacing Scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Typography Scale */
  --font-sans: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Noto Serif JP", Georgia, serif;
  --font-mono: "Source Code Pro", "Fira Code", monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  /* Layout */
  --max-width: 1280px;
  --content-width: 750px;
  --sidebar-width: 280px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ========================================
   Reset & Base
   ======================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.9;
  color: var(--color-text);
  background-color: var(--color-bg-warm);
  min-height: 100vh;
}

::selection {
  background: var(--color-accent);
  color: var(--color-primary);
}

/* ========================================
   Typography
   ======================================== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.35;
  color: var(--color-primary);
  letter-spacing: -0.02em;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p {
  margin-bottom: var(--space-6);
  color: var(--color-text-secondary);
}

.page-content section {
  margin-bottom: 3rem;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: all var(--transition-fast);
}

a:hover {
  color: var(--color-accent-dark);
}

strong {
  font-weight: 600;
  color: var(--color-text);
}

/* ========================================
   Layout Containers
   ======================================== */
.wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.content-wrapper {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* ========================================
   Header - Sticky with Blur
   ======================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border-light);
  transition: all var(--transition-base);
}

.site-header.is-scrolled {
  box-shadow: 0 10px 28px rgba(2, 12, 27, 0.14);
}

.site-header .wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 72px;
}

.site-title {
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.site-title::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--gradient-accent);
  border-radius: var(--radius-full);
}

.site-title:hover {
  color: var(--color-accent-dark);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.site-nav a {
  position: relative;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.site-nav a:hover {
  color: var(--color-primary);
  background: var(--color-bg-cool);
}

.site-nav a::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--gradient-accent);
  border-radius: var(--radius-full);
  transform: translateX(-50%);
  transition: width var(--transition-fast);
}

.site-nav a:hover::after {
  width: calc(100% - var(--space-8));
}

/* ========================================
   Hero Section (Home)
   ======================================== */
.home-hero {
  position: relative;
  padding: var(--space-24) 0;
  background: var(--gradient-hero);
  color: var(--color-text-inverse);
  overflow: hidden;
}

.home-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
}

.home-hero .wrapper {
  position: relative;
  z-index: 1;
  text-align: center;
}

.home-hero h1 {
  font-size: var(--text-5xl);
  color: var(--color-text-inverse);
  margin-bottom: var(--space-6);
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.home-hero .lead {
  font-size: var(--text-lg);
  color: rgba(255, 255, 255, 0.8);
  max-width: 640px;
  margin: 0 auto var(--space-10);
  line-height: 1.7;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-12);
  margin-top: var(--space-12);
}

.hero-stat {
  text-align: center;
}

.hero-stat-number {
  display: block;
  font-size: var(--text-4xl);
  font-weight: 800;
  color: var(--color-accent);
}

.hero-stat-label {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ========================================
   Main Content Area
   ======================================== */
.page-content {
  padding: var(--space-16) 0;
  min-height: calc(100vh - 200px);
}

/* ========================================
   Section Titles
   ======================================== */
.section-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-4);
  border-bottom: 2px solid var(--color-border);
}

.section-title svg {
  color: var(--color-accent-dark);
}

/* ========================================
   Post Cards (Home & Archive)
   ======================================== */
.post-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: var(--space-8);
}

.home-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-8);
}

.home-grid-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  transform: translateY(0);
}

.home-grid-card .post-card-image {
  height: 200px;
  min-height: 200px;
  flex-shrink: 0;
}

.home-grid-card .post-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.home-grid-card .post-card-content {
  flex: 1;
}

.home-grid-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

.post-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--space-8);
  background: var(--color-bg-card);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: all var(--transition-slow);
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.post-card-content {
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.post-card-date {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.post-card-category {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  background: var(--color-accent-light);
  color: var(--color-accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.post-card-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: var(--space-3);
  line-height: 1.4;
  transition: color var(--transition-fast);
}

.post-card:hover .post-card-title {
  color: var(--color-accent-dark);
}

.post-card-excerpt {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.7;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-light);
}

.post-card-read-more {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-accent-dark);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.post-card-read-more svg {
  transition: transform var(--transition-fast);
}

.post-card:hover .post-card-read-more svg {
  transform: translateX(4px);
}

.post-card-image {
  position: relative;
  overflow: hidden;
}

.post-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.post-card:hover .post-card-image img {
  transform: scale(1.05);
}

/* Featured Post Card */
.post-card.featured {
  grid-template-columns: 1fr;
  grid-template-rows: 300px 1fr;
}

.post-card.featured .post-card-title {
  font-size: var(--text-2xl);
}

/* ========================================
   Post Page - Hero
   ======================================== */
.post-hero {
  background: var(--gradient-hero);
  color: #ffffff;
  padding: var(--space-16) var(--space-6);
  margin: calc(var(--space-6) * -1);
  margin-bottom: var(--space-12);
  border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
  position: relative;
  overflow: hidden;
}

.post-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.post-hero-content {
  position: relative;
  z-index: 1;
  max-width: var(--content-width);
  margin: 0 auto;
}

.post-hero .post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.post-hero .post-meta time,
.post-hero .reading-time {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.7);
}

.post-hero .post-meta svg {
  opacity: 0.7;
}

.post-category {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: var(--space-1) var(--space-3);
  background: var(--color-accent);
  color: var(--color-primary);
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.post-hero .post-title {
  font-size: var(--text-4xl);
  color: var(--color-text-inverse);
  margin-bottom: var(--space-6);
  line-height: 1.25;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
}

.post-hero .post-description {
  font-size: var(--text-lg);
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.7;
  margin-bottom: 0;
}

.post-hero-image {
  max-width: var(--content-width);
  margin: var(--space-10) auto 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;
}

.post-hero-image img {
  width: 100%;
  height: auto;
  display: block;
}

/* ========================================
   Table of Contents
   ======================================== */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  z-index: 1200;
  background: rgba(100, 255, 218, 0.2);
}

#reading-progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #4fd1c7 0%, #0a192f 100%);
  transition: width 120ms linear;
}

.post-body {
  max-width: calc(var(--content-width) + var(--sidebar-width) + var(--space-10));
  margin: 0 auto;
  padding: 0 var(--space-6);
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: var(--space-10);
  align-items: start;
}

.toc-wrapper {
  position: relative;
}

.toc-container {
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow: auto;
  background: var(--color-bg-cool);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  border: 1px solid var(--color-border-light);
}

.toc-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}

.toc-title svg {
  color: var(--color-accent-dark);
}

.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc li {
  margin-bottom: var(--space-2);
}

.toc li.h3 {
  padding-left: var(--space-6);
}

.toc a {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  display: block;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.toc a:hover {
  color: var(--color-primary);
  background: var(--color-bg);
}

.toc a.is-active {
  color: var(--color-primary);
  background: var(--color-accent-light);
  font-weight: 600;
}

/* ========================================
   Post Content
   ======================================== */
.post-content-wrapper {
  min-width: 0;
}

.post-content {
  font-size: 18px;
  line-height: 1.9;
  color: var(--color-text);
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  margin-top: var(--space-12);
  margin-bottom: var(--space-6);
  scroll-margin-top: 100px;
}

.post-content h2 {
  font-size: var(--text-2xl);
  padding: var(--space-2) 0 var(--space-2) var(--space-5);
  border-left: 4px solid var(--color-accent-dark);
  background: linear-gradient(90deg, rgba(100, 255, 218, 0.14), rgba(100, 255, 218, 0));
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.post-content h3 {
  font-size: var(--text-xl);
  color: var(--color-primary-light);
}

.post-content p {
  margin-bottom: var(--space-6);
  color: var(--color-text);
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: var(--space-10) 0;
  box-shadow: 0 18px 40px rgba(10, 25, 47, 0.18);
  transition: transform var(--transition-slow), box-shadow var(--transition-base);
  cursor: zoom-in;
}

.post-content img:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 50px rgba(10, 25, 47, 0.24);
}

.post-content img:active {
  position: fixed;
  inset: 6vh 6vw;
  width: auto;
  max-width: 88vw;
  max-height: 88vh;
  margin: auto;
  z-index: 1100;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.85);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.post-content ul,
.post-content ol {
  padding-left: var(--space-8);
  margin-bottom: var(--space-6);
}

.post-content li {
  margin-bottom: var(--space-3);
  color: var(--color-text);
}

.post-content li::marker {
  color: var(--color-accent-dark);
}

.post-content blockquote {
  position: relative;
  margin: var(--space-10) 0;
  padding: var(--space-6) var(--space-8) var(--space-6) var(--space-7);
  background: linear-gradient(90deg, rgba(100, 255, 218, 0.1) 0%, rgba(248, 250, 252, 0.9) 100%);
  border-left: 4px solid var(--color-accent-dark);
  border-radius: var(--radius-md);
  font-style: italic;
}

.post-content blockquote p {
  margin-bottom: 0;
  color: var(--color-text-secondary);
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: #f3f7ff;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  color: #c2410c;
}

.post-content pre {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0)),
    #0f172a;
  color: #e2e8f0;
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin: var(--space-8) 0;
  border: 1px solid rgba(100, 116, 139, 0.35);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.35);
}

.post-content pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-8) 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.post-content th,
.post-content td {
  padding: var(--space-4) var(--space-5);
  text-align: left;
  border-bottom: 1px solid var(--color-border-light);
}

.post-content th {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-weight: 600;
}

.post-content tbody tr:nth-child(even) td {
  background: rgba(15, 23, 42, 0.03);
}

.post-content tr:hover td {
  background: rgba(100, 255, 218, 0.12);
}

/* ========================================
   Sources Section
   ======================================== */
.sources-section {
  margin-top: var(--space-12);
  padding: var(--space-8);
  background: var(--color-bg-cool);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
}

.sources-section h3 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-lg);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.sources-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sources-section li {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border-light);
}

.sources-section li:last-child {
  border-bottom: none;
}

.sources-section a {
  color: var(--color-accent-dark);
  font-size: var(--text-sm);
  word-break: break-all;
}

.sources-section a:hover {
  text-decoration: underline;
}

/* ========================================
   Tags
   ======================================== */
.post-tags {
  margin-top: var(--space-12);
  padding-top: var(--space-8);
  border-top: 1px solid var(--color-border);
}

.tags-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.post-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
  padding: 0;
  margin: 0;
}

.tag {
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-4);
  background: var(--color-bg-cool);
  color: var(--color-text-secondary);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  transition: all var(--transition-fast);
}

.tag:hover {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}

/* ========================================
   Share Buttons
   ======================================== */
.share-buttons {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-10);
  padding: var(--space-6);
  background: var(--color-bg-cool);
  border-radius: var(--radius-lg);
}

.share-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-right: auto;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.share-twitter:hover {
  background: #1da1f2;
  color: white;
  border-color: #1da1f2;
}

.share-facebook:hover {
  background: #4267B2;
  color: white;
  border-color: #4267B2;
}

.share-hatena:hover {
  background: #00A4DE;
  color: white;
  border-color: #00A4DE;
}

.share-copy:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* ========================================
   Post Footer
   ======================================== */
.post-footer {
  margin-top: var(--space-12);
  padding: var(--space-8);
  background: var(--color-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
}

.post-author {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
}

.author-avatar {
  width: 56px;
  height: 56px;
  background: var(--gradient-hero);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
}

.author-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.author-name {
  font-weight: 600;
  color: var(--color-primary);
}

.author-bio {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.post-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-bg-cool);
  border-radius: var(--radius-md);
}

.post-disclaimer svg {
  flex-shrink: 0;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.post-disclaimer p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.6;
}

/* ========================================
   Related Posts
   ======================================== */
.related-posts {
  background: var(--color-bg-cool);
  padding: var(--space-16) 0;
  margin-top: var(--space-16);
}

.related-posts .section-title {
  justify-content: center;
  border-bottom: none;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
  margin-top: var(--space-10);
}

.related-card {
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-slow);
}

.related-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.related-image {
  height: 160px;
  overflow: hidden;
}

.related-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.related-card:hover .related-image img {
  transform: scale(1.05);
}

.related-content {
  padding: var(--space-5);
}

.related-content time {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.related-content h3 {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-primary);
  margin-top: var(--space-2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-card:hover h3 {
  color: var(--color-accent-dark);
}

/* ========================================
   Post Navigation
   ======================================== */
.post-navigation {
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  padding: var(--space-8) 0;
}

.post-navigation .content-wrapper {
  display: flex;
  justify-content: space-between;
  gap: var(--space-8);
  max-width: var(--max-width);
}

.nav-prev,
.nav-next {
  flex: 1;
  padding: var(--space-6);
  background: var(--color-bg-cool);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

.nav-prev:hover,
.nav-next:hover {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

.nav-next {
  text-align: right;
}

.nav-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.nav-next .nav-label {
  justify-content: flex-end;
}

.nav-prev:hover .nav-label,
.nav-next:hover .nav-label {
  color: rgba(255, 255, 255, 0.7);
}

.nav-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-primary);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nav-prev:hover .nav-title,
.nav-next:hover .nav-title {
  color: var(--color-text-inverse);
}

/* ========================================
   Footer
   ======================================== */
.site-footer {
  background: var(--color-primary);
  color: rgba(255, 255, 255, 0.7);
  padding: var(--space-12) 0;
  margin-top: auto;
}

.site-footer .wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.footer-social {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.9);
  font-size: var(--text-sm);
}

.footer-social a:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  text-decoration: none;
}

.site-footer p {
  font-size: var(--text-sm);
  margin: 0;
  color: rgba(255, 255, 255, 0.5);
}

.site-footer a {
  color: var(--color-accent);
}

.site-footer a:hover {
  text-decoration: underline;
}

/* ========================================
   Category & Archive Pages
   ======================================== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-6);
  list-style: none;
  padding: 0;
}

.category-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-6);
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
  transition: all var(--transition-fast);
}

.category-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-accent-dark);
}

.category-name {
  font-weight: 600;
  color: var(--color-primary);
}

.category-count {
  font-size: var(--text-sm);
  padding: var(--space-1) var(--space-3);
  background: var(--color-accent-light);
  color: var(--color-accent-dark);
  border-radius: var(--radius-full);
  font-weight: 600;
}

/* Archive */
.archive-year {
  font-size: var(--text-xl);
  font-weight: 700;
  margin-top: var(--space-12);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--color-border);
  color: var(--color-primary);
}

.archive-list {
  list-style: none;
  padding: 0;
}

.archive-item {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-border-light);
  transition: background var(--transition-fast);
}

.archive-item:hover {
  background: var(--color-bg-cool);
  margin: 0 calc(var(--space-4) * -1);
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.archive-item time {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  min-width: 100px;
  font-family: var(--font-mono);
}

.archive-item a {
  flex: 1;
  color: var(--color-text);
  font-weight: 500;
}

.archive-item a:hover {
  color: var(--color-accent-dark);
}

/* ========================================
   Dark Mode
   ======================================== */
@media (prefers-color-scheme: dark) {
  :root {
    --color-text: #f1f5f9;
    --color-text-secondary: #e2e8f0;
    --color-text-light: #cbd5e1;
    --color-text-muted: #94a3b8;
    --color-text-inverse: #0f172a;
    --color-bg: #0f172a;
    --color-bg-warm: #0f172a;
    --color-bg-cool: #1e293b;
    --color-bg-card: #1e293b;
    --color-bg-elevated: #334155;
    --color-border: #475569;
    --color-border-light: #334155;
    --color-primary: #e2e8f0;
    --color-primary-light: #cbd5e1;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.3);
  }

  body {
    background: #0f172a;
    color: #f1f5f9;
  }

  .site-header {
    background: rgba(15, 23, 42, 0.95);
    border-bottom-color: #334155;
  }

  .site-title {
    color: #f1f5f9;
  }

  .site-nav a {
    color: #cbd5e1;
  }

  .site-nav a:hover {
    color: #64ffda;
  }

  /* ホームページ */
  .home-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  }

  .section-title {
    color: #f1f5f9;
  }

  /* カード */
  .post-card,
  .related-card,
  .post-footer,
  .toc-container,
  .share-buttons,
  .sources-section,
  .category-card {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
  }

  .post-card-title {
    color: #f1f5f9;
  }

  .post-card-excerpt {
    color: #cbd5e1;
  }

  .post-card-meta,
  .post-card-date {
    color: #94a3b8;
  }

  .post-card-read-more {
    color: #64ffda;
  }

  .post-card-category {
    background: rgba(100, 255, 218, 0.15);
    color: #64ffda;
    border-color: rgba(100, 255, 218, 0.3);
  }

  /* 記事ページ */
  .post-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  }

  .post-title {
    color: #f1f5f9;
  }

  .post-description {
    color: #cbd5e1;
  }

  .post-content {
    color: #e2e8f0;
  }

  .post-content p {
    color: #e2e8f0;
  }

  .post-content h1,
  .post-content h2,
  .post-content h3,
  .post-content h4 {
    color: #f1f5f9;
  }

  .post-content h2 {
    background: linear-gradient(90deg, rgba(100, 255, 218, 0.15), transparent);
    border-left-color: #64ffda;
  }

  .post-content h3 {
    color: #e2e8f0;
  }

  .post-content a {
    color: #64ffda;
  }

  .post-content strong {
    color: #f1f5f9;
  }

  .post-content blockquote {
    background: linear-gradient(90deg, rgba(100, 255, 218, 0.08), rgba(30, 41, 59, 0.8));
    border-left-color: #64ffda;
  }

  .post-content blockquote p {
    color: #cbd5e1;
  }

  .post-content code {
    background: #334155;
    color: #fbbf24;
  }

  .post-content li {
    color: #e2e8f0;
  }

  .post-content li::marker {
    color: #64ffda;
  }

  .post-content th {
    background: #334155;
    color: #f1f5f9;
  }

  .post-content td {
    color: #e2e8f0;
    border-color: #334155;
  }

  .post-content tbody tr:nth-child(even) td {
    background: rgba(148, 163, 184, 0.06);
  }

  .post-content tr:hover td {
    background: rgba(100, 255, 218, 0.08);
  }

  /* 目次 */
  .toc-container {
    background: #1e293b;
    border-color: #334155;
  }

  .toc-title {
    color: #f1f5f9;
  }

  .toc a {
    color: #cbd5e1;
  }

  .toc a:hover {
    color: #64ffda;
    background: rgba(100, 255, 218, 0.08);
  }

  .toc a.is-active {
    color: #64ffda;
    background: rgba(100, 255, 218, 0.12);
  }

  /* タグ・シェア */
  .post-tags .tag {
    color: #94a3b8;
    background: #334155;
  }

  .share-buttons {
    background: #1e293b;
  }

  .share-btn {
    color: #cbd5e1;
    border-color: #475569;
  }

  .share-btn:hover {
    color: #64ffda;
    border-color: #64ffda;
  }

  /* フッター */
  .post-footer {
    background: #1e293b;
    border-color: #334155;
  }

  .author-name {
    color: #f1f5f9;
  }

  .author-bio {
    color: #94a3b8;
  }

  .post-disclaimer {
    color: #94a3b8;
  }

  .post-disclaimer p {
    color: #94a3b8;
  }

  /* ナビゲーション */
  .post-navigation a {
    color: #cbd5e1;
    background: #1e293b;
    border-color: #334155;
  }

  .post-navigation a:hover {
    border-color: #64ffda;
  }

  .nav-title {
    color: #f1f5f9;
  }

  /* 関連記事 */
  .related-posts {
    background: #0f172a;
  }

  .related-card {
    background: #1e293b;
    border-color: #334155;
  }

  .related-card h3 {
    color: #f1f5f9;
  }

  .related-card time {
    color: #94a3b8;
  }

  /* サイトフッター */
  .site-footer {
    background: #020617;
    color: #94a3b8;
  }

  .site-footer p {
    color: #94a3b8;
  }

  .site-footer a {
    color: #cbd5e1;
  }

  /* 読了プログレスバー */
  .reading-progress {
    background: rgba(30, 41, 59, 0.5);
  }

  /* カテゴリバッジ */
  .post-category {
    color: #64ffda;
  }

  .reading-time {
    color: #94a3b8;
  }

  .post-meta time {
    color: #94a3b8;
  }
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 1024px) {
  .post-card {
    grid-template-columns: 1fr 220px;
  }

  .post-body {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .toc-container {
    position: static;
    max-height: none;
  }

  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    --text-4xl: 1.875rem;
    --text-5xl: 2.25rem;
  }

  .site-header .wrapper {
    flex-direction: column;
    height: auto;
    padding: var(--space-4) var(--space-6);
    gap: var(--space-3);
  }

  .site-nav {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .wrapper {
    padding: 0 var(--space-5);
  }

  .home-hero {
    padding: var(--space-16) 0;
  }

  .hero-stats {
    flex-direction: column;
    gap: var(--space-6);
  }

  .post-card {
    grid-template-columns: 1fr;
  }

  .post-card-image {
    height: 200px;
    order: -1;
  }

  .home-card-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .post-hero {
    padding: var(--space-10) var(--space-4);
    margin: calc(var(--space-4) * -1);
    margin-bottom: var(--space-8);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  }

  .post-hero .post-title {
    font-size: var(--text-2xl);
  }

  .post-content {
    font-size: 17px;
    line-height: 1.85;
  }

  .post-content-wrapper {
    padding: 0 var(--space-1);
  }

  .toc-wrapper {
    order: -1;
  }

  .toc-title {
    margin-bottom: var(--space-3);
  }

  .toc a {
    padding: var(--space-2) var(--space-2);
  }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .post-navigation .content-wrapper {
    flex-direction: column;
  }

  .share-buttons {
    flex-wrap: wrap;
    justify-content: center;
  }

  .share-label {
    width: 100%;
    text-align: center;
    margin-bottom: var(--space-2);
    margin-right: 0;
  }
}

@media (max-width: 480px) {
  .wrapper,
  .content-wrapper {
    padding: 0 var(--space-4);
  }

  .post-body {
    padding: 0 var(--space-3);
  }

  .post-content {
    font-size: 16px;
  }

  .post-card-content {
    padding: var(--space-5);
  }

  .post-footer {
    padding: var(--space-5);
  }

  .post-author {
    flex-direction: column;
    text-align: center;
  }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
  .site-header,
  .site-footer,
  .post-navigation,
  .share-buttons,
  .toc-wrapper,
  .reading-progress,
  .related-posts {
    display: none !important;
  }

  .post-hero {
    background: none !important;
    color: var(--color-text) !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .post-hero .post-title,
  .post-hero .post-meta time,
  .post-hero .post-description {
    color: var(--color-text) !important;
  }

  .page-content {
    padding: 0;
  }
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.post-card,
.related-card {
  animation: fadeIn 0.5s ease forwards;
}

.post-card:nth-child(2) { animation-delay: 0.1s; }
.post-card:nth-child(3) { animation-delay: 0.2s; }
.post-card:nth-child(4) { animation-delay: 0.3s; }
