/* Hyperliquid Whale Tracker
   Sea-chart palette: chart paper, navy ink, shoal water, kelp (long), buoy red (short), beacon yellow (action). */

@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #F1F5F4;
  --panel: #FFFFFF;
  --ink: #0D2433;
  --ink-2: #47606F;
  --line: #C9D8DB;
  --shoal: #DCE9EB;
  --deep: #123B52;
  --long: #0A7D68;
  --short: #C23B2A;
  --beacon: #F0B429;
  --beacon-ink: #2B1F00;
  --focus: #1B6FB5;
  --wrap: 1180px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0B2233;
    --panel: #102C40;
    --ink: #E7F0F1;
    --ink-2: #9DB4BF;
    --line: #23465B;
    --shoal: #143549;
    --deep: #07182A;
    --long: #3CCFA9;
    --short: #FF7C68;
    --beacon: #F5C043;
    --beacon-ink: #2B1F00;
    --focus: #7CC4FF;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0B2233;
  --panel: #102C40;
  --ink: #E7F0F1;
  --ink-2: #9DB4BF;
  --line: #23465B;
  --shoal: #143549;
  --deep: #07182A;
  --long: #3CCFA9;
  --short: #FF7C68;
  --beacon: #F5C043;
  --beacon-ink: #2B1F00;
  --focus: #7CC4FF;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
button, input, select { font: inherit; color: inherit; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }
.skip { position: absolute; left: -999px; top: 0; background: var(--beacon); color: var(--beacon-ink); padding: 0.5rem 0.9rem; z-index: 20; }
.skip:focus { left: 0.5rem; top: 0.5rem; }

/* Header */
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: 1.5rem; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; text-decoration: none; font-weight: 700; font-stretch: 112%; letter-spacing: -0.01em; white-space: nowrap; }
.fluke { width: 26px; height: 26px; fill: var(--ink); flex: none; }
.nav { display: flex; gap: 1.35rem; margin-left: auto; font-size: 0.95rem; }
.nav a { text-decoration: none; color: var(--ink-2); }
.nav a:hover { color: var(--ink); text-decoration: underline; }
.theme { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 0.3rem 0.85rem; font-size: 0.9rem; cursor: pointer; }
.theme:hover { border-color: var(--ink); }

/* Hero */
.hero { padding-block: clamp(2.5rem, 7vw, 5rem) clamp(2rem, 5vw, 3.5rem); }
h1 {
  font-size: clamp(2.6rem, 8.2vw, 6rem);
  font-weight: 800;
  font-stretch: 125%;
  line-height: 0.94;
  letter-spacing: -0.035em;
  max-width: 12ch;
  text-wrap: balance;
}
.lead { margin-top: 1.5rem; font-size: clamp(1.1rem, 1.6vw, 1.3rem); line-height: 1.45; max-width: 62ch; color: var(--ink-2); }
.now { margin-top: 2rem; font-size: clamp(1.25rem, 2.3vw, 1.75rem); line-height: 1.35; font-weight: 500; max-width: 46ch; text-wrap: pretty; }
.now b { font-weight: 750; white-space: nowrap; }
.now .long, .tg .long { color: var(--long); }
.now .short { color: var(--short); }
.stamp { margin-top: 0.9rem; display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; font-size: 0.92rem; color: var(--ink-2); }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-2); flex: none; }
.pulse.live { background: var(--long); animation: pulse 2.4s ease-out infinite; }
.pulse.err { background: var(--short); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--long) 60%, transparent); } 100% { box-shadow: 0 0 0 9px transparent; } }
.linkbtn { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 0.18em; cursor: pointer; color: var(--ink); }

/* Waterline chart */
.water { margin-top: clamp(2rem, 4vw, 3rem); }
.water figcaption { font-size: 0.95rem; color: var(--ink-2); margin-bottom: 0.75rem; }
.water-plot {
  --half: clamp(110px, 16vw, 170px);
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: clamp(4px, 1vw, 14px);
  height: calc(var(--half) * 2 + 2.2rem);
  padding-inline: clamp(0.5rem, 2vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background:
    linear-gradient(to bottom, var(--panel) 0, var(--panel) calc(50% - 1px), var(--ink) calc(50% - 1px), var(--ink) calc(50% + 1px), transparent calc(50% + 1px)),
    repeating-linear-gradient(to bottom, var(--shoal) 0, var(--shoal) 17px, color-mix(in srgb, var(--line) 70%, var(--shoal)) 17px, color-mix(in srgb, var(--line) 70%, var(--shoal)) 18px);
}
.water-plot:empty::after { content: "Waiting for positions."; position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-2); font-size: 0.95rem; }
.wcol { display: grid; grid-template-rows: 1fr 2.2rem 1fr; min-width: 0; }
.wcol .up, .wcol .down { position: relative; display: flex; justify-content: center; }
.wcol .up { align-items: flex-end; }
.wcol .down { align-items: flex-start; }
.wbar { width: min(100%, 64px); min-height: 2px; border-radius: 3px 3px 0 0; background: var(--long); position: relative; transition: height 0.5s ease; }
.wcol .down .wbar { background: var(--short); border-radius: 0 0 3px 3px; }
.wbar span { position: absolute; left: 50%; transform: translateX(-50%); font-size: 0.78rem; font-weight: 600; font-stretch: 85%; white-space: nowrap; color: var(--ink); }
.wcol .up .wbar span { bottom: calc(100% + 3px); }
.wcol .down .wbar span { top: calc(100% + 3px); }
.wname { align-self: center; justify-self: center; z-index: 1; font-weight: 750; font-stretch: 100%; font-size: 0.86rem; background: var(--ink); color: var(--paper); padding: 0.1rem 0.45rem; border-radius: 3px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* Bands */
.band { padding-block: clamp(3rem, 7vw, 5.5rem); border-top: 1px solid var(--line); }
.band.alt { background: var(--shoal); }
h2 { font-size: clamp(1.75rem, 3.4vw, 2.6rem); font-weight: 750; font-stretch: 112%; line-height: 1.06; letter-spacing: -0.02em; max-width: 22ch; text-wrap: balance; }
h3 { font-size: 1.12rem; font-weight: 700; line-height: 1.25; }
.sub { margin-top: 0.8rem; color: var(--ink-2); max-width: 64ch; }
.band p + p { margin-top: 1rem; }
.note { font-size: 0.9rem; color: var(--ink-2); max-width: 70ch; }
.split { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.split > div > p, .split > div > ol, .split > div > ul { max-width: 64ch; }
.split h2 { margin-bottom: 1.3rem; }

/* Controls */
.controls { margin-top: 1.8rem; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem 1.5rem; }
.seg { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; }
.seg legend, .pick > span, .lookup > label { display: block; padding: 0; margin-bottom: 0.35rem; font-size: 0.85rem; font-weight: 600; font-stretch: 88%; color: var(--ink-2); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg label span { display: block; padding: 0.45rem 0.85rem; border: 1px solid var(--line); margin-left: -1px; background: var(--panel); font-size: 0.95rem; }
.seg label:first-of-type span { border-radius: 5px 0 0 5px; margin-left: 0; }
.seg label:last-of-type span { border-radius: 0 5px 5px 0; }
.seg input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.pick select, .lookup input { height: 2.45rem; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); padding: 0 0.7rem; font-size: 0.95rem; }
.lookup { margin-left: auto; flex: 1 1 320px; max-width: 460px; }
.lookup-row { display: flex; gap: 0.5rem; }
.lookup input { flex: 1; min-width: 0; }
.lookup button { height: 2.45rem; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); border-radius: 5px; padding: 0 0.95rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.msg { min-height: 1.3rem; margin-top: 0.3rem; font-size: 0.88rem; color: var(--short); }

.wallet-card { margin-top: 1.2rem; border: 1px solid var(--ink); border-radius: 6px; background: var(--panel); padding: 1.1rem 1.25rem; }
.wallet-card header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 1.2rem; margin-bottom: 0.8rem; }
.wallet-card header button { margin-left: auto; }
.wallet-card .addr { font-weight: 700; overflow-wrap: anywhere; }

/* Table */
.table-scroll { margin-top: 1.4rem; overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
table.pos { width: 100%; border-collapse: collapse; font-size: 0.95rem; min-width: 940px; }
.pos th, .pos td { padding: 0.62rem 0.8rem; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.pos tbody tr:last-child td { border-bottom: 0; }
.pos th { font-size: 0.84rem; font-weight: 600; font-stretch: 88%; color: var(--ink-2); background: var(--panel); position: sticky; top: 0; }
.pos th button { background: none; border: 0; padding: 0; font-weight: inherit; font-stretch: inherit; color: inherit; cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 0.2em; }
.pos th button[aria-pressed="true"] { color: var(--ink); text-decoration-style: solid; }
.pos th button[aria-pressed="true"]::after { content: " \2193"; }
.pos th button[data-dir="asc"]::after { content: " \2191"; }
.pos .num { text-align: right; }
.pos .c-coin, .pos td:first-child { position: sticky; left: 0; background: var(--panel); font-weight: 700; }
.pos tbody tr:hover td { background: color-mix(in srgb, var(--shoal) 55%, var(--panel)); }
.side { font-weight: 650; }
.side.long, .pnl.pos-v { color: var(--long); }
.side.short, .pnl.neg-v { color: var(--short); }
.lev small, .dim { color: var(--ink-2); font-size: 0.85em; }
.liq-near { font-weight: 700; color: var(--short); }
.liq-meter { display: inline-block; width: 44px; height: 5px; margin-right: 0.45rem; border-radius: 3px; background: var(--shoal); vertical-align: middle; overflow: hidden; }
.liq-meter i { display: block; height: 100%; background: var(--ink-2); }
.liq-near .liq-meter i { background: var(--short); }
.pos td a { text-decoration-color: var(--line); }
.pos .empty td { padding: 2.2rem 1rem; text-align: center; color: var(--ink-2); position: static; font-weight: 400; white-space: normal; }
.table-foot { margin-top: 0.9rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }
#registry-note { margin-top: 0.5rem; }

/* Buttons */
.btn { display: inline-block; background: var(--beacon); color: var(--beacon-ink); border: 1px solid var(--beacon); border-radius: 5px; padding: 0.72rem 1.15rem; font-weight: 700; text-decoration: none; cursor: pointer; line-height: 1.2; }
.btn:hover { filter: brightness(0.95); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--paper); filter: none; }

/* Alerts */
.facts { margin-top: 1.4rem; display: grid; gap: 0.9rem; }
.facts li { padding-left: 1.1rem; position: relative; }
.facts li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 0.45rem; height: 2px; background: var(--ink); }
.plans { margin-top: 1.8rem; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.plans + .note { margin-top: 1rem; }
.alert-side h3 { margin-top: 2rem; margin-bottom: 0.5rem; }
.tg { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--long); border-radius: 4px 10px 10px 4px; padding: 0.95rem 1.15rem; max-width: 360px; }
.tg p + p { margin-top: 0.25rem; }
.tg-head { font-size: 0.85rem; font-weight: 600; font-stretch: 88%; color: var(--ink-2); }
.tg-size { font-size: 1.3rem; font-weight: 750; letter-spacing: -0.01em; }
.tg-size .delta { color: var(--long); font-size: 1rem; margin-left: 0.3rem; }
.tg-time { font-size: 0.85rem; color: var(--ink-2); }
.tg + .note { margin-top: 0.6rem; }

/* Guide */
.grid4 { margin-top: 2.2rem; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-top: 2px solid var(--ink); }
.grid4 article { padding: 1.2rem 1.4rem 0.5rem 0; }
.grid4 article + article { padding-left: 1.4rem; border-left: 1px solid var(--line); }
.grid4 h3 { margin-bottom: 0.55rem; }
.grid4 p { font-size: 0.98rem; }
.case { margin-top: 2.4rem; max-width: 70ch; padding-left: 1.2rem; border-left: 4px solid var(--short); }

/* Record */
.figures { display: grid; gap: 0; border-top: 2px solid var(--ink); }
.figures div { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 0.75rem 0; border-bottom: 1px solid color-mix(in srgb, var(--ink) 25%, transparent); }
.figures dt { color: var(--ink-2); }
.figures dd { font-size: 1.5rem; font-weight: 750; font-stretch: 112%; }
.record-side .note { margin-top: 1rem; }

/* Method */
.steps { margin-top: 1.4rem; counter-reset: s; display: grid; gap: 1rem; }
.steps li { counter-increment: s; padding-left: 2.4rem; position: relative; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0.05rem; width: 1.6rem; height: 1.6rem; border: 1.5px solid var(--ink); border-radius: 50%; display: grid; place-items: center; font-size: 0.85rem; font-weight: 700; }
#method aside h3 { margin-bottom: 0.2rem; }

/* FAQ */
.faq { margin-top: 2.2rem; columns: 2; column-gap: clamp(2rem, 5vw, 4.5rem); }
.faq > div { break-inside: avoid; padding: 1.1rem 0 1.3rem; border-top: 1px solid color-mix(in srgb, var(--ink) 30%, transparent); }
.faq h3 { margin-bottom: 0.45rem; }
.faq p { font-size: 0.98rem; }

/* Footer */
.foot { background: var(--deep); color: #DDE9EC; padding-block: 3rem; font-size: 0.93rem; }
.foot-in { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 2.5rem; }
.foot p { max-width: 62ch; color: #B5C8CF; }
.foot p + p { margin-top: 0.7rem; }
.foot .foot-brand { font-weight: 750; font-stretch: 112%; font-size: 1.1rem; color: #fff; margin-bottom: 0.6rem; }
.foot nav { display: grid; gap: 0.5rem; align-content: start; justify-items: start; }
.foot :focus-visible { outline-color: var(--beacon); }

/* Responsive */
@media (max-width: 980px) {
  .nav { display: none; }
  .theme { margin-left: auto; }
  .split, .foot-in { grid-template-columns: 1fr; }
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid4 article:nth-child(3) { padding-left: 0; border-left: 0; }
  .grid4 article:nth-child(n+3) { border-top: 1px solid var(--line); }
  .faq { columns: 1; }
  .lookup { margin-left: 0; max-width: none; }
}
@media (max-width: 620px) {
  body { font-size: 1rem; }
  .brand span { font-size: 0.95rem; }
  .grid4 { grid-template-columns: 1fr; }
  .grid4 article, .grid4 article + article { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .grid4 article:first-child { border-top: 0; }
  .wcol:nth-child(n+7) { display: none; }
  .wbar span { font-size: 0.7rem; }
  .wname { font-size: 0.72rem; padding: 0.1rem 0.28rem; font-stretch: 88%; }
  .water-plot { gap: 3px; padding-inline: 0.35rem; }
  .plans .btn { width: 100%; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .pulse.live { animation: none; }
  .wbar { transition: none; }
}
