/* 屋苑指南 /estates/ — 2026-11-14 redesign (filters + data cards + compare)
   Uses brand.css tokens: --navy --panel --gold --gold-light --ink --ink-dim --ink-faint --line --line-soft */

.eg-wrap { max-width: 1120px; }
.eg-wrap .foot, .eg-wrap .breadcrumb { max-width: none; }

/* ---------- Hero ---------- */
.eg-hero {
  position: relative;
  margin: 8px 0 20px;
  padding: 44px 0 28px;
  border-bottom: 1px solid var(--line-soft);
}
.eg-hero h1 { margin: 0 0 8px; font-size: clamp(32px, 5.5vw, 52px); font-weight: 800; line-height: 1.1; letter-spacing: .02em; }
.eg-lede { color: var(--ink-dim); font-size: 17px; margin: 0 0 20px; max-width: 46ch; }
.eg-search {
  display: flex; align-items: center; gap: 10px;
  max-width: 520px; padding: 0 16px;
  background: rgba(22,33,58,.75); border: 1px solid var(--line); border-radius: 14px;
  transition: border-color .18s;
}
.eg-search:focus-within { border-color: var(--gold); }
.eg-search svg { width: 20px; height: 20px; fill: none; stroke: var(--ink-dim); stroke-width: 2; stroke-linecap: round; flex: none; }
.eg-search input {
  flex: 1; min-width: 0; padding: 14px 0; background: transparent; border: 0; outline: 0;
  color: var(--ink); font: inherit; font-size: 16px;
}
.eg-search input::placeholder { color: var(--ink-faint); }

/* ---------- Filters ---------- */
.eg-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 12px; }
.eg-chip, .eg-select, .eg-reset {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); color: var(--ink); font: inherit; font-size: 14.5px; font-weight: 700;
  cursor: pointer; transition: border-color .18s, background .18s, color .18s;
}
.eg-chip:hover, .eg-select:hover { border-color: var(--gold); }
.eg-chip[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--gold-light), var(--gold)); color: #1A1206; border-color: transparent;
}
.eg-select span { color: var(--ink-dim); font-weight: 600; }
.eg-select select {
  appearance: none; -webkit-appearance: none; background: transparent; border: 0; outline: 0;
  color: var(--gold-light); font: inherit; font-weight: 800; cursor: pointer; padding-right: 14px;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: right 4px center, right 0 center; background-size: 5px 5px; background-repeat: no-repeat;
}
.eg-select select option { background: var(--navy); color: var(--ink); }
.eg-select.is-on { border-color: var(--gold); }
.eg-reset[hidden], .eg-region[hidden], .eg-vr[hidden] { display: none; }
.eg-reset { background: transparent; border-color: transparent; color: var(--gold-light); text-decoration: underline; }

/* ---------- Sticky area tabs ---------- */
.eg-tabs {
  position: sticky; top: var(--eg-top, 0px); z-index: 39;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 0 -20px 20px; padding: 10px 20px;
  background: rgba(15,24,41,.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.eg-tabs::-webkit-scrollbar { display: none; }
.eg-tabs a {
  flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line-soft); background: var(--panel);
  color: var(--ink); text-decoration: none; font-weight: 700; font-size: 15px;
  transition: all .18s;
}
.eg-tabs a:hover { border-color: var(--gold); }
.eg-tabs a.on { background: linear-gradient(135deg, var(--gold-light), var(--gold)); color: #1A1206; border-color: transparent; }
.eg-tabs a.is-empty { opacity: .35; }

/* ---------- 360 VR (click-to-load) ---------- */
.eg-vr { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--panel); margin: 0 0 8px; }
.eg-vr-poster {
  position: relative; display: block; width: 100%; aspect-ratio: 21 / 8; padding: 0; border: 0; cursor: pointer;
  background: var(--panel); color: var(--ink); font: inherit;
}
.eg-vr-poster img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s; }
.eg-vr-poster:hover img { transform: scale(1.03); }
.eg-vr-poster::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(15,24,41,0) 40%, rgba(15,24,41,.75)); }
.eg-vr-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 1;
  padding: 14px 26px; border-radius: 999px; font-size: 18px; font-weight: 800;
  background: rgba(15,24,41,.7); border: 2px solid var(--gold-light); color: var(--ink);
  backdrop-filter: blur(4px); box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.eg-vr-cap { position: absolute; left: 16px; bottom: 12px; z-index: 1; font-size: 13.5px; color: var(--ink); font-weight: 600; }
#kowloon-station-vr { width: 100%; height: 440px; }

/* ---------- Sections ---------- */
.eg-region { margin: 36px 0 0; }
.eg-sec { scroll-margin-top: calc(var(--eg-top, 0px) + 70px); }
.eg-sec h2.sec { display: flex; align-items: baseline; gap: 12px; margin-top: 18px; }
.eg-count { color: var(--ink-dim); font-size: 15px; font-weight: 600; }
.eg-count b { color: var(--gold-light); }
.eg-sec[hidden] { display: none; }

/* ---------- Cards ---------- */
.eg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 900px) { .eg-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .eg-grid { grid-template-columns: 1fr; } }

.eg-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.eg-card:hover { border-color: var(--line); transform: translateY(-2px); box-shadow: 0 14px 34px rgba(0,0,0,.28); }
.eg-card.is-picked { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 14px 34px rgba(201,164,92,.16); }
.eg-card[hidden] { display: none; }

.eg-media { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: #1b2846; text-decoration: none; }
.eg-media.is-ph { aspect-ratio: auto; height: 92px; }
.eg-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s; }
.eg-card:hover .eg-media img { transform: scale(1.04); }
.eg-ph {
  width: 100%; height: 100%; display: flex; align-items: flex-end; padding: 14px 16px; box-sizing: border-box;
  background:
    linear-gradient(180deg, rgba(15,24,41,0) 30%, rgba(15,24,41,.85)),
    repeating-linear-gradient(90deg, rgba(201,164,92,.10) 0 2px, transparent 2px 22px),
    linear-gradient(160deg, #22355c 0%, #16213A 60%, #0F1829 100%);
}
.eg-ph { padding-left: 96px; }
.eg-ph span { font-size: 13px; letter-spacing: .2em; opacity: .9; font-weight: 800; letter-spacing: .04em; color: rgba(227,200,142,.55); line-height: 1.1; }

.eg-cmp {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px 6px 8px;
  border-radius: 10px; background: rgba(15,24,41,.78); backdrop-filter: blur(6px);
  border: 1px solid var(--line-soft); font-size: 13px; font-weight: 700; color: var(--ink); cursor: pointer;
}
.eg-cmp input { width: 16px; height: 16px; margin: 0; accent-color: var(--gold); cursor: pointer; }
.eg-card.is-picked .eg-cmp { background: var(--gold); color: #1A1206; border-color: transparent; }

.eg-body { display: flex; flex-direction: column; flex: 1; padding: 16px 18px 18px; }
.eg-head h3 { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.25; }
.eg-head h3 a { color: var(--ink); text-decoration: none; }
.eg-head h3 a:hover { color: var(--gold-light); }
.eg-en { margin: 2px 0 0; color: var(--ink-dim); font-size: 14px; }
.eg-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.eg-badge {
  font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  border: 1px solid rgba(201,164,92,.5); color: var(--gold-light);
}
.eg-badge-blue { border-color: rgba(120,180,240,.45); color: #A9D0F5; }
.eg-meta { list-style: none; margin: 12px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line-soft); flex: 1; }
.eg-meta li { display: flex; gap: 8px; font-size: 14.5px; color: var(--ink-dim); padding: 3px 0; line-height: 1.45; }
.eg-ic { flex: none; width: 18px; text-align: center; opacity: .85; }
.eg-actions { display: grid; grid-template-columns: 1fr 1.2fr; gap: 10px; margin-top: 14px; }

.eg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 14px; border-radius: 12px; font: inherit; font-size: 14.5px; font-weight: 800;
  text-decoration: none; cursor: pointer; border: 1px solid transparent; transition: all .18s; white-space: nowrap;
}
.eg-btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.eg-btn-ghost:hover { border-color: var(--gold); color: var(--gold-light); }
.eg-btn-gold { background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 60%, #A1824A 100%); color: #1A1206; }
.eg-btn-gold:hover { box-shadow: 0 8px 24px rgba(201,164,92,.32); }

.eg-empty { margin: 28px 0; padding: 22px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--ink-dim); }
.eg-empty a { color: var(--gold-light); font-weight: 700; }
.eg-note { margin: 36px 0 0; font-size: 13px; color: var(--ink-faint); }

/* ---------- Compare bar + dialog ---------- */
.eg-cmpbar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 150;
  display: flex; align-items: center; gap: 10px; width: min(760px, calc(100% - 24px)); box-sizing: border-box;
  padding: 10px 10px 10px 18px; border-radius: 16px;
  background: rgba(22,33,58,.96); border: 1px solid var(--gold); backdrop-filter: blur(10px);
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
}
.eg-cmpbar[hidden] { display: none; }
.eg-cmpbar-txt { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eg-cmpbar-txt b { color: var(--gold-light); }
@media (max-width: 768px) {
  .eg-cmpbar { bottom: calc(68px + env(safe-area-inset-bottom)); padding-left: 14px; }
  .eg-cmpbar #eg-cmp-clear { display: none; }
}

.eg-dialog {
  width: min(960px, calc(100% - 24px)); max-height: 86vh; padding: 0; border-radius: 18px;
  background: var(--navy); color: var(--ink); border: 1px solid var(--line);
}
.eg-dialog::backdrop { background: rgba(5,10,20,.7); backdrop-filter: blur(3px); }
.eg-dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.eg-dialog-head h2 { margin: 0; font-size: 20px; }
.eg-dialog-head button { background: transparent; border: 0; color: var(--ink-dim); font-size: 20px; cursor: pointer; }
.eg-dialog-body { overflow: auto; max-height: calc(86vh - 140px); }
.eg-dialog-body table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.eg-dialog-body th, .eg-dialog-body td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.eg-dialog-body thead th { position: sticky; top: 0; background: var(--panel); color: var(--gold-light); font-size: 17px; }
.eg-dialog-body thead th small { display: block; color: var(--ink-dim); font-size: 12.5px; font-weight: 500; }
.eg-dialog-body tbody th { color: var(--ink-faint); font-weight: 600; white-space: nowrap; width: 1%; }
.eg-dialog-foot { padding: 14px 20px; border-top: 1px solid var(--line-soft); display: flex; justify-content: flex-end; }

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  .eg-hero { padding: 24px 0 20px; }
  .eg-lede { font-size: 15.5px; }
  .eg-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -20px 6px; padding: 0 20px 4px; }
  .eg-filters::-webkit-scrollbar { display: none; }
  .eg-chip, .eg-select, .eg-reset { flex: none; min-height: 44px; padding: 0 14px; font-size: 14px; }
  .eg-vr-poster { aspect-ratio: 16 / 9; }
  .eg-vr-play { font-size: 15.5px; padding: 11px 20px; white-space: nowrap; }
  #kowloon-station-vr { height: 320px; }
  .eg-head h3 { font-size: 21px; }
}

/* 區域發展指南入口（2026-11-20） */
.eg-guides { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 18px; }
.eg-guides span { font-size: 12.5px; font-weight: 800; color: var(--gold-light); letter-spacing: .04em; margin-right: 4px; }
.eg-guides a { font-size: 13px; font-weight: 700; color: var(--ink); text-decoration: none; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; transition: all .16s ease; }
.eg-guides a:hover { color: var(--gold-light); border-color: var(--gold); background: rgba(201,164,92,.08); }
.eg-guide-link { margin-left: 10px; font-size: 13px; font-weight: 700; color: var(--gold-light); text-decoration: none; white-space: nowrap; }
.eg-guide-link:hover { text-decoration: underline; }

/* ===== v3 polish 2026-11-20：>=44px 觸控目標、>=12px 字、focus ring、橫向捲動提示 ===== */
/* focus rings（鍵盤/螢幕閱讀器） */
.eg-chip:focus-visible, .eg-reset:focus-visible, .eg-btn:focus-visible, .eg-tabs a:focus-visible,
.eg-guides a:focus-visible, .eg-vr-poster:focus-visible, .eg-dialog-head button:focus-visible,
.eg-head h3 a:focus-visible, .eg-cmpbar button:focus-visible {
  outline: 3px solid var(--gold-light); outline-offset: 2px;
}
.eg-select:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(227,200,142,.45); }
.eg-select select:focus-visible { outline: 0; }
.eg-search:focus-within { box-shadow: 0 0 0 3px rgba(227,200,142,.35); }
.eg-cmp:focus-within { outline: 3px solid var(--gold-light); outline-offset: 2px; }
.eg-card:focus-within { border-color: var(--line); }

/* 房數／校網：整個膠囊都係 select 範圍，高度 44 */
.eg-select { padding-right: 0; }
.eg-select select { min-height: 44px; padding: 0 30px 0 6px; background-position: right 14px center, right 10px center; background-size: 5px 5px; }

/* 比較 checkbox：標籤 44px 高 */
.eg-cmp { min-height: 44px; padding: 0 14px 0 12px; border-radius: 12px; font-size: 14px; }
.eg-cmp input { width: 20px; height: 20px; }

/* 卡片：整張卡可撳（stretched link），內部按鈕、比較掣疊喺上面 */
.eg-head h3 a { display: inline-block; padding: 9px 0; margin: -9px 0; }
.eg-head h3 a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.eg-card .eg-actions, .eg-card .eg-cmp { z-index: 2; }
.eg-actions { position: relative; }
.eg-card:hover { cursor: pointer; }
.eg-badge { font-size: 12.5px; }
.eg-ph span { font-size: 13px; }

/* 比較列 / 對話框 */
.eg-cmpbar .eg-btn { min-width: 44px; }
.eg-dialog-head button { min-width: 44px; min-height: 44px; border-radius: 999px; }
.eg-dialog-body thead th small { font-size: 12.5px; }
.eg-dialog-body thead th a { display: inline-block; padding: 6px 0; }
.eg-dialog-foot .eg-btn { min-height: 44px; }

/* 頁面 chrome：麵包屑、頁尾（只影響本頁） */
.eg-wrap .breadcrumb a, .eg-wrap .breadcrumb .current { display: inline-flex; align-items: center; min-height: 44px; }
.eg-wrap .foot .disclaimer { font-size: 12px; line-height: 1.7; }
.eg-wrap .foot .disclaimer a { display: inline-flex; align-items: center; min-height: 44px; }
.eg-wrap .foot-sitemap-col h3 { margin: 0 0 10px; font-size: 12px; font-weight: 800; letter-spacing: .04em; color: var(--gold-light); text-transform: uppercase; }
.eg-wrap .foot-sitemap-col a { display: flex; align-items: center; min-height: 44px; padding: 0; }
.eg-wrap .foot-social a { min-height: 44px; }
.eg-wrap .foot-social .xhs-badge { font-size: 12px; }
.topbar .brand-name { min-height: 44px; }
.topbar .brand-name .lic { font-size: 12px; }
.topbar .back-link { min-height: 44px; display: inline-flex; align-items: center; }
.topbar-social { gap: 4px; }
.topbar-social a { width: auto; min-width: 40px; height: 44px; }
.topbar-social .xhs-badge { font-size: 12px; padding: 2px 4px; }
.lang-switch span, .lang-switch a { font-size: 12px; }

/* 手機底部 Tab bar（mobile-nav.js 注入）：字 >=12px、drawer 關閉掣 44px */
@media (max-width: 768px) {
  body .mnav-tabbar a, body .mnav-tabbar button { font-size: 12px; }
  body .mnav-drawer-close { min-width: 44px; min-height: 44px; }
  body .mnav-group h4 { font-size: 12px; }
}

/* 橫向捲動提示：邊緣淡出（由 estates-index.js 按捲動位置切換 class） */
@media (max-width: 600px) {
  .eg-filters { padding-top: 4px; padding-bottom: 8px; }
  .eg-filters.has-more-r, .eg-tabs.has-more-r {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent);
  }
  .eg-filters.has-more-l, .eg-tabs.has-more-l {
    -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent);
            mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent);
  }
  .eg-filters.has-more-l.has-more-r, .eg-tabs.has-more-l.has-more-r {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 36px), transparent);
            mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 36px), transparent);
  }
  .eg-actions { grid-template-columns: 1fr 1.2fr; }
  .eg-meta li { font-size: 14.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .eg-card, .eg-card:hover, .eg-media img, .eg-card:hover .eg-media img, .eg-vr-poster img { transition: none; transform: none; }
}

/* 比較：input 撐滿 44px 標籤（透明），用 ::before 畫勾選框；focus 見 .eg-cmp:focus-within */
.eg-cmp { overflow: hidden; }
.eg-cmp input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; z-index: 1; }
.eg-cmp span { display: inline-flex; align-items: center; gap: 8px; }
.eg-cmp span::before {
  content: ""; flex: none; width: 20px; height: 20px; box-sizing: border-box; border-radius: 5px;
  border: 2px solid var(--gold-light); background: transparent;
}
.eg-cmp input:checked + span::before {
  background: var(--gold) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-6.5' fill='none' stroke='%231A1206' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
  border-color: #1A1206;
}
.eg-card.is-picked .eg-cmp span::before { border-color: #1A1206; }
.eg-wrap .breadcrumb a { padding: 0 10px; margin: 0 -10px; }

body .mnav-drawer-close { min-width: 44px; min-height: 44px; }


/* ===== tablet topbar 2026-11-20：481–900px 品牌名唔再斷行（隱藏社交圖示同牌照，與區域指南一致） ===== */
@media (min-width:481px) and (max-width:900px){
  .topbar .topbar-social{display:none}
  .topbar .brand-name{white-space:nowrap}
  .topbar .brand-name .lic{display:none}
}
