/* Yggdrasil Markets — forest aesthetic
 * Deep canopy greens with mossy bark accents + golden mushroom highlights.
 * Cream parchment text. Calm, not flashy. Reads like a Wikipedia page
 * about an enchanted forest, not a flashing crypto dashboard.
 */

:root {
  --bg-canopy: #0f2419;
  --bg-deep: #1a3d2f;
  --bg-tile: #20493a;
  --bg-tile-hover: #266150;
  --bark: #3d2e1a;
  --bark-light: #5a4428;
  --moss: #6b8e4e;
  --moss-light: #8db865;
  --mushroom: #d4a017;
  --mushroom-soft: #e8c560;
  --copper: #b87333;
  --parchment: #f5e6d3;
  --parchment-dim: #c5b89e;
  --parchment-faint: #8a7e6a;
  --gain: #8db865;
  --loss: #c25450;
  --max-w: 1100px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background: linear-gradient(180deg, var(--bg-canopy) 0%, var(--bg-deep) 100%);
  min-height: 100vh;
  color: var(--parchment);
  font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--mushroom-soft);
  text-decoration: none;
  border-bottom: 1px dotted var(--mushroom);
}

a:hover,
a:focus-visible {
  color: var(--mushroom);
  border-bottom-style: solid;
}

:focus-visible {
  outline: 2px solid var(--mushroom);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── Masthead ─────────────────────────────────────────── */

.masthead {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1.5rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-glyph {
  font-size: 3rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.brand-text h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--parchment);
}

.tagline {
  color: var(--parchment-dim);
  font-style: italic;
  font-size: 0.95rem;
}

.status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--parchment-dim);
}

.dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--parchment-faint);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.2);
}

.dot.ok    { background: var(--moss-light); box-shadow: 0 0 8px var(--moss); }
.dot.stale { background: var(--mushroom);   box-shadow: 0 0 8px var(--mushroom); }
.dot.error { background: var(--loss);       box-shadow: 0 0 8px var(--loss); }

/* ── Main ─────────────────────────────────────────────── */

main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

/* ── Tiles ────────────────────────────────────────────── */

.tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin: 1rem 0 2.5rem;
}

@media (max-width: 640px) {
  .tiles { grid-template-columns: 1fr; }
}

.tile {
  background: var(--bg-tile);
  border: 1px solid rgba(141, 184, 101, 0.15);
  border-radius: 8px;
  padding: 1.5rem 1.5rem 1.25rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto auto;
  grid-template-areas:
    "creature meta     price"
    "creature meta     change"
    "provenance provenance range";
  column-gap: 1.25rem;
  row-gap: 0.4rem;
  align-items: center;
  transition: background 0.2s, transform 0.2s;
}

.tile:hover {
  background: var(--bg-tile-hover);
  transform: translateY(-2px);
}

.creature {
  grid-area: creature;
  align-self: start;
  margin-top: 0.15rem;
  width: 56px;
  height: 56px;
}

.creature img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.2);
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
  display: block;
  opacity: 0;
  transition: opacity 0.4s ease-in;
}

.creature img[src] { opacity: 1; }

/* If logo fails to load, show the broken-image character gracefully */
.creature img:not([src]),
.creature img[alt]:not([src]) {
  opacity: 0.4;
  background: linear-gradient(135deg, var(--bark), var(--bark-light));
}

.meta { grid-area: meta; }

.ticker {
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.05em;
  color: var(--parchment);
}

.name {
  font-size: 0.9rem;
  color: var(--parchment-dim);
}

.lore {
  color: var(--parchment-faint);
  font-style: italic;
}

.price {
  grid-area: price;
  font-size: 1.6rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--parchment);
  text-align: right;
}

.change {
  grid-area: change;
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.change.gain { color: var(--gain); }
.change.loss { color: var(--loss); }
.change.flat { color: var(--parchment-faint); }

.range {
  grid-area: range;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--parchment-faint);
  text-align: right;
}

.range .low::before  { content: "▼ "; color: var(--loss); }
.range .high::before { content: "▲ "; color: var(--gain); margin-left: 0.5rem; }

.provenance {
  grid-area: provenance;
  font-size: 0.75rem;
  color: var(--parchment-faint);
  border-top: 1px dotted rgba(245, 230, 211, 0.1);
  padding-top: 0.5rem;
  margin-top: 0.25rem;
}

/* ── Chart ────────────────────────────────────────────── */

.chart-section {
  background: rgba(15, 36, 25, 0.5);
  border: 1px solid rgba(141, 184, 101, 0.1);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.chart-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--parchment);
  margin-bottom: 0.25rem;
}

.chart-header .hint {
  color: var(--parchment-dim);
  font-size: 0.85rem;
  font-style: italic;
  margin-bottom: 1rem;
}

.chart-wrap {
  position: relative;
  height: 320px;
}

@media (max-width: 640px) {
  .chart-wrap { height: 240px; }
}

.chart-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  color: var(--parchment-faint);
  font-style: italic;
  font-size: 0.9rem;
}

/* ── Source note ──────────────────────────────────────── */

.source-note {
  background: rgba(61, 46, 26, 0.3);
  border-left: 3px solid var(--mushroom);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  color: var(--parchment-dim);
  border-radius: 0 4px 4px 0;
}

/* ── Gated section ────────────────────────────────────── */

.gated-section {
  background: rgba(15, 36, 25, 0.55);
  border: 1px solid rgba(212, 160, 23, 0.25);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.gated-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--parchment);
  margin-bottom: 0.25rem;
}

.gated-header .hint {
  color: var(--parchment-dim);
  font-size: 0.85rem;
  font-style: italic;
  margin-bottom: 1.25rem;
}

.gate-lock {
  text-align: center;
  padding: 1.5rem 1rem;
  background: rgba(61, 46, 26, 0.25);
  border-radius: 6px;
  border: 1px dashed rgba(212, 160, 23, 0.3);
}

.lock-glyph {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.gate-lock h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--parchment);
  margin-bottom: 0.75rem;
}

.gate-lock > p {
  color: var(--parchment-dim);
  font-size: 0.9rem;
  max-width: 540px;
  margin: 0 auto 1.25rem;
}

.connect-btn {
  background: var(--mushroom);
  color: var(--bg-canopy);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.connect-btn:hover:not(:disabled) {
  background: var(--mushroom-soft);
  transform: translateY(-1px);
}

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

.connect-btn .coming-soon {
  font-size: 0.75rem;
  font-weight: 400;
  margin-left: 0.4rem;
  opacity: 0.85;
}

.onboarding {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px dotted rgba(245, 230, 211, 0.15);
}

.onboarding-lead {
  color: var(--parchment-dim);
  font-size: 0.85rem;
  font-style: italic;
  margin-bottom: 0.75rem;
}

.wallet-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  padding: 0;
}

.wallet-links li { display: contents; }

.wallet-links a {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  background: rgba(141, 184, 101, 0.1);
  border: 1px solid rgba(141, 184, 101, 0.25);
  border-radius: 4px;
  color: var(--moss-light);
  font-size: 0.85rem;
  border-bottom: none;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  white-space: nowrap;
}

.wallet-links a:hover,
.wallet-links a:focus-visible {
  background: rgba(141, 184, 101, 0.2);
  color: var(--parchment);
  border-color: var(--moss);
  transform: translateY(-1px);
}

@media (max-width: 480px) {
  .wallet-links { gap: 0.5rem; }
  .wallet-links a { font-size: 0.8rem; padding: 0.45rem 0.7rem; }
}

.link-arrow { margin-left: 0.25rem; opacity: 0.7; }

.onboarding-fineprint {
  color: var(--parchment-faint);
  font-size: 0.72rem;
  font-style: italic;
  margin-top: 0.75rem;
}

/* ── Footer ───────────────────────────────────────────── */

footer {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
  text-align: center;
  border-top: 1px solid rgba(141, 184, 101, 0.1);
  color: var(--parchment-dim);
  font-size: 0.85rem;
}

footer p { margin-top: 0.5rem; }

footer .micro {
  color: var(--parchment-faint);
  font-size: 0.75rem;
  font-style: italic;
  margin-top: 0.75rem;
}
