/* =====================================================================
   觀現創境 Zensight — 公司門戶(zensight.center)全站樣式
   big.dk 式斯堪的納維亞極簡風:白底 / 黑字 / 大留白
   頁面:首頁(產品+作品集) / 產品頁 / 法務頁 / 404
   ===================================================================== */

:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #8a8a8a;
  --line: #e6e6e6;
  --thumb-bg: #f4f4f4;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: clip; /* 作品集詳情向右出血到屏幕邊緣,防止出現橫向滾動條(不影響 sticky) */
}

body {
  font-family: "Helvetica Neue", "PingFang HK", "PingFang TC", "PingFang SC", "Hiragino Sans GB", "Microsoft JhengHei", "Noto Sans CJK HK", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { display: block; }
a { color: inherit; }

::selection { background: #111; color: #fff; }

/* ---------- 頁頭 ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 18px 32px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.logo img {
  display: block;
  height: 40px;
  width: 40px;
}

.main-nav { display: flex; gap: 28px; justify-self: center; }

.main-nav a {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-decoration: none;
  color: var(--muted);
  padding-bottom: 2px;
}

.main-nav a:hover { color: var(--text); }
.main-nav a.active { color: var(--text); border-bottom: 2px solid var(--text); }

/* 右側語言切換 */
.header-actions { justify-self: end; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.lang-switch { position: relative; flex-shrink: 0; }

.lang-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 5px 14px;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}

.lang-btn:hover { color: var(--text); border-color: var(--text); }

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 128px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  display: none;
  z-index: 30;
}

.lang-switch.open .lang-menu { display: block; }

.lang-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  padding: 10px 16px;
}

.lang-menu button:hover { background: #f4f4f4; }
.lang-menu button.current { font-weight: 600; }

/* ---------- 後台 /admin(整頁佈局:登錄卡 + 標籤導航 + 兩個獨立區塊) ---------- */

.admin-main {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.admin-login {
  max-width: 380px;
  margin: 10vh auto 0;
  padding: 0 16px;
}

/* 表單面板(登錄卡 / 案例表單 / 公司信息表單) */
.admin-form-panel {
  border: 1px solid var(--line);
  padding: 22px 24px 26px;
  background: #fff;
}

/* 標籤導航:案例管理 | 公司信息 …… 登出 */
.admin-tabs {
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.admin-tabs .logout-btn { margin-left: auto; }

.logout-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  color: var(--muted);
  padding: 5px 0;
}

.logout-btn:hover { color: var(--text); }

.login-error {
  color: #c00;
  font-size: 12px;
  margin: 4px 0 0;
}

.admin-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

/* 已有案例列表 */

.admin-list-section h4,
.admin-form h4 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.admin-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.admin-list-item em {
  display: block;
  font-style: normal;
  color: var(--muted);
  font-size: 12px;
}

.admin-empty { color: var(--muted); font-size: 13px; padding: 8px 0 4px; }

.admin-note { font-size: 12px; color: var(--muted); margin: 8px 0 24px; }

.admin-item-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.del-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 12px;
  flex-shrink: 0;
}

.del-btn:hover { border-color: #c00; color: #c00; }

.mini-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 12px;
}

.mini-btn:hover { color: var(--text); border-color: var(--text); }

/* 公司信息表單區塊 */
.admin-site-form { margin-top: 4px; }

/* 表單(均置於 .admin-form-panel 面板內) */

.admin-form { padding-top: 0; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

.field { margin-bottom: 12px; }

.field label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--text);
}

.field textarea { min-height: 88px; resize: vertical; }

.field input[type="file"] { padding: 6px; font-size: 12px; }

/* 新增分類:下拉框下方的內聯輸入行 */
.cat-add-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.cat-add-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--text);
  background: #fff;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
}

.cat-add-row input:focus { outline: none; }

.cat-add-row .mini-btn { flex-shrink: 0; margin: 0; }

.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 16px; }

/* ---------- Hero ---------- */

.hero {
  max-width: 1060px;
  margin: 0 auto;
  padding: clamp(56px, 10vh, 120px) 32px 72px;
}

.hero h1 {
  font-size: clamp(32px, 5.5vw, 60px);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.12;
}

.hero p {
  margin-top: 24px;
  max-width: 620px;
  font-size: 16px;
  line-height: 1.85;
  color: #444;
}

/* ---------- 產品區 ---------- */

.products-section { border-top: 1px solid var(--line); }

.products-inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 64px 32px;
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 32px;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 48px 40px;
}

.product-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
}

.product-icon {
  width: 72px;
  height: 72px;
  border: 1px solid var(--line);
  overflow: hidden;
  flex-shrink: 0;
}

.product-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-icon.empty { background: var(--thumb-bg); }

.product-name {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.45;
}

.product-tagline {
  font-size: 13px;
  line-height: 1.7;
  color: #555;
}

.product-highlights {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.product-cta {
  margin-top: auto;
  align-self: flex-start;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--text);
  padding: 8px 18px;
}

a.product-cta:hover { opacity: 0.75; }

.product-cta.is-disabled {
  color: var(--muted);
  border-color: var(--line);
  cursor: default;
}

.product-badge {
  margin-top: auto;
  align-self: flex-start;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 999px;
  padding: 4px 12px;
}

.product-more {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-decoration: none;
}

.product-more:hover { color: var(--text); }

/* ---------- 產品頁 ---------- */

.product-head {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.product-head .product-icon { width: 88px; height: 88px; }

.product-page .page-head { padding-bottom: 0; }

.features-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px 0 8px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: #333;
}

.product-cta-block { margin-top: 32px; }

/* ---------- 按鈕(產品頁 CTA / 404 返回) ---------- */

.btn-primary {
  display: inline-block;
  background: var(--text);
  color: #fff;
  border: 1px solid var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  padding: 9px 22px;
  text-decoration: none;
}

a.btn-primary:hover { opacity: 0.85; }

.btn-primary.is-disabled {
  background: none;
  color: var(--muted);
  border-color: var(--line);
  cursor: default;
}

.btn-ghost {
  display: inline-block;
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  padding: 9px 22px;
  text-decoration: none;
}

.btn-ghost:hover { color: var(--text); border-color: var(--text); }

/* ---------- 作品集區標 ---------- */

.work-label {
  max-width: 1060px;
  margin: 0 auto;
  padding: 48px 32px 0;
}

/* ---------- 篩選欄 ---------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 14px 32px;
  border-bottom: 1px solid var(--line);
}

.filter-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding: 2px 0;
}

.filter-btn:hover { color: var(--text); }

.filter-btn.active {
  color: var(--text);
  font-weight: 600;
}

/* ---------- 作品集列表(big.dk 式豎排,點擊原位展開詳情) ---------- */

.project-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 64px;
  padding: 48px 32px 96px;
}

.project-item {
  width: 100%;
  max-width: 1060px;
  scroll-margin-top: 96px; /* 展開滾動定位時給吸頂頁頭留白 */
  animation: rise 0.5s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* 列表行:左信息欄 + 右大圖 */

.item-head {
  display: flex;
  align-items: flex-start;
  gap: clamp(24px, 4vw, 56px);
  width: 100%;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}

.item-info {
  flex: 0 0 clamp(150px, 16vw, 200px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.item-icon {
  width: 26px;
  height: 26px;
  background: #111;
  overflow: hidden;
}

.item-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.05);
}

.item-title {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.45;
}

.item-loc {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.item-media {
  flex: 1;
  min-width: 0;
  display: block;
}

.item-media img {
  width: 100%;
  max-width: 520px; /* 列表縮略圖比展開後的大圖小,點擊放大更明顯 */
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--thumb-bg);
}

/* 展開後列表行融進詳情(只保留一行大圖詳情,不重複顯示) */
.project-item.open .item-head { display: none; }

/* 展開的詳情:左參數 / 中大圖+圖集 / 右描述
   整體向右出血延伸到屏幕右緣(big.dk 式);出血加在本層,
   內層 overflow:hidden 裁剪高度時不會裁掉出血部分 */
.item-detail {
  position: relative;
  height: 0;
  overflow: hidden;
  margin-right: calc(50% - 50vw);
}

.d-close {
  position: absolute;
  top: 0;
  right: 16px;
  z-index: 3;
  width: 30px;
  height: 30px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  color: var(--muted);
}

.d-close:hover { color: var(--text); border-color: var(--text); }

.detail-cols {
  display: grid;
  grid-template-columns: clamp(150px, 14vw, 180px) minmax(0, 1fr) clamp(160px, 15vw, 190px);
  gap: clamp(24px, 3vw, 40px);
  align-items: start;
  padding: 48px 0 8px;
}

.d-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

.d-loc {
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.d-year {
  margin-top: 28px;
  font-size: 12px;
  color: var(--muted);
}

.d-stats { margin-top: 10px; }

.d-stat {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.d-stat dt {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.d-stat dd {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 600;
}

.d-hero img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--thumb-bg);
}

/* 橫向拖動圖集(≥2 張圖:下一張右側露邊 + 方塊指示器) */

.d-track {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none; /* 隱藏滾動條(Firefox) */
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.d-track::-webkit-scrollbar { display: none; }

.d-track.dragging {
  cursor: grabbing;
  scroll-snap-type: none; /* 拖拽時關閉吸附,鬆手後再吸附 */
}

.d-track img {
  width: 75%; /* 主圖約佔 3/4,下一張在右側大面積露出 */
  flex-shrink: 0;
  scroll-snap-align: start;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--thumb-bg);
  pointer-events: none; /* 防止原生圖片拖拽干擾 */
}

.d-dots {
  display: flex;
  gap: 6px;
  padding-top: 14px;
}

.d-dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  background: var(--line);
  cursor: pointer;
}

.d-dots button.on { background: var(--text); }

.d-desc {
  font-size: 12px;
  line-height: 1.9;
  color: #444;
}

.d-desc p + p { margin-top: 1em; }

/* ---------- 關於 ---------- */

.about-section {
  max-width: 720px;
  padding: 88px 32px;
  border-top: 1px solid var(--line);
}

.about-section h2 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
}

.about-section p { font-size: 15px; line-height: 1.9; color: #333; }

/* ---------- 頁腳 ---------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px 40px;
  padding: 40px 32px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--text); }

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

/* ---------- 產品頁 / 法務頁通用頁頭 ---------- */

.page-head { padding: 48px 32px 8px; max-width: 1060px; margin: 0 auto; }

.back-link {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 28px;
}

.back-link:hover { color: var(--text); }

.detail-title {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.detail-meta {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

/* 描述區(產品頁) */

.description {
  max-width: 720px;
  padding: 56px 32px;
  font-size: 15px;
  line-height: 1.95;
  color: #333;
}

.description p + p { margin-top: 1.2em; }

.description-inner { max-width: 720px; margin: 0 auto; padding: 40px 32px 72px; }
.description-inner p + p { margin-top: 1.2em; }

/* ---------- 法務頁 ---------- */

.legal-main {
  max-width: 720px;
  padding: 64px 32px 56px;
}

.legal-main h1 {
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 700;
}

.legal-updated {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.legal-intro {
  margin-top: 20px;
  font-size: 15px;
  line-height: 1.8;
  color: #333;
}

.legal-main section { margin-top: 40px; }

.legal-main section h2 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.legal-main section p {
  font-size: 14px;
  line-height: 1.9;
  color: #333;
}

.legal-foot {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.9;
  color: var(--muted);
}

.legal-foot a { color: var(--muted); }
.legal-foot a:hover { color: var(--text); }

/* ---------- 404 ---------- */

.not-found { padding: 96px 32px; text-align: center; color: var(--muted); }
.not-found a { color: var(--text); }

/* =====================================================================
   頁面切換動畫(big.dk 式整頁交叉淡化)
   - Chrome 126+ / Edge 126+ / Safari 18.2+:由下方 @view-transition 規則
     自動啟用原生整頁 cross-fade
   - 舊瀏覽器:由 js/transition.js 用 JS 淡出/淡入兜底
   ===================================================================== */

@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.35s;
  animation-timing-function: cubic-bezier(0.45, 0, 0.55, 1);
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* ---------- JS 兜底(不支持原生跨頁過渡的瀏覽器) ---------- */

body {
  transition: opacity 0.32s cubic-bezier(0.45, 0, 0.55, 1);
}

body.page-exit { opacity: 0; }

body.page-enter {
  animation: page-fade-in 0.4s cubic-bezier(0.45, 0, 0.55, 1) backwards;
}

@keyframes page-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  body { transition: none; }
  body.page-enter { animation: none; }
}

/* =====================================================================
   開場動畫(黑屏 → 居中白色 logo → 飛向頁頭 logo → 揭示頁面)
   僅首頁引入;結構由 js/intro.js 動態創建,這裡只定義樣式
   ===================================================================== */

.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

/* 開場 logo:全程純白(黑屏可見),落位後隨黑幕一起淡去,
   頁頭原色 logo 在正下方同步顯現銜接 */
.intro-logo {
  position: relative;
  display: block;
  width: 64px;
  height: 64px;
  will-change: transform;
}

.intro-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ---------- 移動端 ---------- */

@media (max-width: 640px) {
  .site-header { padding: 14px 16px; }
  .main-nav { gap: 18px; }
  .lang-switch { flex-shrink: 0; }
  .lang-btn { padding: 4px 10px; font-size: 11px; }
  .header-actions { gap: 6px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .admin-main { padding: 20px 16px 56px; }
  .admin-tabs { gap: 16px; }
  .filter-bar { gap: 16px; padding: 12px 16px; }
  .project-list { padding: 20px 16px 56px; gap: 36px; }
  .item-info { flex-basis: 108px; }
  .item-media img { aspect-ratio: 4 / 3; }
  .detail-cols { grid-template-columns: 1fr; gap: 20px; padding-top: 40px; }
  .item-detail { margin-right: 0; }
  .d-close { top: 0; right: 0; }
  .d-title { font-size: 17px; }
  .d-track { gap: 12px; }
  .d-track img { width: 80%; }
  .d-dots { padding-top: 10px; }
  .about-section { padding: 56px 16px; }
  .site-footer { padding: 28px 16px; }
  .page-head { padding: 32px 16px 4px; }
  .description { padding: 40px 16px; }
  .description-inner { padding: 24px 16px 48px; }
  .hero { padding: 40px 16px 48px; }
  .products-grid { grid-template-columns: 1fr; gap: 36px; }
  .products-inner { padding: 48px 16px; }
  .work-label { padding: 32px 16px 0; }
  .legal-main { padding: 40px 16px 32px; }
}
