/* ==========================================================================
   Higgspad / Holder Crates : base layer
   Tokens, reset, typography, buttons, header, footer, dialog, toast.
   ========================================================================== */

:root {
  /* Surfaces (Higgspad theme-color #0a0a0b) */
  --bg: #0a0a0b;
  --bg-1: #0e0e10;
  --bg-2: #131316;
  --bg-3: #1a1a1e;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --line-3: rgba(255, 255, 255, 0.22);

  /* Text */
  --text: #f5f5f6;
  --muted: #a8a8b0;
  --dim: #8c8c95;

  /* Signals */
  --live: #5ee08a;
  --pending: #f2c14e;
  --burn: #ff7a45;

  /* Tier tints (always paired with a text label) */
  --copper: #cf835d;
  --bronze: #b4925c;
  --silver: #b9c0ca;
  --gold: #e3bc57;
  --platinum: #e4ecf5;

  /* Shape */
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --pill: 999px;

  /* Type */
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Layout */
  --container: 1200px;
  --gutter: clamp(1.1rem, 3vw, 2rem);
  --header-h: 64px;
  --section-y: clamp(4.5rem, 9vw, 7.5rem);

  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
code { font-family: var(--mono); font-size: .88em; }
[hidden] { display: none !important; }

::selection { background: rgba(255, 255, 255, .9); color: #0a0a0b; }

:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
  border-radius: 6px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 12px; top: -60px;
  z-index: 200;
  padding: 10px 16px;
  background: #fff; color: #0a0a0b;
  border-radius: var(--pill);
  font-weight: 600;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; }

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Icons ---------- */
.i-12 { width: 12px; height: 12px; flex: none; }
.i-14 { width: 14px; height: 14px; flex: none; }
.i-16 { width: 16px; height: 16px; flex: none; }
.i-18 { width: 18px; height: 18px; flex: none; }

/* ---------- Type helpers ---------- */
.mono-label {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: lowercase;
  color: var(--dim);
}
.h3 { font-size: 1.08rem; font-weight: 600; letter-spacing: -.01em; line-height: 1.35; }
.fine { font-size: .82rem; color: var(--dim); line-height: 1.5; }
.text-link {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--line-3);
  text-underline-offset: 3px;
  transition: text-decoration-color .2s;
}
.text-link:hover { text-decoration-color: #fff; }
.break { word-break: break-all; }

/* ---------- Buttons ---------- */
.btn {
  --h: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  min-height: var(--h);
  padding: 0 1.2rem;
  border-radius: var(--pill);
  font-weight: 600;
  font-size: .94rem;
  letter-spacing: -.005em;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: #fff; color: #0a0a0b; }
.btn-primary:hover { background: #e6e6e8; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--line-3); background: rgba(255, 255, 255, .04); }
.btn-sm { --h: 36px; padding: 0 .95rem; font-size: .86rem; }
.btn-lg { --h: 52px; padding: 0 1.5rem; font-size: 1rem; }

/* ---------- Pills & chips ---------- */
.state-pill {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .28rem .65rem;
  border-radius: var(--pill);
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, .03);
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
  white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); flex: none; }
.is-pending .dot { background: var(--pending); box-shadow: 0 0 0 3px rgba(242, 193, 78, .14); animation: pulse 2.4s ease-in-out infinite; }
.is-live .dot, .dot--live { background: var(--live); box-shadow: 0 0 0 3px rgba(94, 224, 138, .14); }
.is-demo .dot { background: transparent; border: 1.5px dashed var(--muted); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

.chip {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .3rem .8rem .3rem .3rem;
  border: 1px solid var(--line-2);
  border-radius: var(--pill);
  font-size: .82rem;
  color: var(--muted);
  background: rgba(255, 255, 255, .02);
}
.chip-new {
  padding: .14rem .5rem;
  border-radius: var(--pill);
  background: #fff;
  color: #0a0a0b;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .02em;
}

/* ---------- Panels ---------- */
.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(255, 255, 255, .01));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(10, 10, 11, .78);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.header-inner { height: 100%; display: flex; align-items: center; gap: 1.5rem; }

.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 600; letter-spacing: -.01em; flex: none; }
.brand-logo { width: 28px; height: 28px; border-radius: 8px; object-fit: cover; background: var(--bg-3); }
.brand-name { font-size: 1rem; }
.brand-sep { color: var(--dim); font-weight: 400; }
.brand-sub { color: var(--muted); font-weight: 500; font-size: .95rem; }

.site-nav { margin-left: auto; }
.nav-list { display: flex; align-items: center; gap: .25rem; }
.nav-list a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 .75rem;
  border-radius: var(--pill);
  color: var(--muted);
  font-size: .9rem;
  font-weight: 500;
  transition: color .2s, background-color .2s;
}
.nav-list a:hover, .nav-list a[aria-current="true"] { color: var(--text); background: rgba(255, 255, 255, .05); }
.nav-ext-mobile { display: none; }

.header-actions { display: flex; align-items: center; gap: .6rem; }
.ext-link {
  display: inline-flex; align-items: center; gap: .3rem;
  color: var(--muted); font-size: .86rem; font-weight: 500;
  padding: 0 .4rem; min-height: 36px;
}
.ext-link:hover { color: var(--text); }
.icon-link {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  color: var(--muted);
  transition: color .2s, border-color .2s;
}
.icon-link:hover { color: var(--text); border-color: var(--line-3); }

.nav-toggle {
  display: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  place-items: center;
}
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
  display: block; width: 16px; height: 1.5px; background: var(--text); border-radius: 2px;
  transition: transform .25s var(--ease), opacity .2s;
}
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -5px; }
.nav-toggle-bars::after { top: 5px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-5px) rotate(-45deg); }

@media (max-width: 1100px) {
  .ext-link { display: none; }
}

@media (max-width: 960px) {
  .nav-toggle { display: inline-grid; }
  .site-nav {
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    margin: 0;
    background: rgba(10, 10, 11, .97);
    border-bottom: 1px solid var(--line);
    padding: .75rem var(--gutter) 1.25rem;
    display: none;
  }
  .site-nav.is-open { display: block; }
  .nav-list { flex-direction: column; align-items: stretch; gap: 2px; }
  .nav-list a { min-height: 48px; padding: 0 .9rem; font-size: 1rem; border-radius: 12px; }
  .nav-ext-mobile { display: block; }
  .nav-ext-mobile:first-of-type { margin-top: .5rem; border-top: 1px solid var(--line); padding-top: .5rem; }
  .header-actions { margin-left: auto; }
}

@media (max-width: 560px) {
  .brand-sub, .brand-sep { display: none; }
  .header-actions .icon-link { display: none; }
  .header-actions .btn-sm { padding: 0 .8rem; font-size: .82rem; }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding-top: 3.5rem; background: var(--bg); }
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 2rem;
  padding-bottom: 2.5rem;
}
.footer-brand p { margin-top: 1rem; max-width: 36ch; color: var(--dim); font-size: .88rem; }
.footer-h { font-size: .78rem; font-family: var(--mono); font-weight: 500; color: var(--dim); letter-spacing: .06em; text-transform: lowercase; margin-bottom: .9rem; }
.footer-col li + li { margin-top: .45rem; }
.footer-col a { color: var(--muted); font-size: .92rem; display: inline-block; padding: .1rem 0; }
.footer-col a:hover { color: var(--text); }
.footer-bottom {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-block: 1.25rem 1.5rem;
  font-size: .82rem; color: var(--dim);
}
.footer-bottom a { color: var(--muted); }
.footer-bottom a:hover { color: var(--text); }
.footer-bottom .net { display: inline-flex; align-items: center; gap: .5rem; font-family: var(--mono); font-size: .75rem; }

@media (max-width: 860px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 420px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* ---------- Dialog ---------- */
.dialog {
  width: min(460px, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  background: var(--bg-2);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.dialog::backdrop { background: rgba(0, 0, 0, .65); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.dialog[open] { animation: dialogIn .25s var(--ease); }
@keyframes dialogIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.dialog-inner { padding: 1.5rem; }
.dialog-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.dialog-close { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); }
.dialog-close:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.dialog-title { font-size: 1.4rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; margin-bottom: .75rem; }
.dialog p { color: var(--muted); }
.dialog p + p { margin-top: .75rem; }
.dialog-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.5rem; flex-wrap: wrap; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%; bottom: 24px;
  transform: translate(-50%, 20px);
  padding: .65rem 1rem;
  background: #fff; color: #0a0a0b;
  border-radius: var(--pill);
  font-size: .88rem; font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
  z-index: 300;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Mobile sticky CTA ---------- */
.mobile-cta { display: none; }
@media (max-width: 720px) {
  .mobile-cta {
    display: block;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 90;
    padding: .75rem var(--gutter) calc(.75rem + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(10, 10, 11, 0), rgba(10, 10, 11, .95) 35%);
    transform: translateY(110%);
    transition: transform .3s var(--ease);
  }
  .mobile-cta .btn { width: 100%; }
  .mobile-cta.is-on { transform: none; }
  .toast { bottom: 88px; }
}

/* ---------- Reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}
