/* style.css: ReClaim */

/* ---------------------------------------------------------------
   Colors and basics
   --------------------------------------------------------------- */
:root {
  --paper: #f1f3f8;        /* page background */
  --surface: #ffffff;      /* inputs, list */
  --ink: #1a2350;          /* text */
  --ink-soft: #55608a;     /* hints, secondary text */
  --line: #d3d9e8;         /* borders */
  --cobalt: #2e4bff;       /* main buttons, links */
  --cobalt-dark: #2237cc;
  --signal: #ffc531;       /* the tag, and "Found" */
  --green: #14805e;        /* "Registered" */
  --green-bg: #dcf3ea;
  --danger: #c62f2f;
  --radius: 6px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.55;
}

h1, h2, h3 {
  margin: 0;
  font-family: "Bricolage Grotesque", "Public Sans", system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.08;
  text-wrap: balance;
}

h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); }
h3 { font-size: 1.3rem; }

p { margin: 0; }

a { color: var(--cobalt); }

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


/* ---------------------------------------------------------------
   Top bar
   --------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 32px;
  padding: 14px max(24px, calc((100% - 1040px) / 2 + 24px));
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 26px;
  height: 26px;
}

.nav-links {
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.nav-links button {
  padding: 8px 12px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--ink-soft);
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.nav-links button:hover { color: var(--ink); }

.nav-links button.active {
  color: var(--ink);
  border-bottom-color: var(--cobalt);
}

#connectBtn { margin-left: auto; }

.banner {
  padding: 14px max(24px, calc((100% - 1040px) / 2 + 24px));
  border-bottom: 1px solid #e3aaaa;
  background: #fbe3e3;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.banner.info {
  border-bottom-color: #e6cf85;
  background: #fff3cc;
}

.banner .btn { margin-top: 10px; }

a.btn { text-decoration: none; }

@media (max-width: 600px) {
  .banner { padding: 12px 16px; }
}

#connectBtn.connected:disabled {
  opacity: 1;
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  cursor: default;
}


/* ---------------------------------------------------------------
   Page layout
   --------------------------------------------------------------- */
main {
  flex: 1;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}

.page-section { display: none; }
.page-section.active { display: block; }

.page-section.narrow { max-width: 520px; }

.lead {
  max-width: 46ch;
  margin-top: 14px;
  color: var(--ink-soft);
  font-size: 1.125rem;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.head-actions { display: flex; gap: 8px; }

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
  gap: 56px;
  align-items: start;
}


/* ---------------------------------------------------------------
   Forms and buttons
   --------------------------------------------------------------- */
label {
  display: block;
  margin: 24px 0 6px;
  font-weight: 600;
  font-size: 0.95rem;
}

input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--cobalt);
  box-shadow: 0 0 0 3px rgba(46, 75, 255, 0.2);
}

input[readonly] { background: #e7eaf4; }

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

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

.hint {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.hint.center { text-align: center; }

.wallet-line { margin-top: 12px; overflow-wrap: anywhere; }

label.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  font-weight: 500;
  cursor: pointer;
}

label.check input {
  width: 20px;
  height: 20px;
  accent-color: var(--cobalt);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.btn:hover { background: #e7eaf4; }

.btn.primary {
  background: var(--cobalt);
  border-color: var(--cobalt);
  color: #fff;
}

.btn.primary:hover {
  background: var(--cobalt-dark);
  border-color: var(--cobalt-dark);
}

.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: #fbe3e3; }

.btn.danger-solid {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn.danger-solid:hover { background: #a82424; border-color: #a82424; }

.btn.big { min-height: 50px; padding: 0 26px; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 0.9rem; }

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


/* ---------------------------------------------------------------
   Home (before connecting)
   --------------------------------------------------------------- */
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
  gap: 56px;
  align-items: center;
}

.intro .btn { margin-top: 28px; }

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
  margin: 80px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  padding-top: 14px;
  border-top: 2px solid var(--ink);
  counter-increment: step;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.steps li::before {
  content: counter(step);
  display: block;
  margin-bottom: 8px;
  color: var(--cobalt);
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 800;
  font-size: 2rem;
  line-height: 1;
}

.steps strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 1.05rem;
}


/* ---------------------------------------------------------------
   The tag (the one loud thing on the page)
   --------------------------------------------------------------- */
.tag {
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  padding: 66px 24px 26px;
  background: var(--signal);
  color: var(--ink);
  text-align: center;

  /* cut corners at the top, like a luggage tag */
  clip-path: polygon(30px 0, calc(100% - 30px) 0, 100% 30px, 100% 100%, 0 100%, 0 30px);

  /* punch the hole */
  -webkit-mask: radial-gradient(circle 11px at 50% 34px, transparent 10px, #000 11px);
  mask: radial-gradient(circle 11px at 50% 34px, transparent 10px, #000 11px);
}

.tag-lead {
  text-wrap: balance;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.2;
}

.tag-qr {
  margin-top: 16px;
  padding: 10px;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
}

.tag-qr svg { display: block; width: 100%; height: auto; }

/* before the item is registered there's no code, so no QR yet */
.tag-qr.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border: 2px dashed var(--line);
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.tag-name {
  margin-top: 18px;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.tag-code {
  margin-top: 6px;
  font-weight: 600;
  letter-spacing: 0.08em;
}


/* ---------------------------------------------------------------
   Register page
   --------------------------------------------------------------- */
.code-box {
  margin-top: 28px;
  padding: 16px 18px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--surface);
}

.code-box span { font-size: 0.9rem; color: var(--ink-soft); }

.code-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.code-line:first-child { padding-top: 0; }

.code-box .hint { margin-top: 14px; }

.code-box strong {
  display: block;
  margin: 2px 0 0;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 1.6rem;
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
}


/* ---------------------------------------------------------------
   Item list
   --------------------------------------------------------------- */
.items {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.item {
  padding: 22px 24px 24px 24px;
  border-left: 6px solid var(--green);
}

.item + .item { border-top: 1px solid var(--line); }

.item.found { border-left-color: var(--signal); }

.item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.item-tools {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
}

.item-head h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.item-code {
  margin-top: 4px;
  color: var(--ink-soft);
  font-weight: 500;
  letter-spacing: 0.06em;
}

.item-note {
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.badge {
  padding: 2px 10px;
  border-radius: 999px;
  font-family: "Public Sans", system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0;
}

.badge.registered { background: var(--green-bg); color: var(--green); }
.badge.found { background: var(--signal); color: var(--ink); }

.item-found {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  margin-top: 18px;
}

.details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  margin: 0;
}

.details dt { color: var(--ink-soft); }
.details dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 14px;
}

/* History timeline inside each item */
.history {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.history summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
}

.history-list {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.history-list li {
  position: relative;
  display: grid;
  padding: 0 0 16px 28px;
  font-size: 0.95rem;
}

/* the dot */
.history-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 14px;
  height: 14px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--surface);
}

/* the line that joins the dots */
.history-list li::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 22px;
  bottom: 0;
  width: 2px;
  background: var(--line);
}

.history-list li:last-child { padding-bottom: 0; }
.history-list li:last-child::after { display: none; }

.history-list li.found::before { background: var(--signal); }
.history-list li.returned::before { background: var(--green); border-color: var(--green); }
.history-list li.dismissed::before { background: var(--line); }

.history-list span { color: var(--ink-soft); font-size: 0.875rem; }

.empty {
  padding: 48px 24px;
  text-align: center;
}

.empty p { margin-bottom: 16px; color: var(--ink-soft); }

.items > .hint { padding: 24px; }


/* ---------------------------------------------------------------
   Maps
   --------------------------------------------------------------- */
.map {
  position: relative;
  isolation: isolate;          /* keeps Leaflet's z-indexes inside the map */
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #dfe4f0;
  color: var(--ink-soft);
}

.map.tall { height: 420px; }

.map-row {
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.map-row .hint { margin: 0; }

.map-pin {
  width: 22px;
  height: 22px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: var(--cobalt);
  box-shadow: 0 1px 6px rgba(26, 35, 80, 0.5);
}


/* ---------------------------------------------------------------
   Lookup message under the public code (finder page)
   --------------------------------------------------------------- */
.lookup {
  margin-top: 10px;
  padding: 10px 14px;
  border-left: 4px solid var(--green);
  background: var(--green-bg);
  font-size: 0.95rem;
}

.lookup .details { margin-top: 10px; }

.lookup.warn { border-left-color: var(--signal); background: #fff3cc; }
.lookup.bad { border-left-color: var(--danger); background: #fbe3e3; }


/* ---------------------------------------------------------------
   Toast and dialog
   --------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 2000;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  transform: translateX(-50%);
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-weight: 500;
}

.toast.error { background: var(--danger); }
.toast.success { background: var(--green); }

dialog {
  width: min(92vw, 380px);
  padding: 24px;
  border: 0;
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
}

#confirmDialog h3 { margin-bottom: 10px; }

dialog::backdrop { background: rgba(26, 35, 80, 0.55); }

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}


/* ---------------------------------------------------------------
   Footer (BOT Chain branding)
   --------------------------------------------------------------- */
.site-footer {
  padding: 28px max(24px, calc((100% - 1040px) / 2 + 24px));
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 32px;
}

.footer-brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--ink-soft);
}

.chain-name {
  color: var(--ink);
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.chain-name:hover { text-decoration: underline; }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}

.footer-links a {
  color: var(--ink);
  font-weight: 500;
}

/* ---------------------------------------------------------------
   Printing: only the tag goes on paper
   --------------------------------------------------------------- */
#printArea { display: none; }

@media print {
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block; padding: 24px; }
  .tag {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}


/* ---------------------------------------------------------------
   Smaller screens
   --------------------------------------------------------------- */
@media (max-width: 860px) {
  main { padding-top: 32px; }

  .two-col,
  .intro { grid-template-columns: minmax(0, 1fr); gap: 40px; }

  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 56px; }

  .item-found { grid-template-columns: minmax(0, 1fr); }
  .item-head { flex-wrap: wrap; }

  .map.tall { height: 320px; }
}

@media (max-width: 600px) {
  .site-footer { padding: 24px 16px; }
  .topbar { padding: 12px 16px; gap: 8px 16px; }
  .nav-links { order: 3; width: 100%; }
  .nav-links button { padding: 8px; font-size: 0.9rem; }

  main { padding: 28px 16px 72px; }

  .steps { grid-template-columns: minmax(0, 1fr); }

  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
}

@media (max-width: 400px) {
  .nav-links { gap: 0; }
  .nav-links button { padding: 8px 6px; font-size: 0.85rem; }
}