@font-face {
  font-family: "Ranade";
  src: url("../fonts/ranade-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Ranade";
  src: url("../fonts/ranade-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   $CARP — wall plaque
   The wall colour is sampled from the source frames (#A59B8E). The plaque
   image feathers into it over 40px, which is the entire responsive strategy:
   the wall extends seamlessly at any aspect ratio.
   ========================================================================== */

:root {
  --wall: #A59B8E;
  --engraved: #4A4238;
  --engraved-dim: #6B6255;

  /* plaque image geometry, measured from the source frames */
  --img-aspect: 1672 / 941;
  --plaque-of-image: 0.918;   /* plaque occupies 91.8% of the image width */

  /* button centres and diameters, as a fraction of image width/height */
  --red-x: 50.12%;   --red-y: 75.45%;   --red-d: 1.734%;
  --blk-x: 50.09%;   --blk-y: 85.07%;   --blk-d: 2.034%;

  --label-face: "Ranade", "Hoefler Text", "Iowan Old Style", "Palatino Linotype",
           Palatino, Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;              /* no scrollbar, at any breakpoint */
}

body {
  background-color: var(--wall);
  background-image: radial-gradient(125% 125% at 68% 20%,
    #B7AFA5 0%, #ABA294 38%, #A0967F 72%, #8E8372 100%);
}

body {
  font-family: var(--label-face);
  color: var(--engraved);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.stage {
  position: relative;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Desktop: plaque ~70vw. The image is wider than the plaque it contains, so
   the image itself is 70 / 0.918 = 76vw. Height-capped so short, wide
   viewports never push the plaque off screen. */
.mount {
  position: relative;
  z-index: 1;                /* plaque and labels ride above the ghost */
  width: min(76vw, 112vh, 1672px);
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
}

.wall-art {
  position: relative;
  width: 100%;
}

/* painted on the wall itself, anchored to the foot of the page.
   Everything else rides above it. */
.ghost {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 0;
  width: max-content;
  max-width: none;
  margin: 0;
  font-weight: 700;
  text-transform: uppercase;
  font-size: min(9.8vw, 26vh);
  line-height: 1;
  letter-spacing: 0.055em;
  text-indent: 0.0275em;   /* offset the trailing letter-space */
  color: var(--engraved);
  opacity: 0.15;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
}

.plaque {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: var(--img-aspect);
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

/* --------------------------------------------------------------------------
   Frames. All stacked and decoded up front; swapping is a visibility flip
   with no transition anywhere near it. Hard cuts only.
   -------------------------------------------------------------------------- */

.frames { position: absolute; inset: 0; }

.frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  opacity: 0;
  transition: none !important;

  /* feather the image edge into the wall */
  --fx: min(130px, 11%);
  --fy: min(110px, 16%);
  -webkit-mask-image:
    linear-gradient(to right,  transparent 0, #000 var(--fx), #000 calc(100% - var(--fx)), transparent 100%),
    linear-gradient(to bottom, transparent 0, #000 var(--fy), #000 calc(100% - var(--fy)), transparent 100%);
  mask-image:
    linear-gradient(to right,  transparent 0, #000 var(--fx), #000 calc(100% - var(--fx)), transparent 100%),
    linear-gradient(to bottom, transparent 0, #000 var(--fy), #000 calc(100% - var(--fy)), transparent 100%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

.frame.is-on { opacity: 1; }

/* --------------------------------------------------------------------------
   Buttons. The domes are painted into the plaque photograph; these are real
   <button>s sitting exactly on top, with a generous transparent hit area.
   -------------------------------------------------------------------------- */

.hit {
  position: absolute;
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  transform: translate(-50%, -50%);
  border-radius: 50%;
}
.hit[disabled] { cursor: default; }

/* the box is exactly the painted dome; the touch target is grown outward by a
   pseudo-element so it scales with the plaque instead of breaking alignment */
.hit::before {
  content: "";
  position: absolute;
  inset: -150%;
  border-radius: 50%;
}

.hit--red   { left: var(--red-x); top: var(--red-y); width: var(--red-d); aspect-ratio: 1; }
.hit--black { left: var(--blk-x); top: var(--blk-y); width: var(--blk-d); aspect-ratio: 34 / 30; }

.knob {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}

/* pressed: an inset shadow over the painted dome reads as travel without
   displacing a pixel of the photograph */
.hit--red:active .knob,
.hit--red.is-down .knob {
  background: rgba(0, 0, 0, 0.20);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.55),
              inset 0 -1px 1px rgba(255, 255, 255, 0.10);
}

/* mute toggle: proud by 1px when live, flush when muted */
.hit--black .knob {
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.45),
              inset 0 1px 1px rgba(255, 255, 255, 0.16);
}
.hit--black[aria-pressed="true"] .knob {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

.hit:focus-visible {
  outline: 2px solid #1E1B16;
  outline-offset: 4px;
}

/* --------------------------------------------------------------------------
   Wall labels. Centred under the plaque, engraved rather than designed.
   -------------------------------------------------------------------------- */

.labels {
  --label: max(15.6px, 0.72vw);          /* museum label, +20% */
  margin: clamp(0.9rem, 2.2vh, 1.9rem) auto 0;
  width: 100%;
  text-align: center;
  font-size: var(--label);
  line-height: 1.7;
  letter-spacing: 0.012em;
  min-width: 0;
}
.labels p { margin: 0; }

.ticker {
  font-weight: 700;
  font-size: 1.12em;
  letter-spacing: 0.1em;
}

.ca   { margin-top: clamp(0.8rem, 1.8vh, 1.5rem) !important; }
.chan { margin-top: clamp(0.7rem, 1.5vh, 1.2rem) !important; }

/* --------------------------------------------------------------------------
   Contract address: a glass pill. Blurs and saturates what is behind it,
   catches a highlight along its top edge, and turns green when it copies.
   -------------------------------------------------------------------------- */

.ca-btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 0.65em;
  max-width: 100%;
  padding: 0.72em 1.25em;
  border-radius: 999px;
  font: inherit;
  color: var(--engraved);
  cursor: pointer;

  border: 1px solid rgba(255, 255, 255, 0.5);
  background:
    linear-gradient(180deg,
      rgba(255, 255, 255, 0.44) 0%,
      rgba(255, 255, 255, 0.10) 45%,
      rgba(255, 255, 255, 0.22) 100%);
  -webkit-backdrop-filter: blur(14px) saturate(1.6) brightness(1.04);
  backdrop-filter: blur(14px) saturate(1.6) brightness(1.04);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    inset 0 -1px 1px rgba(0, 0, 0, 0.10),
    0 10px 22px -14px rgba(0, 0, 0, 0.55);
  transition: box-shadow 340ms ease, border-color 340ms ease,
              background 340ms ease, color 340ms ease;
}

/* specular sweep */
.ca-btn::after {
  content: "";
  position: absolute;
  inset: -60% -30%;
  z-index: -1;
  background: linear-gradient(105deg,
    transparent 38%, rgba(255, 255, 255, 0.55) 50%, transparent 62%);
  transform: translateX(-120%);
  transition: transform 900ms cubic-bezier(0.22, 0.61, 0.36, 1);
  pointer-events: none;
}
.ca-btn:hover::after,
.ca-btn:focus-visible::after { transform: translateX(120%); }

.ca-btn:hover { border-color: rgba(255, 255, 255, 0.72); }

/* both labels share one grid cell, so the pill keeps the address's width and
   does not lurch when it says Copied */
.ca-text {
  display: grid;
  font-size: clamp(9.5px, 0.84em, 15px);
  letter-spacing: 0.04em;
  font-variant-numeric: lining-nums tabular-nums;
  overflow-wrap: anywhere;
  min-width: 0;
}
.ca-text > span { grid-area: 1 / 1; place-self: center; }
.ca-done { visibility: hidden; font-weight: 700; letter-spacing: 0.08em; }
.ca-btn.is-copied .ca-addr { visibility: hidden; }
.ca-btn.is-copied .ca-done { visibility: visible; }

.ca-ico { flex: none; overflow: visible; }
.ca-ico rect, .ca-ico path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ca-ico-tick { opacity: 0; }

/* copied */
.ca-btn.is-copied {
  color: #17492C;
  border-color: rgba(64, 200, 116, 0.85);
  background:
    linear-gradient(180deg,
      rgba(186, 255, 214, 0.60) 0%,
      rgba(64, 200, 116, 0.20) 45%,
      rgba(64, 200, 116, 0.32) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 0 0 1px rgba(64, 200, 116, 0.45),
    0 0 30px 4px rgba(64, 200, 116, 0.55),
    0 0 70px 10px rgba(64, 200, 116, 0.22);
}
.ca-btn.is-copied .ca-ico-back,
.ca-btn.is-copied .ca-ico-front { opacity: 0; }
.ca-btn.is-copied .ca-ico-tick  { opacity: 1; }

.labels a {
  color: var(--engraved-dim);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.labels a:hover { color: var(--engraved); border-bottom-color: currentColor; }

.labels :focus-visible {
  outline: 1px solid var(--engraved);
  outline-offset: 4px;
}

/* --------------------------------------------------------------------------
   Mobile portrait: plaque to ~92vw, sitting above centre because the labels
   take the room below it. Never cropped, never rotated.
   -------------------------------------------------------------------------- */

@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  .mount { width: min(100vw, 168vh); }
  .labels {
    --label: 15px;
    padding: 0 5vw;
  }
  .ca-btn { padding: 0.65em 1em; gap: 0.5em; }

  .frame { --fx: min(56px, 9%); --fy: min(48px, 12%); }
}

@media (max-height: 460px) {
  .mount { width: min(56vw, 104vh, 1672px); }
  .labels { --label: 12.5px; line-height: 1.5; }
}

@media (prefers-reduced-motion: reduce) {
  .ca-btn, .ca-btn::after { transition: none; }
  .ca-btn:hover::after, .ca-btn:focus-visible::after { transform: translateX(-120%); }
}
