/*
    WHEEL OF LIFE ASSESSMENT

    Markup: src/includes/wheel-of-life.njk, behaviour: wheel-of-life.N.js.
    Uses the --pf-* tokens of the site-wide "modern shell" in index.NN.css.
    The deploy caches this file for a year: bump N in its name (and in the
    include) whenever it changes.
*/

.wheel-of-life {
    --wol-ink: var(--text-color-light);
    --wol-muted: #77746f;
    --wol-button-bg: rgba(255, 255, 255, 0.75);
    --wol-button-bg-hover: #fff;
    --wol-line: var(--pf-line);
    --wol-field: rgba(255, 255, 255, 0.6);

    max-width: 920px;
    margin: 30px auto 0;
    font-family: var(--pf-font);
    font-weight: 400;
    letter-spacing: normal;
    color: var(--wol-ink);
}

body.dark .wheel-of-life {
    --wol-ink: var(--text-color-dark);
    --wol-muted: rgba(255, 255, 255, 0.62);
    --wol-button-bg: rgba(255, 255, 255, 0.08);
    --wol-button-bg-hover: rgba(255, 255, 255, 0.16);
    --wol-line: var(--pf-line-dark);
    --wol-field: rgba(255, 255, 255, 0.06);
}

.wheel-of-life__card {
    padding: 24px 26px;
    border: 1px solid var(--wol-line);
    border-radius: 18px;
    background: var(--pf-surface);
    box-shadow: var(--pf-shadow-card), var(--pf-inset);
}

.wheel-of-life__layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 24px 32px;
    align-items: start;
}

/* the chart */

.wheel-of-life__chart-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wheel-of-life__chart {
    display: block;
    width: 100%;
    max-width: 460px;
    height: auto;
}

.wheel-of-life__label {
    font-family: var(--pf-font);
}

body.dark .wheel-of-life__ring,
body.dark .wheel-of-life__spoke,
body.dark .wheel-of-life__target {
    stroke: #fff;
}

body.dark .wheel-of-life__wedge {
    stroke: #3a3836;
}

body.dark .wheel-of-life__label {
    fill: #fff;
}

.wheel-of-life__average {
    margin-top: 6px;
    color: var(--wol-muted);
    font-size: 15px;
}

.wheel-of-life__average strong {
    color: var(--wol-ink);
    font-size: 20px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* the score rows */

.wheel-of-life__areas-head {
    display: block;
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
}

.wheel-of-life__muted {
    display: block;
    color: var(--wol-muted);
    font-size: 14px;
    font-weight: 400;
}

.wheel-of-life__area {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr);
    align-items: center;
    column-gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid var(--wol-line);
}

.wheel-of-life__area:last-child {
    border-bottom: 0;
}

.wheel-of-life__swatch {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--area-color);
}

.wheel-of-life__name {
    width: 100%;
    min-width: 0;
    margin: 0 0 0 -6px;
    padding: 3px 6px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 15px;
    font-weight: 500;
}

.wheel-of-life__name:hover {
    border-color: var(--wol-line);
}

.wheel-of-life__name:focus {
    border-color: var(--pf-primary-deep);
    background: var(--wol-field);
    outline: none;
}

.wheel-of-life__slider-row {
    display: flex;
    grid-column: 2;
    align-items: center;
    gap: 10px;
}

.wheel-of-life__slider-row[hidden] {
    display: none;
}

.wheel-of-life__slider {
    flex: 1;
    min-width: 0;
    margin: 0;
    accent-color: var(--pf-primary-deep);
    cursor: pointer;
}

.wheel-of-life__slider-row--target .wheel-of-life__slider {
    accent-color: var(--wol-muted);
}

.wheel-of-life__target-label {
    color: var(--wol-muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.wheel-of-life__value {
    min-width: 1.6em;
    font-size: 16px;
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* toolbar */

.wheel-of-life__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--wol-line);
}

.wheel-of-life__toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
}

.wheel-of-life__toggle input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--pf-primary-deep);
}

.wheel-of-life__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wheel-of-life__button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 15px;
    border: 1px solid var(--wol-line);
    border-radius: 999px;
    background: var(--wol-button-bg);
    color: inherit;
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s var(--pf-ease-spring), background-color 0.2s;
}

.wheel-of-life__button:hover {
    background: var(--wol-button-bg-hover);
    transform: translateY(-1px);
}

.wheel-of-life__button--quiet {
    border-color: transparent;
    background: transparent;
    color: var(--wol-muted);
}

/* insights */

.wheel-of-life__insights {
    display: block;
    margin-top: 20px;
    padding: 18px 20px;
    border-radius: 14px;
    background: var(--wol-field);
}

.wheel-of-life__insights-title,
.wheel-of-life__focus-label,
.wheel-of-life__questions-title {
    display: block;
    color: var(--wol-muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.wheel-of-life__summary {
    display: block;
    margin-top: 6px;
    font-size: 16px;
    line-height: 1.55;
}

.wheel-of-life__focus-label {
    margin-top: 16px;
}

.wheel-of-life__focus {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.wheel-of-life__focus-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.3rem 0.85rem 0.3rem 0.6rem;
    border: 1.5px solid var(--wol-line);
    border-radius: 2rem;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.wheel-of-life__focus-option:hover {
    border-color: var(--pf-primary-deep);
}

.wheel-of-life__focus-option input {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: var(--pf-primary-deep);
}

.wheel-of-life__focus-option:has(input:checked) {
    border-color: var(--pf-primary-deep);
    background: var(--pf-primary);
    color: var(--pf-ink);
    font-weight: 500;
}

.wheel-of-life__focus-option:has(input:focus-visible) {
    outline: 2px solid var(--pf-primary-deep);
    outline-offset: 2px;
}

.wheel-of-life__questions {
    display: block;
    margin-top: 16px;
}

.wheel-of-life .wheel-of-life__questions ol {
    max-width: none;
    margin: 8px 0 0;
    padding-left: 1.4em;
    font-size: 16px;
    line-height: 1.55;
    letter-spacing: normal;
}

.wheel-of-life__questions li + li {
    margin-top: 4px;
}

.wheel-of-life__more {
    display: block;
    margin-top: 12px;
    font-size: 15px;
}

.wheel-of-life a {
    color: inherit;
    text-decoration: none;
    background: linear-gradient(to bottom, transparent 55%, rgba(255, 212, 101, 0.8) 55%);
}

.wheel-of-life a:hover {
    background: linear-gradient(to bottom, transparent 55%, #ffd465 55%);
}

/* under the card */

.wheel-of-life__tip {
    display: block;
    margin-top: 12px;
    color: var(--wol-muted);
    font-size: 14px;
    text-align: center;
}

.wheel-of-life__visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 860px) {
    .wheel-of-life__layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .wheel-of-life {
        margin-top: 24px;
    }

    .wheel-of-life__card {
        padding: 16px 14px;
    }

    .wheel-of-life__insights {
        padding: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wheel-of-life__button {
        transition: none;
    }
}

/* Print only the wheel, scores and questions. */
@media print {
    body > *:not(.content),
    .content > *:not(main),
    main > *:not(.wheel-of-life) {
        display: none !important;
    }

    .wheel-of-life,
    body.dark .wheel-of-life {
        --wol-ink: #000;
        --wol-muted: #555;
        max-width: none;
        margin: 0;
        color: #000;
    }

    body.dark .wheel-of-life__wedge {
        stroke: #fff;
    }

    .wheel-of-life__card {
        border: 0;
        background: none;
        box-shadow: none;
    }

    .wheel-of-life__toolbar,
    .wheel-of-life__tip,
    .wheel-of-life__focus-label,
    .wheel-of-life__focus,
    .wheel-of-life__more {
        display: none;
    }

    .wheel-of-life__layout {
        grid-template-columns: 1fr 1fr;
    }

    body.dark .wheel-of-life__ring,
    body.dark .wheel-of-life__spoke,
    body.dark .wheel-of-life__target {
        stroke: #000;
    }

    body.dark .wheel-of-life__label {
        fill: #000;
    }
}
