/* BAORUH Web — Design System */
/* Tokens, base styles, components shared across all pages */

/* Utility: opt-out of inherited uppercase, e.g. mixed-case names inside eyebrow labels */
.nocaps { text-transform: none !important; letter-spacing: 0.04em; }

:root {
  /* Color — Ink & Paper (warm cool neutrals) */
  --ink: oklch(0.18 0.02 250);
  --ink-2: oklch(0.26 0.02 250);
  --ink-3: oklch(0.38 0.02 250);
  --paper: oklch(0.985 0.003 90);
  --paper-2: oklch(0.97 0.004 90);

  /* Steel — cool grays */
  --steel-50:  oklch(0.97 0.005 250);
  --steel-100: oklch(0.94 0.008 250);
  --steel-200: oklch(0.88 0.01 250);
  --steel-300: oklch(0.78 0.012 250);
  --steel-400: oklch(0.62 0.015 250);
  --steel-500: oklch(0.5 0.018 250);
  --steel-600: oklch(0.4 0.018 250);
  --steel-700: oklch(0.3 0.018 250);
  --steel-800: oklch(0.22 0.018 250);
  --steel-900: oklch(0.14 0.02 250);

  /* Brand — BAORUH 官方 CI：C85 M35 Y20 K0 + 鵝黃 + 訊號綠 */
  --brand: #1B6E96;
  --brand-deep: #16749A;
  --brand-soft: #E2EFF5;
  --accent: oklch(0.82 0.16 90);   /* BR-85V 鵝黃 */
  --accent-soft: oklch(0.95 0.06 90);
  --signal: oklch(0.65 0.18 145);  /* 訊號綠 — 合規/連線 */
  --signal-soft: oklch(0.94 0.05 145);
  --warn: oklch(0.7 0.18 50);
  --danger: oklch(0.6 0.22 25);

  /* Type stack — overridable by Tweaks */
  --font-zh: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  --font-en: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;

  /* Spatial */
  --gap: 24px;
  --radius: 4px;
  --radius-lg: 8px;
  --container: 1280px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04), 0 0 0 1px rgba(15,23,42,0.04);
  --shadow-md: 0 4px 14px -4px rgba(15,23,42,0.08), 0 0 0 1px rgba(15,23,42,0.05);
  --shadow-lg: 0 24px 48px -12px rgba(15,23,42,0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-en), var(--font-zh);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  font-feature-settings: "ss01", "cv11";
  overflow-x: clip;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ---------- Layout ---------- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 32px;
}
@media (max-width: 768px) {
  .container { padding: 0 20px; }
}

.section { padding: 96px 0; }
.section-tight { padding: 64px 0; }
.section-dark {
  background: var(--ink);
  color: var(--paper);
}
.section-steel { background: var(--steel-50); }

/* ---------- Type ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--brand);
}

.h-display {
  font-size: clamp(40px, 5.6vw, 76px);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.h1 {
  font-size: clamp(34px, 4vw, 52px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.018em;
  text-wrap: balance;
  margin: 0;
}
.h2 {
  font-size: clamp(26px, 2.4vw, 36px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.012em;
  margin: 0;
}
.h3 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
}
.lead {
  font-size: clamp(17px, 1.4vw, 20px);
  line-height: 1.55;
  color: var(--ink-2);
  text-wrap: pretty;
  max-width: 62ch;
}
.body { color: var(--ink-2); text-wrap: pretty; }
.muted { color: var(--steel-500); }
.mono { font-family: var(--font-mono); font-size: 0.92em; letter-spacing: 0.02em; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 2px;
  font-weight: 500;
  font-size: 15px;
  transition: transform .12s, background .15s, border-color .15s, color .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover { background: var(--brand-deep); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--steel-300);
}
.btn-ghost:hover { border-color: var(--ink); }
.btn-on-dark {
  background: var(--paper);
  color: var(--ink);
}
.btn-on-dark-ghost {
  background: transparent;
  color: var(--paper);
  border-color: rgba(255,255,255,0.25);
}
.btn-on-dark-ghost:hover { border-color: var(--paper); }
.btn .arrow { transition: transform .15s; }
.btn:hover .arrow { transform: translateX(3px); }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--steel-100);
}
.site-header-inner {
  display: flex;
  align-items: center;
  gap: 40px;
  height: 68px;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 32px;
}
.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.brand-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.brand-wordmark {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  font-weight: 400;
  letter-spacing: 0;
  font-size: 40px;
  line-height: 1.05; /* slight breathing above + below caps */
  padding: 0 4px;
  border-radius: 0;
}
.footer-brand .brand-wordmark {
  font-size: 48px;
  padding: 0 5px;
}
.nav-list {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav { display: contents; }
.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.nav-list a {
  display: inline-block;
  padding: 8px 14px;
  font-size: 14.5px;
  color: var(--ink-2);
  border-radius: 2px;
  transition: color .15s, background .15s;
}
.nav-list a:hover { color: var(--ink); background: var(--steel-50); }
.nav-list a.active { color: var(--ink); font-weight: 600; }
.nav-list a.active::after {
  content: "";
  display: block;
  height: 2px;
  background: var(--brand);
  margin-top: 6px;
  margin-left: 14px;
  margin-right: 14px;
}

/* Mobile menu toggle */
.nav-toggle {
  display: none;
  background: transparent;
  border: 0;
  width: 40px;
  height: 40px;
  padding: 8px;
  margin-left: auto;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-between;
}
.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--ink);
  transition: transform .2s, opacity .2s;
}
.site-header.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-header.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.site-header.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 900px) {
  .site-header-inner { gap: 16px; padding: 0 20px; height: 60px; }
  .nav-toggle { display: flex; }
  .site-nav {
    display: block;            /* override base `display: contents` so the box actually exists on mobile */
    position: absolute;
    top: 60px;
    left: 0; right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--steel-100);
    box-shadow: 0 12px 24px rgba(0,0,0,0.06);
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s ease;
    z-index: 60;               /* above the page below */
  }
  .site-header.nav-open .site-nav { max-height: calc(100vh - 60px); }
  .nav-list {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 20px;
    gap: 0;
  }
  .nav-list a {
    padding: 14px 12px;
    font-size: 15px;
    border-bottom: 1px solid var(--steel-100);
  }
  .nav-list a.active::after { display: none; }
  .header-tools .btn { display: none; }
  .header-tools { gap: 6px; }
  .lang-switch button { padding: 6px 8px; font-size: 12px; }
}
.lang-switch {
  display: flex;
  border: 1px solid var(--steel-200);
  border-radius: 2px;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
}
.lang-switch button {
  background: transparent;
  border: 0;
  padding: 6px 10px;
  color: var(--ink-3);
}
.lang-switch button.on { background: var(--ink); color: var(--paper); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink);
  color: var(--steel-200);
  padding: 80px 0 40px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 56px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.footer-grid h4 {
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--steel-400);
  margin: 0 0 16px;
}
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-grid a { color: var(--steel-200); font-size: 14px; }
.footer-grid a:hover { color: var(--paper); }
.footer-meta {
  padding-top: 28px;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--steel-500);
  letter-spacing: 0.04em;
}
@media (max-width: 768px) {
  .site-footer { padding: 56px 0 32px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; padding-bottom: 40px; }
  .footer-grid li, .footer-grid a, .footer-brand p { word-break: break-word; overflow-wrap: anywhere; }
  .footer-meta { flex-direction: column; gap: 8px; align-items: flex-start; }
}
@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .footer-brand p { max-width: none; }
  .footer-brand .brand-wordmark { font-size: 36px; padding: 0 4px; }
}

.footer-brand p { color: var(--steel-300); font-size: 14px; line-height: 1.6; max-width: 36ch; margin: 12px 0 0;}

/* ---------- Cards ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--steel-100);
  border-radius: 4px;
  padding: 24px;
  transition: border-color .15s, transform .15s;
}
.card:hover {
  border-color: var(--steel-300);
}

/* ---------- Image placeholders ---------- */
.imgph {
  position: relative;
  background:
    repeating-linear-gradient(135deg,
      var(--steel-50) 0 12px,
      var(--steel-100) 12px 24px);
  border: 1px solid var(--steel-200);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--steel-500);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  overflow: hidden;
}
.imgph[data-tone="dark"] {
  background:
    repeating-linear-gradient(135deg,
      var(--steel-800) 0 12px,
      var(--steel-900) 12px 24px);
  border-color: var(--steel-700);
  color: var(--steel-400);
}
.imgph[data-tone="brand"] {
  background:
    repeating-linear-gradient(135deg,
      var(--brand-soft) 0 12px,
      color-mix(in oklab, var(--brand-soft) 70%, var(--brand) 30%) 12px 24px);
  border-color: color-mix(in oklab, var(--brand) 30%, var(--brand-soft));
  color: var(--brand-deep);
}
.imgph[data-tone="accent"] {
  background:
    repeating-linear-gradient(135deg,
      var(--accent-soft) 0 12px,
      color-mix(in oklab, var(--accent-soft) 70%, var(--accent) 30%) 12px 24px);
  border-color: color-mix(in oklab, var(--accent) 40%, var(--accent-soft));
  color: oklch(0.4 0.12 80);
}
.imgph .ph-label {
  background: rgba(255,255,255,0.85);
  padding: 4px 8px;
  border: 1px solid currentColor;
  border-radius: 1px;
}
.imgph[data-tone="dark"] .ph-label { background: rgba(0,0,0,0.6); }

/* ---------- Pill / Badge ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid currentColor;
}
.pill-new { color: var(--brand); }
.pill-signal { color: var(--signal); }
.pill-accent { color: oklch(0.5 0.14 80); }
.pill-dot::before {
  content: "";
  width: 6px; height: 6px;
  background: currentColor;
  border-radius: 50%;
}

/* ---------- Hairline divider ---------- */
.hairline { height: 1px; background: var(--steel-200); }
.hairline-dark { height: 1px; background: rgba(255,255,255,0.1); }

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal.in { opacity: 1; transform: none; }
@media print { .reveal { opacity: 1 !important; transform: none !important; } }

/* ---------- Tweaks panel position fix ---------- */
/* ---------- Image carousel ---------- */
.img-carousel {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  background: var(--steel-100);
}
.carousel-track {
  display: grid;
  grid-template-columns: 1fr;
}
.carousel-slide {
  grid-row: 1;
  grid-column: 1;
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
}
.carousel-slide.active { opacity: 1; pointer-events: auto; }
.carousel-slide img {
  width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
}
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: 0;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .15s;
}
.carousel-btn:hover { background: rgba(0,0,0,0.78); }
.carousel-btn.prev { left: 12px; }
.carousel-btn.next { right: 12px; }
.carousel-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(0,0,0,0.4);
  border-radius: 999px;
}
.carousel-dots .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: background .15s;
}
.carousel-dots .dot.active { background: #fff; }

/* ---------- Language-switched content ---------- */
/* Default (zh-Hant): show .lang-zh-only, hide .lang-en-only */
.lang-en-only { display: none !important; }
html[lang="en"] .lang-zh-only { display: none !important; }
html[lang="en"] .lang-en-only { display: revert !important; }

/* ---------- Image lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(8,12,18,0.92);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px;
  cursor: zoom-out;
  animation: lb-fade 0.18s ease;
}
.lightbox.on { display: flex; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lightbox .lb-close {
  position: absolute;
  top: 20px; right: 24px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 22px;
  display: grid;
  place-items: center;
  border: 0;
}
.lightbox .lb-close:hover { background: rgba(255,255,255,0.2); }
img.zoomable { cursor: zoom-in; }
@keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }
