/* OTCDO shared base: "Clear Ledger" design tokens and the site header (market pages and articles). */
:root {
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --f-display: 'Space Grotesk', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --f-sans: 'IBM Plex Sans', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --pad: clamp(16px, 4vw, 48px);
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
}
/* Light is the default: a paper-white ledger, ink text, one green accent. */
html[data-theme="light"] {
  --bg: #F5F6F3;
  --bg-2: #EEF0EC;
  --surface: #FFFFFF;
  --surface-2: #F0F2EE;
  --line: #E3E6E1;
  --line-2: #D5DAD3;
  --ink: #101614;
  --ink-2: #3F4B46;
  --ink-3: #5B6661;
  --accent: #0B7A5C;
  --accent-ink: #0B7A5C;
  --accent-soft: #E3F2EC;
  --accent-line: rgba(11, 122, 92, .35);
  --up: #0B7A5C;
  --up-soft: #E3F2EC;
  --down: #1F5FBF;
  --down-soft: #E3ECFA;
  --warn: #A84A07;
  --warn-soft: #FBEBDD;
  --on-accent: #FFFFFF;
  --shadow: 0 1px 2px rgba(16, 22, 20, .04), 0 12px 32px rgba(16, 22, 20, .07);
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #0E1311;
  --bg-2: #131A17;
  --surface: #161E1B;
  --surface-2: #1D2622;
  --line: #24302B;
  --line-2: #32403A;
  --ink: #EEF2F0;
  --ink-2: #C3CCC8;
  --ink-3: #95A29C;
  --accent: #3FC796;
  --accent-ink: #5FD6AA;
  --accent-soft: rgba(63, 199, 150, .12);
  --accent-line: rgba(63, 199, 150, .38);
  --up: #3FC796;
  --up-soft: rgba(63, 199, 150, .12);
  --down: #7AAEFF;
  --down-soft: rgba(122, 174, 255, .12);
  --warn: #FFB547;
  --warn-soft: rgba(255, 181, 71, .12);
  --on-accent: #0E1311;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 40px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
/* Currency code badge — replaces emoji flags (render inconsistently across OS / regions) */
.cc {
  display: inline-grid; place-items: center; flex: none;
  width: 22px; height: 18px; vertical-align: middle; border-radius: 5px;
  background: var(--surface-2); color: var(--ink-2);
  font-family: var(--f-mono); font-size: 8.5px; font-weight: 600; letter-spacing: .02em; line-height: 1;
  transition: background-color .3s, color .3s;
}
/* ---------- Header ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
          backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav-in { display: flex; align-items: center; justify-content: space-between; gap: 20px; height: 68px; }
.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo svg { width: 32px; height: 32px; flex: none; }
.logo-word { font-family: var(--f-display); font-size: 21px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.logo-word i { font-style: normal; color: var(--accent); }
.logo svg { transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.logo:hover svg { transform: translateY(-2px) rotate(-4deg); }
@media (prefers-reduced-motion: reduce) { .logo svg { transition: none; } .logo:hover svg { transform: none; } }
.logo-meta { font-size: 11px; color: var(--ink-3); margin-top: 4px; }

.nav-act { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  height: 40px; min-width: 40px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  transition: border-color .2s, color .2s, background-color .2s;
}
.icon-btn:hover { border-color: var(--line-2); color: var(--ink); background: var(--surface-2); }
.icon-btn svg { width: 16px; height: 16px; }

/* Language dropdown */
.lang { position: relative; }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 6px; box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(-6px); transform-origin: top right;
  transition: opacity .2s var(--ease-out), transform .3s var(--ease-out), visibility .2s;
}
.lang.open .lang-menu { opacity: 1; visibility: visible; transform: none; }
.lang .chev { transition: transform .3s var(--ease-out); }
.lang.open .chev { transform: rotate(180deg); }
.lang-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 8px; transition: background-color .2s; }
.lang-opt:hover { background: var(--surface-2); }
.lang-opt strong { display: block; font-size: 13.5px; font-weight: 600; }
.lang-opt small { display: block; font-size: 11px; color: var(--ink-3); font-family: var(--f-mono); }
.lang-opt .tick { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; }
.lang-opt.on { background: var(--accent-soft); }
.nav a { color: inherit; text-decoration: none; }
.nav button { font: inherit; color: inherit; cursor: pointer; }
@media (max-width: 720px) { .nav-in { height: 60px; } .logo-meta { display: none; } .icon-btn .lbl { display: none; } }
.logo > span { display: flex; flex-direction: column; }
@media (max-width: 1180px) { .logo-meta { display: none; } }
/* Receipt colours: shared by the currency page's quote and the articles' closing card */
html[data-theme="light"] { --rc-bg: #101614; --rc-ink: #F2F5F3; --rc-dim: #A3B2AB; --rc-line: rgba(255, 255, 255, .14); --rc-acc: #5FD6AA; }
html[data-theme="dark"]  { --rc-bg: #F2F5F3; --rc-ink: #101614; --rc-dim: #4F5B56; --rc-line: rgba(16, 22, 20, .14); --rc-acc: #0B7A5C; }

/* ---------- Header: section links, currency menu, quiet controls (shared by every page) ---------- */
:root { --e-out: cubic-bezier(.22, 1, .36, 1); }
/* Header: section links + currency menu */
.nav-in { gap: 24px; }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a, .nav-links-m a { padding: 8px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.nav-links a:hover, .nav-links-m a:hover { background: var(--surface-2); color: var(--ink); }
.nav-links-m { display: none; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 8px; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] .chev { transform: rotate(180deg); }
.menu-list { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: 300px; max-height: 70vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 6px; box-shadow: var(--shadow); }
.menu-opt { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 8px; font-size: 13.5px; }
.menu-opt:hover { background: var(--surface-2); }
.menu-opt.on { background: var(--accent-soft); }
.mo-n { font-weight: 600; }
.mo-p { color: var(--ink-3); font-size: 12px; }
@media (max-width: 960px) { .nav-links { display: none; } .nav-links-m { display: flex; } }

/* Header: quieter controls, one clear current section */
.nav { background: color-mix(in oklab, var(--bg) 82%, transparent); }
.nav .icon-btn { border-color: transparent; background: transparent; }
.nav .icon-btn:hover, .menu[open] > summary { background: var(--surface-2); border-color: transparent; }
.nav-links a { position: relative; color: var(--ink-3); transition: color .2s; }
.nav-links a:hover { background: transparent; color: var(--ink); }
.nav-links a[aria-current="page"] { color: var(--ink); }
.nav-links a[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -15px; height: 2px; background: var(--accent); border-radius: 2px; }
.nav-links-m a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.menu-list { transform-origin: top right; animation: pop .22s var(--e-out); }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }

@media (max-width: 520px) {
  .nav-in { gap: 10px; }
  .nav-act { gap: 6px; }
  .nav-links a[aria-current="page"]::after { display: none; }
}
/* nav tabs never wrap: the mobile row scrolls sideways instead */
.nav-links a, .nav-links-m a { white-space: nowrap; flex: none; }
.nav-links-m::-webkit-scrollbar { display: none; }

/* ---------- Mobile menu: a burger that opens a sheet under the header ---------- */
.nav-burger { display: none; }
.burger { position: relative; display: block; width: 18px; height: 12px; }
.burger i { position: absolute; left: 0; right: 0; height: 1.8px; border-radius: 2px; background: currentColor; transition: transform .35s var(--e-out), top .35s var(--e-out); }
.burger i:first-child { top: 2px; }
.burger i:last-child { top: 8.2px; }
.nav-sheet { display: none; }
@media (max-width: 960px) {
  .nav { position: sticky; }
  .nav-burger { display: inline-flex; }
  .nav.menu-open .burger i:first-child { top: 5.1px; transform: rotate(45deg); }
  .nav.menu-open .burger i:last-child { top: 5.1px; transform: rotate(-45deg); }
  .nav-sheet {
    display: grid; grid-template-rows: 0fr; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--bg); border-bottom: 1px solid transparent;
    box-shadow: 0 24px 40px -28px rgba(16, 22, 20, .45);
    visibility: hidden; transition: grid-template-rows .45s var(--e-out), visibility 0s linear .45s, border-color .3s;
  }
  .nav.menu-open .nav-sheet { grid-template-rows: 1fr; visibility: visible; border-bottom-color: var(--line); transition: grid-template-rows .45s var(--e-out), visibility 0s, border-color .3s; }
  .nav-sheet > nav { min-height: 0; width: 100%; }
  .nav-links-m { display: flex; flex-direction: column; gap: 0; overflow: hidden; padding-bottom: 0; }
  .nav-links-m a {
    display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center;
    padding: 18px 0; border-radius: 0; border-bottom: 1px solid var(--line);
    font: 600 22px/1.2 var(--f-display); letter-spacing: -.02em; color: var(--ink);
    opacity: 0; transform: translateY(-8px);
    transition: opacity .3s, transform .45s var(--e-out), color .2s;
  }
  .nav.menu-open .nav-links-m a { opacity: 1; transform: none; transition-delay: calc(.05s * var(--i) + .05s); }
  .nav-links-m a:last-child { border-bottom: 0; margin-bottom: 8px; }
  .nav-links-m a:hover, .nav-links-m a[aria-current="page"] { background: transparent; color: var(--accent-ink); }
  .ns-n { font: 500 11px/1 var(--f-mono); color: var(--ink-3); letter-spacing: .06em; }
  .nav-links-m svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .5; transition: transform .3s var(--e-out), opacity .2s; }
  .nav-links-m a:hover svg { transform: translateX(3px); opacity: 1; }
  .nav-links-m a[aria-current="page"] svg { opacity: 1; }
  .nav-links-m a[aria-current="page"] .ns-n { color: var(--accent-ink); }
}
@media (prefers-reduced-motion: reduce) {
  .nav-sheet, .nav-links-m a, .burger i { transition: none !important; }
}
@media (max-width: 520px) {
  .nav-act .icon-btn { min-width: 36px; padding: 0 8px; }
  .nav-act { gap: 2px; }
}
