/* =========================================================
   AIガバナンスInfo - プロフェッショナル企業メディア
   Target: 情シス、監査担当者、AIガバナンス責任者
   Design: モダン、洗練、信頼性、先進性
   ========================================================= */

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

:root {
  /* Brand Colors - 洗練された企業カラーパレット */
  --brand-primary: #E2E8F0;      /* ライトグレー（テキスト用） */
  --brand-secondary: #2563EB;    /* ビビッドブルー（先進性） */
  --brand-accent: #06B6D4;       /* シアン（AI・テクノロジー） */
  --brand-accent-2: #8B5CF6;     /* パープル（イノベーション） */
  --brand-dark: #020617;         /* 深い黒 */
  --brand-gradient: linear-gradient(135deg, #2563EB 0%, #06B6D4 100%);

  /* Semantic Colors - ダークテーマ配色 */
  --bg-primary: #0F172A;         /* ダークネイビー背景 */
  --bg-secondary: #1E293B;       /* ミディアムダーク */
  --bg-tertiary: #334155;        /* ライトダーク */
  --bg-accent: rgba(37, 99, 235, 0.1);  /* アクセント背景 */
  --text-primary: #E2E8F0;       /* ライトグレー（メインテキスト） */
  --text-secondary: #CBD5E1;     /* ミディアムグレー */
  --text-tertiary: #94A3B8;      /* ダークグレー */
  --text-muted: #64748B;         /* より暗いグレー */
  --border-light: rgba(148, 163, 184, 0.2);  /* 半透明ボーダー */
  --border-medium: rgba(148, 163, 184, 0.3);
  --border-accent: #2563EB;

  /* Enhanced Shadows - より立体的な影 */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.06), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.12), 0 4px 8px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 24px 48px -12px rgba(0, 0, 0, 0.18), 0 8px 16px -4px rgba(0, 0, 0, 0.08);
  --shadow-card: 0 2px 8px 0 rgba(15, 23, 42, 0.06);
  --shadow-card-hover: 0 12px 32px -4px rgba(15, 23, 42, 0.15), 0 4px 12px -2px rgba(15, 23, 42, 0.08);

  /* Border Radius - モダンな角丸 */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Layout - ゆとりのあるスペーシング */
  --container: 1280px;
  --content: 840px;
  --gutter: 40px;
  --section-spacing: 80px;

  /* Typography - 読みやすく洗練されたフォント設定 */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP",
    "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", "Consolas",
    "Courier New", monospace;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;
}

/* Base Styles */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-primary);
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #334155 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Enhanced Link Styles */
a {
  color: var(--brand-secondary);
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

a:hover {
  color: var(--brand-accent);
}

a:focus-visible {
  outline: 2px solid var(--brand-secondary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Container */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Main content */
.main-content {
  min-height: 70vh;
  max-width: var(--content);
  margin: 0 auto;
}

/* =========================================================
   Premium Header - モダンで洗練されたヘッダー
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  margin-bottom: 64px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.site-header::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--brand-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.site-header:hover::before {
  opacity: 1;
}

.site-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 1.375rem;
  font-weight: var(--font-weight-extrabold);
  color: #FFFFFF;
  letter-spacing: -0.03em;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: all 0.3s ease;
  position: relative;
  z-index: 0;          /* 追加: stacking context を作る */
  isolation: isolate;  /* 追加: 疑似要素の背面回り込み防止 */
}

.site-title::before {
  content: '';
  position: absolute;
  inset: 0; /* 変更: -4px をやめて要素内に収める */
  border-radius: var(--radius);
  background: var(--brand-gradient);
  opacity: 0;
  z-index: -1;
  transition: opacity 0.3s ease;
}

.site-title:hover {
  transform: none; /* 変更: 上方向移動をやめてはみ出し防止 */
  -webkit-text-fill-color: white;
}

.site-title:hover::before {
  opacity: 0.1;
}

/* Premium Navigation */
.site-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.site-nav a {
  position: relative;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: var(--font-weight-semibold);
  padding: 10px 20px;
  border-radius: var(--radius);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.site-nav a::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--brand-gradient);
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: -1;
}

.site-nav a:hover {
  color: white;
  transform: none; /* 変更: 上方向移動をやめてはみ出し防止 */
  box-shadow: var(--shadow-md);
}

.site-nav a:hover::before {
  opacity: 1;
}

/* External Link Icon for お問い合わせ */
.site-nav a[target="_blank"]::after {
  content: '↗';
  margin-left: 4px;
  font-size: 0.75em;
  opacity: 0.7;
}

/* =========================================================
   Premium Article Cards - より洗練されたカードデザイン
   ========================================================= */
.article-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 32px;
}

.article-item {
  position: relative;
  padding: 32px;
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.article-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--brand-gradient);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.article-item:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--brand-secondary);
}

.article-item:hover::before {
  opacity: 1;
}

.article-title {
  margin: 0 0 16px 0;
  font-size: 1.5rem;
  font-weight: var(--font-weight-bold);
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.article-title a {
  color: var(--text-primary);
  text-decoration: none;
  background: linear-gradient(to right, var(--brand-secondary), var(--brand-accent));
  background-size: 0% 2px;
  background-repeat: no-repeat;
  background-position: left bottom;
  transition: background-size 0.3s ease;
}

.article-title a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  z-index: 1;
}

.article-title a:hover {
  background-size: 100% 2px;
  color: var(--brand-secondary);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  color: var(--text-tertiary);
  font-size: 0.875rem;
  margin-bottom: 16px;
  font-weight: var(--font-weight-medium);
}

.article-meta::before {
  content: '📅';
  margin-right: -8px;
}

.article-description {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 1rem;
}

/* =========================================================
   Premium Genre Tabs - より視認性の高いタブ
   ========================================================= */
.genre-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 48px;
  padding: 8px;
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.genre-tab {
  position: relative;
  z-index: 0;           /* 追加: stacking context を作る */
  isolation: isolate;   /* 追加: より確実に背面を分離 */
  padding: 14px 28px;
  font-size: 0.9375rem;
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: var(--radius);
  overflow: hidden;
}

.genre-tab::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--brand-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.genre-tab:not(.active):hover {
  color: var(--brand-secondary);
  background-color: var(--bg-accent);
  transform: translateY(-2px);
}

.genre-tab.active {
  color: white;
  font-weight: var(--font-weight-bold);
  box-shadow: var(--shadow-md);
}

.genre-tab.active::before {
  opacity: 1;
}

/* =========================================================
   Premium Tags - モダンなタグデザイン
   ========================================================= */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.tag {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: var(--font-weight-semibold);
  color: var(--brand-secondary);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(6, 182, 212, 0.08) 100%);
  border: 1px solid rgba(37, 99, 235, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(8px);
}

.tag::before {
  content: '#';
  margin-right: 4px;
  opacity: 0.6;
}

.tag:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-md);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(6, 182, 212, 0.15) 100%);
  border-color: var(--brand-secondary);
}

/* Tag List Page */
.tag-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 20px;
}

.tag-list li a {
  display: flex;
  justify-content: flex-start; /* 変更: 左揃えに */
  align-items: baseline;
  gap: 12px; /* 追加: タグ名とカウントの間にスペース */
  padding: 20px 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-card);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tag-list li a:hover {
  border-color: var(--brand-secondary);
  box-shadow: var(--shadow-card-hover);
  transform: translateX(8px);
  background: rgba(37, 99, 235, 0.15);
}

.tag-count {
  color: var(--text-tertiary);
  font-size: 0.875rem;
  font-weight: var(--font-weight-bold);
  padding: 4px 12px;
  background: rgba(51, 65, 85, 0.6);
  border-radius: var(--radius-full);
}

/* =========================================================
   Premium Article Page - 読みやすい記事レイアウト
   ========================================================= */
.page-title {
  font-size: 2.5rem;
  font-weight: var(--font-weight-extrabold);
  margin: 0 0 48px 0;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.2;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.article-header {
  margin: 0 0 56px 0;
  padding: 40px;
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.article-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--brand-gradient);
}

.article-header h1 {
  margin: 0 0 20px 0;
  font-size: 2.5rem;
  font-weight: var(--font-weight-extrabold);
  line-height: 1.3;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.article-header .article-meta {
  margin-bottom: 16px;
}

.article-header .article-description {
  margin: 0 0 20px 0;
  padding: 16px 20px;
  background: rgba(37, 99, 235, 0.15);
  border-left: 4px solid var(--brand-secondary);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
  font-size: 1.0625rem;
  line-height: 1.7;
}

.copy-article-btn {
  position: relative;
  z-index: 0;
  isolation: isolate;
  margin-top: 20px;
  margin-left: auto;
  display: block;
  padding: 12px 24px;
  font-size: 0.9375rem;
  font-weight: var(--font-weight-semibold);
  color: white;
  background: transparent;
  border: 2px solid var(--brand-secondary);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  font-family: var(--font-sans);
}

.copy-article-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--brand-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.copy-article-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-accent);
}

.copy-article-btn:hover::before {
  opacity: 1;
}

.copy-article-btn:active {
  transform: translateY(0);
}

.article-content {
  margin: 0 0 80px 0;
  font-size: 1.0625rem;
  line-height: 1.85;
}

/* Article Typography */
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
  margin-top: 2.5em;
  margin-bottom: 1em;
  font-weight: var(--font-weight-bold);
  line-height: 1.4;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.article-content h2 {
  font-size: 2rem;
  padding-bottom: 0.5em;
  border-bottom: 3px solid var(--border-light);
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.article-content h3 {
  font-size: 1.5rem;
  position: relative;
  padding-left: 20px;
}

.article-content h3::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.3em;
  width: 4px;
  height: 1.2em;
  background: var(--brand-gradient);
  border-radius: var(--radius-sm);
}

.article-content h4 {
  font-size: 1.25rem;
}

.article-content p {
  margin: 1.5em 0;
  color: var(--text-primary);
  line-height: 1.9;
}

.article-content ul,
.article-content ol {
  margin: 1.5em 0;
  padding-left: 2em;
}

.article-content li {
  margin: 0.75em 0;
  line-height: 1.8;
}

/* Enhanced Blockquote */
.article-content blockquote {
  margin: 2em 0;
  padding: 24px 28px;
  border-left: 5px solid var(--brand-accent);
  background: rgba(6, 182, 212, 0.1);
  color: var(--text-secondary);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  font-style: italic;
  box-shadow: var(--shadow-sm);
}

.article-content blockquote::before {
  content: '"';
  font-size: 3rem;
  line-height: 0;
  color: var(--brand-accent);
  opacity: 0.3;
  position: relative;
  top: 20px;
}

/* Premium Code Styles */
.article-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: rgba(51, 65, 85, 0.8);
  color: #06B6D4;
  border: 1px solid var(--border-light);
  font-weight: var(--font-weight-medium);
}

.article-content pre {
  font-family: var(--font-mono);
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
  color: #E2E8F0;
  padding: 28px;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  line-height: 1.75;
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-lg);
  margin: 2em 0;
  position: relative;
}

.article-content pre::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--brand-gradient);
}

.article-content pre code {
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  font-weight: normal;
}

/* Premium Images */
.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  margin: 2.5em 0;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.article-content img:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-xl);
}

/* Premium Tables */
.article-content table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  margin: 2em 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-light);
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
}

.article-content th,
.article-content td {
  border-bottom: 1px solid var(--border-light);
  padding: 16px 20px;
  text-align: left;
  vertical-align: top;
}

.article-content th {
  background: rgba(51, 65, 85, 0.8);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  text-transform: uppercase;
  font-size: 0.875rem;
  letter-spacing: 0.05em;
}

.article-content tr:last-child td {
  border-bottom: 0;
}

.article-content tbody tr:hover {
  background-color: rgba(37, 99, 235, 0.15);
}

/* =========================================================
   Premium Footer - 洗練されたフッター
   ========================================================= */
.site-footer {
  margin-top: 120px;
  padding: 48px 0;
  border-top: 1px solid var(--border-light);
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.875rem;
  background: transparent;
  position: relative;
}

.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--brand-gradient);
}

.site-footer p {
  margin: 8px 0;
  font-weight: var(--font-weight-medium);
}

/* =========================================================
   404 Error Page
   ========================================================= */
.error-page {
  text-align: center;
  padding: 100px 40px;
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  margin: 60px 0;
}

.error-page h1 {
  font-size: 6rem;
  font-weight: var(--font-weight-extrabold);
  margin: 0 0 24px 0;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.05em;
}

.error-page p {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin: 0;
  font-weight: var(--font-weight-medium);
}

/* =========================================================
   Responsive Design - モバイル最適化
   ========================================================= */
@media (max-width: 900px) {
  :root {
    --gutter: 28px;
    --section-spacing: 56px;
  }

  .main-content {
    max-width: 100%;
  }

  .site-title {
    font-size: 1.25rem;
  }

  .article-header h1 {
    font-size: 2rem;
  }

  .page-title {
    font-size: 2rem;
  }

  .article-content h2 {
    font-size: 1.625rem;
  }

  .article-content h3 {
    font-size: 1.25rem;
  }
}

@media (max-width: 600px) {
  :root {
    --gutter: 20px;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    padding: 20px 0;
    margin-bottom: 40px;
  }

  .site-title {
    font-size: 1.125rem;
    padding: 8px 12px;
  }

  .site-nav {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .site-nav a {
    padding: 8px 14px;
    font-size: 0.875rem;
  }

  .genre-tabs {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 32px;
    padding: 6px;
  }

  .genre-tab {
    padding: 10px 18px;
    font-size: 0.875rem;
  }

  .article-item {
    padding: 24px;
  }

  .article-header {
    padding: 28px;
    margin-bottom: 40px;
  }

  .article-header h1 {
    font-size: 1.75rem;
  }

  .page-title {
    font-size: 1.75rem;
    margin-bottom: 32px;
  }

  .error-page {
    padding: 80px 28px;
  }

  .error-page h1 {
    font-size: 4rem;
  }

  .site-footer {
    margin-top: 80px;
    padding: 36px 0;
  }
}

/* =========================================================
   Accessibility Enhancements
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 3px solid var(--brand-secondary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border-light: #000000;
    --text-secondary: #000000;
  }
}
