/* ===========================================================================
   22 Million in 3 Hours
   The page is a broadcast graphics layer sitting on a live feed: rails pinned
   to the edges, one enormous clock in the middle, nothing floating in between.
   =========================================================================== */

:root {
  --ink:    #07090C;
  --bone:   #F2EDE3;
  --gold:   #E8B33C;
  --tape:   #C8412F;
  --jade:   #2FA36B;

  --smoke:  rgba(242, 237, 227, 0.58);
  --hair:   rgba(242, 237, 227, 0.16);
  --pane:   rgba(7, 9, 12, 0.44);

  /* The accent the clock, gauge and status all inherit. Flipped to --tape
     in the final minutes so the whole overlay changes character at once. */
  --live:   var(--gold);

  --rail-y: clamp(0.9rem, 2.4vh, 1.6rem);
  --rail-x: clamp(1rem, 3.6vw, 2.75rem);

  --ease: cubic-bezier(0.22, 0.68, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--ink);
  color: var(--bone);
  font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body.is-alert { --live: var(--tape); }

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

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

/* ── Background feed ─────────────────────────────────────────────────────
   object-fit: cover on a square source fills both a 21:9 monitor and a tall
   phone; the subject sits dead centre in the source so nothing important is
   lost at either extreme. */

.feed {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--ink);
}

.feed__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.feed__scrim {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 85% at 50% 45%, rgba(7,9,12,0.30) 0%, rgba(7,9,12,0.66) 60%, rgba(7,9,12,0.90) 100%),
    linear-gradient(to bottom, rgba(7,9,12,0.78) 0%, rgba(7,9,12,0.10) 24%, rgba(7,9,12,0.10) 62%, rgba(7,9,12,0.88) 100%);
}

/* Fine horizontal comb, like a clock burned into a live broadcast. */
.feed__grain {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(242,237,227,0.035) 0px,
    rgba(242,237,227,0.035) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
  opacity: 0.7;
}

/* ── Entry gate ──────────────────────────────────────────────────────── */

.gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 2rem;
  text-align: center;
  background: rgba(7, 9, 12, 0.78);
  backdrop-filter: blur(14px) saturate(0.8);
  -webkit-backdrop-filter: blur(14px) saturate(0.8);
  transition: opacity 0.5s var(--ease), visibility 0.5s;
}

body:not(.is-locked) .gate {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.gate__inner { max-width: 30rem; }

.gate__mark {
  width: clamp(84px, 18vw, 112px);
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--hair);
}

.gate__title {
  margin: 1.4rem 0 0;
  font-family: 'Big Shoulders Display', 'Archivo', sans-serif;
  font-weight: 800;
  font-size: clamp(3rem, 13vw, 5.25rem);
  line-height: 0.86;
  letter-spacing: 0.005em;
  color: var(--bone);
}

.gate__line {
  margin: 1rem 0 2rem;
  color: var(--smoke);
  font-size: 1rem;
}

.gate__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
}

.btn {
  font: inherit;
  font-weight: 600;
  padding: 0.78rem 1.5rem;
  border-radius: 2px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.btn--gold {
  background: var(--gold);
  color: var(--ink);
}
.btn--gold:hover { background: #F2C455; }

.btn--ghost {
  background: transparent;
  color: var(--bone);
  border-color: var(--hair);
}
.btn--ghost:hover { border-color: var(--smoke); }

/* ── Overlay shell ───────────────────────────────────────────────────── */

.hud {
  position: relative;
  z-index: 10;
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding:
    calc(var(--rail-y) + env(safe-area-inset-top))
    calc(var(--rail-x) + env(safe-area-inset-right))
    calc(var(--rail-y) + env(safe-area-inset-bottom))
    calc(var(--rail-x) + env(safe-area-inset-left));
}

.rail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex: 0 0 auto;
}

/* ── Top rail ────────────────────────────────────────────────────────── */

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.brand__mark {
  width: 34px;
  height: 34px;
  border-radius: 3px;
  border: 1px solid var(--hair);
  flex: 0 0 auto;
}

.brand__name {
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail__right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 0 0 auto;
}

.status {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--smoke);
  white-space: nowrap;
}

.status__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--smoke);
  flex: 0 0 auto;
}

.status.is-live { color: var(--bone); }
.status.is-live .status__dot {
  background: var(--tape);
  box-shadow: 0 0 0 0 rgba(200, 65, 47, 0.6);
  animation: pulse 2.4s var(--ease) infinite;
}
.status.is-stale .status__dot { background: var(--gold); }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(200, 65, 47, 0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(200, 65, 47, 0); }
  100% { box-shadow: 0 0 0 0 rgba(200, 65, 47, 0); }
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--hair);
  border-radius: 2px;
  background: var(--pane);
  color: var(--bone);
  cursor: pointer;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease);
}
.icon-btn:hover { border-color: var(--smoke); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .icon-btn__on  { display: none; }
.icon-btn .icon-btn__off { display: block; }
.icon-btn[aria-pressed="true"] { color: var(--gold); }
.icon-btn[aria-pressed="true"] .icon-btn__on  { display: block; }
.icon-btn[aria-pressed="true"] .icon-btn__off { display: none; }

/* ── The core: clock, gauge, market cap ──────────────────────────────── */

.core {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 0;
  padding: 1rem 0;
}

/* The video cuts to bright, busy frames; this keeps the numbers readable on
   all of them without hiding the footage behind a solid panel. */
.core::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 150%;
  height: 118%;
  transform: translate(-50%, -50%);
  background: radial-gradient(58% 48% at 50% 50%, rgba(7,9,12,0.66) 0%, rgba(7,9,12,0.40) 55%, rgba(7,9,12,0) 100%);
  pointer-events: none;
}

.core > * { position: relative; }

.core__label {
  margin: 0 0 0.35rem;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--smoke);
}

.clock {
  display: flex;
  align-items: baseline;
  justify-content: center;
  font-family: 'Big Shoulders Display', 'Archivo', sans-serif;
  font-weight: 700;
  font-size: clamp(4rem, 15.5vw, 10.5rem);
  line-height: 0.82;
  color: var(--live);
  text-shadow: 0 2px 30px rgba(7, 9, 12, 0.85);
  transition: color 0.4s var(--ease);
}

/* Fixed-width cells so nothing shifts when a digit changes. */
.clock__d {
  display: inline-flex;
  justify-content: center;
  width: 0.56em;
}

.clock__d--sec { opacity: 0.66; }

.clock__sep {
  width: 0.26em;
  display: inline-flex;
  justify-content: center;
  opacity: 0.42;
}

.clock__d.is-flip { animation: flip 0.28s var(--ease); }

@keyframes flip {
  from { opacity: 0.25; transform: translateY(-0.055em); }
  to   { opacity: 1;    transform: none; }
}

.clock.is-done { color: var(--tape); }

/* Gauge — the physical link between the clock above and the money below. */

.gauge {
  width: min(38rem, 100%);
  margin-top: clamp(1.1rem, 3vh, 1.8rem);
}

.gauge__track {
  position: relative;
  height: 3px;
  background: rgba(242, 237, 227, 0.14);
  overflow: hidden;
}

.gauge__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: var(--live);
  transition: width 0.8s var(--ease), background-color 0.4s var(--ease);
}

.gauge__goal {
  position: absolute;
  top: -3px;
  right: 0;
  width: 1px;
  height: 9px;
  background: var(--bone);
}

.gauge__pct {
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--smoke);
}

.cap { margin-top: clamp(1.5rem, 4vh, 2.4rem); }

.cap__value {
  margin: 0;
  font-family: 'Big Shoulders Display', 'Archivo', sans-serif;
  font-weight: 700;
  font-size: clamp(2.7rem, 9vw, 5.4rem);
  line-height: 0.94;
  letter-spacing: 0.004em;
  color: var(--bone);
}

.cap__of {
  margin: 0.3rem 0 0;
  font-size: 0.86rem;
  color: var(--smoke);
}
.cap__of span { color: var(--bone); font-weight: 600; }


/* ── Bottom rail ─────────────────────────────────────────────────────── */

.ca {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  max-width: 100%;
  padding: 0.5rem 0.8rem;
  font: inherit;
  color: var(--bone);
  background: var(--pane);
  border: 1px solid var(--hair);
  border-radius: 2px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: border-color 0.18s var(--ease);
}
.ca:hover { border-color: var(--smoke); }

.ca__label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--smoke);
  flex: 0 0 auto;
}

.ca__value {
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ca__hint {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold);
  flex: 0 0 auto;
}

.links {
  display: flex;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.link {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: var(--bone);
  background: var(--pane);
  border: 1px solid var(--hair);
  border-radius: 2px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease);
}
.link:hover { border-color: var(--smoke); color: var(--gold); }
/* Masked rather than <img>, so the marks take the link's colour and turn gold
   on hover. currentColor does not cross into an <img> element. */
.link__icon {
  display: block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: center;
          mask-position: center;
  -webkit-mask-size: contain;
          mask-size: contain;
}

.link__icon--x {
  width: 19px;
  height: 19px;
  -webkit-mask-image: url('/public/images/x.svg');
          mask-image: url('/public/images/x.svg');
}

.link__icon--dex {
  width: 22px;
  height: 22px;
  -webkit-mask-image: url('/public/images/dexscreener.svg');
          mask-image: url('/public/images/dexscreener.svg');
}

/* ── Narrow screens ──────────────────────────────────────────────────── */

@media (max-width: 560px) {
  .brand__name { display: none; }
  .status { font-size: 0.72rem; }

  .rail--bottom {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }
  .ca { justify-content: center; }
  .links { justify-content: center; }
}

/* Landscape phones: the viewport is short, so trim the stack. */
@media (max-height: 460px) and (orientation: landscape) {
  .core__label { display: none; }
  .clock { font-size: clamp(3.2rem, 15vh, 6rem); }
  .cap__value { font-size: clamp(1.7rem, 7vh, 2.8rem); }
  .gauge { margin-top: 0.7rem; }
  .cap { margin-top: 0.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
