/* ============================================================
   World of Casino — Global Stylesheet
   ------------------------------------------------------------
   依賴：design-tokens.css（請先載入）
   內容：
     1. Reset / Normalize
     2. 基礎排版（Body / Heading / Link / Image / Form）
     3. 容器系統（.container / .ast-container / e-con 相容）
     4. Header / Site Navigation
     5. Footer
     6. Utility classes
     7. Breakpoints（544 / 768 / 921 / 1024 / 1201）
   ============================================================ */

/* ============== 1. RESET ============== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; line-height: 1.15; }
body, h1, h2, h3, h4, h5, h6, p, blockquote, dl, dd, figure, hr, pre {
  margin: 0;
}
ul, ol { margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
img, video, canvas, picture { display: block; max-width: 100%; height: auto; }
/* SVG: 不強制 max-width，避免無 width 屬性的 inline icon 撐成 viewport 寬。
   有明確 width/height 屬性或 CSS 規則的 SVG 自己會被尊重。 */
svg { display: inline-block; vertical-align: middle; }
svg:not([width]):not([height]) { max-width: 1.5em; max-height: 1.5em; } /* 兜底防護 */
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; border-spacing: 0; }
:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============== 2. BASE TYPOGRAPHY ============== */
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6,
.entry-content :where(h1, h2, h3, h4, h5, h6) {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--color-text-strong);
}
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
h5 { font-size: var(--fs-md); }
h6 { font-size: var(--fs-base); }

p { margin-block: 0 1em; }
small { font-size: var(--fs-sm); }
strong, b { font-weight: var(--fw-bold); }

a {
  color: var(--color-brand);
  transition: color 0.15s ease;
}
a:hover { color: var(--color-accent); }

code, pre, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.95em;
}
code {
  background: var(--color-code-bg);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
}
pre {
  background: var(--color-code-bg);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

blockquote {
  border-left: 4px solid var(--color-brand);
  padding-left: var(--space-4);
  color: var(--color-text-muted);
  font-style: italic;
}

hr {
  border: 0;
  border-top: 1px solid var(--color-divider);
  margin-block: var(--space-8);
}

/* 圖片 emoji 修正（Astra 原始規則） */
img.emoji {
  display: inline !important;
  border: 0 !important;
  box-shadow: none !important;
  height: 1em !important;
  width: 1em !important;
  margin: 0 0.07em !important;
  vertical-align: -0.1em !important;
  background: none !important;
  padding: 0 !important;
}

/* Screen reader only（Elementor + Astra 慣用） */
.elementor-screen-only,
.screen-reader-text,
.screen-reader-text span {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============== 3. 容器系統 ============== */
.container,
.ast-container {
  width: 100%;
  max-width: var(--container-wide);
  margin-inline: auto;
  padding-inline: var(--space-5);
}
.container--narrow { max-width: var(--container-narrow); }
.container--normal { max-width: var(--container-normal); }
.container--wide   { max-width: var(--container-wide); }

/* Elementor 區塊相容 */
.elementor-section,
.elementor-container,
.e-con {
  width: 100%;
  margin-inline: auto;
}
.e-con { max-width: var(--container-max-width); }

.elementor-section-boxed > .elementor-container {
  max-width: var(--container-wide);
}

/* Flex / Grid 工具（簡化 Elementor 行為） */
.elementor-row,
.elementor-container {
  display: flex;
  flex-wrap: wrap;
}

/* ============== 4. HEADER / NAV ============== */
.site-header,
header.site-header {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: box-shadow 0.2s ease;
}
.site-header.is-scrolled {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.main-header-menu .menu-link.is-active {
  color: var(--color-brand);
  font-weight: var(--fw-semibold);
}
body.is-menu-open { overflow: hidden; }
.ast-main-header-wrap,
.main-header-bar-wrap {
  width: 100%;
}
.ast-primary-header-bar,
.main-header-bar {
  display: flex;
  align-items: center;
  min-height: 72px;
  padding-block: var(--space-3);
}
.site-primary-header-wrap,
.ast-builder-grid-row {
  display: flex;
  width: 100%;
  max-width: var(--container-wide);
  margin-inline: auto;
  padding-inline: var(--space-5);
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}
.ast-builder-grid-row-has-sides {
  justify-content: space-between;
}
.site-header-section { display: flex; align-items: center; }
.site-header-section-left { margin-right: auto; }

/* Logo */
.site-branding .custom-logo,
.site-branding .site-logo,
.site-logo-img img,
.site-logo-link img {
  width: auto;
  height: 56px;
  max-height: 56px;
  max-width: 200px;
  object-fit: contain;
}

/* 主選單 */
.main-header-menu,
#ast-hf-menu-1,
.site-navigation ul {
  display: flex;
  list-style: none;
  gap: var(--space-6);
  margin: 0;
  padding: 0;
  align-items: center;
}
.main-header-menu .menu-item > .menu-link,
.main-header-menu .menu-item > a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-1);
  font-weight: var(--fw-medium);
  color: var(--color-text);
  white-space: nowrap;
  transition: color 0.15s ease;
}
.main-header-menu .menu-item:hover > .menu-link,
.main-header-menu .menu-item.current-menu-item > .menu-link {
  color: var(--color-brand);
}
.main-header-menu .ast-icon.icon-arrow { display: none; }
.main-header-menu .ast-arrow-svg {
  width: 10px; height: auto; opacity: 0.6;
}

/* 行動裝置漢堡按鈕 (LINE 綠方按鈕，參考 icasino.tw pattern) */
/* 用 button.menu-toggle 提升特異性，蓋過 pages/index.css 的 button reset */
button.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  padding: 0;
  background: #06C755;            /* LINE 綠 */
  color: #fff;
  border: 0;
  border-radius: 4px;              /* 接近直角，有品牌感 */
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
button.menu-toggle:hover,
button.menu-toggle:focus-visible { background: #05A647; }
button.menu-toggle:active { transform: scale(0.96); }
button.menu-toggle svg { width: 22px; height: 22px; }

/* ☰ / × 切換：靠 aria-expanded */
button.menu-toggle .icon-close { display: none; }
button.menu-toggle[aria-expanded="true"] .icon-menu { display: none; }
button.menu-toggle[aria-expanded="true"] .icon-close { display: inline-block; }

/* 行動展開選單 ---------------------------------------- */
/* 預設桌機隱藏，由 [hidden] 屬性控制 */
.site-nav--mobile[hidden] { display: none; }

@media (max-width: 921px) {
  /* 切換桌機/行動 */
  .site-nav--desktop { display: none !important; }
  button.menu-toggle { display: inline-flex; }

  /* 行動選單容器 */
  .site-nav--mobile {
    flex-basis: 100%;
    width: 100%;
    margin-top: var(--space-3);
    padding: var(--space-3) 0 var(--space-2);
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
  }
  .site-nav--mobile .main-header-menu--mobile {
    display: flex;
    flex-wrap: wrap;            /* icasino.tw pattern：多欄自動換行 */
    flex-direction: row;
    gap: 4px 0;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: stretch;
  }
  .site-nav--mobile .nav-item {
    flex: 1 1 33.333%;          /* 一列 3 欄 */
    min-width: 33.333%;
    box-sizing: border-box;
  }
  .site-nav--mobile .menu-link {
    display: block;
    padding: 10px 12px;
    font-size: 15px;
    line-height: 1.5;
    font-weight: var(--fw-medium);
    color: var(--color-text);
    text-align: center;
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
  }
  .site-nav--mobile .menu-link:hover,
  .site-nav--mobile .menu-link.is-active,
  .site-nav--mobile .menu-link[aria-current="page"] {
    color: var(--color-brand);
    background: rgba(6, 199, 85, 0.08);
  }

  /* header inner 在行動版改 flex-wrap，讓選單能換到下一行 */
  .site-header-inner {
    flex-wrap: wrap;
    align-items: center;
  }

  /* 開啟時鎖捲動（避免後面內容跟著捲） */
  body.is-menu-open { overflow: hidden; }
}

/* 超小手機（< 400px）：退化成 2 欄，避免字太擠 */
@media (max-width: 400px) {
  .site-nav--mobile .nav-item {
    flex: 1 1 50%;
    min-width: 50%;
  }
}

/* ============== 5. FOOTER ============== */
.site-footer,
footer.site-footer {
  background: var(--color-text-strong);
  color: var(--color-bg);
  padding-block: var(--space-12) var(--space-8);
  margin-top: var(--space-16);
}
.site-footer a { color: var(--color-brand-soft); }
.site-footer a:hover { color: var(--color-bg); }

.footer-widget-area {
  max-width: var(--container-wide);
  margin-inline: auto;
  padding-inline: var(--space-5);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-8);
}

.woc-footer-nav {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.woc-footer-nav li {
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
}

/* 18 禁警語區塊 ---------------------------------------- */
.woc-age-warning {
  max-width: var(--container-wide);
  margin: var(--space-10) auto 0;
  padding: var(--space-5) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}
.woc-age-warning .woc-age-icon {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
}
.woc-age-warning p {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed, 1.7);
  color: rgba(255, 255, 255, 0.8);
}
.woc-age-warning__title {
  display: inline-block;
  margin-bottom: 4px;
  color: #ff6b6b;
  font-size: var(--fs-base);
  font-weight: var(--fw-bold, 700);
  letter-spacing: 0.02em;
}

/* 站底資訊（LINE CTA + 版權）------------------------------ */
.site-info {
  max-width: var(--container-wide);
  margin: var(--space-6) auto 0;
  padding: var(--space-4) var(--space-5) 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  font-size: var(--fs-sm);
  color: rgba(255, 255, 255, 0.7);
}
.site-info__copy {
  margin: 0;
  letter-spacing: 0.02em;
}

/* LINE CTA in footer */
.footer-social {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
}
.footer-line-cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  background: #06C755;            /* LINE 官方綠 */
  color: #fff !important;
  border-radius: var(--radius-pill);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease;
}
.footer-line-cta:hover {
  background: #05A647;
  color: #fff !important;
  transform: translateY(-1px);
}
.footer-line-icon {
  font-weight: 900;
  letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.18);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

/* ============== 6. UTILITY ============== */
.u-sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.u-text-center { text-align: center; }
.u-text-muted  { color: var(--color-text-muted); }
.u-mt-0 { margin-top: 0 !important; }
.u-mt-4 { margin-top: var(--space-4); }
.u-mt-8 { margin-top: var(--space-8); }
.u-mt-12 { margin-top: var(--space-12); }
.u-py-8 { padding-block: var(--space-8); }
.u-py-12 { padding-block: var(--space-12); }
.u-stack > * + * { margin-top: var(--space-4); }
.u-hidden { display: none !important; }

/* ============== 6.5 殘留 Tailwind utility 救援（global shim） ==============
   舊頁面 HTML 內有大量殘留的 Tailwind utility class
   （overflow-x-auto / min-w-full / whitespace-nowrap 等），
   但站上沒載 Tailwind，導致寬表格在手機破版。
   以下補上對應 CSS，讓既有 HTML 自然生效，不用改動 HTML 檔案。 */
.overflow-x-auto {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.overflow-hidden       { overflow: hidden; }
.w-full                { width: 100%; }
.h-full                { height: 100%; }
.min-w-full            { min-width: 100%; }
.max-w-full            { max-width: 100%; }
.whitespace-nowrap     { white-space: nowrap; }
.whitespace-normal     { white-space: normal; }
.text-sm               { font-size: 14px; line-height: 1.6; }
.text-xs               { font-size: 12px; line-height: 1.5; }
.text-left             { text-align: left; }
.text-center           { text-align: center; }
.text-right            { text-align: right; }
.border-collapse       { border-collapse: collapse; }
.tabular-nums          { font-variant-numeric: tabular-nums; }
.px-2                  { padding-left: 8px; padding-right: 8px; }
.px-3                  { padding-left: 12px; padding-right: 12px; }
.px-4                  { padding-left: 16px; padding-right: 16px; }
.py-2                  { padding-top: 8px; padding-bottom: 8px; }
.py-3                  { padding-top: 12px; padding-bottom: 12px; }
.py-4                  { padding-top: 16px; padding-bottom: 16px; }
.mb-2                  { margin-bottom: 8px; }
.mb-4                  { margin-bottom: 16px; }
.mb-6                  { margin-bottom: 24px; }
.mb-8                  { margin-bottom: 32px; }
.mt-4                  { margin-top: 16px; }
.mt-6                  { margin-top: 24px; }

/* 內文 code / pre：長字串強制換行，避免撐版 */
.entry-content pre,
.entry-content code,
article pre,
article code {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* 防呆：手機視窗下，內文表格一律改成 block + 水平捲動，
   即使外層沒包 .overflow-x-auto 也安全 */
@media (max-width: 768px) {
  .entry-content table,
  article table {
    display: block;
    width: max-content;        /* 保留自然寬度，由外層滑動 */
    max-width: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* 移除可能繼承的 nowrap，但不要強制逐字斷字（會讓中文變直書） */
  .entry-content table th,
  .entry-content table td,
  article table th,
  article table td {
    white-space: normal;
    overflow-wrap: break-word;  /* 只有超長詞才斷字 */
    min-width: 4em;             /* 保證 cell 不被擠成 1ch */
  }
  /* 外層已包 .overflow-x-auto 的，內部 table 改回正常 width 100% 顯示 */
  .overflow-x-auto > table {
    display: table;
    width: auto;
    min-width: 100%;
  }
}

/* CTA Button — LINE 綠主按鈕 */
.btn,
.woc-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: #fff;
  font-weight: var(--fw-semibold);
  line-height: 1;
  transition: background 0.15s ease, transform 0.15s ease;
}
.btn:hover,
.woc-cta:hover {
  background: var(--color-accent-hover);
  color: #fff;
  transform: translateY(-1px);
}
.btn--ghost {
  background: transparent;
  color: var(--color-brand);
  border: 1px solid var(--color-brand);
}
.btn--ghost:hover {
  background: var(--color-brand);
  color: #fff;
}

/* ============== 7. RESPONSIVE BREAKPOINTS ============== */
/* 大型桌面 */
@media (min-width: 1201px) {
  .container { padding-inline: var(--space-6); }
}
/* 桌面（Astra 預設 993+） */
@media (max-width: 1024px) {
  h1 { font-size: var(--fs-2xl); }
  h2 { font-size: var(--fs-xl); }
}
/* 平板（Astra 921 切換桌機 / 行動） */
@media (max-width: 921px) {
  .ast-container,
  .container {
    padding-inline: var(--space-4);
  }
}
/* 大手機 / 小平板 */
@media (max-width: 768px) {
  html { font-size: 15px; }
  .footer-widget-area {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
  .woc-age-warning {
    flex-direction: column;
    text-align: center;
    gap: var(--space-3);
    padding: var(--space-4);
  }
  .site-info {
    flex-direction: column;
    text-align: center;
    gap: var(--space-3);
  }
}
/* 手機 */
@media (max-width: 544px) {
  html { font-size: 14.5px; }
  h1 { font-size: var(--fs-xl); }
  h2 { font-size: var(--fs-lg); }
  .container,
  .ast-container { padding-inline: var(--space-4); }
  .ast-primary-header-bar,
  .main-header-bar { min-height: 60px; }
}
