/* Hero + 4 hidden states (loading takeover, manual niche picker, matches grid, thankyou) */

/* ============================================================
   Main offset for fixed header
   ============================================================ */
main {
    padding-top: 80px;
}

/* ============================================================
   Hero-tool wrapper — full viewport height for entry state
   ============================================================ */
#affiliate-match__hero-tool {
    min-height: calc(100vh - 80px);
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
    position: relative;
    overflow: hidden;
    padding-top: var(--space-24);
    padding-bottom: 128px;
    background-color: #ffffff;
    background-image: url('images/hero-bg-bars.png');
    background-repeat: no-repeat;
    background-position: bottom center;
    background-size: 100% auto;
    min-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero__inner {
    position: relative;
    z-index: 1;
    text-align: center;
}

.hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 6px 12px;
    margin-bottom: var(--space-8);
    border-radius: var(--radius-rounded-4px);
    background: var(--Background-gray-85);
    color: var(--text-text-oxford-blue-100);
    font-size: var(--font-size-sub2);
    font-weight: 500;
    line-height: normal;
    letter-spacing: var(--font-spacing-sub2);
}

.hero__eyebrow .material-icons {
    font-size: 18px;
}

/* Diamond icon (wp_get_attachment_image) — ported from Round6/compound/banner .box__diamond */
.hero__eyebrow img {
    width: 1.125rem;
    height: 0.98438rem;
    object-fit: contain;
    transform: translateY(-1.5px);
    display: block;
}

.hero__title {
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.02em;
    margin: 0 auto var(--space-6);
    max-width: 56rem;
    font-size: var(--font-size-H1);
}

.hero__sub {
    font-size: 18px;
    line-height: 1.6;
    color: var(--on-surface-variant);
    max-width: 42rem;
    margin: 0 auto var(--space-10);
}

.hero__form {
    display: flex;
    gap: 12px;
    max-width: 36rem;
    margin: 0 auto;
}

.hero__input {
    flex: 1;
    padding: 16px 24px;
    font-size: 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--outline-variant);
    background: #ffffff;
    color: var(--on-surface);
    box-shadow: var(--shadow-soft);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.hero__input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(11, 28, 48, 0.15);
}

.hero__error {
    margin: 14px auto 0;
    max-width: 640px;
    padding: 10px 14px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 3px solid #dc2626;
    border-radius: 8px;
    color: #b91c1c;
    font-size: 14px;
    line-height: 1.45;
    text-align: left;
}

.hero__blob {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 256px;
    height: 256px;
    border-radius: var(--radius-full);
    filter: blur(72px);
    opacity: 0.3;
    pointer-events: none;
}

.hero__blob--left {
    left: 0;
    background: #f1e4ff;
}

.hero__blob--right {
    right: 0;
    background: #ffe4f3;
}

/* ============================================================
   Matches section
   ============================================================ */
.matches {
    background: var(--surface-container-low);
    border-top: 1px solid var(--outline-variant);
}

.matches__head {
    text-align: center;
    margin-bottom: var(--space-16);
}

.matches__title {
    font-size: clamp(28px, 3.5vw, 48px);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-4);
}

.matches__sub {
    font-size: 16px;
    color: var(--on-surface-variant);
    max-width: 48rem;
    margin: 0 auto var(--space-4);
}

.matches__note {
    font-size: 14px;
    font-style: italic;
    color: color-mix(in srgb, var(--on-surface-variant) 70%, transparent);
    max-width: 36rem;
    margin: 0 auto;
}

/* Niche badge + dimension pills (detected after Gemini classification) */
.matches__niche {
    display: none;
    align-items: center;
    gap: 8px;
    margin: 0 auto var(--space-4);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    background: var(--surface-container);
    color: var(--on-surface);
    font-size: 13px;
    font-weight: 600;
}

.matches__niche .material-icons {
    font-size: 16px;
    color: var(--secondary);
}

.matches__niche .niche-conf {
    color: var(--on-surface-variant);
    font-weight: 500;
}

.matches__dims {
    display: none;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 0 auto var(--space-5);
    max-width: 44rem;
}

.dim-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    background: var(--surface-container-lowest);
    color: var(--on-surface-variant);
    border: 1px solid var(--outline-variant);
}

.dim-badge--price {
    color: var(--hue-orange);
    border-color: color-mix(in srgb, var(--hue-orange) 30%, transparent);
}

.dim-badge--trigger {
    color: var(--hue-rose);
    border-color: color-mix(in srgb, var(--hue-rose) 30%, transparent);
}

.dim-badge--fit {
    color: var(--hue-indigo);
    border-color: color-mix(in srgb, var(--hue-indigo) 30%, transparent);
}

.dim-badge--identity {
    color: var(--hue-teal);
    border-color: color-mix(in srgb, var(--hue-teal) 30%, transparent);
}

/* Manual niche picker (fallback when Gemini classification fails) */
.manual-section {
    background: var(--surface-container-low);
    border-top: 1px solid var(--outline-variant);
}

.niche-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: var(--space-8);
    margin-bottom: var(--space-8);
}

.niche-tile {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--surface-container-lowest);
    border: 1px solid var(--outline-variant);
    font-size: 14px;
    font-weight: 600;
    color: var(--on-surface);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.niche-tile:hover {
    border-color: var(--secondary);
    background: var(--surface-container-low);
}

.niche-tile--selected {
    border-color: var(--secondary);
    border-width: 2px;
    padding: 13px 15px;
    background: color-mix(in srgb, var(--secondary) 8%, transparent);
}

.manual-actions {
    display: flex;
    justify-content: center;
}

.matches__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px;
}

.match-card {
    position: relative;
    overflow: hidden;
    padding: 32px;
    border-radius: var(--radius-xl);
    background: var(--surface-container-lowest);
    border: 1px solid var(--outline-variant);
    box-shadow: var(--shadow-ambient);
    transition: box-shadow 0.2s ease;
}

.match-card:hover {
    box-shadow: var(--shadow-ambient-hover);
}

.match-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
    background: var(--gradient-accent);
}

.match-card:hover::before {
    opacity: 1;
}

.match-card--g1::before {
    background: linear-gradient(90deg, #34d399 0%, #10b981 100%);
}

.match-card--g2::before {
    background: linear-gradient(90deg, #60a5fa 0%, #6366f1 100%);
}

.match-card__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.match-card__title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: var(--space-1);
}

.match-card__eyebrow {
    font-size: 14px;
    color: var(--on-surface-variant);
}

.score-pill {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 700;
}

.score-pill .material-icons {
    font-size: 16px;
}

.score-pill--high {
    background: #ecfdf5;
    color: #059669;
}

.score-pill--auth {
    background: #eff6ff;
    color: #2563eb;
}

.match-card__body {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.match-card__label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--on-surface-variant);
    margin-bottom: var(--space-3);
}

.match-card__text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--on-surface);
}

.affiliate-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.affiliate-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.affiliate-list li>span:last-child::first-letter {
    text-transform: uppercase;
}

.chip {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.chip .material-icons {
    font-size: 16px;
}

.chip--blue {
    background: #dbeafe;
    color: #2563eb;
}

.chip--purple {
    background: #f3e8ff;
    color: #9333ea;
}

.chip--orange {
    background: #ffedd5;
    color: #ea580c;
}

.chip--teal {
    background: #ccfbf1;
    color: #0d9488;
}

.chip--indigo {
    background: #e0e7ff;
    color: #4f46e5;
}

.chip--rose {
    background: #ffe4e6;
    color: #e11d48;
}

/* Featured (locked) card */
.match-card--featured {
    background: var(--primary);
    color: var(--on-primary);
    border: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 400px;
    padding: 40px 32px;
}

.match-card--featured::before {
    display: none;
}

.match-card--featured .feat-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.1;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20'><circle cx='2' cy='2' r='2' fill='%23ffffff'/></svg>");
    background-repeat: repeat;
    pointer-events: none;
}

.feat-body {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.feat-icon {
    font-size: 48px !important;
    margin-bottom: var(--space-6);
    color: #f1e4ff;
}

.feat-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: var(--space-4);
    color: #ffffff !important;
}

.feat-sub {
    color: #d1d5db;
    line-height: 1.6;
    margin-bottom: var(--space-8);
}

/* ============================================================
   Loading takeover (full-viewport analyze screen)
   ============================================================ */
.loading-takeover {
    background: var(--surface-container-low);
    border-top: 1px solid var(--outline-variant);
    padding: var(--section-pad) var(--gutter);
    display: grid;
    place-items: center;
    min-height: 70vh;
}

.loading-takeover__inner {
    width: 100%;
    max-width: 56rem;
    display: flex;
    flex-direction: column;
    gap: 48px;
}

.loading-takeover__header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    max-width: 28rem;
    margin: 0 auto;
    width: 100%;
}

.loading-takeover__title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.loading-takeover__spinner {
    font-size: 20px !important;
    color: var(--hue-indigo);
    animation: lt-spin 0.9s linear infinite;
}

@keyframes lt-spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-takeover__title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--on-surface);
    margin: 0;
}

.loading-takeover__status {
    font-size: 12px;
    font-weight: 500;
    color: var(--on-surface-variant);
    margin-bottom: 8px;
    text-align: center;
}

.loading-takeover__cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

/* Skeleton cards */
.skeleton-card {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.skeleton-card__row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.skeleton-card__tags {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 16px;
}

.skeleton-line {
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-line--avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.skeleton-line--title {
    height: 12px;
    width: 128px;
}

.skeleton-line--short {
    height: 8px;
    width: 96px;
}

.skeleton-line--full {
    height: 8px;
    width: 100%;
    background: linear-gradient(90deg, #f8fafc 0%, #e2e8f0 50%, #f8fafc 100%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-line--tag {
    height: 24px;
    width: 64px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ============================================================
   Thank-you section (post survey-submit)
   ============================================================ */
.thankyou {
    background: var(--surface-container-low);
    border-top: 1px solid var(--outline-variant);
}

.thankyou__inner {
    max-width: 560px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.thankyou__head {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.thankyou__title {
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--on-surface);
}

.thankyou__sub {
    font-size: 16px;
    color: var(--on-surface-variant);
    line-height: 1.6;
}

.thankyou__callout,
.thankyou__cta {
    padding: 24px;
    border-radius: var(--radius-lg);
    background: #fff1f0;
}

.thankyou__callout p,
.thankyou__cta p {
    font-size: 15px;
    color: var(--on-surface-variant);
    line-height: 1.6;
}

.thankyou__callout-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 12px;
    text-align: center;
}

.thankyou__callout p {
    text-align: center;
}

.thankyou__cta {
    border: 1.5px solid color-mix(in srgb, var(--secondary) 45%, transparent);
}

.thankyou__cta-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 12px;
}

.thankyou__cta p {
    margin-bottom: 20px;
}

.thankyou__downloads {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.thankyou__footnote {
    text-align: center;
    font-size: 13px;
    color: var(--on-surface-variant);
    margin-top: 4px;
}

.thankyou__partners {
    margin-top: var(--space-6);
    margin-bottom: var(--space-8);
}

.thankyou__partners-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-4);
}

.thankyou__partners-card {
    position: relative;
    padding: 20px;
    background: #ffffff;
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-ambient);
    text-align: left;
}

.thankyou__partners-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--on-surface);
}

/* Hide the locked card when the user has submitted the survey;
   shrink the matches grid to 2 columns so the remaining cards center cleanly. */
.matches.is-submitted .matches__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 820px;
    margin: 0 auto;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1199px) {
    .thankyou__partners-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1023px) {
    .matches__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .thankyou__partners-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .matches__grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .thankyou__partners-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .hero {
        padding-top: 64px;
        padding-bottom: 80px;
        background-size: 200% auto;
        background-position: bottom right;
    }

    .hero__form {
        flex-direction: column;
    }

    .loading-takeover__cards {
        grid-template-columns: minmax(0, 1fr);
    }

    .matches.is-submitted .matches__grid {
        grid-template-columns: minmax(0, 1fr);
    }
}