/* ============================================================================
   uCURRENCIES — The Currency Foundry
   A bureau-of-engraving aesthetic: cream banknote paper, green-black ink,
   gold foil hairlines, guilloche rosettes, serial plates, engraved rules.
   Fraunces (display) · Archivo (UI) · Spline Sans Mono (numerals)
   ========================================================================== */

:root {
  --paper: #f6f1e5;
  --paper-hi: #fbf7ee;
  --paper-lo: #ede6d2;
  --ink: #12271d;
  --ink-2: #274b3b;
  --ink-soft: rgba(18, 39, 29, 0.62);
  --ink-faint: rgba(18, 39, 29, 0.38);
  --rule: rgba(18, 39, 29, 0.22);
  --rule-faint: rgba(18, 39, 29, 0.12);
  --gold: #a57f24;
  --gold-hi: #c8a03a;
  --gold-soft: rgba(165, 127, 36, 0.32);
  --seal: #8c2f1f;          /* oxidized red ink: errors, warnings */
  --seal-soft: rgba(140, 47, 31, 0.12);
  --verd: #1d5c3f;          /* confirmation green ink */
  --verd-soft: rgba(29, 92, 63, 0.12);
  --shadow-plate: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 10px 28px -18px rgba(18, 39, 29, 0.55);
  --font-display: "Fraunces", "Times New Roman", serif;
  --font-ui: "Archivo", "Helvetica Neue", sans-serif;
  --font-mono: "Spline Sans Mono", "Courier New", monospace;
  --measure: 72rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(165, 127, 36, 0.07), transparent 60%),
    radial-gradient(900px 420px at -10% 8%, rgba(18, 39, 29, 0.05), transparent 55%),
    var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--gold-soft); color: var(--ink); }

a { color: var(--ink-2); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--gold); }

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

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.06; margin: 0; }

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

/* ============================================================================
   Masthead
   ========================================================================== */

.perf-strip {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 1.4rem;
  border-bottom: 1px dashed var(--rule);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: var(--paper-hi);
}

.perf-strip .dot { color: var(--gold); }

.masthead {
  border-bottom: 3px double var(--ink);
  background: linear-gradient(var(--paper-hi), var(--paper));
}

.masthead-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.1rem 1.4rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 1.6rem;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 0.85rem; text-decoration: none; color: var(--ink); }

.brand-rosette { width: 52px; height: 52px; flex: none; }
.brand-rosette .slow-spin { transform-origin: 50% 50%; animation: spin 160s linear infinite; }

.brand-name {
  font-family: var(--font-display);
  font-size: 1.42rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1;
}
.brand-name .u { color: var(--gold); }

.brand-sub {
  margin-top: 0.28rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.mast-nav { display: flex; gap: 0.2rem; margin-left: auto; flex-wrap: wrap; }

.mast-nav a {
  position: relative;
  display: block;
  padding: 0.55rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
  border: 1px solid transparent;
}

.mast-nav a:hover { color: var(--ink); }

.mast-nav a[aria-current] {
  color: var(--ink);
  border-color: var(--ink);
  background: var(--paper-hi);
  box-shadow: 0 0 0 3px var(--paper-hi), 0 0 0 4px var(--gold-soft);
}

.mast-bar-slot { width: 100%; order: 5; }
@media (min-width: 1060px) {
  .mast-bar-slot { width: auto; order: 0; margin-left: auto; }
  .mast-nav { margin-left: 0; }
}

@media (max-width: 720px) {
  .masthead-inner { gap: 0.8rem; padding-top: 0.9rem; }
  .mast-nav a { padding: 0.45rem 0.55rem; letter-spacing: 0.09em; }
  .plate-rosette { width: 300px; height: 300px; right: -120px; }
  .specimen { right: 4%; top: 1.2rem; }
  .ledger { padding: 1.8rem 1rem 3rem; }
  .card { padding: 1.2rem 1.1rem 1.3rem; }
  .section-note { display: none; }
}

/* ============================================================================
   The wallet bar (dapp.js builds its contents into #ucur-bar)
   ========================================================================== */

#ucur-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  flex-wrap: wrap;
}

#ucur-bar select,
#ucur-bar button,
#ucur-bar .ucur-dim,
#ucur-bar a { font-size: 0.74rem !important; }

#ucur-bar select {
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  padding: 0.42rem 0.6rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper-hi);
  color: var(--ink);
  cursor: pointer;
}

#ucur-bar button {
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.46rem 0.9rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: var(--paper-hi);
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}

#ucur-bar button:hover:not(:disabled) { box-shadow: 0 0 0 2px var(--gold-soft); }
#ucur-bar button:active:not(:disabled) { transform: translateY(1px); }
#ucur-bar button:disabled { opacity: 0.5; cursor: default; }
#ucur-bar a { font-family: var(--font-mono); }
#ucur-bar .ucur-dim { font-family: var(--font-mono); color: var(--ink-soft); }

/* ============================================================================
   Hero — the engraved plate
   ========================================================================== */

.plate {
  position: relative;
  border-bottom: 1px solid var(--rule);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 40%),
    var(--paper);
  overflow: hidden;
}

.plate::after {          /* hairline guilloche wash */
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(115deg, var(--rule-faint) 0 1px, transparent 1px 9px);
  opacity: 0.55;
  pointer-events: none;
}

.plate-rosette {
  position: absolute;
  right: -140px;
  top: 50%;
  width: 460px;
  height: 460px;
  transform: translateY(-50%);
  opacity: 0.5;
  pointer-events: none;
}

.plate-inner {
  position: relative;
  z-index: 1;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3.4rem 1.4rem 3rem;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.1rem;
}
.kicker::before { content: ""; width: 2.2rem; height: 1px; background: var(--gold); }

.plate h1 {
  font-size: clamp(2.5rem, 6vw, 4.2rem);
  font-weight: 640;
  letter-spacing: -0.015em;
  max-width: 18ch;
  font-variation-settings: "opsz" 100;
}

.plate h1 em {
  font-style: italic;
  color: var(--ink-2);
}

.plate-sub {
  margin: 1.2rem 0 0;
  max-width: 56ch;
  color: var(--ink-soft);
  font-size: 1.02rem;
}

.specimen {
  position: absolute;
  z-index: 0;
  right: 8%;
  top: 2.2rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: transparent;
  -webkit-text-stroke: 1px var(--rule);
  transform: rotate(-7deg);
  pointer-events: none;
  user-select: none;
}

/* ============================================================================
   Ledger layout + engraved cards
   ========================================================================== */

.ledger {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.6rem 1.4rem 4rem;
  display: grid;
  gap: 1.6rem;
}

.ledger > * { min-width: 0; }   /* grid items must not size to wide tables */

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 0.55rem;
  border-bottom: 3px double var(--ink);
  margin-bottom: 1.2rem;
}

.section-head h2 {
  font-size: 1.28rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.section-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--gold);
}

.section-note {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--ink-soft);
  max-width: 38ch;
  text-align: right;
}

.card {
  position: relative;
  background: var(--paper-hi);
  border: 1px solid var(--ink);
  box-shadow: var(--shadow-plate);
  padding: 1.6rem 1.7rem 1.7rem;
}

.card::before {   /* engraved inner rule */
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid var(--rule);
  pointer-events: none;
}

.card > * { position: relative; }

.card-corner {
  position: absolute;
  top: -1px;
  right: -1px;
  padding: 0.28rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--paper-hi);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem; }
@media (max-width: 880px) { .grid-2 { grid-template-columns: 1fr; } }

/* ============================================================================
   Forms — ruled entries
   ========================================================================== */

.field { margin-bottom: 1.25rem; }

.field-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 0.4rem;
}

.field-hint {
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--ink-faint);
  font-size: 0.72rem;
  text-align: right;
}

input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 0.62rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--paper);
  border: none;
  border-bottom: 2px solid var(--ink-2);
  border-radius: 0;
  transition: border-color 0.12s ease, background 0.12s ease;
}

input:focus, select:focus {
  outline: none;
  border-bottom-color: var(--gold);
  background: var(--paper-hi);
}

input::placeholder { color: var(--ink-faint); }

select { cursor: pointer; }

.inline-controls { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

.check-line {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}
.check-line input { width: auto; accent-color: var(--ink-2); }

/* ============================================================================
   Buttons — the stamp
   ========================================================================== */

.stamp {
  display: inline-block;
  padding: 0.85rem 1.7rem;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  color: var(--paper-hi);
  background: var(--ink);
  border: 1px solid var(--ink);
  box-shadow: 0 0 0 3px var(--paper-hi), 0 0 0 4px var(--gold-soft), 0 6px 16px -10px rgba(18, 39, 29, 0.8);
  cursor: pointer;
  transition: transform 0.07s ease, box-shadow 0.07s ease, background 0.12s ease;
}

.stamp:hover:not(:disabled) { background: var(--ink-2); }

.stamp:active:not(:disabled) {
  transform: translateY(2px) scale(0.985);
  box-shadow: 0 0 0 3px var(--paper-hi), 0 0 0 4px var(--gold-soft), 0 2px 6px -6px rgba(18, 39, 29, 0.9);
}

.stamp:disabled { opacity: 0.45; cursor: default; }

.stamp-ghost {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--ink-2);
  border-radius: 0;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.stamp-ghost:hover:not(:disabled) { background: var(--ink-2); color: var(--paper-hi); }
.stamp-ghost:disabled { opacity: 0.45; cursor: default; }

/* ============================================================================
   Status plates (txTrack / validation output)
   ========================================================================== */

.status {
  margin-top: 0.9rem;
  padding: 0.7rem 0.9rem;
  font-size: 0.88rem;
  line-height: 1.45;
  border-left: 3px solid var(--gold);
  background: rgba(165, 127, 36, 0.07);
  min-height: 1.2rem;
  overflow-wrap: anywhere;
}

.status a { font-family: var(--font-mono); font-size: 0.82rem; }

.dust-note {
  margin-top: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  overflow-wrap: anywhere;
}

/* quote readout rows */
.ledger-rows { margin-top: 1.1rem; }

.ledger-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.4rem;
  padding: 0.55rem 0.2rem;
  border-bottom: 1px solid var(--rule-faint);
  font-size: 0.92rem;
}

.ledger-row dt {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.ledger-row dd {
  margin: 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  text-align: right;
  overflow-wrap: anywhere;
}

/* ============================================================================
   Registry table (market)
   ========================================================================== */

.registry-wrap { overflow-x: auto; }

table.registry {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

table.registry th {
  padding: 0.55rem 0.7rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: left;
  color: var(--ink-soft);
  border-bottom: 3px double var(--ink);
}

table.registry td {
  padding: 0.62rem 0.7rem;
  border-bottom: 1px solid var(--rule-faint);
  vertical-align: top;
}

table.registry tbody tr:hover { background: rgba(165, 127, 36, 0.06); }

table.registry td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.tok-sym { font-family: var(--font-display); font-weight: 700; letter-spacing: 0.04em; }
.tok-name { color: var(--ink-soft); }
.tok-creator { font-family: var(--font-mono); font-size: 0.68rem; color: var(--ink-faint); }

.badge {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 1px solid var(--ink-2);
  color: var(--ink-2);
}

.market-foot {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.market-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}

/* wallet chips (convert/manage sections render plain divs into #div1) */
#div1 { display: flex; flex-wrap: wrap; gap: 0.6rem; }
#div1 > div {
  border: 1px solid var(--rule);
  background: var(--paper);
  padding: 0.55rem 0.8rem;
  font-size: 0.85rem;
}
#div1 > div > div { color: var(--ink-faint); font-size: 0.75rem; }
#div1 a { font-family: var(--font-mono); }

/* session history (manage) */
#manageHistory > div {
  display: flex;
  gap: 0.8rem;
  align-items: baseline;
  padding: 0.45rem 0.2rem;
  border-bottom: 1px solid var(--rule-faint);
  font-size: 0.85rem;
}
#manageHistory a { font-family: var(--font-mono); font-size: 0.8rem; }

/* ============================================================================
   Footer — the counterfoil
   ========================================================================== */

.counterfoil {
  border-top: 3px double var(--ink);
  background: var(--paper-lo);
  margin-top: 2rem;
}

.counterfoil-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2rem 1.4rem 2.6rem;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
  font-size: 0.82rem;
}

@media (max-width: 760px) { .counterfoil-inner { grid-template-columns: 1fr; } }

.counterfoil h3 {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-family: var(--font-ui);
  margin-bottom: 0.7rem;
  color: var(--ink-soft);
}

.counterfoil ul { list-style: none; margin: 0; padding: 0; }
.counterfoil li { margin-bottom: 0.4rem; }
.counterfoil a { text-decoration: none; }
.counterfoil a:hover { text-decoration: underline; }

.fine-print {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.4rem 2.2rem;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

.serial {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

/* ============================================================================
   Modal (create success)
   ========================================================================== */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(18, 39, 29, 0.55);
  align-items: center;
  justify-content: center;
  padding: 1.4rem;
}

.modal .modal-content {
  position: relative;
  max-width: 30rem;
  width: 100%;
  background: var(--paper-hi);
  color: var(--ink);
  border: 1px solid var(--ink);
  box-shadow: 0 0 0 5px var(--paper-hi), 0 0 0 6px var(--gold-soft), 0 30px 60px -30px rgba(0, 0, 0, 0.6);
  padding: 1.8rem 1.9rem;
  text-align: center;
  font-size: 1rem;
}

.modal .modal-content a { font-family: var(--font-mono); font-size: 0.85rem; }

.modal .close {
  position: absolute;
  top: 0.4rem;
  right: 0.7rem;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-soft);
  background: none;
  border: none;
}
.modal .close:hover { color: var(--seal); }

/* ============================================================================
   Motion — the press run
   ========================================================================== */

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin { to { transform: rotate(360deg); } }

.press-run > * { animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.press-run > *:nth-child(1) { animation-delay: 0.02s; }
.press-run > *:nth-child(2) { animation-delay: 0.09s; }
.press-run > *:nth-child(3) { animation-delay: 0.16s; }
.press-run > *:nth-child(4) { animation-delay: 0.23s; }
.press-run > *:nth-child(5) { animation-delay: 0.30s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* print: it IS a banknote, after all */
@media print {
  body::before, .plate-rosette, .specimen { display: none; }
  .mast-nav, .counterfoil form { display: none; }
  body { background: #fff; }
  .card { box-shadow: none; }
}
