/* ==========================================================================
   Components: buttons, chips, header, the Crate, bracket cards, ticket,
   dialog, mobile CTA bar
   ========================================================================== */

/* ---------- Buttons (pill shapes match the Leverage Pad site) ---------- */
.btn {
  --btn-bg: var(--ink);
  --btn-fg: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 12px 24px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease),
    background-color 0.25s var(--ease), border-color 0.25s var(--ease), color 0.25s var(--ease);
}
.btn svg { width: 14px; height: 14px; flex: none; transition: transform 0.3s var(--ease); }
.btn:hover svg { transform: translate(2px, -2px); }
.btn:active { transform: scale(0.97); }

.btn-sm { min-height: 40px; padding: 10px 20px; font-size: 0.8125rem; }
.btn-lg { min-height: 52px; padding: 16px 30px; font-size: 0.9375rem; }

.btn-ink { box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12); }
.btn-ink:hover { background: #000; box-shadow: 0 10px 30px rgba(5, 150, 105, 0.25); }

.btn-ghost {
  --btn-bg: rgba(255, 255, 255, 0.4);
  --btn-fg: var(--green);
  border-color: rgba(5, 150, 105, 0.3);
  backdrop-filter: blur(6px);
}
.btn-ghost:hover { --btn-bg: rgba(255, 255, 255, 0.85); border-color: var(--green); }

.btn-mint { --btn-bg: var(--mint); --btn-fg: #000; }
.btn-mint:hover { --btn-bg: var(--mint-bright); box-shadow: 0 0 0 6px rgba(48, 220, 175, 0.14); }

.btn-outline-mint {
  --btn-bg: transparent;
  --btn-fg: var(--mint);
  border-color: rgba(48, 220, 175, 0.4);
}
.btn-outline-mint:hover { border-color: var(--mint); --btn-bg: rgba(48, 220, 175, 0.08); }

.btn-text {
  --btn-bg: transparent;
  --btn-fg: var(--on-dark-muted);
  padding-inline: 12px;
}
.btn-text:hover { --btn-fg: var(--on-dark); }

/* Square mint block button, as in the site's closing CTA */
.btn-block-mint {
  --btn-bg: var(--mint);
  --btn-fg: #000;
  border-radius: 0;
  min-height: 60px;
  padding: 20px 40px;
  font-size: 1.0625rem;
}
.btn-block-mint:hover { --btn-bg: var(--mint-bright); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.2s, transform 0.2s var(--ease);
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { border-color: var(--ink); transform: translateY(-1px); }

/* ---------- Chip ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid rgba(5, 150, 105, 0.3);
  border-radius: var(--r-pill);
  background: rgba(5, 150, 105, 0.06);
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.chip svg { width: 14px; height: 14px; }

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background-color 0.3s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); background: rgba(255, 255, 255, 0.88); }

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  flex: none;
}
.brand-mark { width: 28px; height: 28px; }
.brand-word { font-size: 1.3125rem; letter-spacing: -0.04em; line-height: 1; white-space: nowrap; }
.brand-word b { font-weight: 600; }
.brand-word span { font-weight: 300; color: var(--green); }
.brand-tag {
  margin-left: 4px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.primary-nav { margin-inline: auto; }
.primary-nav ul { display: flex; gap: 34px; }
.primary-nav a {
  position: relative;
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--ink);
  padding-block: 8px;
}
.primary-nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease);
}
.primary-nav a:hover::after,
.primary-nav a[aria-current="true"]::after { transform: scaleX(1); }

.header-actions { display: flex; align-items: center; gap: 10px; flex: none; }

.menu-toggle {
  display: none;
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  place-items: center;
}
.menu-toggle span,
.menu-toggle span::before {
  display: block;
  width: 16px; height: 1.5px;
  background: var(--ink);
  transition: transform 0.3s var(--ease);
}
.menu-toggle span { position: relative; transform: translateY(-3px); }
.menu-toggle span::before { content: ""; position: absolute; top: 6px; }
.menu-toggle[aria-expanded="true"] span { transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] span::before { transform: translateY(-6px) rotate(-90deg); }

@media (max-width: 1080px) {
  .brand-tag { display: none; }
  .primary-nav ul { gap: 22px; }
}

@media (max-width: 900px) {
  .menu-toggle { display: grid; }
  .header-actions .icon-btn { display: none; }
  .primary-nav {
    position: fixed;
    inset: var(--header-h) 0 auto;
    margin: 0;
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 20px;
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0s linear 0.25s;
  }
  .primary-nav.is-open { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }
  .primary-nav ul { flex-direction: column; gap: 0; }
  .primary-nav a { display: block; padding-block: 14px; font-size: 1.125rem; border-bottom: 1px solid var(--line); }
  .primary-nav a::after { display: none; }
}

@media (max-width: 420px) {
  .header-actions .btn { padding-inline: 14px; }
  .brand-word { font-size: 1.125rem; }
}

/* ==========================================================================
   The Holder Crate
   The Leverage Pad bracket mark, used as a frame around a grid of cells.
   Size stacks cells; time sets them from forest to mint.
   ========================================================================== */
.crate {
  --bracket: var(--mint);
  --gap: clamp(3px, 0.6vw, 6px);
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--night);
  color: var(--on-dark);
  overflow: hidden;
  isolation: isolate;
}

.crate-head,
.crate-foot {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--on-dark-muted);
}
.crate-head { border-bottom: 1px solid var(--panel-line); }
.crate-foot { border-top: 1px solid var(--panel-line); flex-wrap: wrap; }

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border: 1px solid rgba(48, 220, 175, 0.35);
  color: var(--mint);
  letter-spacing: 0.08em;
}
.status-chip .dot {
  width: 6px; height: 6px;
  background: var(--mint);
  animation: blink 2.4s steps(2, jump-none) infinite;
}
.status-chip--muted { border-color: var(--panel-line); color: var(--on-dark-muted); }
.status-chip--muted .dot { background: var(--on-dark-muted); animation: none; }

@keyframes blink { 50% { opacity: 0.25; } }

.crate-body {
  position: relative;
  aspect-ratio: 1 / 1;
  margin: clamp(16px, 3vw, 28px);
}

/* Bracket corners: the official mark's geometry, recoloured per state */
.br {
  position: absolute;
  z-index: 2;
  width: 25%;
  aspect-ratio: 1;
  background: var(--bracket);
  -webkit-mask: url("../assets/img/bracket-corner.svg") center / contain no-repeat;
  mask: url("../assets/img/bracket-corner.svg") center / contain no-repeat;
  transition: translate 0.8s var(--ease), background-color 0.6s var(--ease), opacity 0.6s;
}
.br-tl { top: 0; left: 0; }
.br-tr { top: 0; right: 0; transform: scaleX(-1); }
.br-bl { bottom: 0; left: 0; transform: scaleY(-1); }
.br-br { bottom: 0; right: 0; transform: scale(-1, -1); }

/* Locked-on: brackets tighten when the user reaches for the CTA */
.is-locking .br-tl { translate: 10% 10%; }
.is-locking .br-tr { translate: -10% 10%; }
.is-locking .br-bl { translate: 10% -10%; }
.is-locking .br-br { translate: -10% -10%; }
.is-locking .br { background-color: var(--mint-bright); }

/* Opened: brackets part outward */
.is-open .br-tl { translate: -22% -22%; }
.is-open .br-tr { translate: 22% -22%; }
.is-open .br-bl { translate: -22% 22%; }
.is-open .br-br { translate: 22% 22%; }

.crate-grid {
  position: absolute;
  inset: 13%;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(var(--cols, 8), 1fr);
  grid-template-rows: repeat(var(--rows, 8), 1fr);
  gap: var(--gap);
}

.cell {
  border-radius: var(--r-cell);
  background: var(--cell-0);
  transition: background-color 0.5s var(--ease), transform 0.5s var(--ease), opacity 0.5s var(--ease);
}
.cell[data-l="1"] { background: var(--cell-1); }
.cell[data-l="2"] { background: var(--cell-2); }
.cell[data-l="3"] { background: var(--cell-3); }
.cell[data-l="4"] { background: var(--cell-4); }
.cell[data-l="5"] { background: var(--cell-5); }
.cell.is-peek { background: var(--cell-3); }
.cell.is-sold { background: var(--cell-sold); transform: scale(0.6); opacity: 0; transition-duration: 0.9s; }

/* Seal overlay */
.crate-seal {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  text-align: center;
  pointer-events: none;
}
.seal-lock {
  display: grid;
  place-items: center;
  width: 56px; height: 56px;
  background: var(--night);
  border: 1px solid rgba(48, 220, 175, 0.5);
  color: var(--mint);
  box-shadow: 0 0 0 8px rgba(0, 0, 0, 0.55), 0 0 40px rgba(48, 220, 175, 0.25);
}
.seal-lock svg { width: 22px; height: 22px; }
.seal-text {
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.78);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--on-dark);
}

/* Scan line sweeping the sealed Crate */
.crate-scan {
  position: absolute;
  inset: 13%;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}
.crate-scan::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 30%;
  background: linear-gradient(180deg, transparent, rgba(48, 220, 175, 0.16) 85%, rgba(48, 220, 175, 0.5));
  transform: translateY(-110%);
  animation: scan 5.5s var(--ease) infinite;
}
@keyframes scan {
  0% { transform: translateY(-110%); }
  55%, 100% { transform: translateY(340%); }
}

.grad-strip {
  display: block;
  height: 4px;
  background: var(--grad-strip);
  flex: none;
}

/* Tier ticks inside a Crate */
.tier-ticks { display: flex; gap: 4px; flex: 1 1 auto; min-width: 0; }
.tier-ticks li {
  flex: 1;
  min-width: 0;
  padding-top: 8px;
  border-top: 2px solid rgba(255, 255, 255, 0.12);
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  color: rgba(244, 241, 234, 0.4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: border-color 0.5s var(--ease), color 0.5s var(--ease);
}
.tier-ticks li.is-on { border-top-color: var(--tc, var(--mint)); color: var(--on-dark); }
.tier-ticks li.is-current { color: var(--tc, var(--mint)); }

/* Redaction bar for hidden values */
.redact {
  display: inline-block;
  vertical-align: middle;
  width: var(--w, 88px);
  height: 12px;
  background:
    repeating-linear-gradient(135deg, rgba(48, 220, 175, 0.24) 0 4px, rgba(48, 220, 175, 0.06) 4px 8px);
  background-size: 200% 100%;
  animation: redact 6s linear infinite;
}
@keyframes redact { to { background-position: -113px 0; } }

/* ---------- Bracket card (crop-mark corners, as on the site's feature cards) ---------- */
.bracket-card {
  --c: var(--ink);
  --l: 18px;
  --w: 1.5px;
  position: relative;
  padding: 28px;
  background:
    linear-gradient(var(--c), var(--c)) top left / var(--l) var(--w) no-repeat,
    linear-gradient(var(--c), var(--c)) top left / var(--w) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) top right / var(--l) var(--w) no-repeat,
    linear-gradient(var(--c), var(--c)) top right / var(--w) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / var(--l) var(--w) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / var(--w) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / var(--l) var(--w) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / var(--w) var(--l) no-repeat;
}
.bracket-card--dark { --c: rgba(244, 241, 234, 0.5); }

/* ---------- Ticket: the desk's order-panel pattern, applied to a Crate ---------- */
.ticket {
  background: var(--night);
  color: var(--on-dark);
  border: 1px solid var(--panel-line);
  display: flex;
  flex-direction: column;
}
/* Stop the "Open Your Crate" scroll a little above the ticket */
#open-crate { scroll-margin-top: 80px; }
.ticket-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--panel-line);
}
.ticket-head h3 {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mint);
}
.ticket-rows { padding: 8px 22px; }
.ticket-rows div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px dashed var(--panel-line);
  font-size: 0.875rem;
}
.ticket-rows div:last-child { border-bottom: 0; }
.ticket-rows dt { color: var(--on-dark-muted); }
.ticket-rows dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.ticket-rows .state-off { color: rgba(244, 241, 234, 0.45); }
.ticket-tiers { display: flex; gap: 3px; }
.ticket-tiers span {
  width: 18px; height: 6px;
  background: rgba(255, 255, 255, 0.12);
}
.ticket-cta { padding: 8px 22px 22px; display: grid; gap: 14px; }
.ticket-cta .btn { width: 100%; }
.ticket-note { font-size: 0.75rem; color: var(--on-dark-muted); line-height: 1.5; }

/* ---------- Placeholder wallet dialog ---------- */
.wallet-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--panel-line);
  background: var(--night);
  color: var(--on-dark);
}
.wallet-dialog::backdrop { background: rgba(3, 31, 23, 0.72); backdrop-filter: blur(4px); }
.wallet-dialog[open] { animation: dialog-in 0.4s var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.dialog-body { padding: 28px; display: grid; gap: 16px; }
.dialog-body .crate-mini { width: 64px; }
.dialog-body h2 { font-size: 1.75rem; }
.dialog-body p { color: var(--on-dark-muted); font-size: 0.9375rem; }
.dialog-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

/* ---------- Mini crate (tiers, steps, dialog) ---------- */
.crate-mini {
  --bracket: var(--mint);
  position: relative;
  aspect-ratio: 1;
  width: 72px;
  flex: none;
}
.crate-mini .br { width: 32%; }
.crate-mini .crate-grid { inset: 16%; gap: 2px; }
.crate-mini .cell { border-radius: 1px; }

/* ---------- Mobile sticky CTA ---------- */
.mobile-cta {
  position: fixed;
  left: 12px; right: 12px; bottom: 12px;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 10px 18px;
  background: var(--night);
  color: var(--on-dark);
  border: 1px solid var(--panel-line);
  border-radius: var(--r-pill);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  font-size: 0.8125rem;
  transform: translateY(140%);
  transition: transform 0.45s var(--ease);
}
.mobile-cta.is-visible { transform: none; }
@media (max-width: 720px) { .mobile-cta { display: flex; } }
