/* ==========================================================================
   BBQ Design Tokens & Shared Shell (3-Language EN / zh-CN / zh-TW)
   Aesthetic: Swiss Editorial / Cryptography Research Minimalism
   Shared across /, /architecture, /roadmap, /testnet, and /whitepaper
   ========================================================================== */

@view-transition {
  navigation: auto;
}

::view-transition-old(bbq-header),
::view-transition-new(bbq-header) {
  animation: none;
}

::view-transition-old(root) {
  animation: bbq-vt-out 150ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

::view-transition-new(root) {
  animation: bbq-vt-in 190ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes bbq-vt-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes bbq-vt-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes bbq-main-settle {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bbq-menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

:root {
  color-scheme: dark;

  /* Palette */
  --bg: #09090b;
  --surface: #101114;
  --surface-raised: #16171c;
  --recessed: #060608;

  --ink: #f4f4f5;
  --ink-secondary: #a1a1aa;
  --ink-muted: #7e7e88;
  --ink-faint: #63636b;
  --ink-on-gold: #09090b;

  /* 1px Architectural Hairlines */
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --line-gold: rgba(212, 168, 83, 0.48);

  /* Single Signature Accent & Semantic States */
  --gold: #d4a853;
  --gold-hover: #e2bc6f;
  --gold-dim: rgba(212, 168, 83, 0.08);

  --ok: #34d399;
  --ok-dim: rgba(52, 211, 153, 0.09);
  --ok-line: rgba(52, 211, 153, 0.34);

  --err: #f87171;
  --err-dim: rgba(248, 113, 113, 0.09);
  --err-line: rgba(248, 113, 113, 0.36);

  /* Typography (Strict 2-family ceiling with clean CJK fallbacks) */
  --font-sans: 'Inter', 'Noto Sans SC', 'Noto Sans TC', 'PingFang SC', 'PingFang TC', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Strict 3-size body scale + 1 dense mono step (Hero H1 & wordmark exempt) */
  --text-h2: clamp(1.375rem, 2vw, 1.75rem);
  --text-body: 0.9375rem;   /* 15px */
  --text-sm: 0.8125rem;     /* 13px */
  --text-mono: 0.78125rem;  /* 12.5px */

  /* Layout Rhythm */
  --max-w: 1180px;
  --nav-h: 64px;
  --radius: 2px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  line-break: strict;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  overflow-y: scroll;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) var(--bg);
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  overflow-x: clip;
  max-width: 100vw;
  transition: opacity 80ms ease-out;
}

html.i18n-loading body {
  opacity: 0;
}

h1,
h2,
h3,
h4 {
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

/* Unified Dark Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.26);
}

/* Unified Focus Rings & Native Control Resets */
:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 2px;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font-family: inherit;
  color: inherit;
  border-radius: var(--radius);
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

summary {
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

.mono {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  font-variant-numeric: tabular-nums;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.bbq-container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 32px;
}

/* ==========================================================================
   Shared Minimal Top Navigation (.bbq-header)
   ========================================================================== */

.bbq-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-h);
  view-transition-name: bbq-header;
  background-color: rgba(9, 9, 11, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  transition: background-color 180ms var(--ease), border-color 180ms var(--ease);
}

.bbq-header-inner {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
}

.bbq-brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink);
  white-space: nowrap;
}

.bbq-header-inner > nav {
  justify-self: center;
}

.bbq-brand-glyph {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.bbq-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.bbq-nav a {
  position: relative;
  display: inline-block;
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--ink-secondary);
  white-space: nowrap;
  padding: 4px 0;
  transition: color 160ms var(--ease);
}

.bbq-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background-color: var(--gold);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 180ms var(--ease);
}

.bbq-nav a:hover,
.bbq-nav a:focus-visible,
.bbq-nav a[aria-current="page"] {
  color: var(--ink);
}

.bbq-nav a:hover::after,
.bbq-nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

.bbq-header-right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ==========================================================================
   Custom Swiss Minimalist Dropdown (.bbq-select) — Zero Native <select>
   ========================================================================== */

.bbq-select {
  position: relative;
  width: 100%;
}

.bbq-select.bbq-select-compact {
  width: auto;
}

.bbq-select-trigger {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background-color: var(--recessed);
  color: var(--ink);
  font-size: var(--text-sm);
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms var(--ease), background-color 150ms var(--ease), color 150ms var(--ease);
}

.bbq-select.mono .bbq-select-trigger {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
}

.bbq-select-compact .bbq-select-trigger {
  height: 30px;
  min-width: 94px;
  padding: 0 9px;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border-color: var(--line);
  background-color: var(--surface);
  color: var(--ink-secondary);
  gap: 7px;
}

.bbq-select-trigger:hover {
  border-color: var(--line-strong);
  background-color: var(--surface);
  color: var(--ink);
}

.bbq-select.is-open .bbq-select-trigger {
  border-color: var(--gold);
  background-color: var(--surface);
  color: var(--ink);
}

.bbq-select-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bbq-select-chevron {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  color: var(--ink-muted);
  transition: transform 160ms var(--ease), color 160ms var(--ease);
}

.bbq-select.is-open .bbq-select-chevron {
  transform: rotate(180deg);
  color: var(--gold);
}

.bbq-select-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  z-index: 220;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background-color: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
  animation: bbq-menu-in 140ms var(--ease) both;
}

.bbq-select-menu.align-right {
  left: auto;
  right: 0;
  min-width: 124px;
}

.bbq-select-menu[hidden] {
  display: none;
}

.bbq-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 120ms var(--ease), color 120ms var(--ease);
}

.bbq-select.mono .bbq-select-option {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
}

.bbq-select-compact .bbq-select-option {
  padding: 7px 11px;
  font-size: var(--text-mono);
}

.bbq-select-option:hover,
.bbq-select-option.is-focused {
  background-color: var(--surface-raised);
  color: var(--ink);
}

.bbq-select-option[aria-selected="true"] {
  color: var(--gold);
  background-color: var(--surface-raised);
}

.bbq-select-option[aria-selected="true"]::after {
  content: '';
  width: 5px;
  height: 5px;
  background-color: var(--gold);
  flex-shrink: 0;
}

/* ==========================================================================
   Shared Minimal Footer (.bbq-footer)
   ========================================================================== */

.bbq-footer {
  border-top: 1px solid var(--line);
  padding: 36px 0 44px;
  background-color: var(--bg);
}

.bbq-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.bbq-footer-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.bbq-footer-meta {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  color: var(--ink-muted);
}

.bbq-footer-links {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.bbq-footer-links a {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  transition: color 150ms var(--ease);
}

.bbq-footer-links a:hover {
  color: var(--gold);
}

/* ==========================================================================
   Responsive Shared Shell
   ========================================================================== */

@media (max-width: 820px) {
  .bbq-container {
    padding: 0 20px;
  }
  .bbq-nav {
    gap: 16px;
  }
}

@media (max-width: 540px) {
  .bbq-header-inner {
    grid-template-columns: auto 1fr auto;
    gap: 8px;
  }
  .bbq-nav {
    gap: 10px;
  }
  .bbq-nav a {
    font-size: 0.75rem;
  }
  .bbq-brand span {
    font-size: 0.92rem;
  }
  .bbq-select-compact .bbq-select-trigger {
    min-width: 68px;
    padding: 0 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
