/* ==========================================================================
   components.css: nav, buttons, crate, status, pips, copy, modal, toast
   ========================================================================== */

/* ---------- Buttons ---------- */
.btn {
  --h: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--h);
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: .9375rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn--sm { --h: 38px; padding: 0 16px; font-size: .875rem; }
.btn--lg { --h: 52px; padding: 0 26px; font-size: 1rem; }

.btn--primary {
  background: var(--ember);
  color: #160800;
  box-shadow: 0 0 0 0 rgba(255, 106, 31, 0), inset 0 -2px 0 rgba(0, 0, 0, .15);
}
.btn--primary:hover {
  background: var(--flame);
  color: #160800;
  box-shadow: 0 8px 30px -8px rgba(255, 106, 31, .55), inset 0 -2px 0 rgba(0, 0, 0, .15);
}

.btn--ghost {
  background: transparent;
  color: var(--snow);
  border-color: var(--line-3);
}
.btn--ghost:hover { border-color: var(--muted); color: var(--snow); background: rgba(255, 255, 255, .03); }

.btn__icon { width: 18px; height: 18px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  background: rgba(6, 8, 12, .82);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s var(--ease);
}
.nav.is-scrolled { border-bottom-color: var(--line); }

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--snow);
  text-decoration: none;
  flex-shrink: 0;
}
.brand:hover { color: var(--snow); }
.brand__logo { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--panel-2); }
.brand__word { font-weight: 600; font-size: 1.0625rem; letter-spacing: -0.02em; }
.brand__ticker {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--muted);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 1px 7px;
}
.brand__sep { color: var(--line-3); }
.brand__product { font-family: var(--font-mono); font-size: .8rem; color: var(--flame); }

.nav__links { margin-left: auto; }
.nav__links ul { display: flex; align-items: center; gap: 2px; }
.nav__links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: .9rem;
  text-decoration: none;
}
.nav__links a:hover { color: var(--snow); background: rgba(255, 255, 255, .04); }
.nav__links a.is-active { color: var(--snow); }
.nav__ext { color: var(--text) !important; }

.nav__right { display: flex; align-items: center; gap: 10px; }
.nav__cta-mobile { display: none; }

.nav__toggle {
  display: none;
  width: 44px; height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: transparent;
  cursor: pointer;
  position: relative;
}
.nav__toggle-bars,
.nav__toggle-bars::before,
.nav__toggle-bars::after {
  position: absolute;
  left: 50%;
  width: 18px; height: 1.5px;
  background: var(--snow);
  transform: translateX(-50%);
  transition: transform .25s var(--ease), opacity .2s;
  content: "";
}
.nav__toggle-bars { top: 50%; }
.nav__toggle-bars::before { top: -6px; }
.nav__toggle-bars::after { top: 6px; }
.nav__toggle[aria-expanded="true"] .nav__toggle-bars { background: transparent; }
.nav__toggle[aria-expanded="true"] .nav__toggle-bars::before { transform: translate(-50%, 6px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] .nav__toggle-bars::after { transform: translate(-50%, -6px) rotate(-45deg); }

@media (max-width: 1080px) {
  .brand__sep, .brand__product { display: none; }
}

@media (max-width: 920px) {
  .nav__toggle { display: inline-block; }
  .nav__right { margin-left: auto; }
  .nav__links {
    position: fixed;
    inset: var(--nav-h) 0 auto 0;
    margin: 0;
    padding: 12px var(--gutter) 24px;
    background: rgba(6, 8, 12, .98);
    border-bottom: 1px solid var(--line);
    display: none;
  }
  .nav__links.is-open { display: block; }
  .nav__links ul { flex-direction: column; align-items: stretch; gap: 0; }
  .nav__links a { min-height: 48px; padding: 0 4px; font-size: 1rem; border-radius: 0; border-bottom: 1px solid var(--line); }
  .nav__cta-mobile { display: inline-flex; width: 100%; margin-top: 18px; }
}

@media (max-width: 520px) {
  .nav__cta { display: none; }
}

/* ---------- Status ---------- */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: .72rem;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
}
.status__icon { font-size: .6rem; line-height: 1; }
.status--locked { color: var(--ice); border-color: #2c3644; background: rgba(174, 189, 205, .05); }

.pending {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ice);
}
.pending::before {
  content: "";
  width: 22px; height: 6px;
  border-radius: 3px;
  background: repeating-linear-gradient(90deg, var(--ice-dim) 0 2px, transparent 2px 4px);
}

/* ---------- Pips (5-step indicator) ---------- */
.pips { display: inline-flex; gap: 4px; vertical-align: middle; }
.pips i {
  display: block;
  width: 14px; height: 6px;
  border-radius: 2px;
  border: 1px solid var(--line-3);
}
.pips i.on { background: var(--flame); border-color: var(--flame); }

/* ---------- Copy chip ---------- */
.copy {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  margin-left: 6px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: .72rem;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
.copy:hover { color: var(--snow); border-color: var(--muted); }
.copy.is-done { color: var(--glow); border-color: var(--ember-2); }

/* ==========================================================================
   The Crate
   A zipped container. Cold and snowing while sealed; embers when filled.
   ========================================================================== */
.crate {
  margin: 0;
  width: 100%;
  max-width: 440px;
  --heat: 0;
  --tint: var(--flame);
}
.crate__shell {
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 30%),
    linear-gradient(180deg, #0f141c, #0a0d13);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .04) inset,
    0 40px 80px -40px rgba(0, 0, 0, .8),
    0 0 calc(var(--heat) * 90px) calc(var(--heat) * -10px) rgba(255, 106, 31, calc(var(--heat) * .35));
  padding-bottom: 14px;
  transition: box-shadow .6s var(--ease);
}

/* zipper track across the top */
.crate__zip {
  position: relative;
  height: 26px;
  margin: 0 18px;
  display: flex;
  align-items: center;
}
.crate__teeth {
  flex: 1;
  height: 8px;
  margin-right: 20px;
  background:
    repeating-linear-gradient(90deg, #2b3340 0 3px, transparent 3px 6px) 0 0 / 100% 4px no-repeat,
    repeating-linear-gradient(90deg, transparent 0 3px, #2b3340 3px 6px) 0 4px / 100% 4px no-repeat;
  border-radius: 2px;
}
.crate__pull {
  position: absolute;
  right: -6px;
  top: 4px;
  width: 34px; height: 26px;
}

.crate__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 18px 10px;
  border-top: 1px dashed var(--line-2);
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.crate__ticker { color: var(--faint); }

.crate__chamber {
  position: relative;
  margin: 0 14px;
  padding: 12px 12px 10px 34px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 70% at 50% 110%, rgba(255, 106, 31, calc(var(--heat) * .32)), transparent 70%),
    #07090d;
  overflow: hidden;
  container-type: inline-size;
}
.crate__chamber::after {
  /* glass rim */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .02), inset 0 18px 30px -20px rgba(174, 189, 205, .12);
  pointer-events: none;
}

.crate__gauge {
  position: absolute;
  left: 8px; top: 12px; bottom: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: .58rem;
  color: var(--ice-dim);
  border-right: 1px solid var(--line);
  padding-right: 4px;
}
.crate__gauge li { line-height: 1; transition: color .4s var(--ease); }
.crate__gauge li.is-reached { color: var(--glow); }

.crate__field {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  font-size: calc((100cqi - 0px) / 24.4);
  line-height: 1.18;
  letter-spacing: .32em;
  white-space: pre;
  color: var(--ice-dim);
  text-align: center;
  user-select: none;
  min-height: 9em;
}
.crate__field span { transition: color .3s; }

/* glyph colour levels */
.g-s0 { color: #2a323d; }       /* snow, far */
.g-s1 { color: #5a6676; }       /* snow, mid */
.g-s2 { color: #aebdcd; }       /* snow, near */
.g-e0 { color: var(--ember-0); }
.g-e1 { color: var(--ember-1); }
.g-e2 { color: var(--ember-2); }
.g-e3 { color: var(--ember); }
.g-e4 { color: var(--flame); }
.g-e5 { color: var(--tint); text-shadow: 0 0 8px rgba(255, 154, 60, .35); }
.g-e6 { color: var(--white-hot); text-shadow: 0 0 10px rgba(255, 201, 120, .5); }

.crate__seal {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ice);
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid #2c3644;
  background: rgba(7, 9, 13, .82);
}

.crate__meta {
  margin: 12px 18px 0;
  display: grid;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: .75rem;
}
.crate__meta > div {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 10px;
  align-items: center;
}
.crate__meta dt { color: var(--faint); }
.crate__meta dd { color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.crate__proof { color: var(--ice) !important; }
.crate__proof span { color: var(--faint); margin-left: 6px; }

/* tints per illustrative class */
.crate[data-class="copper"] { --tint: var(--t-copper); }
.crate[data-class="bronze"] { --tint: var(--t-bronze); }
.crate[data-class="silver"] { --tint: var(--t-silver); }
.crate[data-class="gold"] { --tint: var(--t-gold); }
.crate[data-class="platinum"] { --tint: var(--t-platinum); }

/* ---------- Modal ---------- */
.modal {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  background: var(--panel);
  color: var(--text);
}
.modal::backdrop { background: rgba(3, 4, 6, .72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.modal[open] { animation: modal-in .3s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.modal__inner { padding: 22px 24px 24px; }
.modal__bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.modal h2 { font-size: 1.75rem; margin-bottom: 12px; }
.modal p { color: var(--muted); }
.modal__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

/* ---------- Loading popup ---------- */
.site-loader {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 5, 8, .78);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 1;
  visibility: visible;
  transition: opacity .35s var(--ease), visibility .35s var(--ease);
}
.site-loader[aria-hidden="true"] {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.site-loader__panel {
  width: min(520px, 100%);
  padding: 26px 24px 22px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,0)),
    linear-gradient(180deg, rgba(15, 18, 24, .96), rgba(10, 12, 16, .94));
  box-shadow: 0 30px 80px rgba(0, 0, 0, .48), inset 0 1px 0 rgba(255,255,255,.04);
}
.site-loader__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--flame);
}
.site-loader__badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 0 4px rgba(255, 106, 31, .18);
}
.site-loader__panel h2 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 3vw, 2.5rem);
  letter-spacing: -0.04em;
}
.site-loader__panel p {
  margin: 0;
  color: var(--muted);
  max-width: 38ch;
}
.site-loader__bar {
  position: relative;
  overflow: hidden;
  height: 12px;
  margin-top: 22px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255,255,255,.03);
}
.site-loader__bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ember) 0%, var(--flame) 22%, #ffbb73 100%);
  box-shadow: 0 0 24px rgba(255, 106, 31, .5);
  transition: width .12s linear;
}
.site-loader__meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 80;
  transform: translate(-50%, 20px);
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--snow);
  font-family: var(--font-mono);
  font-size: .8rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast:empty { display: none; }
