/* ============================================================
 * QuakeFire Sim — 共通ビジュアルシステム
 * Design language: dark / red-accent / 禁則対応 / scroll-reveal
 * 各コンテンツページ (cluster, insurance, protect, how-to,
 * disclaimer, landing) で読み込む。
 * ============================================================ */

/* ---- 1. 日本語禁則処理（最優先） ----------------------------- */
:where(p, li, h1, h2, h3, h4, h5, h6, dt, dd, td, th, span, strong, em, a) {
  word-break: keep-all;
  overflow-wrap: anywhere;
  line-break: strict;
}

/* 段落・見出しは jisx4051 ライク。長英単語/URL は anywhere で切る */
.qfs-balance {
  text-wrap: balance;
}

/* ---- 2. ベースタイポ ----------------------------------------- */
::selection { background: #7f1d1d; color: #fff; }

/* ---- 3. Hero パターン ---------------------------------------- */
.qfs-hero {
  position: relative;
  padding: 5rem 1.5rem 4rem;
  text-align: center;
  max-width: 64rem;
  margin: 0 auto;
}
.qfs-hero-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #ef4444;
  font-weight: 600;
  margin-bottom: 1rem;
}
.qfs-hero-title {
  font-size: clamp(2.25rem, 5vw + 0.5rem, 4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.18;
  margin-bottom: 1.5rem;
  text-wrap: balance;
}
.qfs-hero-lead {
  color: #a3a3a3;
  font-size: 1.125rem;
  font-weight: 300;
  line-height: 1.75;
  max-width: 42rem;
  margin: 0 auto;
  text-wrap: pretty;
}

/* Hero 背景グロー */
.qfs-hero-glow {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}
.qfs-hero-glow::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #000 0%, rgba(127, 29, 29, 0.18) 50%, #000 100%);
}
.qfs-hero-glow::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(127, 29, 29, 0.16) 0%, transparent 60%);
}
.qfs-hero > * { position: relative; z-index: 1; }

/* ---- 4. 共通カード ------------------------------------------- */
.qfs-card {
  background: rgba(23, 23, 23, 0.55);
  border: 1px solid rgba(64, 64, 64, 0.6);
  border-radius: 1rem;
  padding: 1.75rem;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.qfs-card:hover {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(23, 23, 23, 0.7);
}
.qfs-card-eyebrow {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ef4444;
  margin-bottom: 0.5rem;
}

/* アクセントトーンのバリアント */
.qfs-card.qfs-tone-danger {
  background: rgba(127, 29, 29, 0.12);
  border-color: rgba(127, 29, 29, 0.4);
}
.qfs-card.qfs-tone-info {
  background: rgba(30, 58, 138, 0.12);
  border-color: rgba(30, 58, 138, 0.4);
}
.qfs-card.qfs-tone-success {
  background: rgba(20, 83, 45, 0.12);
  border-color: rgba(20, 83, 45, 0.4);
}
.qfs-card.qfs-tone-warn {
  background: rgba(120, 53, 15, 0.14);
  border-color: rgba(120, 53, 15, 0.4);
}

/* ---- 5. セクション定型 --------------------------------------- */
.qfs-section {
  position: relative;
  padding: 6rem 1.5rem;
}
.qfs-section-tight { padding: 4rem 1.5rem; }
.qfs-section-divider {
  border-top: 1px solid #171717;
}
.qfs-section-header {
  text-align: center;
  max-width: 52rem;
  margin: 0 auto 4rem;
}
.qfs-section-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #ef4444;
  margin-bottom: 0.75rem;
}
.qfs-section-title {
  font-size: clamp(1.75rem, 3.5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin-bottom: 1rem;
  text-wrap: balance;
}
.qfs-section-lead {
  color: #a3a3a3;
  font-size: 1.0625rem;
  line-height: 1.75;
  max-width: 42rem;
  margin: 0 auto;
  text-wrap: pretty;
}

/* ---- 6. Scroll Reveal --------------------------------------- */
.reveal {
  opacity: 0;
  transition: opacity 0.9s ease-out, transform 0.9s ease-out;
  will-change: opacity, transform;
}
.reveal.visible {
  opacity: 1;
  transform: translate3d(0, 0, 0) !important;
}
.reveal-up    { transform: translate3d(0, 2.5rem, 0); }
.reveal-down  { transform: translate3d(0, -1.5rem, 0); }
.reveal-left  { transform: translate3d(2.5rem, 0, 0); }
.reveal-right { transform: translate3d(-2.5rem, 0, 0); }
.reveal-zoom  { transform: scale(0.94); transform-origin: center; }
.reveal-zoom.visible { transform: scale(1) !important; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ---- 7. Stat bar (Top と共通) ------------------------------- */
.qfs-statbar { margin-bottom: 1.25rem; }
.qfs-statbar-label {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 0.5rem;
  gap: 1rem;
}
.qfs-statbar-track {
  height: 0.875rem;
  background: #171717;
  border-radius: 999px;
  overflow: hidden;
}
.qfs-statbar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width 1.5s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}
.qfs-statbar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.18);
  animation: qfs-pulse 2.4s ease-in-out infinite;
}
@keyframes qfs-pulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}

/* ---- 8. Cluster grid (visual) -------------------------------- */
.qfs-grid-block {
  aspect-ratio: 1 / 1;
  border-radius: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.5s ease;
  color: #18181b;
}
.qfs-grid-block.is-burning {
  background: #dc2626;
  color: #000;
  box-shadow: 0 0 24px rgba(220, 38, 38, 0.85);
  animation: qfs-burn-pulse 1.6s ease-in-out infinite;
}
.qfs-grid-block.is-spreading {
  background: rgba(249, 115, 22, 0.85);
  color: #18181b;
}
.qfs-grid-block.is-fireproof {
  background: #1f2937;
  color: #475569;
}
.qfs-grid-block.is-other {
  background: #404040;
  color: #262626;
}
@keyframes qfs-burn-pulse {
  0%, 100% { transform: scale(1.06); box-shadow: 0 0 24px rgba(220, 38, 38, 0.85); }
  50%      { transform: scale(1.12); box-shadow: 0 0 36px rgba(220, 38, 38, 1); }
}

/* ---- 9. アクセントテーブル → モバイルでカード化 -------------- */
.qfs-table-wrap { overflow-x: auto; }
.qfs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.qfs-table thead th {
  text-align: left;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #404040;
  font-weight: 600;
  color: #d4d4d4;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}
.qfs-table tbody td {
  padding: 1rem;
  border-bottom: 1px solid #1f2937;
  color: #d4d4d4;
  vertical-align: top;
}
.qfs-table tbody tr:last-child td { border-bottom: none; }
.qfs-table tbody td:first-child {
  font-weight: 600;
  color: #fff;
}

@media (max-width: 720px) {
  /* Card-ize: thead 隠して各セルを縦カードに */
  .qfs-table.qfs-table-stack thead { display: none; }
  .qfs-table.qfs-table-stack,
  .qfs-table.qfs-table-stack tbody,
  .qfs-table.qfs-table-stack tr,
  .qfs-table.qfs-table-stack td {
    display: block;
    width: 100%;
  }
  .qfs-table.qfs-table-stack tr {
    background: rgba(23, 23, 23, 0.55);
    border: 1px solid rgba(64, 64, 64, 0.6);
    border-radius: 0.85rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
  }
  .qfs-table.qfs-table-stack td {
    border: none;
    padding: 0.5rem 1rem;
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    gap: 0.5rem;
  }
  .qfs-table.qfs-table-stack td::before {
    content: attr(data-label);
    font-size: 0.7rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    align-self: center;
  }
  .qfs-table.qfs-table-stack td:first-child {
    background: rgba(127, 29, 29, 0.18);
    border-radius: 0.5rem 0.5rem 0 0;
    padding-top: 0.85rem;
  }
  .qfs-table.qfs-table-stack td:first-child::before {
    content: '';
    display: none;
  }
  .qfs-table.qfs-table-stack td:first-child {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

/* ---- 10. ドーナツ風 SVG 用 ----------------------------------- */
.qfs-donut-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
@media (min-width: 720px) {
  .qfs-donut-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.qfs-donut-card {
  position: relative;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(64, 64, 64, 0.6);
  border-radius: 1rem;
  padding: 1.25rem 1rem;
  text-align: center;
  transition: border-color 0.2s ease;
}
.qfs-donut-card:hover { border-color: rgba(239, 68, 68, 0.45); }
.qfs-donut-svg { width: 110px; height: 110px; margin: 0 auto 0.6rem; display: block; }
.qfs-donut-svg .qfs-donut-track { stroke: #1f2937; stroke-width: 14; fill: none; }
.qfs-donut-svg .qfs-donut-arc {
  stroke-width: 14;
  fill: none;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 1.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.qfs-donut-pct {
  fill: #fff;
  font-weight: 700;
  font-size: 22px;
  text-anchor: middle;
  dominant-baseline: central;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* tone variations for donut */
.qfs-donut-card.qfs-tone-danger  .qfs-donut-arc { stroke: #ef4444; }
.qfs-donut-card.qfs-tone-warn    .qfs-donut-arc { stroke: #f97316; }
.qfs-donut-card.qfs-tone-caution .qfs-donut-arc { stroke: #eab308; }
.qfs-donut-card.qfs-tone-mute    .qfs-donut-arc { stroke: #71717a; }
.qfs-donut-card.qfs-tone-danger  { background: rgba(127, 29, 29, 0.18); border-color: rgba(127, 29, 29, 0.45); }
.qfs-donut-card.qfs-tone-warn    { background: rgba(120, 53, 15, 0.18); border-color: rgba(120, 53, 15, 0.45); }
.qfs-donut-card.qfs-tone-caution { background: rgba(133, 77, 14, 0.18); border-color: rgba(133, 77, 14, 0.45); }

.qfs-donut-label {
  font-size: 0.75rem;
  color: #fca5a5;
  font-weight: 700;
  margin-bottom: 0.4rem;
  letter-spacing: 0.05em;
}
.qfs-donut-card.qfs-tone-warn    .qfs-donut-label { color: #fdba74; }
.qfs-donut-card.qfs-tone-caution .qfs-donut-label { color: #fde047; }
.qfs-donut-card.qfs-tone-mute    .qfs-donut-label { color: #d4d4d8; }

.qfs-donut-meta {
  font-size: 0.7rem;
  color: #a3a3a3;
  margin-top: 0.5rem;
  line-height: 1.5;
}

/* ---- 11. アイコンカード（4要素タイル等） --------------------- */
.qfs-icon-card {
  background: rgba(23, 23, 23, 0.5);
  border: 1px solid rgba(64, 64, 64, 0.6);
  border-radius: 0.875rem;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.qfs-icon-card:hover {
  border-color: rgba(239, 68, 68, 0.5);
  transform: translateY(-2px);
}
.qfs-icon-card::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -30%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.08), transparent 70%);
  pointer-events: none;
}
.qfs-icon-card-num {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 0.85rem;
}
.qfs-icon-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #fff;
}
.qfs-icon-card-body {
  color: #a3a3a3;
  font-size: 0.875rem;
  line-height: 1.7;
}

/* ---- 12. CTA ボタン共通 -------------------------------------- */
.qfs-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.95rem 2rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  background: #fff;
  color: #000;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}
.qfs-cta:hover {
  transform: scale(1.03);
  background: #e5e5e5;
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.25);
}
.qfs-cta-secondary {
  background: transparent;
  color: #d4d4d4;
  border: 1px solid #404040;
}
.qfs-cta-secondary:hover {
  background: rgba(64, 64, 64, 0.4);
  color: #fff;
  box-shadow: none;
}

/* ---- 13. ステップ・コネクター ------------------------------- */
.qfs-step-pill {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}
.qfs-step-pill.tone-1 { background: #ef4444; color: #fff; }
.qfs-step-pill.tone-2 { background: #f97316; color: #fff; }
.qfs-step-pill.tone-3 { background: #eab308; color: #000; }

/* ---- 14. dim/glow util --------------------------------------- */
.qfs-glow-red {
  box-shadow: 0 0 50px rgba(220, 38, 38, 0.18);
}
.qfs-divider-line {
  height: 1px;
  background: linear-gradient(90deg, transparent, #404040, transparent);
}
