/* conjoint_experiment.css — Conjoint Experiment Simulator
   Uses the shared tokens in main.css; defines only what this tool adds. */

/* ─────────────────────────────────────────────────────────────
   Small shared-ish helpers this page needs but main.css lacks
   ───────────────────────────────────────────────────────────── */

.note {
    font-size: 0.875rem;
    color: var(--app-muted);
    line-height: 1.6;
}

.callout {
    border-left: 4px solid var(--app-accent);
    background: #f2f7fd;
    padding: 0.9rem 1.1rem;
    border-radius: 0 8px 8px 0;
    margin: 1rem 0;
}

.callout--info {
    border-left-color: var(--app-accent);
    background: #f2f7fd;
}

.callout--error {
    border-left-color: var(--app-danger);
    background: #fdf3f3;
    color: #8a2f20;
}

.table-scroll {
    overflow-x: auto;
    margin: 1rem 0;
}

.btn-lg {
    font-size: 1.05rem;
    padding: 0.85rem 1.75rem;
}

/* main.css styles .btn-secondary for the dark marketing pages (white text on a
   10%-white pill), which is invisible on this light page. */
.app-main .btn-secondary {
    background: #fff;
    color: var(--app-accent-dark);
    border: 1px solid var(--app-border);
    cursor: pointer;
}

.app-main .btn-secondary:hover {
    background: #eef3fa;
    border-color: var(--app-accent);
}

.advanced-settings > summary,
.inspect-3d > summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--app-accent-dark);
    padding: 0.5rem 0;
}

/* ─────────────────────────────────────────────────────────────
   Attribute table
   ───────────────────────────────────────────────────────────── */

.attribute-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.94rem;
}

.attribute-table th,
.attribute-table td {
    border: 1px solid var(--app-border);
    padding: 0.65rem 0.8rem;
    text-align: left;
    vertical-align: top;
}

.attribute-table thead th {
    background: #eef3fa;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--app-muted);
}

.attribute-table tbody th {
    background: #f8fafd;
    font-weight: 600;
    white-space: nowrap;
}

.ref-tag {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--app-muted);
}

/* ─────────────────────────────────────────────────────────────
   Design facts
   ───────────────────────────────────────────────────────────── */

.design-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.9rem;
    margin: 1.25rem 0;
}

.design-fact {
    background: #f8fafd;
    border: 1px solid var(--app-border);
    border-radius: 10px;
    padding: 0.9rem 1rem;
    text-align: center;
}

.design-fact__value {
    display: block;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--app-accent-dark);
    line-height: 1.2;
}

.design-fact__label {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--app-muted);
}

.balance-proof {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 1rem;
    font-size: 0.9rem;
    line-height: 1.9;
    color: var(--app-text);
}

.balance-proof li {
    border-bottom: 1px dashed var(--app-border);
    padding: 0.15rem 0;
}

.balance-proof li:last-child {
    border-bottom: none;
}

/* ─────────────────────────────────────────────────────────────
   Hero product viewer (visible on load)
   ───────────────────────────────────────────────────────────── */

.hero-product {
    display: grid;
    grid-template-columns: minmax(280px, 420px) 1fr;
    gap: 1.75rem;
    align-items: center;
}

.hero-product__viewer {
    background: linear-gradient(180deg, #fbfcfe 0%, #e9eef6 100%);
    border: 1px solid var(--app-border);
    border-radius: 12px;
    overflow: hidden;
}

.hero-product__copy h2 {
    margin-top: 0;
}

#inspect-stage-mount {
    height: 460px;
}

#inspect-stage-mount three-d-stage {
    width: 100%;
    height: 460px;
    display: block;
}

.viewer-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    color: var(--app-muted);
    font-size: 0.9rem;
}

three-d-stage:not(:defined) {
    visibility: hidden;
}

@media (max-width: 860px) {
    .hero-product {
        grid-template-columns: 1fr;
    }

    #inspect-stage-mount,
    #inspect-stage-mount three-d-stage {
        height: 360px;
    }
}

/* ─────────────────────────────────────────────────────────────
   The task runner
   ───────────────────────────────────────────────────────────── */

.task-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.task-header h2 {
    margin: 0;
    font-size: 1.1rem;
    white-space: nowrap;
}

.task-progress {
    flex: 1 1 200px;
    height: 8px;
    background: #e6edf6;
    border-radius: 999px;
    overflow: hidden;
}

.task-progress__bar {
    height: 100%;
    width: 0;
    background: var(--app-accent);
    border-radius: 999px;
    transition: width 0.25s ease;
}

.task-prompt {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.25rem 0 1rem;
}

.viewer-hint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.viewer-hint .note {
    margin: 0;
}

.btn-sm {
    font-size: 0.82rem;
    padding: 0.4rem 0.8rem;
}

.choice-grid {
    /* 2 x 2: three bottles and the opt-out, all the same weight on the page. */
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.1rem;
}

@media (max-width: 720px) {
    .choice-grid {
        grid-template-columns: 1fr;
    }
}

.choice-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--app-card-bg);
    border: 2px solid var(--app-border);
    border-radius: 12px;
    padding: 1rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.choice-card:hover {
    border-color: #b9cde4;
}

.choice-card:focus-within {
    border-color: var(--app-accent);
    box-shadow: 0 6px 18px rgba(42, 125, 225, 0.14);
}

.choice-key {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    z-index: 1;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: #eef3fa;
    color: var(--app-accent-dark);
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.choice-canvas {
    /* The renderer matches its buffer to this box's measured aspect ratio, so
       the shape here is free — but it must stay IDENTICAL across cards, since
       the shared camera is what preserves the real size difference between a
       40 oz body and an 18 oz one. */
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: 420px;
    margin-bottom: 0.85rem;
    cursor: grab;
    touch-action: none; /* let the pointer handlers own the drag */
    border-radius: 8px;
    background: linear-gradient(180deg, #fbfcfe 0%, #eef2f8 100%);
}

.choice-canvas.is-dragging {
    cursor: grabbing;
}

.choice-canvas:focus-visible {
    outline: 3px solid var(--app-accent);
    outline-offset: 2px;
}

.choice-spec {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.2rem 0.6rem;
    margin: 0 0 0.9rem;
    font-size: 0.85rem;
    border-top: 1px solid var(--app-border);
    padding-top: 0.7rem;
}

.choice-spec dt {
    color: var(--app-muted);
    font-size: 0.78rem;
}

.choice-spec dd {
    margin: 0;
    font-weight: 500;
}

.choice-spec dd.choice-price {
    font-weight: 700;
    color: var(--app-accent-dark);
}

.choice-select {
    margin-top: auto;
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--app-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.choice-select:hover {
    background: var(--app-accent-dark);
}

.choice-select:focus-visible {
    outline: 3px solid var(--app-accent-dark);
    outline-offset: 2px;
}

.choice-none {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 220px;
    padding: 1.5rem;
    background: #f8fafd;
    border: 2px dashed var(--app-border);
    border-radius: 12px;
    font: inherit;
    color: var(--app-muted);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.choice-none .choice-key {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
}

.choice-none__body {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    max-width: 30ch;
}

.choice-none__title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--app-text);
}

.choice-none__hint {
    font-size: 0.85rem;
    line-height: 1.5;
}

.choice-none:hover {
    border-color: var(--app-accent);
    background: #eef3fa;
}

.choice-none:focus-visible {
    outline: 3px solid var(--app-accent);
    outline-offset: 2px;
}

.keyboard-hint {
    margin-top: 1rem;
}

.keyboard-hint kbd {
    background: #eef3fa;
    border: 1px solid var(--app-border);
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 0.1rem 0.35rem;
    font-size: 0.85em;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ─────────────────────────────────────────────────────────────
   Part-worth comparison: you vs the market
   ───────────────────────────────────────────────────────────── */

.comparison-headline {
    font-size: 1.05rem;
    background: #f8fafd;
    border-left: 4px solid var(--app-accent);
    border-radius: 0 8px 8px 0;
    padding: 0.8rem 1.1rem;
    margin: 1rem 0;
}

.pw-legend {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin: 0.75rem 0 1.25rem;
    font-size: 0.85rem;
    color: var(--app-muted);
}

.pw-legend__item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.pw-swatch {
    width: 14px;
    height: 10px;
    border-radius: 2px;
}

.pw-swatch--you { background: var(--app-accent); }
.pw-swatch--market { background: #9aa8b8; }

.pw-attr {
    margin-bottom: 1.5rem;
}

/* Shown instead of the bars when the answers cannot identify part-worths at all.
   Deliberately reads as an explanation rather than an error. */
.pw-unavailable {
    padding: 1rem 1.15rem;
    border: 1px solid var(--app-border);
    border-left: 4px solid #9aa8b8;
    border-radius: 8px;
    background: rgba(154, 168, 184, 0.09);
}

.pw-unavailable h4 {
    margin: 0 0 0.6rem;
    font-size: 0.98rem;
}

.pw-unavailable p {
    margin: 0 0 0.7rem;
    font-size: 0.9rem;
    line-height: 1.55;
}

.pw-unavailable p:last-child {
    margin-bottom: 0;
}

.pw-unavailable__note {
    color: var(--app-muted);
}

.pw-attr h4 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 0 0 0.6rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--app-border);
    font-size: 0.95rem;
}

.pw-importance {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--app-muted);
}

.pw-row {
    display: grid;
    grid-template-columns: minmax(110px, 1.1fr) 3fr minmax(88px, auto);
    align-items: center;
    gap: 0.75rem;
    padding: 0.3rem 0;
}

.pw-label {
    font-size: 0.85rem;
}

.pw-track {
    position: relative;
    height: 22px;
    /* The centre line is zero: bars run right for "worth more than this
       attribute's average", left for less. */
    background:
        linear-gradient(to right, transparent calc(50% - 1px), var(--app-border) calc(50% - 1px),
        var(--app-border) calc(50% + 1px), transparent calc(50% + 1px));
}

.pw-bar {
    position: absolute;
    height: 8px;
    border-radius: 2px;
    min-width: 1px;
}

.pw-bar--you {
    top: 1px;
    background: var(--app-accent);
}

.pw-bar--market {
    top: 12px;
    background: #9aa8b8;
}

.pw-value {
    font-size: 0.78rem;
    color: var(--app-muted);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

@media (max-width: 620px) {
    .pw-row {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }

    .pw-value {
        text-align: left;
    }
}

/* ─────────────────────────────────────────────────────────────
   Results
   ───────────────────────────────────────────────────────────── */

.readout-levels {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
    font-size: 0.95rem;
    line-height: 1.9;
}

.readout-levels li {
    border-bottom: 1px dashed var(--app-border);
    padding: 0.2rem 0;
}

.readout-levels li:last-child {
    border-bottom: none;
}

.handoff-steps {
    line-height: 1.8;
    padding-left: 1.3rem;
}

.handoff-steps li {
    margin-bottom: 0.9rem;
}

.handoff-steps code {
    background: #eef3fa;
    border-radius: 4px;
    padding: 0.1rem 0.35rem;
    font-size: 0.9em;
}

.handoff-steps > li > div {
    margin-top: 0.6rem;
}

@media (prefers-reduced-motion: reduce) {
    .choice-card,
    .choice-select,
    .task-progress__bar {
        transition: none;
    }
}
