/* =======================================
   エンジニア転職スタック - カスタムスタイル
   Tailwind CSS の補助・コンポーネント化
   ======================================= */

:root {
  --color-primary: #1a6dff;
  --color-primary-dark: #1557c9;
  --color-accent: #ff7a2f;
  --color-accent-dark: #e6681e;
  --color-text: #1a1a1a;
  --color-text-muted: #5f6b7a;
  --color-bg: #f7f8fa;
  --color-card: #ffffff;
  --color-border: #e6e9ef;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', sans-serif;
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* スマホ横スクロール防止 */
html, body {
  overflow-x: hidden;
}

/* コンテナ最大幅を 1200px に統一 */
.container {
  max-width: 1200px !important;
}

/* フォーカスリング */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ボタンコンポーネント */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 700;
  border-radius: 0.75rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  text-decoration: none;
  cursor: pointer;
  border: none;
  line-height: 1.5;
  min-height: 52px;
  padding: 0.875rem 1.75rem;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

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

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

.btn-accent:hover {
  background-color: var(--color-accent-dark);
}

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

.btn-primary:hover {
  background-color: var(--color-primary-dark);
}

.btn-compact {
  min-height: 40px !important;
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
}

.btn-white {
  background-color: #fff;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-white:hover {
  background-color: #f8fafc;
}

/* カードコンポーネント */
.card {
  background-color: var(--color-card);
  border-radius: 1rem;
  border: 1px solid var(--color-border);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
}

/* セクション見出し */
.section-title {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--color-text);
}

/* カテゴリバッジ */
.category-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.1875rem 0.625rem;
  border-radius: 9999px;
  line-height: 1.5;
}

.category-badge-blue {
  background-color: #e8f1ff;
  color: var(--color-primary);
}

.category-badge-orange {
  background-color: #fff0e6;
  color: var(--color-accent-dark);
}

/* ランキングバッジ */
.ranking-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.ranking-badge-gold {
  background-color: #ffd700;
  color: #5a4a00;
}

.ranking-badge-silver {
  background-color: #c0c0c0;
  color: #333;
}

.ranking-badge-bronze {
  background-color: #cd7f32;
  color: #fff;
}

.ranking-badge-default {
  background-color: #f1f5f9;
  color: var(--color-text-muted);
}

/* 画像のアスペクト比固定（CLS対策） */
.img-aspect-16-9 {
  aspect-ratio: 16 / 9;
  width: 100%;
  height: auto;
  object-fit: cover;
}

.img-aspect-4-3 {
  aspect-ratio: 4 / 3;
  width: 100%;
  height: auto;
  object-fit: cover;
}

.img-aspect-3-2 {
  aspect-ratio: 3 / 2;
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* 診断カードアイコン */
.diagnostic-icon {
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8f1ff 0%, #d4e6ff 100%);
  color: var(--color-primary);
}

.diagnostic-icon svg {
  width: 50px;
  height: 50px;
}

/* 安心サービスアイコン */
.trust-icon {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8f1ff 0%, #d4e6ff 100%);
  color: var(--color-primary);
  flex-shrink: 0;
}

.trust-icon svg {
  width: 36px;
  height: 36px;
}

/* 比較表 */
.compare-table {
  width: 100%;
  border-collapse: collapse;
}

.compare-table col:nth-child(1) { width: 28%; }
.compare-table col:nth-child(2) { width: 20%; }
.compare-table col:nth-child(3) { width: 12%; }
.compare-table col:nth-child(4) { width: 40%; }

.compare-table th,
.compare-table td {
  padding: 1rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.compare-table th {
  background-color: #f8f9fb;
  font-weight: 700;
  color: var(--color-text-muted);
  white-space: nowrap;
  font-size: 0.875rem;
}

.compare-table td {
  vertical-align: middle;
  font-size: 0.8125rem;
}

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

/* 星評価 */
.star-rating {
  color: #ffb800;
  letter-spacing: -0.12em;
}

/* ヘッダー追従時のモダンスタイル */
#site-header {
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: rgba(255, 255, 255, 0.2);
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

#site-header.is-scrolled {
  background-color: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  border-bottom-color: rgba(230, 233, 239, 0.8);
}

/* モバイルメニュー */
.mobile-menu {
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out;
}

.mobile-menu.is-open {
  transform: translateX(0);
}

.mobile-menu-overlay {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

/* トップへ戻るボタン */
.back-to-top {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 9999px;
  background-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background-color 0.2s ease;
  cursor: pointer;
  border: none;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background-color: var(--color-primary-dark);
}

.back-to-top:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}

/* ユーティリティ */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* アニメーション抑制設定を尊重 */
@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;
  }
}

/* サイト内検索パネル */
.search-panel {
  top: 64px;
}

.search-panel-backdrop {
  top: 64px;
}

.search-panel.is-open {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.search-panel-backdrop.is-open {
  display: block !important;
}

.search-results {
  max-height: 60vh;
  overflow-y: auto;
}

.search-result-item {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  text-decoration: none;
}

.search-result-item:hover,
.search-result-item:focus {
  background-color: #f1f5f9;
}

.search-result-item .result-title {
  font-weight: 700;
  color: var(--color-text);
}

.search-result-item .result-desc {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* 記事詳細ページの調整 */

/* メイン画像：デスクトップは 1/3 幅、左寄せ、角丸を小さく */
article[itemtype="https://schema.org/Article"] > figure {
  width: 100%;
  border-radius: 0.5rem;
}

@media (min-width: 768px) {
  article[itemtype="https://schema.org/Article"] > figure {
    width: 33%;
  }
}

/* ページヘッダーの h1 を小さく */
section[aria-label="ページヘッダー"] h1 {
  font-size: 0.875rem;
  line-height: 1.4;
}

@media (min-width: 1024px) {
  section[aria-label="ページヘッダー"] h1 {
    font-size: 1.125rem;
  }
}

/* ページヘッダーコンテナの余白を少し詰める */
section[aria-label="ページヘッダー"] > div.container {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

@media (min-width: 1024px) {
  section[aria-label="ページヘッダー"] > div.container {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }
}

/* パンくずとタイトルの余白を詰める */
section[aria-label="ページヘッダー"] nav[aria-label="パンくずリスト"] {
  margin-bottom: 0.5rem;
}

section[aria-label="ページヘッダー"] .flex.items-start {
  margin-bottom: 0.25rem;
}

/* 印刷用スタイル */
@media print {
  header,
  footer,
  #search-panel,
  #search-panel-backdrop,
  #mobile-menu,
  #mobile-menu-overlay,
  #back-to-top,
  .btn,
  nav[aria-label="前後の記事"],
  .card:has(> form) {
    display: none !important;
  }

  body {
    background: #fff;
    padding-top: 0 !important;
    overflow: visible;
  }

  main {
    display: block;
  }

  article[itemtype="https://schema.org/Article"].card {
    box-shadow: none;
    border: none;
    padding: 0 !important;
  }

  article[itemtype="https://schema.org/Article"] img,
  article[itemtype="https://schema.org/Article"] figure {
    max-width: 100%;
    page-break-inside: avoid;
  }

  a[href]::after {
    content: none !important;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }

  h1, h2, h3 {
    page-break-after: avoid;
  }

  p, li, tr, pre, blockquote {
    page-break-inside: avoid;
  }
}
