/* =============================================================================
   Card-stack wrapper + the curly "try it" hint
   ============================================================================= */

.card-stack-anchor { position: relative; }

.card-stack-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-12);
}

.try-hint {
    position: absolute;
    left: 100%;
    margin-left: var(--spacing-small);
    top: 382px;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--color-accent);
    transition: opacity 0.4s ease;
    pointer-events: none;
    animation: try-hint-bounce 0.7s 0s 1 backwards;
}
@keyframes try-hint-bounce {
    0%   { transform: scale(1);    opacity: 0; animation-timing-function: ease-out; }
    50%  { transform: scale(1.15); opacity: 1; animation-timing-function: ease-in; }
    100% { transform: scale(1);    opacity: 1; }
}
.try-hint-text  { font-family: var(--font-family-serif); font-style: italic; font-size: var(--font-size-medium); }
.try-hint-arrow { margin-top: 2px; }
.try-hint.tried { opacity: 0; }
@media (max-width: 800px) {
    /* Sit just above the card-stack as a normal flex item (the wrap is a
       column flex), with text on the right and the desktop curve flipped
       both ways so it reads as left-then-down. */
    .try-hint {
        position: static;
        flex-direction: row-reverse;
        align-items: center;
        gap: var(--spacing-small);
    }
    .try-hint-arrow { transform: scale(-1, -1) matrix(0, 1, 1, 0, 0, 0); }
}

/* =============================================================================
   Card-stack frame + the cards inside
   ============================================================================= */

.card-stack {
    width: 280px;
    height: 520px;
    background: var(--color-card);
    border-radius: var(--radius-card-stack);
    box-shadow: var(--shadow-card-stack);
    position: relative;
}
@media (max-width: 800px) {
    /* Card-stack fills the hero column horizontally; JS sets height inline
       so the stack + everything below it exactly fill the viewport. The
       scroll-driven scale grows from the top edge (not the center) so the
       peek line stays anchored as the stack grows. */
    .card-stack { width: 100%; transform-origin: top; }
}
.stage { position: absolute; inset: 0; }

.card {
    position: absolute;
    inset: 0;
    background: var(--color-card);
    border-radius: var(--radius-card-stack);
    padding: var(--spacing-36) var(--spacing-28) 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    transition: transform 0.4s cubic-bezier(.45,.05,.55,.95), opacity 0.4s ease;
}
.card.swiped-left  { transform: translateX(-220%) rotate(-18deg); opacity: 0; pointer-events: none; }
.card.swiped-right { transform: translateX( 220%) rotate( 18deg); opacity: 0; pointer-events: none; }

.statement {
    font-family: var(--font-family-serif);
    font-weight: 600;
    font-size: var(--font-size-statement);
    line-height: 1.3;
    text-align: center;
    flex: 1;
    display: flex;
    align-items: center;
    width: 100%;
}

/* Category pill at top of each card */
.pill {
    padding: var(--spacing-tiny) 11px;
    border-radius: 11px;
    font-size: var(--font-size-tiny);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.pill-rhythm   { background: color-mix(in oklab, var(--color-rhythm)   18%, transparent); color: var(--color-rhythm-text);   }
.pill-intimacy { background: color-mix(in oklab, var(--color-intimacy) 18%, transparent); color: var(--color-intimacy-text); }
.pill-future   { background: color-mix(in oklab, var(--color-future)   18%, transparent); color: var(--color-future-text);   }

/* =============================================================================
   Spectrum (5 dots + axis labels)
   ============================================================================= */

.spectrum-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.spectrum {
    display: flex;
    gap: 14px;
    align-items: center;
}
.dot {
    position: relative;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: color-mix(in oklab, var(--color-muted) 30%, transparent);
    border: 0;
    padding: 0;
    cursor: pointer;
    transition: transform var(--transition-quick), background-color var(--transition-quick);
    -webkit-appearance: none;
    appearance: none;
}
/* Floating label above the active dot */
.dot::before {
    content: attr(data-label);
    position: absolute;
    bottom: calc(100% + var(--spacing-small));
    left: 50%;
    transform: translateX(-50%);
    font-size: var(--font-size-tiny);
    font-weight: 500;
    color: var(--color-muted);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
}
.dot:hover                                { background: color-mix(in oklab, var(--color-muted) 55%, transparent); }
.dot:hover::before, .dot.selected::before { opacity: 1; }
.dot:disabled                             { cursor: default; }
.dot.highlight-agree    { background: var(--color-agree);    transform: scale(1.45); }
.dot.highlight-neutral  { background: var(--color-muted);    transform: scale(1.45); }
.dot.highlight-disagree { background: var(--color-disagree); transform: scale(1.45); }

.spectrum-axis {
    display: flex;
    justify-content: space-between;
    width: 152px;
    font-size: var(--font-size-tiny);
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Bump up interior dimensions on mobile so they stay proportional with
   the wider card-stack (which fills the hero column width). */
@media (max-width: 800px) {
    .card      { padding: var(--spacing-48) var(--spacing-28) var(--spacing-40); }
    .statement { font-size: var(--font-size-heading); }
    .dot       { width: 22px; height: 22px; }
    .spectrum  { gap: 18px; }
}

/* =============================================================================
   Progress bar (segments below the card-stack)
   ============================================================================= */

.progress { display: flex; gap: 6px; width: 240px; }
.segment {
    flex: 1;
    height: 4px;
    background: color-mix(in oklab, var(--color-muted) 22%, transparent);
    border-radius: 2px;
    overflow: hidden;
}
.segment-fill {
    height: 100%;
    width: 0%;
    background: var(--color-accent);
    transition: width 0.4s ease;
}
.segment.filled .segment-fill { width: 100%; }

/* =============================================================================
   Results screen — takes over the card-stack after all cards are answered
   ============================================================================= */

.results {
    position: absolute;
    inset: 0;
    background: var(--color-card);
    border-radius: var(--radius-card-stack);
    padding: var(--spacing-32) var(--spacing-24) var(--spacing-28);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-16);
    z-index: 4;
}
.results.hidden { display: none; }
.results .analysis { background: transparent; padding: 0; margin: 0; }
.results .analysis-label {
    text-align: center;
    font-size: var(--font-size-small);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-muted);
    margin: 0 0 var(--spacing-12);
}

.result-rows {
    margin-top: var(--spacing-16);
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.result-row {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-small);
    padding: 10px var(--spacing-12);
    border-radius: 10px;
    border: 1px solid;
}
.result-row-rhythm {
    background:    color-mix(in oklab, var(--color-rhythm)   12%, transparent);
    border-color:  color-mix(in oklab, var(--color-rhythm)   30%, transparent);
}
.result-row-intimacy {
    background:    color-mix(in oklab, var(--color-intimacy) 12%, transparent);
    border-color:  color-mix(in oklab, var(--color-intimacy) 30%, transparent);
}
.result-row-future {
    background:    color-mix(in oklab, var(--color-future)   12%, transparent);
    border-color:  color-mix(in oklab, var(--color-future)   40%, transparent);
}

.result-statement {
    font-weight: 600;
    font-size: var(--font-size-caption);
    line-height: 1.25;
    /* Allow long statements to wrap onto multiple lines instead of clipping. */
    white-space: normal;
    overflow-wrap: anywhere;
}
.result-spectrum { display: flex; gap: 7px; align-items: center; }
.result-verdict {
    margin-left: auto;
    font-size: var(--font-size-small);
    font-weight: 500;
    font-style: italic;
    color: var(--color-muted);
}
.result-verdict.aligned { color: var(--color-agree); }

.result-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: color-mix(in oklab, var(--color-muted) 28%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
    /* Dot backgrounds are light/colorful regardless of theme, so the letter
       must always be dark for contrast (don't follow --color-text). */
    color: var(--color-on-light);
}
.result-dot-you  { background: var(--color-agree); }
.result-dot-most { background: var(--color-accent); }
.result-dot-merged {
    background: linear-gradient(135deg, var(--color-agree) 50%, var(--color-accent) 50%);
    color: var(--color-on-light);
}

.result-legend {
    margin-top: 2px;
    margin-bottom: 6px;
    font-size: var(--font-size-small);
    font-weight: 600;
    text-align: center;
}
.result-legend .legend-you  { color: var(--color-agree); }
.result-legend .legend-amp  { color: var(--color-muted); font-weight: 500; }
.result-legend .legend-them { color: var(--color-accent); }

/* Matches strip at the bottom of the results */
.matches-section {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-12);
}
.result-hint {
    font-size: var(--font-size-tiny);
    font-weight: 500;
    color: var(--color-muted);
    text-align: center;
    letter-spacing: 0.02em;
}

/* Intro animation: rows fade-in consecutively, then matches scale in */
.results .result-row,
.results .result-legend,
.results .result-hint {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.45s ease, transform var(--transition-smooth);
}
.results .match {
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(.2,.7,.3,1.2);
}
.results .result-row.is-visible,
.results .result-legend.is-visible,
.results .result-hint.is-visible,
.results .match.is-visible { opacity: 1; transform: none; }

/* Match teasers — tappable to compare with that person */
.results .match                         { cursor: pointer; }
.results .match.is-visible              { transition: opacity var(--transition-quick), box-shadow var(--transition-quick); }
.results .match.dimmed                  { opacity: 0.4; }
.results .match.selected .match-avatar  { box-shadow: 0 0 0 2px var(--color-text); }

.results .matches      { margin-top: 0; gap: 10px; }
.results .match-avatar { width: 48px; height: 48px; font-size: var(--font-size-medium); }
.results .match-pill   { font-size: 9px; padding: 1px 5px; border-radius: var(--spacing-small); }
.results .match-name   { font-size: var(--font-size-caption); }

/* =============================================================================
   Match avatars (also used standalone, e.g., in results)
   ============================================================================= */

.matches {
    margin: var(--spacing-40) 0 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-16);
}
.match {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.match-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-family-serif);
    font-weight: 600;
    font-size: var(--font-size-statement);
    color: var(--color-text);
    position: relative;
}
.match-avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}
.avatar-1 { background: var(--color-avatar-1); }
.avatar-2 { background: var(--color-avatar-2); }
.avatar-3 { background: var(--color-avatar-3); }
.avatar-4 { background: var(--color-avatar-4); }

.match-pill {
    position: absolute;
    bottom: -2px;
    right: -2px;
    padding: 2px 6px;
    border-radius: 9px;
    font-family: var(--font-family-sans);
    font-size: var(--font-size-tiny);
    font-weight: 700;
    color: var(--color-background);
}
.percent-high { background: color-mix(in oklab, var(--color-agree)  85%, transparent); }
.percent-mid  { background: color-mix(in oklab, var(--color-accent) 88%, transparent); }
.match-name   { font-size: var(--font-size-caption); color: var(--color-muted); }
