/* App-specific styles for the DeFi Yield Scanner. Uses BG brand tokens (brand.css). */

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* top bar */
.top { display: flex; align-items: center; justify-content: space-between; padding-top: 24px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .mark { display: block; }
.wordmark { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.topnav { display: flex; align-items: center; gap: 16px; }
.navlink { font-family: var(--display); font-weight: 600; font-size: 13px; color: var(--muted); transition: color var(--ease); }
.navlink:hover { color: var(--text); text-decoration: none; }
#theme .theme-dark, #theme .theme-light { font-size: 14px; line-height: 1; }
:root[data-theme="dark"] #theme .theme-light { display: none; }
:root:not([data-theme="dark"]) #theme .theme-dark { display: none; }

/* hero */
.hero { padding-top: 28px; }
.hero-line { font-size: 34px; line-height: 1.15; max-width: 760px; color: var(--text); }
.sub { margin: 12px 0 0; color: var(--muted); max-width: 720px; font-size: 15px; }
.sub strong { color: var(--text); font-weight: 600; }

/* controls */
.controls { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; margin: 28px auto 8px; }
.ctl { display: flex; align-items: center; gap: 10px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-btn); overflow: hidden; background: var(--surface); }
.seg button { background: transparent; color: var(--muted); border: 0; padding: 7px 14px; cursor: pointer; font: 600 13px var(--display); transition: background var(--ease), color var(--ease); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--accent-tint); color: var(--accent); }
.seg button:hover:not(.on) { color: var(--text); }
.chk { display: flex; align-items: center; gap: 8px; color: var(--muted); cursor: pointer; font-size: 14px; }
.chk input { accent-color: var(--accent); width: 15px; height: 15px; }

/* chain filter chips (multi-select) */
.chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 7px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted); font: 600 12px var(--display); transition: all var(--ease); }
.chip .chic { margin: 0; opacity: 0.5; transition: opacity var(--ease); }
.chip:hover { color: var(--text); border-color: var(--tertiary); }
.chip.on { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); }
.chip.on .chic { opacity: 1; }

/* windows */
.window { margin: 26px 0; }
.wtitle { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.wtitle h2 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.05em; }
.wtitle .count { color: var(--tertiary); font-size: 12px; font-family: var(--body); }
.wtitle .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.t1 .dot { background: var(--accent); }
.t2 .dot { background: var(--warning); }
.t3 .dot { background: var(--info); }

/* shared grid for header + rows */
.grid {
  display: grid;
  grid-template-columns: 30px minmax(180px, 1fr) 150px 84px 84px 58px 88px 16px;
  align-items: center; gap: 12px;
}

/* header row (sortable) */
.thead { padding: 0 12px 8px; }
.thead .th { font: 600 10px var(--display); text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); user-select: none; }
.thead .th.sortable { cursor: pointer; display: inline-flex; align-items: center; gap: 4px; transition: color var(--ease); }
.thead .th.sortable:hover { color: var(--text); }
.thead .th.active { color: var(--accent); }
.thead .th.num { justify-content: flex-end; text-align: right; }
.thead .th.center { justify-content: center; }
.caret { font-size: 8px; opacity: 0.9; }

/* data rows */
.rows { display: grid; gap: 4px; }
.row { padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); cursor: pointer; transition: border-color var(--ease), background var(--ease); }
.row:hover { border-color: var(--accent); }
.row:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.row.open { border-color: var(--accent); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.chev { color: var(--tertiary); font-size: 16px; text-align: center; transition: transform var(--ease); }
.row.open .chev { transform: rotate(90deg); color: var(--accent); }

/* detail subpanel (inline accordion) */
.detail { background: var(--elevated); border: 1px solid var(--accent); border-top: 0;
  border-radius: 0 0 var(--r-card) var(--r-card); padding: 16px; margin-top: -4px; margin-bottom: 4px; }
.dgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.dcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-badge); padding: 10px 12px; }
.dcard.wide { grid-column: 1 / -1; }
.dk { font: 600 10px var(--display); text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 6px; }
.dbig { font: 700 22px var(--display); color: var(--text); font-variant-numeric: tabular-nums; }
.dline { font-size: 14px; color: var(--text); }
.dline b { font-weight: 600; }
.dsub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.dsub .rew { color: var(--accent-soft); }
.dline b.up { color: var(--warning); } .dline b.steady { color: var(--success); } .dline b.down { color: var(--error); }
.dactions { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.dactions .btn:hover { text-decoration: none; }
.dnote { font-size: 13px; color: var(--muted); }

@media (max-width: 760px) { .dgrid { grid-template-columns: repeat(2, 1fr); } }

.logo { position: relative; width: 26px; height: 26px; border-radius: 7px; overflow: hidden; background: var(--accent-tint); }
.logo .mono { position: absolute; inset: 0; display: grid; place-items: center; color: var(--accent); font: 800 11px var(--display); }
.logo .ic { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--elevated); }

.name { overflow: hidden; }
.name .line { display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.name .proj { font-weight: 600; color: var(--text); }
.name .sym { color: var(--muted); }
.name .chain { color: var(--tertiary); font-size: 12px; }
.chic { width: 14px; height: 14px; border-radius: 4px; object-fit: cover; flex: none; margin-left: 2px; }
.ext { color: var(--tertiary); font-size: 13px; margin-left: 2px; text-decoration: none; flex: none; transition: color var(--ease); }
.ext:hover { color: var(--accent); text-decoration: none; }
.ext.exact { color: var(--accent-soft); }

.bar { height: 12px; background: var(--elevated); border-radius: 4px; overflow: hidden; display: flex; border: 1px solid var(--border); }
.bar .b { background: var(--accent); height: 100%; }
.bar .r { background: color-mix(in srgb, var(--accent) 22%, transparent); height: 100%; }

.num { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; }
.num.base { font-weight: 600; color: var(--text); }
.num.mean { color: var(--muted); }
.tvl { text-align: right; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* trend flag with tooltip */
.flag { text-align: center; position: relative; cursor: help; }
.flag .g { font-size: 13px; }
.flag.up .g { color: var(--warning); }
.flag.steady .g { color: var(--success); }
.flag.down .g { color: var(--error); }
.flag[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; bottom: 130%; left: 50%; transform: translateX(-50%);
  background: var(--elevated); color: var(--text); border: 1px solid var(--border);
  padding: 6px 9px; border-radius: var(--r-btn); font: 400 12px var(--body); white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25); z-index: 10; font-variant-numeric: tabular-nums;
}
.lock { color: var(--error); font-size: 11px; margin-left: 4px; }
.empty { color: var(--tertiary); padding: 14px; }
.loadmore { display: block; width: 100%; margin-top: 8px; padding: 10px; background: var(--surface);
  border: 1px dashed var(--border); border-radius: var(--r-card); color: var(--muted);
  font: 600 13px var(--display); cursor: pointer; transition: all var(--ease); }
.loadmore:hover { border-color: var(--accent); color: var(--accent); border-style: solid; }

/* footer */
footer { margin: 44px 0 64px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); padding-top: 18px; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 10px; }
.legend .g { font-weight: 700; }
.legend .up { color: var(--warning); } .legend .steady { color: var(--success); } .legend .down { color: var(--error); }
.legend span span { color: var(--text); }

@media (max-width: 760px) {
  .hero-line { font-size: 26px; }
  .grid { grid-template-columns: 26px 1fr 70px 50px; gap: 8px; }
  .grid .bar, .grid .mean, .grid .tvl, .grid .chev, .thead .th.hide-sm { display: none; }
}
