/* ==========================================================================
   Tune-the-string check (.ggc)
   A small drag-or-arrow puzzle the four public forms ask for before they
   will send. Markup is built by assets/gogo/captcha.js.

   The widget sets its own colours from the data-tone that captcha.js works
   out from the background behind it. Inheriting currentColor was the first
   attempt and it was wrong: the newsletter form in the footer inherits dark
   text even though it sits on brand blue, so the label came out near-black
   on blue and the target was invisible.
   ========================================================================== */

.ggc{
  --ggc-ease: cubic-bezier(.4,0,.2,1);
  /* light surroundings: dark ink */
  --ggc-fg: #0B0B12;
  --ggc-soft: rgba(11,11,18,.07);
  --ggc-line: rgba(11,11,18,.24);
  --ggc-string: rgba(11,11,18,.34);
  --ggc-ok: #0F6F5E;

  display: block;
  width: 100%;
  max-width: 420px;
  margin: 18px 0;
  font-family: "Century Gothic", Arial, sans-serif;
  text-align: left;
  color: var(--ggc-fg);
}

/* dark surroundings: light ink */
.ggc[data-tone="dark"]{
  --ggc-fg: #fff;
  --ggc-soft: rgba(255,255,255,.14);
  --ggc-line: rgba(255,255,255,.46);
  --ggc-string: rgba(255,255,255,.6);
  --ggc-ok: #AFFFE9;
}

.ggc__label{
  display: block;
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.35;
  opacity: .9;
}

/* --- the string ---------------------------------------------------------- */
.ggc__track{
  position: relative;
  height: 54px;
  padding: 0 6px;
  border-radius: 12px;
  background: var(--ggc-soft);
  border: 1px solid var(--ggc-line);
  box-sizing: border-box;
  touch-action: none;            /* the handle owns horizontal dragging */
  cursor: grab;
}
.ggc[data-state="solved"] .ggc__track{ cursor: default; }

/* the string itself, drawn as a hairline that thickens as it comes into tune */
.ggc__string{
  position: absolute;
  left: 10px; right: 10px; top: 50%;
  height: 2px;
  margin-top: -1px;
  border-radius: 2px;
  background: var(--ggc-string);
  transition: background .2s ease;
}

/* where it needs to get to */
/* Width is set by the script, to exactly the span that counts as in tune —
   centred on the note, so the box IS the hit zone rather than a hint at it. */
.ggc__target{
  position: absolute;
  top: 8px; bottom: 8px;
  transform: translateX(-50%);
  border-radius: 9px;
  border: 2px dashed var(--ggc-line);
  transition: border-color .2s ease, background .2s ease;
}
.ggc[data-near="true"] .ggc__target{
  background: rgba(20,172,147,.16);
  border-color: #14AC93;
}
.ggc[data-state="solved"] .ggc__target{
  background: rgba(20,172,147,.2);
  border-style: solid;
  border-color: #14AC93;
}

/* the pick you drag — the shape is the SVG, not the button, so the shadow
   and the focus ring follow the pick rather than boxing it in */
.ggc__pick{
  position: absolute;
  top: 50%;
  width: 32px; height: 35px;
  margin: -17.5px 0 0 -16px;
  padding: 0;
  display: block;
  background: none;
  border: 0;
  border-radius: 4px;
  cursor: grab;
  touch-action: none;
  transition: transform .15s var(--ggc-ease);
}
.ggc__pick:active{ cursor: grabbing; transform: scale(1.08); }
.ggc__pick:focus-visible{ outline: 3px solid #194BF5; outline-offset: 3px; }
.ggc[data-state="solved"] .ggc__pick{ cursor: default; }

.ggc__pickart{
  width: 100%; height: 100%;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.3));
}
.ggc__pickbody{
  fill: #fff;
  stroke: rgba(11,11,18,.28);
  stroke-width: 1;
}
.ggc__pickstrings{ stroke: rgba(11,11,18,.42); }

.ggc[data-state="solved"] .ggc__pickbody{ fill: #14AC93; stroke: #0F6F5E; }
.ggc[data-state="solved"] .ggc__pickstrings{ stroke: rgba(255,255,255,.95); }

/* --- status -------------------------------------------------------------- */
.ggc__status{
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.4;
  min-height: 1.4em;
  opacity: .85;
}
.ggc[data-state="solved"] .ggc__status{ color: var(--ggc-ok); opacity: 1; font-weight: 600; }
.ggc[data-state="error"] .ggc__status{ color: #C32020; opacity: 1; }
/* Red on brand blue is unreadable, so the dark tone gets a light red. */
.ggc[data-tone="dark"][data-state="error"] .ggc__status{ color: #FFB4B4; }

/* --- the bait ------------------------------------------------------------
   Off-screen rather than display:none, since some bots skip hidden fields
   but fill anything they can read. Nothing here is announced or focusable. */
.ggc__hp{
  position: absolute !important;
  left: -9999px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

@media (prefers-reduced-motion: reduce){
  .ggc__pick, .ggc__string, .ggc__target{ transition: none; }
  .ggc__pick:active{ transform: none; }
}
