:root {
  --bg: #ffffff;
  --fg: #0f172a;
  --muted: #5b6476;
  --accent: #3b82f6;
  --card: #f6f7fb;
  --border: #e5e7eb;
  --shadow: 0 10px 20px rgba(2, 6, 23, 0.07);
}

:root[data-theme="dark"] {
  --bg: #0b1220;
  --fg: #e5e7eb;
  --muted: #9aa3b2;
  --accent: #60a5fa;
  --card: #121a2a;
  --border: #1f2937;
  --shadow: 0 10px 20px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font: 16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", "SF Pro", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
}

img { max-width: 100%; display: block; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.section { padding: 64px 0; }
.section.alt { background: var(--card); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: 40px; }
h2 { font-size: 28px; margin-bottom: 20px; }
h3 { font-size: 20px; }

.lead { font-size: 18px; margin: 8px 0 8px; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }

.btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.btn, .btn-outline, .btn-ghost {
  display: inline-block; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--accent);
  text-decoration: none; color: #fff; background: var(--accent); box-shadow: var(--shadow);
}
.btn-outline { color: var(--accent); background: transparent; }
.btn-gold {
  color: #d4af37; background: #1a1a1a; border-color: #d4af37;
  font-weight: 600; letter-spacing: 0.5px;
  box-shadow: 0 2px 12px rgba(212,175,55,0.25);
}
.btn-gold:hover {
  background: #111; color: #e6c44d;
  box-shadow: 0 4px 18px rgba(212,175,55,0.4);
}
.btn-ghost { color: var(--fg); background: transparent; border-color: var(--border); box-shadow: none; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 100; background: var(--bg);
  border-bottom: 1px solid var(--border); backdrop-filter: saturate(180%) blur(8px);
}
.header-inner { display: flex; align-items: center; gap: 20px; padding: 12px 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); }
.brand-avatar { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); }
.brand-text small { display: block; color: var(--muted); font-size: 12px; }

.nav-toggle { display: none; background: transparent; border: 0; padding: 8px; border-radius: 10px; }
.nav-toggle .bar { display:block; width: 22px; height: 2px; background: var(--fg); margin:5px 0; }

.site-nav ul { list-style: none; display: flex; gap: 14px; margin: 0; padding: 0; }
.site-nav a, .site-nav button { text-decoration: none; color: var(--fg); background: none; border: 0; padding: 8px 10px; border-radius: 10px; }
.site-nav a:hover { background: var(--card); }

/* Layout helpers */
.grid-2 { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 24px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

.card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

.card, .hero-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: var(--shadow);
}
.card-header { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.card-footer { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.meta { list-style: none; padding: 0; margin: 0; }
.meta li { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.meta li:last-child { border-bottom: 0; }
.meta span { width: 72px; color: var(--muted); }

.tags { display: flex; gap: 8px; flex-wrap: wrap; list-style: none; padding: 0; margin: 8px 0 0; }
.tags li, .chip {
  background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; padding: 4px 10px; border-radius: 999px; font-size: 13px;
}

.chip { text-decoration: none; display: inline-block; }

.bullets { margin: 8px 0 0; padding-left: 18px; }
.bullets li { margin: 6px 0; }

/* Two-column layout for research cards: left = image + meta, right = bullets */
.card-two-col { display: grid; grid-template-columns: 50% 50%; gap: 16px; align-items: start; }
.card-two-col .card-left { display: flex; flex-direction: column; gap: 8px; }
.card-two-col .card-right { display: block; }
.card-two-col img { width: 100%; height: auto; border-radius: 8px; }

/* Collapse/expand behavior for Research section */
#research .cards { max-height: 9999px; transition: max-height 300ms ease, opacity 200ms ease; opacity: 1; overflow: hidden; }
#research.collapsed .cards { max-height: 0; opacity: 0; pointer-events: none; }
#research:not(.collapsed) .cards { max-height: 9999px; }
#research h2 { cursor: pointer; }
#research h2[aria-expanded="true"]::after { content: " ▲"; font-size: 14px; color: var(--muted); margin-left: 8px; }
#research h2[aria-expanded="false"]::after { content: " ▼"; font-size: 14px; color: var(--muted); margin-left: 8px; }
#research h2:focus { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
#research h2 .note { font-size: 14px; color: var(--muted); font-weight: 400; margin-left: 8px; vertical-align: middle; }

/* Timeline */
.timeline { position: relative; margin: 10px 0; }
.timeline:before { content:""; position:absolute; left: 12px; top:0; bottom:0; width:2px; background: var(--border); }
.tl-item { position: relative; padding-left: 36px; margin: 22px 0; }
.tl-dot { position:absolute; left:5px; top:6px; width:16px; height:16px; background: var(--accent); border-radius:50%; box-shadow: var(--shadow); }
.tl-header { display:flex; justify-content:space-between; align-items:baseline; gap:12px; }
.time { color: var(--muted); white-space: nowrap; }

/* Forms */
label { display: block; font-weight: 600; margin: 8px 0; }
input, textarea {
  width: 100%; margin-top: 6px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--border); background: transparent; color: var(--fg);
}
.contact-form .grid-2 { grid-template-columns: repeat(2, 1fr); gap: 12px; }

/* Footer */
.site-footer { padding: 24px 0; border-top: 1px solid var(--border); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; }
.back-to-top { text-decoration: none; display:inline-flex; width:36px; height:36px; justify-content:center; align-items:center;
  border:1px solid var(--border); border-radius:10px; }

/* Hero */
.hero .lead { margin-bottom: 4px; }
.hero-card { align-self: stretch; display: flex; flex-direction: column; gap: 16px; }

/* Visitor Map */
.visitor-map {
  margin-top: auto;
  padding: 16px;
  background: linear-gradient(135deg, var(--bg) 0%, var(--card) 100%);
  border: 2px solid var(--border);
  border-radius: 12px;
  text-align: center;
}
.visitor-map-title {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.5px;
}
.visitor-map img {
  width: 85%;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.visitor-map img:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

/* Accessibility */
.skip-link {
  position: absolute; left: -999px; top: auto; width: 1px; height: 1px; overflow: hidden;
}
.skip-link:focus { position: static; width: auto; height: auto; padding: 8px; background: var(--accent); color: #fff; }

/* Responsive */
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3, .card-grid { grid-template-columns: 1fr; }
  .card-two-col { grid-template-columns: 1fr; }
  .site-nav { display: none; position: absolute; right: 10px; top: 56px; background: var(--bg);
    border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
  .site-nav.open { display: block; }
  .site-nav ul { display: grid; gap: 0; }
  .site-nav li { border-bottom: 1px solid var(--border); }
  .site-nav li:last-child { border-bottom: 0; }
  .nav-toggle { display: inline-block; }
}

/* Floating back-to-top button */
.floating-top {
  position: fixed;
  right: 20px;
  bottom: 24px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  box-shadow: var(--shadow);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
}
.floating-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }

/* Language switch transition animation */
[data-i18n] {
  transition: opacity 0.35s ease, filter 0.35s ease, transform 0.35s ease;
}
[data-i18n].i18n-out {
  opacity: 0;
  filter: blur(4px);
  transform: translateY(4px);
}
[data-i18n].i18n-in {
  animation: i18n-fade-in 0.4s ease forwards;
}
@keyframes i18n-fade-in {
  0% { opacity: 0; filter: blur(4px); transform: translateY(-4px); }
  100% { opacity: 1; filter: blur(0); transform: translateY(0); }
}

/* Lang button style */
#langBtn {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.5px;
}

/* Business Card Modal */
.card-modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.card-modal-overlay.active { opacity: 1; visibility: visible; }
.card-modal-overlay.active .card-modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}
.card-modal {
  position: relative;
  background: var(--bg); border: 1px solid var(--border); border-radius: 20px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.2);
  max-width: 660px; width: 90%; padding: 0;
  transform: scale(0.9) translateY(20px); opacity: 0;
  transition: transform 0.35s cubic-bezier(.34,1.56,.64,1), opacity 0.3s ease;
}
.card-modal-close {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none; font-size: 28px; color: var(--muted);
  cursor: pointer; line-height: 1; z-index: 1;
  transition: color 0.2s;
}
.card-modal-close:hover { color: var(--fg); }

/* Business Card Layout */
.biz-card {
  display: flex;
  width: 100%; aspect-ratio: 1.65 / 1;
  overflow: hidden; border-radius: 16px;
  background: var(--bg);
  border: 2px solid var(--border);
  position: relative;
}
/* Corner line decorations */
.biz-card::before,
.biz-card::after {
  content: ''; position: absolute; pointer-events: none;
}
.biz-card::before {
  top: 10px; left: 10px;
  width: 36px; height: 36px;
  border-top: 2px solid var(--accent); border-left: 2px solid var(--accent);
}
.biz-card::after {
  bottom: 10px; right: 10px;
  width: 36px; height: 36px;
  border-bottom: 2px solid var(--accent); border-right: 2px solid var(--accent);
}
.biz-card-name ruby { ruby-position: over; }
.biz-card-name rt { font-size: 14px; font-weight: 400; color: var(--muted); letter-spacing: 1px; }

.biz-card-left {
  flex: 1; display: flex; flex-direction: column; justify-content: space-between;
  padding: 32px 40px;
}
.biz-card-name {
  font-size: 38px; margin: 0 0 4px; font-weight: 700;
  letter-spacing: 1px; color: var(--fg);
}
.biz-card-name-sub {
  font-size: 22px; color: var(--muted); margin: 0;
  letter-spacing: 2px;
}
.biz-card-divider {
  width: 44px; height: 2px; background: var(--accent);
}
.biz-card-title {
  font-size: 19px; color: var(--fg); margin: 0 0 4px; font-weight: 500;
}
.biz-card-org {
  font-size: 16px; color: var(--muted); margin: 0;
}
.biz-card-contact {
  display: flex; gap: 24px; flex-wrap: wrap;
  font-size: 16px; color: var(--fg);
}
.biz-card-contact span {
  display: inline-flex; align-items: center; gap: 6px;
}
.biz-icon {
  font-size: 14px; flex-shrink: 0;
}

.biz-card-right {
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 24px 32px;
  border-left: 2px solid var(--accent);
  box-shadow: -6px 0 0 0 var(--bg), -8px 0 0 0 var(--accent);
  gap: 16px;
}
.biz-card-logos {
  display: flex; flex-direction: column; gap: 18px; align-items: center;
}
.biz-card-logos img {
  height: 56px; width: auto;
}
.biz-card-qr {
  text-align: center;
}
.biz-card-qr img {
  width: 96px; height: 96px; border-radius: 6px;
  border: 1px solid var(--border);
}
.biz-card-qr-label {
  font-size: 13px; color: var(--muted); margin: 5px 0 0;
}

@media (max-width: 900px) {
  .biz-card { flex-direction: column; aspect-ratio: auto; }
  .biz-card-left { padding: 20px; gap: 12px; }
  .biz-card-right { border-left: none; border-top: 3px double var(--accent); padding: 16px; }
  .biz-card-contact { justify-content: center; }
  .biz-card-name-block { text-align: center; }
  .biz-card-divider { margin: 0 auto; }
  .biz-card-detail { text-align: center; }
}
