/* ==========================================================================
   Shared components drawn by JS: the Thousand Ring (static/js/ring.js) and
   the live counter (static/js/counter.js). Tokens come from site.css.
   ========================================================================== */


/* Thousand Ring ----------------------------------------------------------
   Colours are custom properties read by ring.js, so surfaces switch in CSS.
   Light pages by default; .theme-dark uses the mockup's on-Ridge colours. */
.thousand-ring {
  --ring-open: #DDD5C3;
  --ring-captain: var(--board-captain);
  --ring-joined: var(--board-joined);
  --ring-supporter: var(--lift-gold);
  --ring-glow: var(--ridge);
  --ring-label: var(--granite);
  position: relative;
  width: 100%;
  max-width: 350px;
  margin: 0 auto;
  container-type: inline-size;
}
.theme-dark .thousand-ring {
  --ring-open: #34495A;
  --ring-captain: #3E9B63;   /* brighter captain green: #1E6B3C disappears on Ridge */
  --ring-glow: var(--snowfield);
  --ring-label: var(--mist);
}
.thousand-ring--lg { max-width: 740px; }

/* Square from the first paint, so the page never jumps when JS draws. */
.thousand-ring__canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
}

.thousand-ring__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  pointer-events: none;
}
.thousand-ring__n {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 11.5cqi;        /* 40px at the mockup's 350px */
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.thousand-ring__label {
  max-width: 38cqi;
  font-size: clamp(var(--text-small), 4.3cqi, 24px);
  line-height: 1.3;
  color: var(--ring-label);
}

/* The canvas is aria-hidden; this caption is what screen readers get. */
.thousand-ring__caption {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Optional legend for pages that show one (Home):
   <ul class="ring-legend"><li><span class="ring-legend__dot ring-legend__dot--captain"></span>Captains</li>... */
.ring-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2) 18px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-small);
}
.ring-legend li { display: flex; align-items: center; gap: 6px; }
.ring-legend__dot { width: 12px; height: 12px; border-radius: 50%; background: var(--lift-gold); }
.ring-legend__dot--captain { background: var(--board-captain); }
.ring-legend__dot--joined { background: var(--board-joined); }
.theme-dark .ring-legend { color: var(--mist); }
.theme-dark .ring-legend__dot--captain { background: #3E9B63; }

/* "Count again" does nothing without motion, so hide it then. */
@media (prefers-reduced-motion: reduce) {
  [data-ring-replay] { display: none; }
}


/* Live counter -----------------------------------------------------------
   "How would you feel knowing N people have your back?" Inherits the size of
   wherever it sits (a card line, an h2-sized block); the number stands out. */
.back-counter {
  margin: 0;
  line-height: 1.35;
}
.back-counter__n {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.18em;
  letter-spacing: -0.01em;
  color: var(--deep-gold);
}
.theme-dark .back-counter__n { color: var(--lift-gold); }

[data-count-up] { font-variant-numeric: tabular-nums; }


/* Photo picker -----------------------------------------------------------
   campaign.photos.PhotoInput: round preview + "Add a photo" pill button. */
.photo-input {
  display: flex;
  align-items: center;
  gap: 14px;
}
.photo-input__preview {
  flex: 0 0 auto;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  overflow: hidden;
  background: #EEE8DC;
  border: 1px dashed #B9AE97;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--granite);
}
.photo-input__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-input__img[hidden],
.photo-input__placeholder[hidden] { display: none; }
.photo-input__controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}
.photo-input__button {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 24px;
  border: 1.5px solid var(--ridge);
  background: transparent;
  color: var(--ridge);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}
.photo-input__button:hover { background: rgba(29, 43, 54, 0.06); }
/* Inside a .field, the form-input rules (width: 100%, padding, min-height) would otherwise
   beat .visually-hidden and leave an invisible full-width box that scrolls the page sideways. */
.photo-input input[type="file"].visually-hidden {
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  border: 0;
}
.photo-input__button:focus-within {
  outline: 3px solid rgba(59, 102, 82, 0.35);
  outline-offset: 2px;
}
.photo-input__status,
.photo-input__help {
  font-size: var(--text-small);
  line-height: 1.4;
  color: var(--granite);
  overflow-wrap: anywhere;
}
.photo-input__status:empty { display: none; }
