/*
Theme Name: いっぱい動物診断
Theme URI: https://example.com/ippai-animal-check
Author: You
Author URI: https://example.com
Description: 「いっぱい動物診断」のLP用ミニマルテーマ。グラデ背景、ハンバーガーメニュー、漂うSVG動物、レスポンシブ対応。固定ページテンプレでクイズ表示。
Version: 1.1.0
Text Domain: ippai-animal
*/

/* Reset & base */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Yomogi', 'Zen Maru Gothic', cursive, sans-serif;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #333;
}

/* Header / Hamburger */
.hamburger {
    position: fixed;
    top: 25px;
    right: 25px;
    width: 50px; height: 50px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px;
    box-shadow: 0 4px 15px rgba(0,0,0,.1);
    z-index: 1000;
    transition: all .3s ease;
}
.hamburger:hover { transform: scale(1.1); }
.hamburger span {
    width: 25px; height: 3px; background: #667eea; border-radius: 3px; transition: all .3s ease;
}
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(7px, 7px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(7px, -7px); }

/* Slide menu */
.menu {
    position: fixed; top: 0; right: -300px; width: 300px; height: 100vh;
    background: #fff; box-shadow: -5px 0 15px rgba(0,0,0,.1);
    transition: right .3s ease; z-index: 999; padding: 100px 30px 30px;
}
.menu.active { right: 0; }
.menu .menu-item, .menu a {
    display: block; padding: 20px; margin-bottom: 10px; border-radius: 15px; cursor: pointer;
    transition: all .3s ease; font-size: 1.2rem; color: #333; background: #f8f9fa; text-decoration: none;
}
.menu .menu-item:hover, .menu a:hover { background: #667eea; color: #fff; transform: translateX(-5px); }

/* Overlay */
.overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    opacity: 0; visibility: hidden; transition: all .3s ease; z-index: 998;
}
.overlay.active { opacity: 1; visibility: visible; }

/* LP Main container */
.container { text-align: center; max-width: 600px; width: 100%; }
.logo { margin-bottom: 20px; animation: float 3s ease-in-out infinite; }
.logo-text { font-size: 3rem; margin-bottom: 10px; }
h1 { font-size: 2.5rem; color: #333; margin-bottom: 15px; font-weight: 700; }
.subtitle { font-size: 1.1rem; color: #666; margin-bottom: 50px; line-height: 1.6; }

/* Buttons */
.button-container { display: flex; flex-direction: column; gap: 20px; align-items: center; }
.btn {
    width: 280px; padding: 18px 40px; font-size: 1.3rem; border: none; border-radius: 50px; cursor: pointer;
    font-weight: 600; transition: all .3s ease; text-decoration: none; display: inline-block;
    box-shadow: 0 4px 15px rgba(0,0,0,.1);
}
.btn-primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; }
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(102,126,234,.4); }
.btn-secondary { background: #fff; color: #667eea; border: 2px solid #667eea; }
.btn-secondary:hover { background: #f8f9ff; transform: translateY(-3px); box-shadow: 0 6px 20px rgba(102,126,234,.2); }

/* Floating animals (LP only) */
.animals { position: fixed; width: 80px; height: 80px; opacity: .2; pointer-events: none; animation: drift 20s ease-in-out infinite; }
.animal1 { top: 10%; left: 10%; animation-delay: 0s; }
.animal2 { top: 20%; right: 15%; animation-delay: 2s; }
.animal3 { bottom: 15%; left: 15%; animation-delay: 4s; }
.animal4 { bottom: 20%; right: 10%; animation-delay: 6s; }
.animal5 { top: 50%; left: 5%; animation-delay: 8s; }
.animal6 { top: 60%; right: 8%; animation-delay: 10s; }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-20px)} }
@keyframes drift { 0%,100%{transform:translate(0,0) rotate(0)} 25%{transform:translate(10px,10px) rotate(5deg)} 50%{transform:translate(0,20px) rotate(0)} 75%{transform:translate(-10px,10px) rotate(-5deg)} }

/* Accessibility */
@media (prefers-reduced-motion: reduce) { .logo, .animals { animation: none !important; } }

/* Responsive */
@media (max-width: 600px) {
    h1 { font-size: 2rem; }
    .logo-text { font-size: 2rem; }
    .subtitle { font-size: 1rem; }
    .btn { width: 240px; font-size: 1.1rem; padding: 15px 30px; }
}
body.admin-bar .hamburger { top: 57px; }

/* ===== Quiz Template UI ===== */
.quiz-wrap { width: 100%; max-width: 760px; margin: 80px auto 40px; }
.quiz-card {
    background: #fff; border-radius: 20px; padding: 24px; box-shadow: 0 10px 30px rgba(0,0,0,.06);
}
.quiz-meta { display:flex; justify-content: space-between; align-items:center; margin-bottom: 12px; font-size:.95rem; color:#666; }
.quiz-q {
    font-size: 1.6rem; font-weight: 700; line-height: 1.5; margin: 8px 0 18px; color: #333;
}
.quiz-answers { display: grid; gap: 12px; }
.quiz-ans-btn {
    width: 100%; padding: 14px 16px; border-radius: 14px; border: 2px solid transparent; background: #f8f9ff;
    font-size: 1.05rem; text-align: left; cursor: pointer; transition: transform .08s ease, box-shadow .2s ease, background .2s ease;
}
.quiz-ans-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(102,126,234,.18); background: #f3f5ff; }
.quiz-ans-btn:active { transform: scale(.99); }
.quiz-progress {
    height: 8px; background: #edf2ff; border-radius: 999px; overflow: hidden; margin: 14px 0 0;
}
.quiz-progress > span { display:block; height:100%; width:0%; background: linear-gradient(90deg, #667eea, #764ba2); transition: width .25s ease; }

.quiz-score {
    margin-top: 18px; background:#fff; border-radius: 16px; padding: 16px; border:1px dashed #e7e7f7;
}
.score-bars { display:grid; grid-template-columns: 1fr; gap:10px; margin-top:10px; }
.score-row { display:flex; align-items:center; gap:10px; }
.score-label { width: 24px; font-weight: 700; text-align:center; color:#555; }
.score-bar-wrap { flex:1; height:14px; background:#f1f3f5; border-radius:999px; overflow:hidden; }
.score-bar { height:100%; width:0; background: linear-gradient(90deg,#667eea,#764ba2); transition: width .25s ease; }
.score-val { width: 40px; text-align:right; font-variant-numeric: tabular-nums; color:#555; }

.quiz-finish {
    text-align:center; padding: 28px 20px;
}
.quiz-finish h2 { font-size: 1.6rem; margin-bottom: 12px; }
.quiz-finish p { color:#666; margin-bottom: 16px; }
.quiz-finish .btn { width:auto; }

.result-table {
    width:100%; border-collapse: collapse; margin-top:16px; font-size: .95rem;
}
.result-table th, .result-table td { padding:8px 10px; border-bottom:1px solid #eee; text-align:left; }
.result-table th { color:#666; font-weight:600; }

/* ===== Single Result Page ===== */
.result-article {
  width: 100%;
  max-width: 980px;
  margin: 80px auto 60px;
  padding: 0 16px;
}

.result-hero {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 28px;
  align-items: center;
  margin-bottom: 28px;
}
@media (max-width: 800px) {
  .result-hero { grid-template-columns: 1fr; }
}

.ratio-1x1 {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1; /* 正方形 */
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(135deg, #eef2ff, #f8f9ff);
  box-shadow: 0 10px 30px rgba(0,0,0,0.06);
}
.ratio-1x1 img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.result-thumb--placeholder,
.result-grid-thumb--ph {
  display: grid; place-items: center;
  font-size: 48px;
  color: #667eea;
  width: 100%; height: 100%;
}

.result-title {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: .02em;
  margin: 0 0 8px;
}
.result-catch {
  color: #666; line-height: 1.7; margin: 0 0 16px;
}

.result-cta {
  display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px;
}
.result-cta .btn { width: auto; padding: 12px 22px; font-size: 1rem; }

.result-section { margin-top: 28px; }
.result-section-title {
  font-weight: 700; color: #333; margin-bottom: 10px;
}

/* score bars （既存のクイズUIと調和） */
.result-scores .score-bars { display:grid; gap:10px; }
.score-row { display:flex; align-items:center; gap:10px; }
.score-label { width: 24px; font-weight: 700; text-align:center; color:#555; }
.score-bar-wrap { flex:1; height:14px; background:#f1f3f5; border-radius:999px; overflow:hidden; }
.score-bar { height:100%; width:0; background: linear-gradient(90deg,#667eea,#764ba2); transition: width .25s ease; }
.score-val { width: 40px; text-align:right; font-variant-numeric: tabular-nums; color:#555; }

/* content & chips */
.result-content { background:#fff; border-radius: 18px; padding: 18px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); }
.result-text { background:#fff; border-radius: 12px; padding: 12px 14px; box-shadow: 0 6px 18px rgba(0,0,0,0.04); }

.chip-group { display:flex; flex-wrap: wrap; gap:10px; }
.chip {
  display:inline-flex; align-items:center; gap:6px;
  padding: 8px 12px; border-radius: 999px;
  background: #f0f4ff; color:#4652d0; font-weight:600; font-size:.95rem;
  border: 1px solid rgba(102,126,234,.25);
}

/* related grid */
.result-related { margin-top: 36px; }
.result-grid {
  display:grid; gap:16px; grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 900px) { .result-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .result-grid { grid-template-columns: 1fr; } }

.result-grid-item {
  display:block; text-decoration:none; color: inherit;
  background:#fff; border-radius: 18px; overflow:hidden;
  box-shadow: 0 10px 26px rgba(0,0,0,.06);
  transition: transform .12s ease, box-shadow .2s ease;
}
.result-grid-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(102,126,234,.18);
}
.result-grid-thumb { aspect-ratio: 1 / 1; background: #f5f7ff; }
.result-grid-thumb img { width:100%; height:100%; object-fit: cover; }
.result-grid-title { padding: 12px 14px; font-weight: 700; line-height: 1.4; }




/* ===== Smartphone: result image fits in-screen as perfect square ===== */
:root {
  /* 画像のまわりに確保する安全余白（ヘッダー/タイトル/ボタン分）。
     端末やデザイン次第で 140–220px 程度に微調整してください。 */
  --img-safe-gap: 180px;
}

@media (max-width: 640px) {
  /* 1カラムにして余白を詰める */
  .result-hero {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* 画像ブロックを中央寄せ */
  .result-img-wrap {
    display: flex;
    justify-content: center;
  }

  /* 正方形の器を「画面幅」と「画面高−余白」の小さい方に合わせる */
  .ratio-1x1.result-thumb {
    /* 新しいビューポート単位 svh を優先（iOSのツールバー影響を避ける） */
    --img-size: min(92vw, calc(100svh - var(--img-safe-gap)));
    width: var(--img-size);
    height: var(--img-size);
    max-width: 600px;     /* お好みで上限 */
    max-height: 600px;
    margin-inline: auto;
    border-radius: 18px;  /* デザイン合わせ（任意） */
    overflow: hidden;     /* はみ出し防止 */
    background: linear-gradient(135deg, #eef2ff, #f8f9ff);
    box-shadow: 0 8px 24px rgba(0,0,0,.06);
  }

  /* svh 非対応ブラウザ向けフォールバック */
  @supports not (height: 100svh) {
    .ratio-1x1.result-thumb {
      --img-size: min(92vw, calc(100vh - var(--img-safe-gap)));
      width: var(--img-size);
      height: var(--img-size);
    }
  }

  /* 中の画像を正方形にフィットさせる（基本はトリミング） */
  .ratio-1x1.result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;   /* 全体を見せたいなら contain に変更（下に別案） */
  }

  /* プレースホルダーも同じサイズで */
  .result-thumb--placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    font-size: clamp(32px, 10vw, 56px);
    color: #667eea;
  }
}

/* ==== トリミングしたくない場合（全体表示）====
   画像に .is-contain クラスを付けると、その記事だけ「切り抜かず全面表示」にできます。 */
.ratio-1x1.result-thumb.is-contain img {
  object-fit: contain;     /* 余白は生まれるが画像は欠けない */
  background: #fff;
}

/* 現在のスコア系のUIを丸ごと非表示にする */
#quiz-score,
.quiz-score,
.score-title,
.current-score,
[data-role="current-score"],
[aria-label="現在のスコア"],
[title="現在のスコア"] {
  display: none !important;
}
