/* ============================================================
   あまた音楽堂 共通スタイル (amata_common.css)
   読み込み: 管理画面 > コンテンツ管理 > CSS で
   @import ではなく default_frame.twig の {% block stylesheet %} 直前、
   もしくは レイアウト管理のヘッダー内で <link> 推奨。
   ------------------------------------------------------------
   ■ 設計ルール（このプロジェクトの憲法）
   1. 独自要素はすべて .amata- プレフィックス。
      → EC-CUBE標準の .ec-* と土俵を分けることで、そもそも
        スタイルが衝突しない＝ !important が不要になる。
   2. !important は「EC-CUBEコアの打ち消し」目的のみ許可し、
      ファイル末尾の OVERRIDES セクションに理由コメント付きで隔離。
   3. 色・余白・動き・z-index は :root のデザイントークンを必ず参照。
      値を直書きしない（変更時に1箇所で済む）。
   ============================================================ */

/* ------------------------------------------------------------
   1. デザイントークン
   ------------------------------------------------------------ */
:root {
  /* Brand color（あまた音楽堂_基本配色_rgb / ガイドシート準拠） */
  --amata-teal: #1a9ca6;   /* R26 /G156/B166 */
  --amata-mint: #99d1ba;   /* R153/G209/B186 */
  /* ロゴと同じ「右上に向かって60%以降で明るくなる」グラデーション */
  --amata-grad: linear-gradient(30deg,
      var(--amata-teal) 0%,
      var(--amata-teal) 60%,
      var(--amata-mint) 100%);

  --amata-ink: #24393b;        /* 真っ黒ではなく青緑寄りの墨色 */
  --amata-ink-soft: #5b6f70;
  --amata-red: #e60012;        /* NEWバッジ等のアクセント */
  --amata-bg-tint-1: #f3fbf9;  /* 背景グラデーション用の極薄ミント */
  --amata-bg-tint-2: #e9f6f1;
  --amata-line: #e3efec;

  /* Typography */
  --amata-font-jp: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN',
                   'Yu Gothic', sans-serif;

  /* Motion（Framerライクな“行き過ぎて戻る”質感のイージング） */
  --amata-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --amata-dur-fast: 0.35s;
  --amata-dur: 0.7s;

  /* Layout */
  --amata-radius: 12px;
  --amata-radius-pill: 999px;
  --amata-shadow-1: 0 4px 16px rgba(26, 92, 98, 0.08);
  --amata-shadow-2: 0 18px 40px rgba(26, 92, 98, 0.16);
  --amata-container: 1150px;

  /* ヘッダー高さ。初期値はフォールバックで、実測値を
     amata_common.js が更新する（route別マジックナンバーの廃止） */
  --amata-header-h: 135px;

  /* z-index 管理表。新しい階層が必要になったらここに追記する。
     999999 のような場当たり的な値は今後使用しない。 */
  --amata-z-header: 100;
  --amata-z-overlay: 110;
  --amata-z-drawer: 120;
}

/* ------------------------------------------------------------
   2. ベース
   ------------------------------------------------------------ */
html {
  /* ページ内リンクが固定ヘッダーに隠れないようにする */
  scroll-padding-top: calc(var(--amata-header-h) + 16px);
}

body {
  /* 固定ヘッダー分の逃し。高さはJSが実測してくれる */
  padding-top: var(--amata-header-h);
  font-family: var(--amata-font-jp);
  color: var(--amata-ink);
}

/* キーボード操作時のフォーカスリング（ブランド色で統一） */
:where(a, button, input, [tabindex]):focus-visible {
  outline: 3px solid var(--amata-teal);
  outline-offset: 2px;
  border-radius: 4px;
}

/* 汎用: グラデーション文字 */
.amata-grad-text {
  background: var(--amata-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--amata-teal); /* clip非対応環境へのフォールバック */
}

/* 表示制御（!important不要。amata-要素にだけ使う前提） */
.amata-pc-only { display: block; }
.amata-sp-only { display: none; }

/* ------------------------------------------------------------
   3. ヘッダー
   ------------------------------------------------------------ */
.amata-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: var(--amata-z-header);
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  /* 影は初期表示から常時表示（当初デザイン踏襲）。
     MV背景が白のため、影がないとヘッダーとの境目が消える */
  box-shadow: 0 2px 18px rgba(26, 92, 98, 0.12);
  transition: transform var(--amata-dur-fast) var(--amata-ease-out);
}
.amata-header.is-hidden   { transform: translateY(-100%); }

.amata-header__inner {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 15px;
}

.amata-header__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 90px;
}

/* ロゴとナビの幅を揃えて検索窓を光学的中央に置く */
.amata-header__logo { width: 250px; flex-shrink: 0; }
.amata-header__logo img { width: 160px; height: auto; display: block; }
.amata-header__nav  { width: 250px; flex-shrink: 0; }

/* 検索 */
.amata-header__search {
  flex: 1;
  max-width: 500px;
  display: flex;
  justify-content: center;
}
.amata-search {
  display: flex;
  width: 100%;
  background: #f2f6f5;
  border-radius: var(--amata-radius-pill);
  overflow: hidden;
  transition: box-shadow var(--amata-dur-fast) ease;
}
.amata-search:focus-within { box-shadow: 0 0 0 2px var(--amata-teal) inset; }
.amata-search input {
  flex: 1;
  min-width: 0;
  height: 45px;
  padding: 10px 20px;
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
}
.amata-search button {
  display: grid;
  place-items: center;
  padding: 0 20px;
  border: none;
  cursor: pointer;
  color: #fff;
  background: var(--amata-grad);
  transition: opacity var(--amata-dur-fast) ease;
}
.amata-search button:hover { opacity: 0.85; }

/* ナビ（アイコン列） */
.amata-header__ul {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 25px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.amata-header__li a,
.amata-header__li button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--amata-ink);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.amata-header__li span { font-size: 11px; font-weight: 700; }

/* インラインSVGアイコン（Font Awesome CDNを廃止） */
.amata-icon {
  width: 26px;
  height: 26px;
  display: block;
}

/* カートバッジ */
.amata-cart-rel { position: relative; }
.amata-cart-badge {
  position: absolute;
  top: -6px;
  right: -12px;
  min-width: 18px;
  padding: 2px 6px;
  border-radius: var(--amata-radius-pill);
  background: var(--amata-red);
  color: #fff;
  font-size: 10px;
  line-height: 1.4;
  text-align: center;
}

/* 下段カテゴリナビ */
.amata-header__lower {
  border-top: 1px solid var(--amata-line);
  overflow: hidden;
  max-height: 60px; /* transition用。実高さより大きければOK */
  transition: max-height var(--amata-dur-fast) var(--amata-ease-out),
              opacity var(--amata-dur-fast) ease;
}
/* shrinkモード時: 下段だけ畳む */
.amata-header.is-compact .amata-header__lower {
  max-height: 0;
  opacity: 0;
  border-top-color: transparent;
}
.amata-catnav {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.amata-catnav li { display: flex; align-items: center; height: 45px; }
.amata-catnav a {
  font-size: 14px;
  font-weight: 700;
  color: var(--amata-ink);
  text-decoration: none;
}

/* 下線が中央から広がるホバー（現行の意匠を踏襲） */
.amata-underline {
  position: relative;
}
.amata-underline::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 100%;
  height: 2px;
  background: var(--amata-grad);
  transform: translateX(-50%) scaleX(0); /* widthではなくtransformで
                                            アニメ（GPU合成で滑らか） */
  transform-origin: center;
  transition: transform var(--amata-dur-fast) var(--amata-ease-out);
}
.amata-underline:hover::after,
.amata-underline:focus-visible::after {
  transform: translateX(-50%) scaleX(1);
}

/* ------------------------------------------------------------
   4. ドロワー（SP）
   ------------------------------------------------------------ */
.amata-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--amata-z-overlay);
  background: rgba(23, 46, 48, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--amata-dur-fast) ease,
              visibility 0s linear var(--amata-dur-fast);
}
.amata-overlay.is-active {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.amata-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(80%, 360px);
  height: 100dvh;
  z-index: var(--amata-z-drawer);
  background: #fff;
  overflow-y: auto;
  transform: translateX(105%);
  transition: transform var(--amata-dur-fast) var(--amata-ease-out);
}
.amata-drawer.is-active { transform: translateX(0); }

.amata-drawer__head { text-align: right; }
.amata-drawer__close {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 20px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--amata-teal);
  font-weight: 700;
  font-family: inherit;
}
.amata-drawer__body { padding: 0 20px 40px; }
.amata-drawer__ttl {
  margin: 25px 0 10px;
  padding-left: 10px;
  border-left: 4px solid var(--amata-teal);
  color: var(--amata-ink-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.amata-drawer__list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.amata-drawer__list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 0;
  border-bottom: 1px solid #f0f5f4;
  color: var(--amata-ink);
  font-weight: 700;
  text-decoration: none;
}
.amata-drawer__list .amata-icon { width: 20px; height: 20px; }

/* ドロワー展開中は背面のスクロールを止める */
body.is-drawer-open { overflow: hidden; }

/* ------------------------------------------------------------
   5. 商品一覧ページ用（既存カスタムCSSの整理版・!important撤廃）
      ※ このファイルはEC-CUBE標準CSSより後に読み込まれるため、
        同等以上の詳細度があれば !important は不要。
   ------------------------------------------------------------ */
.ec-productRole .ec-productRole__list {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 15px;
  margin-top: 20px;
}
.ec-productRole .ec-productRole__listItem {
  width: calc(25% - 12px);
  margin: 0;
  padding: 0;
}
.ec-productRole .ec-productRole__listItem img {
  width: 100%;
  height: auto;
  border: 1px solid #eee;
  transition: opacity var(--amata-dur-fast) ease;
}
.ec-productRole .ec-productRole__listItem a:hover img { opacity: 0.8; }
.ec-productRole .ec-productRole__listItemTitle {
  height: 3em;
  overflow: hidden;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--amata-ink);
}
.ec-productRole .ec-productRole__listItemPrice {
  margin-top: 5px;
  font-size: 14px;
  font-weight: 700;
  color: var(--amata-red);
}

/* ------------------------------------------------------------
   6. レスポンシブ
   ------------------------------------------------------------ */
@media (max-width: 991px) {
  .amata-pc-only { display: none; }
  .amata-sp-only { display: flex; }

  .amata-header__main { height: 75px; }
  .amata-header__logo { width: auto; }
  .amata-header__logo img { width: 130px; }
  .amata-header__nav { width: auto; }
  .amata-underline::after { display: none; }
}

@media (max-width: 768px) {
  .ec-productRole .ec-productRole__listItem { width: calc(50% - 8px); }
  .ec-productRole .ec-productRole__listItemTitle { font-size: 12px; }
}

/* ------------------------------------------------------------
   7. モーション低減設定への配慮（Google/WCAG 品質基準）
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .amata-header,
  .amata-drawer,
  .amata-overlay,
  .amata-underline::after {
    transition: none;
  }
}

/* ============================================================
   OVERRIDES — EC-CUBEコアの打ち消し専用セクション
   ------------------------------------------------------------
   ここ以外での !important は禁止。各行に理由を明記すること。
   ============================================================ */

/* 標準ドロワー関連ブロックの非表示（暫定）
   実サイトのDOM確認結果（2026/07）:
   - 標準ヘッダー(.ec-headerRole / .ec-headerNaviRole)は
     レイアウト管理で除外済みのため打ち消し不要 → 削除済み
   - ドロワー系3ブロック（商品検索・カテゴリナビSP・
     ログインナビSP）はまだレイアウトに残っており、非表示でも
     毎ページ描画コスト（カテゴリ取得クエリ含む）が発生している。
     レイアウト管理の「ドロワー」欄から3ブロックを外したら、
     この打ち消しは丸ごと削除すること。 */
.ec-drawerRole,
.ec-drawerRoleClose,
.ec-overlayRole {
  display: none !important; /* 旧ドロワーの誤表示防止（暫定） */
}

/* 標準レイアウトが持つ余白・幅制限の解除（トップページのみ）。
   詳細度で勝つため body.front_page を起点にしており !important 不要 */
body.front_page .ec-layoutRole__contents,
body.front_page .ec-layoutRole__main {
  max-width: none;
  width: 100%;
  padding: 0;
}
/* パララックス背景(z-index:-1)を透過させるための背景無効化。
   透過が必要な層は html を除く3つ:
   body / .ec-layoutRole（標準CSSが background:#fff を持つ）。
   ※ .ec-layoutRole の transparent は default_frame.twig の
     HTML破損修正(A-1)後に必須になった。破損中はクラスが認識されず
     標準の白背景が「偶然」効いていなかっただけで、正しいHTMLでは
     この打ち消しがないと背景レイヤーが白で覆われる */
html { background: #fff; }
body.front_page { background: transparent; }
body.front_page .ec-layoutRole {
  overflow: visible;
  background: transparent;
}
