/* Self-hosted captcha widget (website forms + login). */
.q-captcha { --qc-accent: var(--wp--preset--color--accent); --qc-ink: var(--wp--preset--color--contrast); --qc-muted: var(--wp--preset--color--muted); display: grid; gap: 8px; margin: 4px 0 6px; padding: 12px 14px; border: 1px solid var(--wp--preset--color--line); border-radius: 16px; background: linear-gradient(135deg, color-mix(in srgb, var(--wp--preset--color--brass-light) 9%, white), #fff); box-shadow: 0 10px 24px -20px color-mix(in srgb, var(--wp--preset--color--espresso) 60%, transparent); }
.q-captcha__label { display: flex; align-items: center; gap: 6px; font: 700 11px/1 system-ui, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--qc-muted); }
.q-captcha__shield { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; animation: q-captcha-hue 7s ease-in-out infinite; }
@keyframes q-captcha-hue { 0%, 100% { color: var(--wp--preset--color--accent); } 33% { color: var(--wp--preset--color--brass); } 66% { color: var(--wp--preset--color--sage); } }
.q-captcha__row { display: flex; align-items: center; gap: 10px; }
.q-captcha__img { display: block; width: 180px; height: 60px; border-radius: 10px; background: var(--wp--preset--color--cream); box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); object-fit: cover; }
.q-captcha.is-loading .q-captcha__img { background: linear-gradient(100deg, var(--wp--preset--color--cream) 30%, color-mix(in srgb, var(--wp--preset--color--brass) 11%, white) 50%, var(--wp--preset--color--cream) 70%) 0 0 / 300% 100%; animation: q-captcha-shimmer 1.2s linear infinite; }
.q-captcha.is-loading .q-captcha__img:not([src]) , .q-captcha.is-loading .q-captcha__img[src=""] { color: transparent; }
@keyframes q-captcha-shimmer { to { background-position: -150% 0; } }
.q-captcha__new { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 1px solid var(--wp--preset--color--line); border-radius: 50%; background: #fff; cursor: pointer; transition: transform .2s, box-shadow .2s; }
.q-captcha__new:hover { box-shadow: 0 6px 14px -8px rgba(0,0,0,.4); transform: translateY(-1px); }
.q-captcha__new:focus-visible { outline: 3px solid color-mix(in srgb, var(--wp--preset--color--accent) 55%, transparent); outline-offset: 2px; }
.q-captcha__new svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; animation: q-captcha-hue 7s ease-in-out infinite; }
.q-captcha__new.is-spin svg { animation: q-captcha-spin .6s cubic-bezier(.3,1.4,.5,1), q-captcha-hue 7s ease-in-out infinite; }
@keyframes q-captcha-spin { from { transform: rotate(-360deg); } }
.q-captcha__field { display: grid; gap: 4px; margin: 0; font-size: 13px; font-weight: 600; color: var(--qc-ink); }
.q-captcha__field input { width: 180px; max-width: 100%; min-height: 44px; padding: 6px 12px; border: 1.5px solid color-mix(in srgb, var(--wp--preset--color--on-dark-muted) 91%, white); border-radius: 10px; background: #fff; font: 700 22px/1 ui-monospace, "SFMono-Regular", Menlo, monospace; letter-spacing: .42em; color: var(--qc-ink); transition: border-color .2s, box-shadow .2s; }
.q-captcha__field input:focus { outline: none; border-color: var(--qc-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--wp--preset--color--accent) 18%, transparent); }
.q-captcha.is-complete .q-captcha__field input { border-color: var(--wp--preset--color--sage); }
.q-captcha.is-wrong .q-captcha__field input { border-color: #b32d2e; animation: q-captcha-shake .4s; }
@keyframes q-captcha-shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.q-captcha__img[hidden], .q-flip[hidden], .q-captcha__timer[hidden] { display: none; }

/* The flip board: one picture (480×152, shown at 240×76) cut into five tiles, each flipping on its own hinge. */
.q-captcha__row { flex-wrap: wrap; }
.q-flip { --q-w: 240px; --q-h: 76px; display: flex; gap: 4px; padding: 2px; width: var(--q-w); height: var(--q-h); box-sizing: border-box; }
.q-flip__tile { position: relative; flex: none; width: 44px; height: 72px; border-radius: 7px; overflow: hidden; perspective: 180px; box-shadow: 0 5px 10px -6px rgba(0,0,0,.55); }
.q-flip__half { position: absolute; left: 0; width: 44px; height: 36px; background-repeat: no-repeat; background-size: var(--q-w) var(--q-h); backface-visibility: hidden; }
.q-flip__top, .q-flip__flap-top { top: 0; background-position: calc(-2px - var(--i) * 48px) -2px; transform-origin: 50% 100%; }
.q-flip__bot, .q-flip__flap-bot { top: 36px; background-position: calc(-2px - var(--i) * 48px) -38px; transform-origin: 50% 0; }
.q-flip__top, .q-flip__flap-bot { background-image: var(--q-new); }
.q-flip__bot, .q-flip__flap-top { background-image: var(--q-old); }
.q-flip__flap-top, .q-flip__flap-bot { visibility: hidden; z-index: 1; }
.q-flip.is-flipping .q-flip__flap-top { visibility: visible; animation: q-flip-down .24s ease-in both; animation-delay: calc(var(--i) * 75ms); }
.q-flip.is-flipping .q-flip__flap-bot { visibility: visible; animation: q-flip-up .24s ease-out both; animation-delay: calc(var(--i) * 75ms + .24s); }
@keyframes q-flip-down { from { transform: rotateX(0); } to { transform: rotateX(-90deg); } }
@keyframes q-flip-up { from { transform: rotateX(90deg); } to { transform: rotateX(0); } }
@media (prefers-reduced-motion: reduce) { .q-flip.is-flipping .q-flip__flap-top, .q-flip.is-flipping .q-flip__flap-bot { visibility: hidden; } }

/* A narrow form has no room beside the board: the refresh button moves up next to the "Security check" label. */
@media (max-width: 480px) {
	.q-captcha:has(.q-flip:not([hidden])) { position: relative; }
	.q-captcha:has(.q-flip:not([hidden])) .q-captcha__new { position: absolute; top: 6px; right: 8px; width: 30px; height: 30px; }
	.q-captcha:has(.q-flip:not([hidden])) .q-captcha__new svg { width: 16px; height: 16px; }
}

/* The countdown under the numbers. */
.q-captcha__timer { display: grid; gap: 4px; max-width: 240px; font: 600 12px/1.3 system-ui, sans-serif; font-variant-numeric: tabular-nums; color: var(--qc-muted); }
.q-captcha__bar { display: block; height: 3px; border-radius: 3px; overflow: hidden; background: color-mix(in srgb, var(--qc-muted) 22%, transparent); }
.q-captcha__bar b { display: block; height: 100%; background: var(--wp--preset--color--sage); transform-origin: 0 50%; transition: transform .25s linear, background-color .3s; }
.q-captcha.is-ending .q-captcha__timer { color: #b32d2e; }
.q-captcha.is-ending .q-captcha__bar b { background: #b32d2e; }
.login .q-captcha__timer, .q-gc__balance .q-captcha__timer { color: color-mix(in srgb, var(--wp--preset--color--brass) 17%, white); }

.q-captcha__status { font-size: 12px; color: #b32d2e; }
.q-captcha__status:empty { display: none; }
@media (prefers-reduced-motion: reduce) { .q-captcha *, .q-captcha { animation: none !important; } }

/* wp-login.php – sits on the dark glass panel. */
.login .q-captcha { margin: 0 0 16px; }
.login .q-captcha, .q-gc__balance .q-captcha { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.22); box-shadow: none; }
.login .q-captcha__label, .q-gc__balance .q-captcha__label { color: color-mix(in srgb, var(--wp--preset--color--brass-light) 81%, white); }
.login .q-captcha__field span, .q-gc__balance .q-captcha__field span { color: color-mix(in srgb, var(--wp--preset--color--brass) 17%, white); font-weight: 600; }
.login .q-captcha__field input, .q-gc__balance .q-captcha__field input { border-color: rgba(255,255,255,.35); background: #fff; color: var(--wp--preset--color--contrast); text-transform: none; letter-spacing: .42em; font-family: ui-monospace, Menlo, monospace; }
.login .q-captcha__new, .q-gc__balance .q-captcha__new { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); color: color-mix(in srgb, var(--wp--preset--color--brass) 17%, white); }
.login .q-captcha__field input { width: 100%; font-size: 22px; }
.login .q-captcha__img { width: 180px; }
