/* ============================================================
   Scrip — shared visual language
   A ledger for tokens: parchment, ink, wax-seal red, hairline rules.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Source+Serif+4:opsz,wght@8..60,400;8..60,500;8..60,600&display=swap');

:root {
  --paper: #F4F0E6;
  --paper-raised: #FBF8F1;
  --ink: #2B2118;
  --ink-soft: #6B5D4C;
  --gold: #96700F;
  --gold-soft: #B08D3E;
  --seal: #7A2E2E;
  --seal-hover: #662626;
  --rule: #D8CFBA;
  --rule-strong: #B8AC8F;
  --up: #3D6B4C;
  --down: #7A2E2E;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Source Serif 4', serif;
  font-size: 16px;
  line-height: 1.6;
}

h1, h2, h3, .display {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Masthead ---- */

.masthead {
  border-bottom: 3px double var(--ink);
  padding: 20px 24px 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.masthead-title {
  font-family: 'Fraunces', serif;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.masthead-title .seal-dot {
  display: inline-block;
  width: 9px; height: 9px;
  background: var(--seal);
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

.masthead-nav {
  display: flex;
  gap: 22px;
  font-size: 15px;
  align-items: center;
}

.masthead-nav a {
  color: var(--ink-soft);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}
.masthead-nav a:hover, .masthead-nav a.active {
  color: var(--ink);
  border-bottom-color: var(--gold);
  text-decoration: none;
}

/* ---- Buttons ---- */

.btn {
  font-family: 'Source Serif 4', serif;
  font-size: 15px;
  padding: 10px 20px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.15s, color 0.15s;
}
.btn:hover { background: var(--ink); color: var(--paper); }

.btn-primary {
  background: var(--seal);
  border-color: var(--seal);
  color: var(--paper-raised);
}
.btn-primary:hover { background: var(--seal-hover); border-color: var(--seal-hover); }
.btn-primary:disabled { background: var(--rule-strong); border-color: var(--rule-strong); cursor: not-allowed; }

.btn-ghost {
  border-color: var(--rule-strong);
  color: var(--ink-soft);
}
.btn-ghost:hover { background: var(--rule); color: var(--ink); }

/* ---- Ledger rows (token list) ---- */

.ledger {
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

.ledger-header-row {
  display: grid;
  grid-template-columns: 2.4fr 1fr 1fr 1fr;
  gap: 16px;
  padding: 0 16px 10px;
  font-size: 13px;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule-strong);
}

.ledger-row {
  display: grid;
  grid-template-columns: 2.4fr 1fr 1fr 1fr;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--rule);
  transition: background 0.12s;
}
.ledger-row:hover { background: var(--paper-raised); }

.ledger-token-name {
  display: flex;
  align-items: center;
  gap: 12px;
}

.token-logo {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  object-fit: cover;
  background: var(--paper-raised);
  flex-shrink: 0;
}

.token-logo-fallback {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  background: var(--paper-raised);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  color: var(--gold);
  flex-shrink: 0;
}

.ledger-name-text .symbol { font-weight: 600; }
.ledger-name-text .full-name { font-size: 13px; color: var(--ink-soft); }

.mono-figure { font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }

/* ---- Cards / sections (generic paper block) ---- */

.paper-block {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 24px;
}

.section-label {
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

/* ---- Forms ---- */

label {
  display: block;
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

input, select, textarea {
  width: 100%;
  font-family: 'Source Serif 4', serif;
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  background: var(--paper-raised);
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--gold-soft);
  outline-offset: 1px;
}

.field-group { margin-bottom: 20px; }
.field-number {
  font-family: 'Fraunces', serif;
  color: var(--gold);
  font-weight: 600;
  margin-right: 8px;
}

.hint { font-size: 13px; color: var(--ink-soft); margin-top: 6px; }
.error-text { font-size: 13px; color: var(--down); margin-top: 6px; }

/* ---- Utility ---- */

.container { max-width: 880px; margin: 0 auto; padding: 24px; }
.text-center { text-align: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mt-24 { margin-top: 24px; }
.mb-24 { margin-bottom: 24px; }

@media (max-width: 640px) {
  .ledger-header-row, .ledger-row {
    grid-template-columns: 2fr 1fr;
  }
  .ledger-header-row span:nth-child(3),
  .ledger-header-row span:nth-child(4),
  .ledger-row > div:nth-child(3),
  .ledger-row > div:nth-child(4) {
    display: none;
  }
}
