/*
 * File: /assets/css/wporg-get.css
 * Module: the "Free on WordPress.org" box of the WordPress plugin pages
 *         (template-parts/wporg-get.php), under the hero of
 *         /plugins/core-web-vitals-monitoring/wordpress/ and
 *         /plugins/trust-badges/wordpress/.
 *
 * Prefix chwo-. One box, never a second hero (Adrian, 2026-10-17): a light
 * card in light mode (emerald wash, emerald hairline, tinted shadow) and a
 * token card in dark mode. The picture is a WordPress.org banner and a
 * WordPress Add Plugins card, white by nature in both themes. The markup is
 * the finished frame; cwvm.js adds is-armed (every step paused at its first
 * frame) and is-play when the box is on screen, and every step reads one
 * clock, --chwo-t, in percent keyframes. Motion is transform and opacity.
 */

@property --chwo-ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

/* The section is the container: the box itself changes its grid by its width. */
.chwo { margin-top: clamp(2.75rem, 2rem + 2.5vw, 4.5rem); container-type: inline-size; }

.chwo-box {
    --chwo-t: 4.4s;
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1fr);
    gap: clamp(1.5rem, 1rem + 2vw, 2.75rem);
    align-items: center;
    padding: clamp(1.1rem, 0.8rem + 1vw, 1.75rem) clamp(1.1rem, 0.6rem + 2vw, 2.5rem) clamp(1.1rem, 0.8rem + 1vw, 1.75rem) clamp(1.1rem, 0.8rem + 1vw, 1.75rem);
    overflow: hidden;
    isolation: isolate;
    border: 1px solid var(--cwvm-em-line);
    border-radius: 22px;
    background-color: var(--cwvm-card);
    background-image: linear-gradient(120deg, var(--cwvm-em-wash) 0%, var(--cwvm-card) 62%);
    box-shadow: var(--cwvm-shadow-lift);
}

/* A soft emerald light behind the picture. */
.chwo-box::after {
    content: "";
    position: absolute;
    top: -45%;
    left: -12%;
    z-index: -1;
    width: 62%;
    height: 190%;
    border-radius: 50%;
    background: radial-gradient(closest-side, var(--cwvm-aurora-a), transparent 72%);
    pointer-events: none;
}

/* The light that runs around the rim, twice, when the box arrives. */
.chwo-box::before {
    content: "";
    position: absolute;
    inset: 0;
    padding: 1px;
    border-radius: inherit;
    background: conic-gradient(from var(--chwo-ang), transparent 0%, transparent 62%, rgba(16, 185, 129, 0.95) 75%, rgba(6, 182, 212, 0.9) 83%, transparent 93%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    pointer-events: none;
}

/* ---------------------------------------------------------------- picture */

.chwo-pic { position: relative; padding-bottom: 2.4em; font-size: clamp(11px, 1.25cqi, 14px); }
.chwo-shot { position: relative; display: block; overflow: hidden; border: 1px solid var(--cwvm-line); border-radius: 14px; background-color: var(--bg); box-shadow: var(--cwvm-shadow); }
.chwo-banner { display: block; width: 100%; height: auto; aspect-ratio: 772 / 250; }
.chwo-shot::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 32%, rgba(255, 255, 255, 0.55) 50%, transparent 68%); transform: translateX(120%); pointer-events: none; }
.chwo-chip {
    position: absolute;
    top: 0.6em;
    right: 0.6em;
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    padding: 0.28em 0.62em;
    border: 1px solid var(--line);
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.92);
    color: #1E1E1E;
    font-family: var(--cwvm-mono);
    font-size: 0.68em;
    font-weight: 600;
    line-height: 1.2;
}
.chwo-chip svg { width: 1.15em; height: 1.15em; color: #3858E9; }

/* The plugin's card from WordPress's Add Plugins screen. */
.chwo-card {
    position: absolute;
    right: 5%;
    bottom: 0;
    left: 5%;
    z-index: 2;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.75em;
    align-items: center;
    padding: 0.7em 0.8em;
    border: 1px solid #DCDCDE;
    border-radius: 12px;
    background-color: var(--bg);
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.06), 0 20px 38px -18px rgba(15, 23, 42, 0.5);
    color: #1D2327;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, sans-serif;
}
.chwo-card-icon { width: 2.9em; height: 2.9em; border-radius: 0.6em; }
.chwo-card-name { display: flex; flex-direction: column; gap: 0.15em; min-width: 0; }
.chwo-card-name b { overflow: hidden; color: #2271B1; font-size: 0.95em; font-weight: 600; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.chwo-card-name span { color: #50575E; font-size: 0.76em; font-style: italic; }
.chwo-btn { display: grid; }
.chwo-b {
    grid-area: 1 / 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
    min-height: 2.25em;
    padding: 0 0.9em;
    border: 1px solid #2271B1;
    border-radius: 0.35em;
    background-color: #F6F7F7;
    color: #2271B1;
    font-size: 0.8em;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    opacity: 0;
}
.chwo-b.is-activate { background-color: #2271B1; color: #FFFFFF; }
.chwo-b.is-active { border-color: var(--green); background-color: var(--green-soft); color: var(--green); opacity: 1; }
.chwo-b.is-active svg { flex: none; width: 1.05em; height: 1.05em; }
.chwo-spin { flex: none; width: 0.95em; height: 0.95em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; }

/* ------------------------------------------------------------------- copy */

.chwo-k { display: inline-flex; align-items: center; gap: 0.45rem; margin: 0; color: var(--cwvm-em); font-family: var(--sans); font-size: 0.72rem; font-weight: 600; line-height: 1.2; }
.chwo-k svg { flex: none; width: 15px; height: 15px; }
.chwo-h { margin: 0.6rem 0 0; color: var(--cwvm-ink); font-size: clamp(1.3rem, 1.12rem + 0.7vw, 1.6rem); font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; text-wrap: balance; }
.chwo-p { max-width: 34em; margin: 0.6rem 0 0; color: var(--cwvm-body); font-size: 1rem; line-height: 1.6; }
.chwo-p strong { color: var(--cwvm-ink); }
.chwo-box .chwo-cta { margin-top: 1.15rem; }

/* A narrow box: the picture above the copy. */
@container (max-width: 700px) {
    .chwo-box { grid-template-columns: minmax(0, 1fr); }
    .chwo-pic { font-size: clamp(11px, 2.4cqi, 14px); }
}
@container (max-width: 400px) {
    .chwo-card { right: 3%; left: 3%; gap: 0.6em; padding: 0.6em 0.65em; }
    .chwo-box .chwo-cta { display: flex; justify-content: space-between; }
}

/* ------------------------------------------------------------------ story */
/* One clock: every step is a percent of --chwo-t. Armed = paused at 0%. */

.chwo-box.is-armed .chwo-card,
.chwo-box.is-armed .chwo-shot::after,
.chwo-box.is-armed .chwo-btn,
.chwo-box.is-armed .chwo-b {
    animation-duration: var(--chwo-t);
    animation-timing-function: var(--cwvm-ease);
    animation-fill-mode: both;
    animation-play-state: paused;
}
.chwo-box.is-armed .chwo-card { animation-name: chwoCard; }
.chwo-box.is-armed .chwo-shot::after { animation-name: chwoSweep; }
.chwo-box.is-armed .chwo-btn { animation-name: chwoPress; }
.chwo-box.is-armed .chwo-b { animation-timing-function: step-end; }
.chwo-box.is-armed .chwo-b.is-install { animation-name: chwoInstall; }
.chwo-box.is-armed .chwo-b.is-installing { animation-name: chwoInstalling; }
.chwo-box.is-armed .chwo-b.is-activate { animation-name: chwoActivate; }
.chwo-box.is-armed .chwo-b.is-active { animation-name: chwoActive; animation-timing-function: var(--cwvm-ease); }
.chwo-box.is-play .chwo-card,
.chwo-box.is-play .chwo-shot::after,
.chwo-box.is-play .chwo-btn,
.chwo-box.is-play .chwo-b { animation-play-state: running; }
.chwo-box.is-play::before { animation: chwoRim 2.2s linear 2; }
.chwo-box.is-play .chwo-spin { animation: chwoSpin 0.6s linear calc(var(--chwo-t) * 0.36) 3; }
/* When the card says Active, the real button's light sweeps once. */
.chwo-box.is-play .chwo-cta::after { animation: chwoCta 0.9s var(--cwvm-ease) calc(var(--chwo-t) * 0.86) 1; }

@keyframes chwoCard {
    0%, 4% { opacity: 0; transform: translateY(1em); }
    16%, 100% { opacity: 1; transform: none; }
}
@keyframes chwoSweep {
    0%, 6% { transform: translateX(-120%); }
    26%, 100% { transform: translateX(120%); }
}
@keyframes chwoPress {
    0%, 30% { transform: none; }
    33% { transform: scale(0.92); }
    36%, 72% { transform: none; }
    75% { transform: scale(0.92); }
    78%, 100% { transform: none; }
}
@keyframes chwoInstall {
    0% { opacity: 1; }
    36%, 100% { opacity: 0; }
}
@keyframes chwoInstalling {
    0% { opacity: 0; }
    36% { opacity: 1; }
    62%, 100% { opacity: 0; }
}
@keyframes chwoActivate {
    0% { opacity: 0; }
    62% { opacity: 1; }
    78%, 100% { opacity: 0; }
}
@keyframes chwoActive {
    0%, 77.9% { opacity: 0; transform: scale(0.85); }
    78% { opacity: 1; transform: scale(0.85); }
    86%, 100% { opacity: 1; transform: none; }
}
@keyframes chwoRim {
    0% { opacity: 0; --chwo-ang: 0deg; }
    12% { opacity: 1; }
    88% { opacity: 1; }
    100% { opacity: 0; --chwo-ang: 360deg; }
}
@keyframes chwoSpin { to { transform: rotate(360deg); } }
@keyframes chwoCta {
    from { transform: translateX(-120%); }
    to { transform: translateX(120%); }
}

@media (prefers-reduced-motion: reduce) {
    .chwo-box *, .chwo-box::before, .chwo-box *::after { animation: none !important; }
}
