/* ════════════════════════════════════════════════
   AstroE TrendBoard — Components
   ════════════════════════════════════════════════ */

/* ── Panels ── */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-2xl); }
.panel-title { font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }

/* ── Brand ── */
.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; color: var(--text); }
.brand:hover { opacity: 1; }

/* Mascot badge: fill #F4F4F8, 2px pink→navy ring. Image offsets are
   proportional to the inner circle, so any --size works. */
.badge {
  --size: 48px; --ring: 2px;
  position: relative; display: block; flex-shrink: 0;
  width: var(--size); height: var(--size); border-radius: 50%;
  border: var(--ring) solid transparent;
  background-image: linear-gradient(var(--badge-fill), var(--badge-fill)), linear-gradient(135deg, var(--ring-from), var(--ring-to));
  background-origin: border-box; background-clip: padding-box, border-box;
}
.badge::before { /* glow as its own layer */
  content: ""; position: absolute; inset: calc(var(--ring) * -1); border-radius: 50%;
  box-shadow: 0 0 22px var(--g1); pointer-events: none;
}
/* Light sweep around the ring (replaces the old brand-text shimmer). */
.badge.sweep::after {
  content: ""; position: absolute; inset: calc(var(--ring) * -1); border-radius: 50%; pointer-events: none;
  background: conic-gradient(from 0deg, transparent 0 72%, rgba(255, 255, 255, .9) 86%, transparent 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--ring) - .5px), #000 calc(100% - var(--ring)));
  mask: radial-gradient(farthest-side, transparent calc(100% - var(--ring) - .5px), #000 calc(100% - var(--ring)));
  animation: spin 7s linear infinite;
}
@media (prefers-reduced-motion: reduce) { .badge.sweep::after { animation: none; opacity: 0; } }
.badge-clip { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; }
.badge-clip img { position: absolute; left: -4.2%; top: -4.4%; width: 108.6%; max-width: none; }
.badge--sm { --size: 38px; }
.badge--md { --size: 42px; }

.brand-text { display: flex; flex-direction: column; gap: 7px; }
.brand-sub { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .32em; color: var(--accent-text); }
.badge--sm + .brand-text { gap: 5px; }
.badge--sm + .brand-text .brand-sub { font-size: 8.5px; letter-spacing: .3em; }

/* Theme-paired logo images cross-fade instead of popping. */
.theme-img { display: grid; }
.theme-img > img { grid-area: 1 / 1; transition: opacity 300ms var(--ease-in-out); }
.theme-img .on-light, .theme-light .theme-img .on-dark { opacity: 0; }
.theme-light .theme-img .on-light { opacity: 1; }

/* ── Sidebar nav with one sliding pill ── */
.divider { height: 1px; background: var(--line2); margin: 2px 0; }
.nav { position: relative; display: flex; flex-direction: column; gap: 4px; }
.nav-pill {
  position: absolute; left: 0; right: 0; top: 0; height: 46px; border-radius: var(--r-lg);
  background: var(--accent);
  transform: translateY(var(--y, 0px));
  transition: transform var(--base) var(--ease-out), opacity var(--fast);
  animation: fade-in var(--slow) var(--ease-out) both;
  animation-delay: calc(var(--slow) * .6 + var(--pill-i, 1) * var(--stagger));
}
.nav-pill::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 10px 28px var(--g1); }
.nav-pill.no-anim { transition: none; }
.nav-pill[hidden] { display: block; opacity: 0; }
.nav a {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 14px;
  height: 46px; padding: 0 16px; border-radius: var(--r-lg);
  font-size: 15px; color: var(--text);
  transition: color var(--fast), background-color var(--fast);
}
.nav a:hover { opacity: 1; }
.nav a:not([aria-current]):hover { background: var(--accent-soft); }
.nav a[aria-current] { color: var(--on-accent); font-weight: 600; }
.nav svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav .label { flex-grow: 1; }
.nav-badge {
  font-family: var(--font-mono); font-size: 10px; padding: 2px 7px; border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent-text); transition: background-color var(--fast), color var(--fast);
}
.nav a[aria-current] .nav-badge { background: rgba(0, 0, 0, .18); color: var(--on-accent); }   /* white on it: 6.3:1 */

/* ── Segmented control with a sliding highlight ── */
.seg {
  --seg-r: var(--r-pill);
  position: relative; display: inline-flex; gap: 2px; padding: 3px;
  border-radius: var(--seg-r); background: var(--input); border: 1px solid var(--line);
}
.seg-thumb {
  position: absolute; top: 3px; bottom: 3px; left: 0; width: var(--w, 0px);
  border-radius: calc(var(--seg-r) - 3px); background: var(--accent);
  transform: translateX(var(--x, 0px));
  transition: transform var(--base) var(--ease-out);
}
.seg-thumb.no-anim { transition: none; }
.seg button {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 28px; padding: 0 12px; border: 0; border-radius: calc(var(--seg-r) - 3px);
  background: transparent; color: var(--muted);
  font-size: 11px; white-space: nowrap;
  transition: color var(--fast);
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { color: var(--on-accent); }
.seg--mono button { font-family: var(--font-mono); }
.seg--block { --seg-r: var(--r-md); display: flex; gap: 4px; }
.seg--block button { flex: 1; height: 32px; font-size: 12px; }
.seg svg { width: 13px; height: 13px; }

.appearance { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: var(--r-xl); }

/* ── Buttons: 150ms lift + brighter glow, press = scale .97 ── */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border: 0; border-radius: var(--r-pill);
  background: var(--accent); color: var(--on-accent);
  font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: transform var(--fast) var(--ease-out);
}
.btn::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: 0 8px 24px var(--g1); opacity: .6; transition: opacity var(--fast) var(--ease-out);
}
.btn:hover { opacity: 1; }
.btn:active { transform: scale(.97); }
.btn svg { width: 14px; height: 14px; }
.btn--up { background: transparent; border: 1px solid var(--up); color: var(--up-text); }
.btn--up::after { box-shadow: 0 8px 24px var(--up-soft); opacity: 0; }
.btn--ghost { background: transparent; border: 1px solid var(--line2); color: var(--text); }
.btn--ghost::after { box-shadow: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 32px; height: 32px; padding: 0; border-radius: 9px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  transition: transform var(--fast) var(--ease-out), color var(--fast), border-color var(--fast);
}
.icon-btn:hover { color: var(--text); border-color: var(--line2); opacity: 1; }
.icon-btn:active { transform: scale(.97); }
.icon-btn svg { width: 14px; height: 14px; }

@media (hover: hover) {
  .btn:hover, .icon-btn:hover { transform: translateY(-1px); }
  .btn:hover::after { opacity: 1; }
  .btn:active, .icon-btn:active { transform: scale(.97); }
}

/* ── Search field ── */
.search {
  display: flex; align-items: center; gap: 10px;
  width: 280px; height: 40px; padding: 0 12px;
  border-radius: var(--r-md); border: 1px solid var(--line2); background: var(--input);
  transition: border-color var(--fast);
}
.search:focus-within { border-color: var(--accent); }
.search svg { width: 16px; height: 16px; flex-shrink: 0; stroke: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 14px; }
.search input::placeholder { color: var(--muted); opacity: 1; }
.search input::-webkit-search-cancel-button { display: none; }
.kbd { font-family: var(--font-mono); font-size: 11px; padding: 2px 7px; border-radius: 5px; border: 1px solid var(--line2); color: var(--muted); }

/* ── Status row + LIVE badge ── */
.status { display: flex; align-items: center; gap: 22px; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.status b { color: var(--text); font-weight: 400; }
.live-badge {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px;
  border-radius: var(--r-pill); border: 1px solid var(--line2);
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .08em; color: var(--up-text);
}

/* ── Ticker: two copies of the list, track slides -50%, pauses on hover ── */
.ticker {
  position: relative; flex-shrink: 0; height: 46px;
  display: flex; align-items: center;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 12.5px; white-space: nowrap;
}
.ticker-live { display: none; }
.ticker-viewport {
  flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 48px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 48px), transparent);
}
.ticker-track { display: flex; width: max-content; animation: ticker var(--ticker-dur, 40s) linear infinite; }
.ticker:hover .ticker-track, .ticker:focus-within .ticker-track { animation-play-state: paused; }
.ticker-empty { padding: 0 24px; color: var(--muted); }
@media (max-width: 1023.98px) {
  .ticker { height: var(--tap); font-size: 11.5px; }   /* mockup 34px, raised to the 44px tap minimum */
  .ticker-live { display: flex; align-items: center; gap: 6px; padding: 0 12px 0 16px; color: var(--up-text); letter-spacing: .08em; }
  .ticker-live .live-dot { width: 6px; height: 6px; }
  .ticker-list { gap: 20px; padding-right: 20px; }
}
.ticker-list { display: flex; gap: 30px; padding-right: 30px; }
.ticker-item { display: flex; align-items: center; gap: 8px; color: var(--text); }
.ticker-item:hover { opacity: 1; color: var(--accent-text); }
.ticker-item b { font-weight: 600; }
@media (prefers-reduced-motion: reduce) {
  .ticker-viewport { overflow-x: auto; scrollbar-width: none; }
  .ticker-track { animation: none; padding-left: 24px; }
  .ticker-list[aria-hidden="true"] { display: none; }
}

/* ── Chips / tags ── */
.tag { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; padding: 4px 9px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent-text); }

/* ── Mobile header controls ── */
.hdr-btn {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: var(--tap); height: var(--tap); padding: 0; border-radius: 12px;
  border: 1px solid transparent; background: transparent; color: var(--text);
  transition: transform var(--fast) var(--ease-out), background-color var(--fast), border-color var(--fast);
}
.hdr-btn:active { transform: scale(.97); }
.hdr-btn svg { width: 20px; height: 20px; }
.hdr-btn--boxed { border-color: var(--line2); }
.hdr-btn[aria-expanded="true"] { background: var(--accent-soft); }

/* ☰ → ✕ morph: three bars, transform only */
.burger { position: relative; width: 18px; height: 14px; }
.burger i {
  position: absolute; left: 0; width: 100%; height: 2px; border-radius: 2px; background: currentColor;
  transition: transform var(--base) var(--ease-out), opacity var(--fast);
}
.burger i:nth-child(1) { top: 0; }
.burger i:nth-child(2) { top: 6px; }
.burger i:nth-child(3) { top: 12px; }
[aria-expanded="true"] .burger i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
[aria-expanded="true"] .burger i:nth-child(2) { opacity: 0; transform: scaleX(.2); }
[aria-expanded="true"] .burger i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Drop-down sheets (menu + search). Siblings of the header, not children:
   a backdrop-filter parent would stop their own blur from seeing the page. */
.sheet {
  position: fixed; left: 0; right: 0; top: 64px; z-index: var(--z-menu);
  max-height: calc(100dvh - 64px); overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 16px 20px;
  background: var(--frame);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--line2);
  box-shadow: 0 30px 60px rgba(0, 0, 0, .5);
  opacity: 0; transform: translateY(-8px); visibility: hidden;
  transition: opacity var(--base) var(--ease-out), transform var(--base) var(--ease-out), visibility 0s linear var(--base);
}
.sheet.is-open { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }
.sheet:focus { outline: none; }
.sheet-scrim {
  position: fixed; inset: 64px 0 0; z-index: calc(var(--z-menu) - 1);
  background: rgba(0, 0, 0, .4); opacity: 0; visibility: hidden;
  transition: opacity var(--base) var(--ease-out), visibility 0s linear var(--base);
}
.sheet-scrim.is-open { opacity: 1; visibility: visible; transition-delay: 0s; }
html.scroll-locked, html.scroll-locked body { overflow: hidden; }
@media (min-width: 1024px) { .sheet, .sheet-scrim { display: none; } }

.m-links { display: flex; flex-direction: column; gap: 4px; }
.m-links a {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px;
  border-radius: 12px; font-size: 16px; color: var(--text);
}
.m-links a[aria-current="page"] { background: var(--accent-soft); }
.m-links .label { flex-grow: 1; }
.m-links .chev { width: 14px; height: 14px; opacity: .5; }
.sheet .divider { margin: 10px 0; }
.sheet-row { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.sheet-row > span { font-size: 13px; color: var(--muted); }
.sheet .seg--block button { height: 36px; padding: 0 16px; font-size: 13px; }
.sheet .search { width: 100%; height: 46px; border-radius: var(--r-lg); }
.sheet .search input { font-size: 16px; } /* 16px stops iOS zooming on focus */

/* ── Footer (mobile website) ── */
.site-footer {
  position: relative; z-index: var(--z-window);
  flex-direction: column; gap: 20px;
  margin-top: 28px; padding: 28px 16px 32px;
  border-top: 1px solid var(--line); background: var(--frame);
}
.site-footer .brand { gap: 9px; padding: 0; }
.site-footer p { font-size: 13px; line-height: 1.5; color: var(--muted); }
.footer-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; font-size: 14px; }
.footer-links a { display: flex; align-items: center; min-height: var(--tap); color: var(--text); }
.footer-base {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--faint-text);
}
.footer-social { display: flex; gap: 4px; }
.footer-social a { display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); color: var(--muted); }
.footer-social svg { width: 16px; height: 16px; }

/* ── Toast: slides up, fades out ── */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: var(--z-toast);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--r-pill);
  background: var(--tip); border: 1px solid var(--line2); box-shadow: var(--shadow-pop);
  font-size: 13px; color: var(--text); pointer-events: none;
  animation: toast 2.2s var(--ease-out) forwards;
}
.toast svg { width: 14px; height: 14px; color: var(--up-text); }

/* ════════ Shared token UI (dashboard, token page, galaxy) ════════ */
/* ── Token orb ── */
.orb {
  position: relative; display: grid; place-items: center; flex-shrink: 0; overflow: hidden;
  width: 30px; height: 30px; border-radius: 50%;
  font-family: var(--font-display); font-weight: 700; font-size: 12px; color: #07080F;
}
.orb > * { grid-area: 1 / 1; }
.orb img { width: 100%; height: 100%; object-fit: cover; }

/* ── Change chip ── */
.chg {
  display: inline-block; padding: 3px 7px; border-radius: var(--r-xs); border: 1px solid;
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.chg--up   { color: var(--up-text);   background: var(--up-soft);   border-color: var(--up-edge); }
.chg--down { color: var(--down-text); background: var(--down-soft); border-color: var(--down-edge); }
.chg--flat { color: var(--muted);     background: transparent;      border-color: var(--line2); }

/* ── Sparkline ── */
.spark { overflow: visible; }
.spark path { fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.spark--up path { stroke: var(--up); }
.spark--down path { stroke: var(--down); }
.spark--flat path, .spark--empty path { stroke: var(--faint); stroke-dasharray: 2 3; }

/* ── Stat box ── */
.stat {
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0;
  padding: 8px 4px; border-radius: var(--r-md); border: 1px solid var(--line);
}
.stat > span:first-child { font-family: var(--font-mono); font-size: 9px; letter-spacing: .1em; color: var(--muted); }
.stat > span:last-child { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; }

/* Watch button: filled star when watching */
.btn[aria-pressed="true"] svg path { fill: currentColor; }

/* ── Mobile tap targets: every control reaches 44px.
   Where the mockup draws a control smaller, an invisible ::before extends its hit area. ── */
@media (max-width: 1023.98px) {
  .ticker-track, .ticker-list, .ticker-item { height: 100%; }   /* links span the whole bar */
  .brand { min-height: var(--tap); }
  .skip-link { padding-block: 13px; }

  .seg button { height: 32px; }
  .seg button, .chip, .hashtag, .hashtag-more, .copy-btn, .cp-open-m { position: relative; }
  .seg button::before, .chip::before, .hashtag::before, .hashtag-more::before, .copy-btn::before, .cp-open-m::before {
    content: ""; position: absolute; left: 0; right: 0; top: 50%; height: var(--tap); transform: translateY(-50%);
  }
  .hashtag-more::before { left: -6px; right: -6px; }
  /* scrolling/clipped rows would cut the extended hit areas off: give them room */
  .chips { padding-block: 5px; margin-block: -5px; }
  .tag-cloud { padding-block: 7px; margin-block: -7px; }
  .cp-tf .seg button, .hh-head .seg button, .gx-bar .seg button { flex: 1; }
  .hh-head .seg { flex: 1 1 auto; max-width: 230px; }
  .gx-bar .btn { height: var(--tap); }
  .gx-crumb a, .m-crumb a { padding-inline: 6px; margin-inline: -6px; }
}

/* ── Heat charts (js/charts.js) ── */
.has-chart .lw { position: absolute; inset: 0; }
.chart-marker {
  position: absolute; left: -5.5px; top: -5.5px; z-index: 3; width: 11px; height: 11px;
  background: var(--pink-marker); border: 2px solid var(--chart); border-radius: 1px;
  pointer-events: none; opacity: 0; transition: opacity var(--fast);
}
.chart-marker.is-on { opacity: 1; }
.chart-tip {
  position: absolute; left: 0; top: 0; z-index: 4; width: 170px;
  display: flex; flex-direction: column; gap: 6px; padding: 11px 12px;
  border-radius: 10px; background: var(--tip); border: 1px solid var(--line); box-shadow: var(--shadow-pop);
  font-size: 11px; color: var(--muted); pointer-events: none;
  opacity: 0; will-change: transform;
  transition: opacity var(--fast) var(--ease-out), transform 90ms linear;   /* glides after the cursor */
}
.chart-tip.is-on { opacity: 1; }
.chart-tip.no-move { transition: opacity var(--fast) var(--ease-out); }
.chart-tip .t-time { font-size: 10.5px; }
.chart-tip .t-heat { font-size: 13px; color: var(--text); }
.chart-tip b { font-family: var(--font-mono); font-weight: 600; }
.chart-tip b:not([class]) { color: var(--text); }
.chart-state {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 24px; text-align: center; font-size: 12.5px; line-height: 1.5; color: var(--muted);
  background: radial-gradient(ellipse at 50% 45%, var(--accent-soft), transparent 70%);
}
.chart-state[hidden] { display: none; }
.chart-state strong { font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: .14em; color: var(--text); }
.chart-state span { max-width: 290px; }
.chart-state .btn { height: 34px; margin-top: 4px; }
.cs-dots { display: flex; gap: 6px; margin-bottom: 2px; }
.cs-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-text); animation: twinkle 1.4s ease-in-out infinite; }
.cs-dots i:nth-child(2) { animation-delay: .2s; }
.cs-dots i:nth-child(3) { animation-delay: .4s; }
@media (max-width: 1023.98px) { .chart-tip { width: 140px; padding: 9px 10px; gap: 4px; } }
@media (prefers-reduced-motion: reduce) { .chart-tip { transition: opacity var(--fast); } }

/* ── Placeholder (shell step only) ── */
.placeholder {
  display: grid; place-items: center; min-height: 160px; padding: 20px;
  border: 1px dashed var(--line2); border-radius: var(--r-2xl);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; color: var(--muted); text-align: center;
}
