/* Peeky styles, Factory design system (see docs/design-system.md). */

/* ---------- Design tokens ---------- */
:root {
  /* Colors */
  --color-canvas: #101010;        /* page background */
  --color-panel: #0d0d0d;         /* dashboard preview frame, a hair darker than canvas */
  --color-carbon: #1d1a18;        /* raised dark surfaces, inputs, hairlines */
  --color-ash: #3d3a39;           /* stronger hairlines, ghost borders */
  --color-graphite: #4d4947;
  --color-muted: #8a8380;         /* muted body text */
  --color-label: #b8b3b0;         /* mono labels, eyebrows */
  --color-bone: #eeeeee;          /* main text and light cards */
  --color-chalk: #fafafa;         /* light button fill */
  --color-orange: #ee6018;        /* status / data only, never a fill */
  --color-green: #a0ca92;         /* status / data only, never a fill */

  /* Fonts */
  --font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Layout */
  --page-max: 1200px;
  --gutter: 24px;
  --section-gap: 96px;

  /* Radius */
  --radius-sm: 3px;    /* buttons, inputs */
  --radius-card: 10px;
  --radius-panel: 20px;

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --fast: 0.15s;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--color-canvas);
  color: var(--color-bone);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

/* The hidden attribute must always win, even over display: flex in a class */
[hidden] {
  display: none !important;
}

h1, h2, h3, p {
  margin: 0;
  font-weight: 400;
}

a {
  color: var(--color-bone);
  text-decoration: none;
  transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease),
              background-color var(--fast) var(--ease);
}

a:hover {
  color: var(--color-chalk);
}

input:focus,
button:focus-visible,
a:focus-visible {
  outline: 1px solid var(--color-bone);
  outline-offset: 2px;
}

/* ---------- Type helpers ---------- */
.display {
  font-size: 72px;
  line-height: 1;
  letter-spacing: -2.88px;
  text-wrap: balance;
}

.heading-lg {
  font-size: 44px;
  line-height: 1.12;
  letter-spacing: -1.1px;
  text-wrap: balance;
}

.heading {
  font-size: 36px;
  line-height: 1.1;
  letter-spacing: -1.12px;
}

/* Geist Mono 12px uppercase: the "instrument" voice for labels and tags */
.label,
.eyebrow,
.status {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  letter-spacing: -0.24px;
  text-transform: uppercase;
  color: var(--color-label);
}

.mono {
  font-family: var(--font-mono);
}

.eyebrow,
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status {
  gap: 6px;
}

/* 6px status pulse */
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-orange);
  flex: none;
}

.wordmark {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-bone);
}

/* ---------- Buttons ---------- */
.btn {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}

.btn-lg {
  height: 48px;
  padding: 0 18px;
}

.btn-light {
  background: var(--color-chalk);
  color: var(--color-canvas);
}

.btn-light:hover {
  background: var(--color-bone);
  color: var(--color-canvas);
}

/* Dark button. On the light CTA card it uses the canvas black, as in the design. */
.btn-dark {
  background: var(--color-canvas);
  color: var(--color-bone);
}

.btn-dark:hover {
  background: var(--color-carbon);
  color: var(--color-chalk);
}

/* Text link with an underline hairline */
.link-ghost {
  align-self: flex-start;
  padding-block: 8px;
  font-size: 14px;
  border-bottom: 1px solid var(--color-ash);
}

.link-ghost:hover {
  border-bottom-color: var(--color-chalk);
}

/* ---------- Page frame ---------- */
.page {
  padding: 0 var(--gutter) var(--section-gap);
}

.site-header,
.landing,
.app,
.site-footer {
  max-width: var(--page-max);
  margin-inline: auto;
}

.site-header {
  min-height: 64px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
  font-size: 14px;
  text-transform: uppercase;
}

.landing {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
  padding-top: 80px;
}

.site-footer {
  margin-top: var(--section-gap);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px;
  font-size: 14px;
  color: var(--color-muted);
}

/* ---------- Hero ---------- */
/* Two flex children that wrap: copy on the left, preview on the right.
   The huge flex-grow on the preview makes it take the wider share, and
   when there is no room for both they stack. */
.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 56px;
}

.hero-copy {
  flex: 1 1 380px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.lede {
  max-width: 30em;
  color: var(--color-muted);
}

/* Address form */
.lookup {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lookup-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.input {
  flex: 1 1 260px;
  min-width: 0;
  height: 48px;
  padding-inline: 14px;
  background: var(--color-carbon);
  border: 1px solid var(--color-ash);
  border-radius: var(--radius-sm);
  color: var(--color-bone);
  font-family: var(--font-mono);
  font-size: 14px;
  transition: border-color var(--fast) var(--ease);
}

.input::placeholder {
  color: var(--color-muted);
}

.input[aria-invalid='true'] {
  border-color: var(--color-orange);
}

.form-hint {
  font-size: 14px;
  color: var(--color-muted);
}

/* Error is a status message, so orange is allowed here */
.form-error {
  font-size: 14px;
  color: var(--color-orange);
}

.form-error:empty {
  display: none;
}

/* ---------- Dashboard preview ---------- */
.preview {
  flex: 999 1 560px;
  min-width: 0;
  background: var(--color-panel);
  border: 1px solid var(--color-carbon);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.preview-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-carbon);
}

.traffic {
  display: flex;
  gap: 6px;
}

.traffic span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-ash);
}

.preview-title {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: -0.24px;
  text-transform: uppercase;
  color: var(--color-muted);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tile {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid var(--color-carbon);
  border-right: 1px solid var(--color-carbon);
}

/* Right column already touches the frame border */
.tile:nth-child(2n) {
  border-right: 0;
}

.tile-value {
  font-size: 36px;
  line-height: 1.1;
  letter-spacing: -1.12px;
  font-variant-numeric: tabular-nums;
}

.tile-note {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-muted);
}

.tile-note.up {
  color: var(--color-green);
}

.share-rows {
  display: flex;
  flex-direction: column;
  padding: 8px 20px 16px;
}

.share-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 16px;
  padding-block: 10px;
  border-bottom: 1px solid var(--color-carbon);
  font-size: 14px;
}

.bar {
  height: 4px;
  background: var(--color-carbon);
  border-radius: 2px;
}

.bar span {
  display: block;
  height: 4px;
  width: var(--share);
  background: var(--color-label);
  border-radius: 2px;
}

.share-value {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--color-label);
}

/* ---------- How it works ---------- */
.how {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-head .heading-lg {
  max-width: 16em;
}

/* auto-fit: as many 280px+ columns as fit, so 3 on desktop and 1 on a phone */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 24px;
}

/* Dark card: the border is the card, no fill */
.feature-card {
  border: 1px solid var(--color-carbon);
  border-radius: var(--radius-card);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.feature-title {
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.6px;
}

.feature-body {
  flex: 1;
  color: var(--color-muted);
}

/* ---------- CTA card ---------- */
.cta-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  background: var(--color-bone);
  color: var(--color-canvas);
  border-radius: var(--radius-card);
  padding: 40px;
}

.cta-copy {
  flex: 999 1 420px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cta-card .eyebrow {
  color: var(--color-canvas);
}

/* ---------- Small helpers ---------- */
/* Data colors. Green and orange are only for up/down and status. */
.text-up    { color: var(--color-green); }
.text-down  { color: var(--color-orange); }
.text-muted { color: var(--color-muted); }
.text-label { color: var(--color-label); }

.dot-green   { background: var(--color-green); }
.dot-neutral { background: var(--color-label); }

.label-muted {
  color: var(--color-muted);
}

.small-note {
  font-size: 12px;
  color: var(--color-muted);
}

/* Hidden on screen, still read by screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Extra button sizes and the ghost style used in the dashboard */
.btn-md {
  height: 44px;
  padding: 0 16px;
  justify-content: center;
}

.btn-ghost {
  background: transparent;
  color: var(--color-bone);
  border: 1px solid var(--color-ash);
}

.btn-ghost:hover {
  border-color: var(--color-bone);
}

/* ---------- Dashboard (app.html) ---------- */
.app-header {
  border-bottom: 1px solid var(--color-carbon);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Small mono text button, used for Refresh in the header */
.btn-text {
  padding: 8px 0;
  background: transparent;
  border: 0;
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: -0.24px;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--fast) var(--ease);
}

.btn-text:hover {
  color: var(--color-bone);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Same flex-wrap trick as the hero: sidebar and main sit side by side,
   and stack when the screen is too narrow for both. */
.app {
  display: flex;
  flex-wrap: wrap;
  gap: 56px;
  padding-top: 40px;
}

/* Sidebar */
.sidebar {
  flex: 1 1 260px;
  max-width: 300px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.wallets {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wallet-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* One wallet: the select button plus a small remove button next to it */
.wallet-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.wallet-row .wallet {
  flex: 1;
  min-width: 0;
}

.wallet-remove {
  width: 32px;
  height: 32px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  cursor: pointer;
  transition: color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}

.wallet-remove:hover {
  color: var(--color-bone);
  background: var(--color-carbon);
}

.wallet {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-bottom-color: var(--color-carbon);
  border-radius: var(--radius-sm);
  color: var(--color-bone);
  font-family: var(--font-sans);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}

.wallet:hover {
  border-color: var(--color-carbon);
}

/* aria-pressed="true" marks the selected wallet (also for screen readers) */
.wallet[aria-pressed='true'] {
  background: var(--color-carbon);
  border-color: var(--color-ash);
}

.wallet-id {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Long nicknames end in "…" instead of pushing the SOL amount out */
.wallet-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-addr {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-muted);
}

.wallet-sol {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--color-label);
}

.wallet[aria-pressed='true'] .wallet-sol {
  color: var(--color-bone);
}

.add-wallet,
.share {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* flex: none, because in a column the landing input's flex-basis would
   turn into a 260px height */
.input-sm {
  flex: none;
  height: 44px;
  padding-inline: 12px;
  font-size: 13px;
}

/* Nicknames are normal words, so they use the sans font */
.input-text {
  font-family: var(--font-sans);
  font-size: 14px;
}

/* Main column */
.dash {
  flex: 999 1 600px;
  min-width: 0;
}

.tabs {
  display: flex;
  gap: 32px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--color-carbon);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: -0.24px;
  text-transform: uppercase;
}

/* The active tab gets a light underline that sits on top of the hairline */
.tab {
  padding-block: 14px;
  margin-bottom: -1px;
  border-bottom: 1px solid transparent;
  color: var(--color-muted);
}

.tab[aria-current='page'] {
  color: var(--color-bone);
  border-bottom-color: var(--color-bone);
}

.view,
.view-body {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

/* Loading, empty and error message box */
.state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 40px 24px;
  border: 1px solid var(--color-carbon);
  border-radius: var(--radius-card);
}

.state-title {
  font-size: 24px;
  letter-spacing: -0.6px;
}

.state-body {
  color: var(--color-muted);
}

.state .btn {
  margin-top: 8px;
}

/* Holdings: total value */
.total {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.total-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 16px;
}

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

.total-change {
  font-family: var(--font-mono);
  font-size: 14px;
}

/* Holdings: row of metric tiles. Each tile draws its right and bottom
   hairline; overflow: hidden plus margin-right: -1px clips the line at the
   far right edge, so it also looks right when the tiles wrap. */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  border-top: 1px solid var(--color-carbon);
  overflow: hidden;
}

.stat {
  margin-right: -1px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-right: 1px solid var(--color-carbon);
  border-bottom: 1px solid var(--color-carbon);
}

.stat-value {
  font-size: 36px;
  line-height: 1.1;
  letter-spacing: -1.12px;
  font-variant-numeric: tabular-nums;
}

/* A titled block, like the token table */
.block {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.block-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.block-title {
  font-size: 24px;
  letter-spacing: -0.6px;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.holdings-table { min-width: 720px; }
.tx-table       { min-width: 760px; }

.data-table th {
  padding: 12px;
  border-bottom: 1px solid var(--color-ash);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.24px;
  text-align: left;
  text-transform: uppercase;
  color: var(--color-label);
}

.data-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--color-carbon);
}

/* First and last columns line up with the edges, no outer padding */
.data-table th:first-child,
.data-table td:first-child {
  padding-left: 0;
}

.data-table th:last-child,
.data-table td:last-child {
  padding-right: 0;
}

.data-table .num {
  text-align: right;
}

/* Token cell: round mark + symbol + name */
.token {
  display: flex;
  align-items: center;
  gap: 12px;
}

.token-mark {
  width: 32px;
  height: 32px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-ash);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-label);
}

.token-id {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.token-name {
  font-size: 12px;
  color: var(--color-muted);
}

.held {
  font-size: 13px;
  color: var(--color-muted);
}

/* Spam rows, once shown, stay visibly in the background */
.is-spam {
  opacity: 0.5;
}

.share-col {
  width: 16%;
}

.share-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.share-cell .bar {
  flex: 1;
}

.share-pct {
  width: 32px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-label);
}

/* Looks like a quiet text link, but it's a button because it toggles something */
.link-quiet {
  align-self: flex-start;
  min-height: 44px;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--color-muted);
  font-family: var(--font-sans);
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
  transition: color var(--fast) var(--ease);
}

.link-quiet:hover {
  color: var(--color-bone);
}

/* Transactions: heading and filter chips */
.view-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  /* the view gap is 40px; the design keeps the chips a bit closer */
  margin-top: -8px;
}

.chip {
  height: 36px;
  padding: 0 14px;
  background: transparent;
  border: 1px solid var(--color-ash);
  border-radius: var(--radius-sm);
  color: var(--color-bone);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: -0.24px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease),
              border-color var(--fast) var(--ease);
}

.chip:hover {
  border-color: var(--color-bone);
}

.chip[aria-pressed='true'] {
  background: var(--color-bone);
  border-color: var(--color-bone);
  color: var(--color-canvas);
}

/* Transactions table */
.day-row td {
  padding: 20px 0 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: -0.24px;
  text-transform: uppercase;
  color: var(--color-muted);
}

.tx-type {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: -0.24px;
  text-transform: uppercase;
}

.tx-what {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.tx-note {
  font-size: 12px;
  color: var(--color-muted);
}

.explorer {
  text-align: right;
}

.icon-link {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
}

.table-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.table-foot .small-note {
  max-width: 36em;
}

/* ---------- Phone width ---------- */
@media (max-width: 600px) {
  :root {
    --gutter: 16px;
    --section-gap: 72px;
  }

  .landing {
    padding-top: 48px;
  }

  /* Keep the same tight ratio (-0.04em), just smaller */
  .display {
    font-size: 48px;
    letter-spacing: -1.92px;
  }

  .heading-lg {
    font-size: 34px;
    letter-spacing: -0.85px;
  }

  .heading {
    font-size: 28px;
    letter-spacing: -0.87px;
  }

  /* The nav wraps under the wordmark here, so give the header some air */
  .site-header {
    padding-block: 16px;
  }

  .site-nav {
    gap: 16px;
  }

  /* Full-width button under the input */
  .lookup-row .btn {
    flex: 1 1 100%;
    justify-content: center;
  }

  .tile {
    padding: 16px;
  }

  .tile-value {
    font-size: 28px;
    letter-spacing: -0.87px;
  }

  .share-rows {
    padding-inline: 16px;
  }

  .share-row {
    grid-template-columns: 48px minmax(0, 1fr) 64px;
    gap: 12px;
  }

  .cta-card {
    padding: 24px;
  }

  /* Dashboard: sidebar becomes full width above the main column */
  .app {
    gap: 40px;
    padding-top: 24px;
  }

  .sidebar {
    max-width: none;
  }

  .stat {
    padding: 16px;
  }

  .stat-value {
    font-size: 28px;
    letter-spacing: -0.87px;
  }
}
