/*
 * FFXIV TW Tools - Shared Navbar (Cyberpunk × Allagan codex)
 * 引用方式：<link rel="stylesheet" href="https://ffxiv-tw-tools-portal.pages.dev/header.css">
 */
.ftw-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 64px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 clamp(1rem, 2vw, 1.5rem);
  z-index: 1000;
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif);
  /* 深色金屬底 + CRT scanline 疊加（內建 cyberpunk 質感） */
  background:
    var(--pattern-scanline, transparent),
    linear-gradient(180deg,
      rgba(10, 14, 24, 0.96) 0%,
      rgba(19, 24, 38, 0.96) 100%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  /* 上 cyan 細線、下金線 — 雙金屬邊框 */
  border-bottom: none;
  box-shadow:
    inset 0 1px 0 rgba(78, 201, 208, 0.18),
    0 1px 0 rgba(230, 192, 104, 0.22),
    0 8px 24px rgba(0, 0, 0, 0.5);
}

/* 底部金線飾條（gilt line trim） */
.ftw-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  height: 1px;
  background: var(--line-gilt, linear-gradient(90deg, transparent, rgba(230, 192, 104, 0.6) 50%, transparent));
  pointer-events: none;
}

/* === Logo === */
.ftw-header__logo {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: var(--space-2, 0.5rem);
  text-decoration: none;
  color: var(--color-text, #f0f4f8);
  font-family: var(--font-mono, ui-monospace, Consolas, monospace);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: var(--tracking-wide, 0.12em);
  text-transform: uppercase;
  transition: color .2s, text-shadow .2s;
}
.ftw-header__logo:hover {
  color: var(--color-neon-cyan, #7df9ff);
  text-shadow: 0 0 8px rgba(125, 249, 255, 0.6);
}
.ftw-header__logo-icon {
  font-size: 1.3rem;
  filter: drop-shadow(0 0 4px rgba(230, 192, 104, 0.5));
}

/* === Current Tool Name (Center) === */
.ftw-header__current {
  justify-self: center;
  text-align: center;
  color: var(--color-text, #f0f4f8);
  font-family: var(--font-display, serif);
  font-size: clamp(1.15rem, calc(0.8rem + 0.8vw), 2rem);
  font-weight: 700;
  letter-spacing: var(--tracking-wide, 0.08em);
  line-height: 1.2;
  white-space: nowrap;
  position: relative;
  /* Chromatic aberration — cyberpunk 招牌效果 */
  text-shadow:
    -1px 0 0 rgba(255, 94, 212, 0.35),
    1px 0 0 rgba(125, 249, 255, 0.35),
    0 0 16px rgba(230, 192, 104, 0.2);
}

/* 標題兩側 cyber 角符號（codex frame） */
.ftw-header__current::before,
.ftw-header__current::after {
  font-family: var(--font-mono, monospace);
  color: var(--color-accent-cyan, #4ec9d0);
  font-size: 0.55em;
  font-weight: 400;
  opacity: 0.7;
  margin: 0 0.6em;
  vertical-align: middle;
}
.ftw-header__current::before { content: '◢'; }
.ftw-header__current::after  { content: '◣'; }

/* === Spacer (right column) — 變成版本徽章 === */
.ftw-header__spacer {
  justify-self: end;
  font-family: var(--font-mono, monospace);
  font-size: 0.65rem;
  letter-spacing: var(--tracking-wider, 0.2em);
  color: var(--color-text-muted, #9aa3b8);
  opacity: 0.6;
}
.ftw-header__spacer::before {
  content: 'v1.0';
  padding: 4px 10px;
  border: 1px solid rgba(78, 201, 208, 0.25);
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
  background: rgba(78, 201, 208, 0.06);
}

/* 防呆：CDN cache 期 / 舊 header.js 殘留的 theme button 強制隱藏 */
.ftw-header__theme { display: none !important; }

@media (max-width: 640px) {
  .ftw-header__logo-text { display: none; }
  .ftw-header__current::before,
  .ftw-header__current::after { display: none; }
  .ftw-header__spacer::before { display: none; }
}

/* body padding 避免內容被 fixed navbar 擋 */
body { padding-top: 80px !important; }

/* =====================================================================
 * Codex UI Kit — 跨工具共用 component class（單一權威，改這裡同步全部）
 * 用法：任何子工具的 panel / card 加 class="codex-tablet" 即套用
 *      cyan 變體用 class="codex-tablet codex-tablet--cyan"
 *      gold 變體用 class="codex-tablet codex-tablet--gold"
 * ===================================================================== */
.codex-tablet {
  position: relative;
  background: var(--gradient-tablet, var(--color-surface, #232a3d));
  border: 1px solid rgba(230, 192, 104, 0.16);
  clip-path: var(--clip-tablet);
  box-shadow: var(--shadow-mystical, 0 4px 12px rgba(0, 0, 0, 0.4));
  isolation: isolate;
  /* clip-path 已造型，覆蓋原有 radius */
  border-radius: 0 !important;
}
/* 內層細邊（雙金屬框） */
.codex-tablet::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(230, 192, 104, 0.12);
  clip-path: var(--clip-tablet);
  pointer-events: none;
  z-index: 1;
}
/* Cyan 變體（sub-timer / island / faux 用） */
.codex-tablet--cyan {
  border-color: rgba(78, 201, 208, 0.22);
  box-shadow: var(--shadow-mystical-cyan, 0 4px 12px rgba(0, 0, 0, 0.4));
}
.codex-tablet--cyan::before {
  border-color: rgba(78, 201, 208, 0.16);
}
/* Gold 變體（portal 用） */
.codex-tablet--gold {
  box-shadow: var(--shadow-mystical-gold, 0 4px 12px rgba(0, 0, 0, 0.4));
}

/* HUD 角標（4 角斜直角，cyberpunk 點綴）
   用法：在 .codex-tablet 內加 <span class="codex-hud"></span> */
.codex-hud {
  position: absolute;
  inset: 18px;
  pointer-events: none;
  z-index: 2;
}
.codex-hud::before,
.codex-hud::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--color-accent-cyan, #4ec9d0);
  opacity: 0.8;
  transition: opacity 0.4s, box-shadow 0.4s;
}
.codex-hud::before {
  top: 0; left: 0;
  border-right: 0; border-bottom: 0;
}
.codex-hud::after {
  bottom: 0; right: 0;
  border-left: 0; border-top: 0;
}
.codex-tablet:hover .codex-hud::before,
.codex-tablet:hover .codex-hud::after {
  opacity: 1;
  box-shadow: 0 0 6px var(--color-accent-cyan, #4ec9d0);
}
.codex-tablet--gold .codex-hud::before,
.codex-tablet--gold .codex-hud::after {
  border-color: var(--color-accent-gold, #e6c068);
}

/* 金線分隔 — hr / div 套 class 即用 */
.codex-divider {
  height: 1px;
  background: var(--line-gilt, currentColor);
  border: 0;
  margin: 0;
  opacity: 0.55;
}
.codex-divider--cyan { background: var(--line-gilt-cyan, currentColor); }

/* —— Codex Label — 寬字距小標籤（hero overline 的字體系統）——
   用法：class="codex-label" 套用「mono + 寬字距 + 大寫 + cyan accent」
   CJK 自動 fallback 系統繁中字（Win → Microsoft JhengHei / Mac → PingFang TC）
   變體：--gold / --muted / --neon
*/
.codex-label {
  font-family: var(--font-mono, ui-monospace, Consolas, monospace);
  font-size: 0.78rem;
  letter-spacing: var(--tracking-wider, 0.28em);
  text-transform: uppercase;
  color: var(--color-accent-cyan, #4ec9d0);
  font-weight: 500;
}
.codex-label--gold  { color: var(--color-accent-gold, #e6c068); }
.codex-label--muted { color: var(--color-text-muted, #9aa3b8); opacity: 0.85; }
.codex-label--neon {
  color: var(--color-neon-cyan, #7df9ff);
  text-shadow: 0 0 8px rgba(125, 249, 255, 0.5);
}
/* 大號版（給標題級的 label） */
.codex-label--lg { font-size: 1rem; }
.codex-label--xl { font-size: 1.4rem; letter-spacing: var(--tracking-wide, 0.16em); }
