/*──────────────────────────────────────────────────────────────*/
/* 1. Design Tokens                                             */
/*──────────────────────────────────────────────────────────────*/
:root {
  /* Color — Primary (Blue) */
  --color-primary-900: #0f172a;
  --color-primary-800: #1e2d5a;
  --color-primary-700: #1e3a8a;
  --color-primary-600: #1d4ed8;
  --color-primary-500: #3b82f6;
  --color-primary-100: #dbeafe;
  --color-primary-50:  #eff6ff;

  /* Color — Neutral (Slate) */
  --color-neutral-950: #0a0f1e;
  --color-neutral-900: #0f172a;
  --color-neutral-800: #1e293b;
  --color-neutral-700: #334155;
  --color-neutral-600: #475569;
  --color-neutral-500: #64748b;
  --color-neutral-400: #94a3b8;
  --color-neutral-300: #cbd5e1;
  --color-neutral-200: #e2e8f0;
  --color-neutral-100: #f1f5f9;
  --color-neutral-50:  #f8fafc;

  /* Color — Accent (Indigo) */
  --color-accent:      #6366f1;
  --color-accent-light:#e0e7ff;

  /* Semantic tokens */
  --bg-page:       var(--color-neutral-50);
  --bg-surface:    #ffffff;
  --bg-nav:        rgba(10, 15, 30, 0.85);
  --bg-footer:     var(--color-neutral-950);
  --text-base:     var(--color-neutral-900);
  --text-muted:    var(--color-neutral-500);
  --text-light:    var(--color-neutral-400);
  --brand:         var(--color-primary-700);
  --brand-hover:   var(--color-primary-800);

  /* Typography */
  --font-sans: 'Inter', 'Noto Sans JP', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Fira Code', 'Consolas', monospace;

  /* Spacing — 8pt grid */
  --sp-1:  0.25rem;   /*  4px */
  --sp-2:  0.5rem;    /*  8px */
  --sp-3:  0.75rem;   /* 12px */
  --sp-4:  1rem;      /* 16px */
  --sp-5:  1.25rem;   /* 20px */
  --sp-6:  1.5rem;    /* 24px */
  --sp-8:  2rem;      /* 32px */
  --sp-10: 2.5rem;    /* 40px */
  --sp-12: 3rem;      /* 48px */
  --sp-16: 4rem;      /* 64px */
  --sp-20: 5rem;      /* 80px */
  --sp-24: 6rem;      /* 96px */

  /* Layout */
  --max-width:  1120px;
  --nav-height: 64px;

  /* Border radius */
  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15,23,42,0.05);
  --shadow-sm: 0 2px 8px rgba(15,23,42,0.07);
  --shadow-md: 0 4px 16px rgba(15,23,42,0.10);
  --shadow-lg: 0 12px 32px rgba(15,23,42,0.13);
  --shadow-xl: 0 24px 48px rgba(15,23,42,0.17);

  /* Transitions */
  --ease-out:      cubic-bezier(0.0, 0.0, 0.2, 1);
  --ease-in-out:   cubic-bezier(0.4, 0.0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --transition-fast: var(--duration-fast) var(--ease-in-out);
  --transition-base: var(--duration-base) var(--ease-in-out);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-base);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

/*──────────────────────────────────────────────────────────────*/
/* 3. Layout                                                    */
/*──────────────────────────────────────────────────────────────*/
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

main {
  padding-top: var(--nav-height);
}

/*──────────────────────────────────────────────────────────────*/
/* 4. Navbar — Frosted Glass                                    */
/*──────────────────────────────────────────────────────────────*/
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--nav-height);
  background: var(--bg-nav);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 var(--sp-6);
  z-index: 1000;
  transition: background var(--transition-base);
}

.navbar .logo {
  font-size: 1.2rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  background: linear-gradient(90deg, #ffffff 0%, rgba(255,255,255,0.75) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ハンバーガーボタン: モバイルのみ */
.hamburger {
  display: block;
  font-size: 1.5rem;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.9);
  user-select: none;
  line-height: 1;
  padding: var(--sp-2);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.hamburger:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* ナビリンク群 */
.menu {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: var(--nav-height);
  left: 0;
  width: 100%;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  background: rgba(10, 15, 30, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0 var(--sp-6);
  transition: max-height 0.3s var(--ease-in-out), opacity 0.3s var(--ease-in-out);
  z-index: 999;
}

.menu.active {
  max-height: 300px;
  opacity: 1;
  padding: var(--sp-4) var(--sp-6);
}

.menu a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: var(--sp-3) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  transition: color var(--transition-fast);
  letter-spacing: 0.01em;
}

.menu a:last-child {
  border-bottom: none;
}

.menu a:hover {
  color: #ffffff;
}

/* PC: 横並びナビ */
@media (min-width: 768px) {
  .hamburger {
    display: none;
  }

  .menu {
    flex-direction: row;
    position: static;
    max-height: none;
    opacity: 1;
    overflow: visible;
    width: auto;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
    padding: 0;
    gap: var(--sp-8);
    transition: none;
  }

  .menu a {
    padding: 0;
    border-bottom: none;
    position: relative;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.02em;
  }

  /* ホバー下線アニメーション */
  .menu a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.6);
    transition: width var(--transition-base);
  }

  .menu a:hover::after {
    width: 100%;
  }

  .menu a:hover {
    color: #ffffff;
  }
}

/*──────────────────────────────────────────────────────────────*/
/* 5. Hero Header                                               */
/*──────────────────────────────────────────────────────────────*/
.hero-header {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 55% at 50% -5%, #1e3a8a 0%, transparent 65%),
    linear-gradient(180deg, #0f172a 0%, var(--color-neutral-950) 100%);
  color: #ffffff;
  text-align: center;
  padding: var(--sp-24) var(--sp-6) var(--sp-20);
}

/* グリッドパターンオーバーレイ */
.hero-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

/* ブルーグロー */
.hero-header::after {
  content: '';
  position: absolute;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
  top: -250px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  padding: var(--sp-1) var(--sp-4);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--sp-6);
}

.hero-header h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: var(--sp-5);
  background: linear-gradient(180deg, #ffffff 50%, rgba(255,255,255,0.6) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-header p {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.65);
  max-width: 480px;
  margin: 0 auto var(--sp-10);
  line-height: 1.8;
}

.hero-cta {
  display: flex;
  gap: var(--sp-4);
  justify-content: center;
  flex-wrap: wrap;
}

/*──────────────────────────────────────────────────────────────*/
/* 6. Sections                                                  */
/*──────────────────────────────────────────────────────────────*/
.section {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-neutral-200);
  padding: var(--sp-10) var(--sp-8);
  margin: var(--sp-8) auto;
  max-width: var(--max-width);
}

.section {
  margin-left: var(--sp-6);
  margin-right: var(--sp-6);
}

@media (min-width: calc(1120px + 3rem)) {
  .section {
    margin-left: auto;
    margin-right: auto;
  }
}

.section h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-base);
  letter-spacing: -0.025em;
  margin-bottom: var(--sp-8);
  padding-bottom: var(--sp-5);
  position: relative;
}

.section h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 2.5rem;
  height: 3px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--color-accent) 100%);
  border-radius: var(--radius-full);
}

.section h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-base);
  margin-bottom: var(--sp-3);
  letter-spacing: -0.01em;
}

.section p {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text-base);
  margin-bottom: var(--sp-4);
}

.section ul,
.section ol {
  padding-left: var(--sp-6);
  margin-bottom: var(--sp-4);
}

.section li {
  margin-bottom: var(--sp-2);
  line-height: 1.75;
}

/*──────────────────────────────────────────────────────────────*/
/* 7. Post Cards (Top Page Grid)                                */
/*──────────────────────────────────────────────────────────────*/
.post-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-5);
  margin-bottom: var(--sp-8);
}

@media (max-width: 900px) {
  .post-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 580px) {
  .post-card-grid {
    grid-template-columns: 1fr;
  }
}

.post-card {
  background: var(--bg-surface);
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-xs);
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base),
    border-color var(--transition-base);
  position: relative;
}

/* ホバー時の上部アクセントライン */
.post-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--color-accent) 100%);
  opacity: 0;
  transition: opacity var(--transition-base);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.post-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
  border-color: var(--color-primary-100);
}

.post-card:hover::before {
  opacity: 1;
}

.post-card-thumbnail {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, var(--color-neutral-100) 0%, var(--color-neutral-200) 100%);
  flex-shrink: 0;
}

.post-card-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease-out);
}

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

.post-card-content {
  padding: var(--sp-5);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-card-title {
  font-size: 0.975rem;
  font-weight: 700;
  color: var(--text-base);
  line-height: 1.45;
  margin-bottom: var(--sp-3);
  letter-spacing: -0.01em;
  transition: color var(--transition-fast);
}

.post-card:hover .post-card-title {
  color: var(--brand);
}

.post-card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.post-card-excerpt {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: auto;
}

.posts-more-link {
  text-align: right;
}

/*──────────────────────────────────────────────────────────────*/
/* 8. News List (Posts Page)                                    */
/*──────────────────────────────────────────────────────────────*/
.news-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.news-item {
  display: flex;
  gap: var(--sp-5);
  padding: var(--sp-5) 0;
  border-bottom: 1px solid var(--color-neutral-100);
  text-decoration: none;
  color: inherit;
  transition: background var(--transition-fast);
  border-radius: var(--radius-sm);
}

.news-item:last-child {
  border-bottom: none;
}

.news-thumbnail {
  flex-shrink: 0;
  width: 140px;
  height: 90px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-neutral-100);
}

.news-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s var(--ease-out);
}

.news-item:hover .news-thumbnail img {
  transform: scale(1.05);
}

.news-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.news-title {
  margin-bottom: var(--sp-2);
}

.news-title a {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-base);
  text-decoration: none;
  line-height: 1.45;
  display: block;
  letter-spacing: -0.01em;
  transition: color var(--transition-fast);
}

.news-title a:hover {
  color: var(--brand);
}

.news-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: var(--sp-2);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.news-excerpt {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}

@media (max-width: 580px) {
  .news-thumbnail {
    width: 88px;
    height: 58px;
  }
}

/*──────────────────────────────────────────────────────────────*/
/* 9. Tag Pills                                                 */
/*──────────────────────────────────────────────────────────────*/
.tag-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  padding: 0.15rem 0.6rem;
  white-space: nowrap;
  letter-spacing: 0.02em;
  text-decoration: none;
  /* デフォルト: indigo */
  color: var(--color-accent);
  background-color: var(--color-accent-light);
  border: 1px solid rgba(99, 102, 241, 0.2);
  transition: background var(--transition-fast);
}

/*──────────────────────────────────────────────────────────────*/
/* 10. Buttons                                                  */
/*──────────────────────────────────────────────────────────────*/
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: linear-gradient(135deg, var(--color-primary-700) 0%, var(--color-primary-600) 100%);
  color: #ffffff;
  padding: 0.65rem 1.6rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  letter-spacing: 0.02em;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(30, 64, 175, 0.32);
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base),
    background var(--transition-base);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--color-primary-800) 0%, var(--color-primary-700) 100%);
  box-shadow: 0 6px 20px rgba(30, 64, 175, 0.42);
  transform: translateY(-2px);
  color: #ffffff;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  padding: 0.65rem 1.6rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition:
    transform var(--transition-base),
    background var(--transition-base),
    border-color var(--transition-base);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  color: #ffffff;
}

/*──────────────────────────────────────────────────────────────*/
/* 11. Post Content (記事本文内)                                */
/*──────────────────────────────────────────────────────────────*/
.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: var(--sp-8);
  padding-bottom: var(--sp-5);
  border-bottom: 1px solid var(--color-neutral-200);
}

.section img {
  max-width: 100%;
  height: auto;
  margin: var(--sp-6) auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.section iframe {
  display: block;
  width: 100%;
  max-width: 820px;
  aspect-ratio: 16 / 9;
  height: auto;
  margin: var(--sp-6) auto;
  border-radius: var(--radius-md);
  border: 0;
  box-shadow: var(--shadow-lg);
}

.section pre {
  background: var(--color-neutral-800);
  color: #e2e8f0;
  padding: var(--sp-5) var(--sp-6);
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.7;
  margin: var(--sp-5) 0;
}

.section code {
  font-family: var(--font-mono);
}

.section p > code,
.section li > code {
  background: var(--color-neutral-100);
  color: #be123c;
  padding: 0.15em 0.45em;
  border-radius: var(--radius-sm);
  font-size: 0.875em;
}

/*──────────────────────────────────────────────────────────────*/
/* 12. Reading Progress Bar                                     */
/*──────────────────────────────────────────────────────────────*/
.progress-bar {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  width: 0%;
  height: 2px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--color-accent) 100%);
  z-index: 1001;
  transition: width 50ms linear;
}

/*──────────────────────────────────────────────────────────────*/
/* 13. Back to Top Button                                       */
/*──────────────────────────────────────────────────────────────*/
.back-to-top {
  position: fixed;
  bottom: var(--sp-8);
  right: var(--sp-6);
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--color-primary-700) 0%, var(--color-accent) 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-full);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition:
    opacity var(--transition-base),
    transform var(--transition-base),
    box-shadow var(--transition-base);
  z-index: 990;
}

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

.back-to-top:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-2px);
}

/*──────────────────────────────────────────────────────────────*/
/* 14. Footer                                                   */
/*──────────────────────────────────────────────────────────────*/
footer {
  background: var(--bg-footer);
  margin-top: var(--sp-16);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--sp-12) var(--sp-6) var(--sp-8);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-12);
  align-items: start;
}

@media (max-width: 600px) {
  .footer-inner {
    grid-template-columns: 1fr;
    gap: var(--sp-8);
  }
}

.footer-brand .footer-logo {
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  display: block;
  margin-bottom: var(--sp-3);
}

.footer-brand p {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.7;
  margin: 0;
}

.footer-nav {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.footer-nav-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: var(--sp-1);
}

.footer-nav a {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-nav a:hover {
  color: rgba(255, 255, 255, 0.9);
}

.footer-bottom {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-6);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.3);
}
