@charset "UTF-8";
/*
 * 共用頁首樣式（桌機主選單 + 手機側邊選單）
 *
 * 規則由 css/index_v3.css（廠商設計稿）中 .site-header__* 與 .mobile-menu__* 抽出，
 * 內容未經修改，僅補上頁首自身需要的 reset 與 CSS 變數，使其可獨立用於未載入
 * index_v3_reset.css 的頁面（例如走 _Layout.php 的內頁）。
 *
 * 搭配：lib/_Header.php（結構）、js/site-header.js（行為）
 */

/* 設計稿變數（僅取頁首用到的三個），限定在頁首範圍內避免影響頁面其他部分 */
.site-header,
.mobile-menu {
  --color-primary: #7458a7;
  --color-text: #142346;
  --color-white: #fff;
}

/* 頁首高度：因為 .site-header 是 position:fixed 不佔空間，需由 body 補上相同的上方留白。
   數值與斷點沿用設計稿 index_v3.css 的 --site-header-height。
   舊版 _Layout.php 是靠 mycss.css 的 #header{height:115px} 佔位塊達成同樣效果，
   改用本檔後該佔位塊不再存在（元素已移除），故留白改由此處負責。 */
:root {
  --site-header-height: 84px;
}

body {
  padding-top: var(--site-header-height);
}

@media (max-width: 1280px) {
  :root {
    --site-header-height: 72px;
  }
}

@media (max-width: 768px) {
  :root {
    --site-header-height: 100px;
  }
}

@media (max-width: 500px) {
  :root {
    --site-header-height: 76px;
  }
}

/* 頁首自身的 reset：內頁沒有 index_v3_reset.css，於此範圍內補回設計稿假設的基準。
   一律以 :where() 包住，讓特異度歸零（等同原 reset.css 的元素選擇器層級），
   才不會蓋掉設計稿用單一 class 指定的文字色。 */
:where(.site-header, .mobile-menu) *,
:where(.site-header, .mobile-menu) *::before,
:where(.site-header, .mobile-menu) *::after {
  box-sizing: border-box;
}

:where(.site-header, .mobile-menu) a {
  color: inherit;
  text-decoration: none;
}

:where(.site-header, .mobile-menu) ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

:where(.site-header, .mobile-menu) p {
  margin: 0;
}

:where(.site-header, .mobile-menu) img,
:where(.site-header, .mobile-menu) svg {
  display: block;
  max-width: 100%;
  max-height: none;
}

:where(.site-header, .mobile-menu) button {
  font: inherit;
  color: inherit;
}

/* ── 以下為設計稿原樣抽出 ────────────────────────────────── */

.site-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 90;
  width: 100%;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 18px rgba(173, 119, 220, 0.12);
  backdrop-filter: blur(12px);
}

.site-header__inner {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 84px;
  margin: 0 auto;
  padding: 0 30px;
  gap: 48px;
}

.site-header__logo {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.site-header__nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 auto;
  gap: 44px;
  color: var(--color-text);
  font-size: 20px;
  font-weight: 400;
}

.site-header__nav-item {
  position: relative;
  display: flex;
  align-items: center;
}

.site-header__nav-item::before {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  height: 16px;
  content: "";
}

.site-header__nav-link {
  position: relative;
  color: var(--color-text);
  padding: 8px 0;
  white-space: nowrap;
}

.site-header__nav-link::after {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: #f77a8e;
  border-radius: 999px;
  content: "";
  transition: width 0.25s ease;
}

.site-header__nav-link:hover::after,
.site-header__nav-link:focus-visible::after,
.site-header__nav-item:hover > .site-header__nav-link::after,
.site-header__nav-link[aria-current="true"]::after {
  width: 50px;
}

.site-header__dropdown {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  z-index: 2;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 15px 15px;
  border: 1px solid #d4d4d4;
  border-radius: 5px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(80, 64, 112, 0.08);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.site-header__nav-item:hover .site-header__dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.site-header__dropdown a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px 20px;
  border-radius: 10px;
  color: #4f4f4f;
  letter-spacing: 0;
  white-space: nowrap;
  transition: color 0.5s ease, background-color 0.5s ease;
}

.site-header__dropdown a:hover,
.site-header__dropdown a:focus-visible {
  color: #8d6abc;
  background: #f2e6fb;
}

.site-header__actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 22px;
}

.site-header__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 124px;
  min-height: 48px;
  padding: 10px 30px;
  border-radius: 999px;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 3px;
  white-space: nowrap;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.site-header__button:hover {
  box-shadow: 0 8px 18px rgba(173, 119, 220, 0.22);
  transform: translateY(-1px);
}

.site-header__button--primary {
  color: var(--color-white);
  background: linear-gradient(90deg, #a8a2de 0%, #c47bc0 100%);
}

.site-header__menu {
  display: none;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  border-radius: 50%;
  background: rgba(173, 119, 220, 0.12);
}

.site-header__menu span {
  width: 18px;
  height: 2px;
  background: var(--color-primary);
  border-radius: 999px;
}

body.mobile-menu-open {
  overflow: hidden;
}

.mobile-menu {
  display: none;
}

@media (max-width: 1280px) {
  .site-header__inner {
  min-height: 72px;
      padding: 0 28px 0 10px;
      gap: 18px;
  }

  .site-header__logo img {
  max-width: 100%;
  }

  .site-header__nav {
  gap: 18px;
      font-size: 14px;
  }

  .site-header__button {
  min-width: 74px;
      min-height: 34px;
      padding-right: 14px;
      padding-left: 14px;
      font-size: 14px;
  }

}

@media (max-width: 900px) {
  .site-header__actions {
  gap: 10px;
  }

  .site-header__button {
  min-width: 70px;
  }

}

@media (max-width: 768px) {
  .site-header__inner {
  position: relative;
      min-height: 100px;
      padding: 0 20px;
      gap: 12px;
  }

  .site-header__nav {
  display: none;
  }

  .site-header__actions {
  display: flex;
      position: absolute;
      top: 50%;
      right: 82px;
      margin-left: auto;
      gap: 0;
      transform: translateY(-50%);
  }

  .site-header__actions .site-header__button {
  box-sizing: border-box;
      width: 110px;
      min-width: 0;
      min-height: 50px;
      padding: 0;
      font-size: 20px;
  }

  .site-header__actions .site-header__button:nth-child(n + 2) {
  display: none;
  }

  .site-header__menu {
  display: inline-flex;
      position: absolute;
      top: 50%;
      right: 20px;
      z-index: 120;
      width: 50px;
      height: 50px;
      flex: 0 0 50px;
      background: linear-gradient(90deg, #a4a8e2 0%, #c57abf 100%);
      transform: translateY(-50%);
  }

  .site-header__menu span {
  position: absolute;
      width: 21px;
      height: 3px;
      background: #fff;
      transition: transform 0.24s ease, opacity 0.2s ease;
  }

  .site-header__menu span:first-child {
  transform: translateY(-4px);
  }

  .site-header__menu span:nth-child(2) {
  transform: translateY(3px);
  }

  .site-header__menu span:nth-child(3) {
  display: none;
  }

  .site-header__menu[aria-expanded="true"] span:first-child {
  transform: rotate(45deg);
  }

  .site-header__menu[aria-expanded="true"] span:nth-child(2) {
  transform: rotate(-45deg);
  }

  .mobile-menu {
  position: fixed;
      inset: 0;
      z-index: 100;
      box-sizing: border-box;
      display: flex;
      flex-direction: column;
      height: 100dvh;
      padding: 24px 36px 34px;
      overflow-y: auto;
      background: url("../images/index_v3/bg_list.jpg") center / cover no-repeat;
      opacity: 0;
      pointer-events: none;
      visibility: hidden;
      transform: none;
      transition: opacity 0.25s ease, visibility 0.25s ease;
  }

  .mobile-menu.is-open {
  opacity: 1;
      pointer-events: auto;
      visibility: visible;
  }

  .mobile-menu__header {
  display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 24px;
  }

  .mobile-menu__logo {
  display: inline-flex;
      align-items: center;
  }

  .mobile-menu__logo img {
  width: clamp(200px, 43vw, 375px);
  }

  .mobile-menu__close {
  display: none;
  }

  .mobile-menu__nav {
  display: grid;
      gap: 0;
      margin-top: clamp(55px, 7vh, 110px);
      margin-bottom: 20px;
      color: #a35ca4;
      font-size: clamp(20px, 6vw, 58px);
      font-weight: 400;
      line-height: 1.2;
  }

  .mobile-menu__item {
  display: grid;
  }

  .mobile-menu__nav > a,
  .mobile-menu__toggle {
  display: flex;
      /* min-height: clamp(78px, 15vw, 162px); */
      align-items: flex-start;
      justify-content: space-between;
      margin: 0;
      padding: 20px 0;
      border: 0;
      border-bottom: clamp(2px, 0.35vw, 4px) solid #b57ab1;
      color: #b57ab1;
      font: inherit;
      line-height: inherit;
      text-align: left;
  }

  .mobile-menu__toggle {
  width: 100%;
      background: transparent;
      cursor: pointer;
  }

  .mobile-menu__toggle::after {
  margin-left: 24px;
      color: #b57ab1;
      content: "+";
      font-size: 1.35em;
      font-weight: 400;
      line-height: 0.8;
  }

  .mobile-menu__item.is-open > .mobile-menu__toggle::after {
  content: "−";
  }

  .mobile-menu__submenu {
  display: grid;
      height: 0;
      overflow: hidden;
      pointer-events: none;
      transition: height 0.35s ease-in-out;
  }

  .mobile-menu__item.is-open > .mobile-menu__submenu {
  pointer-events: auto;
  }

  .mobile-menu__submenu a {
  display: flex;
      align-items: center;
      padding: 15px 0;
      border-bottom: clamp(2px, 0.3vw, 3px) solid #e3cff9;
      color: #888888;
      font-size: clamp(24px, 5.2vw, 48px);
      line-height: 1.2;
  }

  .mobile-menu__actions {
  display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: clamp(28px, 7vw, 68px);
      margin-top: auto;
  }

  .mobile-menu__actions a {
  display: inline-flex;
      min-height: clamp(54px, 11vw, 92px);
      align-items: center;
      justify-content: center;
      border-radius: 999px;
      color: var(--color-white);
      background: linear-gradient(90deg, #a8a2de 0%, #c47bc0 100%);
      font-size: clamp(28px, 5.2vw, 50px);
      font-weight: 400;
      line-height: 1;
  }

  .mobile-menu__socials {
  display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: clamp(18px, 5vw, 28px);
      margin-top: 30px;
      align-items: center;
  }

  .mobile-menu__socials a {
  display: inline-flex;
      align-items: center;
      justify-content: center;
  }

  .mobile-menu__socials img {
  width: min(100%, clamp(76px, 16vw, 155px));
  }

}

@media (max-width: 500px) {
  .site-header__inner {
  min-height: 76px;
      padding: 0 16px;
      gap: 10px;
  }

  .site-header__actions .site-header__button {
  width: 86px;
      min-width: 0;
      min-height: 46px;
      padding: 0;
      font-size: 20px;
  }

  .site-header__menu {
  right: 16px;
      width: 46px;
      height: 46px;
      flex-basis: 46px;
  }

  .site-header__actions {
  right: 72px;
  }

}

/* ── 站方整合：中和 css/mycss.css 的全域 a:hover ─────────────────────
   mycss.css 有 a:hover{color:#A184C1}，特異度 (0,1,1)，會蓋掉本檔以單一 class
   指定的文字色 (0,1,0)。本檔載入順序在 mycss.css 之後，於頁首範圍內還原原色。
   設計稿本來就要變色的 .site-header__dropdown a:hover 另外以更高特異度保留。 */
.site-header a:hover,
.mobile-menu a:hover {
  color: inherit;
}

.site-header .site-header__nav-link:hover {
  color: var(--color-text);
}

.site-header .site-header__button--primary:hover {
  color: var(--color-white);
}

.mobile-menu .mobile-menu__direct-link:hover {
  color: #b57ab1;
}

.mobile-menu .mobile-menu__submenu a:hover {
  color: #888888;
}

.mobile-menu .mobile-menu__actions a:hover {
  color: var(--color-white);
}

/* 設計稿指定：下拉選單 hover 變色 */
.site-header .site-header__dropdown a:hover,
.site-header .site-header__dropdown a:focus-visible {
  color: #8d6abc;
}

/* ── 站方整合：已登入會員的頭像與下拉選單 ────────────────────────────
   設計稿沒有登入狀態的頁首，這段是站方補的。原本只寫在 css/index_v3_custom.css，
   內頁改用本檔後會缺樣式（頭像變成未設定尺寸的圖片），故移入共用檔。 */
.site-header__member {
  display: flex;
  align-items: center;
}

.site-header__member-avatar {
  display: flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.site-header__member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 下拉靠右對齊：設計稿的下拉是 left:50% 搭配 translateX(-50%) 置中，
   會員頭像位於最右側，置中會超出視窗。
   注意 transform 必須一併歸零 —— 只改 left/right 而保留 translateX(-50%) 的話，
   下拉會往左偏半個自身寬度，與頭像之間出現空隙，滑鼠移過去就關閉而選不到。 */
.site-header__member .site-header__dropdown {
  right: 0;
  left: auto;
  transform: translate(0, 8px);
}

.site-header__member:hover .site-header__dropdown {
  transform: translate(0, 0);
}

/* ── 站方整合：內頁的堆疊層級 ────────────────────────────────────────
   設計稿的 .site-header 是 z-index:90，在首頁沒問題（首頁自身沒有更高的元素）。
   但內頁沿用舊版 bootstrap 的 .navbar.fixed-top（z-index:1030），既有頁面樣式是
   以那個高度為前提寫的 —— 例如 css/tarot-styles.css 的 #content / #taro-content
   是 z-index:1000，會直接蓋住 90 的頁首。
   因此內頁把整組頁首往上抬到與舊 navbar 相同的 1030，維持既有的堆疊關係；
   modal（10000）、loading（100000）、SweetAlert（10000000）仍在頁首之上，行為不變。 */
.site-header {
  z-index: 1030;
}

.mobile-menu {
  z-index: 1040;
}

@media (max-width: 768px) {
  .site-header__menu {
    z-index: 1060;
  }
}

/* ── 站方整合：隔離頁面專屬 CSS 對 header / nav 元素的影響 ────────────
   部分頁面載入的樣式表直接對純元素選擇器下規則，例如 css/layout.css 的
   header{padding-bottom:60px}（塔羅系列頁面會載入）。舊版頁首外層 #header 只是
   一個佔位塊，多出的 padding 看不出來；新版 .site-header 本身就是 fixed 的白色列，
   多出的 padding 會讓整條列變高（實測塔羅頁 84px → 164px）。
   於此明確歸零，特異度 (0,1,0) 高於純元素選擇器 (0,0,1)。 */
.site-header {
  margin: 0;
  padding: 0;
}

.site-header .site-header__nav {
  width: auto;
}
