/* GSAPアニメーション ギャラリー 共通スタイル */
/* ページUIのスタイルのみを置く。デモ本体のCSSは js/effects/ の各定義から動的に注入する */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --accent: #6366f1;
  --sub: #ec4899;
}

body {
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  font-size: 16px;
  line-height: 1.7;
}

/* ============ ヘッダー ============ */
.header {
  position: relative;
  background: linear-gradient(135deg, #0f172a 0%, #3730a3 60%, #6d28d9 100%);
  color: #fff;
  padding: 40px 20px 36px;
  text-align: center;
}
/* 言語切替リンク（ja ↔ en。ヘッダー右上） */
.lang-switch {
  position: absolute;
  top: 16px;
  right: 16px;
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid rgba(147, 197, 253, 0.5);
  border-radius: 999px;
  color: #bfdbfe;
  font-size: 1rem;
  text-decoration: none;
}
.lang-switch:hover {
  background: rgba(147, 197, 253, 0.15);
}
.header h1 {
  font-size: clamp(1.4rem, 1.1rem + 1.5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.header p {
  margin-top: 10px;
  color: #c7d2fe;
  font-size: 1rem;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}
/* ============ レイアウト ============ */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px 56px;
}
.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.sidebar {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-right: 2px;
}

/* ============ サイドバー ============ */
.input-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px;
}
.input-card h2 {
  font-size: 1.05rem;
  margin-bottom: 12px;
}
.code-box {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  font-size: 16px;
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  line-height: 1.55;
  max-height: 340px;
  overflow: auto;
  white-space: pre;
}
.code-box code:empty::before {
  content: "カードをクリックするとコードが表示されます";
  color: #64748b;
  white-space: normal;
}
html[lang="en"] .code-box code:empty::before {
  content: "Click a card to see its code";
}
.copy-preview {
  margin-top: 12px;
  width: 100%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
}
.copy-preview:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}
.note {
  margin-top: 10px;
  font-size: 1rem;
  color: #64748b;
  line-height: 1.5;
}
.reset-settings {
  width: 100%;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
  border-radius: 9px;
  padding: 8px;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 12px;
}
.reset-settings:hover {
  background: #f1f5f9;
}
/* 視覚的には隠すが、スクリーンリーダーには読ませるラベル */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.field {
  margin-bottom: 14px;
}
.field label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
}
.color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.color-row input[type="color"] {
  width: 52px;
  height: 36px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  font-size: 1rem;
}
.color-val {
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  color: #475569;
}
.count-note {
  color: #64748b;
  border-top: 1px dashed #e2e8f0;
  padding-top: 10px;
}

.search {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 1rem;
  font-family: inherit;
  color: #1e293b;
}
.search:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ============ フィルタ ============ */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.chip {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 1rem;
  cursor: pointer;
}
.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

/* ============ カードグリッド ============ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.card-head {
  padding: 14px 16px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-cat {
  flex: none;
  background: #eef2ff;
  color: #4338ca;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 1rem;
}
.card-head h3 {
  font-size: 1rem;
  font-weight: 700;
}

/* デモ台。各エフェクトのCSSはここより内側にスコープされる */
.stage {
  position: relative;
  height: 190px;
  margin: 0 16px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* スクロール連動デモ用。カード内に独立したスクロール領域を作り、
   ScrollTrigger の scroller にこの要素を指定する */
.stage--scroll {
  display: block;
  overflow-y: auto;
  scrollbar-width: thin;
}
.empty {
  grid-column: 1 / -1;
  padding: 40px 0;
  text-align: center;
  color: #64748b;
}

.stage--scroll::before {
  content: "↓ この中をスクロール";
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 1rem;
  pointer-events: none;
}

html[lang="en"] .stage--scroll::before {
  content: "↓ Scroll inside";
}

.card-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px 14px;
}
.card-actions button {
  flex: 1;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  border-radius: 9px;
  padding: 8px;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
}
.card-actions button:hover {
  background: #f1f5f9;
}
.card-actions .btn-copy {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.card-actions .btn-copy:hover {
  filter: brightness(1.08);
  background: var(--accent);
}

/* ============ トースト ============ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 20px);
  background: #0f172a;
  color: #fff;
  padding: 10px 22px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 200;
}
.toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ============ 使い方セクション ============ */
.usage {
  max-width: 960px;
  margin: 0 auto;
  padding: 8px 20px 48px;
  line-height: 1.9;
  color: #334155;
}
.usage h2 {
  margin: 32px 0 8px;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  color: #0f172a;
}
.usage h3 {
  margin: 20px 0 4px;
  font-size: 1rem;
}
.usage ol,
.usage ul {
  margin: 0;
  padding-left: 1.4em;
}
.usage a {
  color: #4338ca;
}
.usage code {
  background: #eef2ff;
  color: #3730a3;
  border-radius: 5px;
  padding: 1px 6px;
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 1rem;
}

/* ============ フッター ============ */
footer {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  padding: 24px 40px;
  color: #64748b;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}
footer a {
  color: #1e293b;
  text-decoration: none;
  transition: color 0.2s;
}
footer a:hover {
  color: #3b82f6;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-links a {
  border: 1px solid #e2e8f0;
  padding: 8px 16px;
  border-radius: 6px;
  transition: all 0.2s;
}
.footer-links a:hover {
  border-color: #3b82f6;
  color: #3b82f6;
}

/* ============ 広告（右下フローティングカード / ~/.claude/rules/ad-units.md 準拠） ============ */
.footer-ad {
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0;
  width: 320px;
  overflow: hidden;
  background: transparent;
  border: none;
  box-shadow: none;
}
.footer-ad.is-closed {
  display: none;
}
.ad-widget__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  position: relative;
  z-index: 1;
}
.ad-widget__label {
  color: #64748b;
  font-size: 12px;
  letter-spacing: 0.04em;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 999px;
}
.ad-widget__close {
  appearance: none;
  border: none;
  background: #f1f5f9;
  color: #64748b;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.ad-widget__close:hover {
  background: #e2e8f0;
  color: #1e293b;
}
.footer-ad ins.adsbygoogle {
  display: block;
  width: 320px;
  height: 100px;
}

@media screen and (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    max-height: none;
  }
}

@media screen and (max-width: 768px) {
  footer {
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 24px 16px;
    text-align: center;
  }
  .footer-links {
    justify-content: center;
  }
  .footer-ad {
    position: static;
    align-self: center;
    margin: 24px auto 0;
    gap: 0;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    z-index: auto;
  }
  /* PCで閉じてもSPでは表示する */
  .footer-ad.is-closed {
    display: flex;
  }
  .ad-widget__head {
    display: none;
  }
  .footer-ad ins.adsbygoogle {
    width: 320px;
    height: 100px;
  }
}
