/*-- -------------------------- -->
<---    Bottleneck Scorecard    -->
<--- -------------------------- -*/

/*
  Only loaded on the scorecard page template. Follows the same conventions as
  the rest of the theme: mobile-first breakpoints, CSS custom properties from
  style.css, and a dark mode block keyed off body.dark-mode.
*/

/* Mobile - 360px */
@media only screen and (min-width: 0rem) {
    #scorecard {
        padding: var(--sectionPadding);
        background-color: #f7f7f7;
        position: relative;
        z-index: 1;
    }

    #scorecard .cs-container {
        width: 100%;
        max-width: 46rem;
        margin: auto;
    }

    /* -- shared panel ------------------------------------------------- */

    .sc-panel {
        width: 100%;
        padding: clamp(1.5rem, 5vw, 3rem);
        box-sizing: border-box;
        background-color: #fff;
        border: 1px solid #e5e5e5;
        border-radius: 1rem;
    }

    .sc-panel .cs-topper {
        text-align: left;
    }

    .sc-panel .cs-title {
        margin-bottom: 1rem;
    }

    .sc-fineprint {
        font-size: 0.875rem;
        line-height: 1.5em;
        color: #767676;
        margin: 1.25rem 0 0;
    }

    /* -- start screen -------------------------------------------------- */

    .sc-meta {
        margin: 2rem 0;
        padding: 0;
        display: flex;
        flex-wrap: wrap;
        gap: 1.5rem;
        list-style: none;
    }

    .sc-meta li {
        display: flex;
        flex-direction: column;
        min-width: 6rem;
    }

    .sc-meta strong {
        font-size: 1.75rem;
        line-height: 1.1em;
        font-family: 'Playfair Display', serif;
        color: var(--primary);
    }

    .sc-meta span {
        font-size: 0.875rem;
        line-height: 1.4em;
        color: #767676;
        max-width: 12ch;
    }

    .sc-dims {
        margin: 0 0 2rem;
        padding: 1.5rem;
        background-color: #f7f7f7;
        border-radius: 0.75rem;
    }

    .sc-dims-title {
        font-size: 1rem;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        font-weight: 700;
        color: var(--headerColor);
        margin: 0 0 1rem;
    }

    .sc-dim-list {
        margin: 0;
        padding-left: 1.25rem;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .sc-dim-list li {
        color: var(--bodyTextColor);
    }

    .sc-dim-list strong {
        display: block;
        color: var(--headerColor);
        font-size: 1rem;
    }

    .sc-dim-list span {
        font-size: 0.9375rem;
        line-height: 1.5em;
    }

    .sc-start-button {
        font-size: 1rem;
        line-height: 3.5rem;
        text-decoration: none;
        font-weight: 700;
        overflow: hidden;
        margin: 0;
        color: #fff;
        padding: 0 3rem;
        border: none;
        border-radius: 1.875rem;
        background-color: var(--primary);
        display: inline-block;
        position: relative;
        z-index: 1;
        cursor: pointer;
        transition: color 0.3s;
    }

    .sc-start-button:before {
        content: "";
        position: absolute;
        display: block;
        height: 100%;
        width: 0%;
        background: #1a1a1a;
        opacity: 1;
        top: 0;
        left: 0;
        z-index: -1;
        transition: width 0.3s;
    }

    .sc-start-button:hover:before {
        width: 100%;
    }

    /* -- question screen ----------------------------------------------- */

    .sc-progress {
        margin-bottom: 2rem;
    }

    .sc-progress-bar {
        width: 100%;
        height: 0.375rem;
        background-color: #e9e9e9;
        border-radius: 1rem;
        overflow: hidden;
    }

    .sc-progress-fill {
        height: 100%;
        background-color: var(--primary);
        border-radius: 1rem;
        transition: width 0.3s ease;
    }

    .sc-progress-text {
        font-size: 0.8125rem;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        font-weight: 700;
        color: #767676;
        margin-top: 0.625rem;
        display: block;
    }

    .sc-tag {
        font-size: var(--topperFontSize);
        line-height: 1.2em;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        font-weight: 700;
        color: var(--primary);
        margin-bottom: 0.5rem;
        display: block;
    }

    .sc-question-text {
        /* 22px - 30px */
        font-size: clamp(1.375rem, 3vw, 1.875rem);
        font-family: 'Playfair Display', serif;
        font-weight: 700;
        line-height: 1.3em;
        color: var(--headerColor);
        margin: 0 0 1.5rem;
    }

    .sc-help {
        font-size: 0.9375rem;
        line-height: 1.5em;
        color: #767676;
        margin: -1rem 0 1.5rem;
    }

    .sc-options {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .sc-option {
        width: 100%;
        padding: 1rem 1.125rem;
        box-sizing: border-box;
        text-align: left;
        font-size: 1rem;
        line-height: 1.5em;
        font-family: inherit;
        color: var(--headerColor);
        background-color: #fff;
        border: 1px solid #dcdcdc;
        border-radius: 0.625rem;
        cursor: pointer;
        display: flex;
        align-items: flex-start;
        gap: 0.875rem;
        transition: border-color 0.2s, background-color 0.2s, transform 0.15s;
    }

    .sc-option:hover {
        border-color: var(--primary);
        background-color: #f4f9f8;
    }

    .sc-option:active {
        transform: scale(0.995);
    }

    .sc-option.sc-selected {
        border-color: var(--primary);
        background-color: #f4f9f8;
        box-shadow: inset 0 0 0 1px var(--primary);
    }

    .sc-option-key {
        width: 1.75rem;
        height: 1.75rem;
        flex: none;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 0.8125rem;
        font-weight: 700;
        color: #767676;
        background-color: #f0f0f0;
        border-radius: 0.375rem;
    }

    .sc-option:hover .sc-option-key,
    .sc-option.sc-selected .sc-option-key {
        color: #fff;
        background-color: var(--primary);
    }

    .sc-back {
        margin-top: 1.5rem;
        padding: 0;
        font-size: 0.9375rem;
        font-family: inherit;
        font-weight: 700;
        color: #767676;
        background: none;
        border: none;
        cursor: pointer;
        text-decoration: underline;
    }

    .sc-back:hover {
        color: var(--primary);
    }

    /* -- loading ------------------------------------------------------- */

    .sc-loading {
        text-align: center;
    }

    .sc-spinner {
        width: 2.5rem;
        height: 2.5rem;
        margin: 0 auto 1.25rem;
        border: 3px solid #e5e5e5;
        border-top-color: var(--primary);
        border-radius: 50%;
        animation: sc-spin 0.8s linear infinite;
    }

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

    /* -- result -------------------------------------------------------- */

    .sc-dial {
        margin: 0.5rem 0 1.5rem;
        display: flex;
        align-items: baseline;
        gap: 0.5rem;
    }

    .sc-dial-score {
        /* 56px - 88px */
        font-size: clamp(3.5rem, 10vw, 5.5rem);
        font-family: 'Playfair Display', serif;
        font-weight: 700;
        line-height: 1em;
        color: var(--primary);
    }

    .sc-dial.sc-band-red .sc-dial-score {
        color: #c0392b;
    }

    .sc-dial.sc-band-amber .sc-dial-score {
        color: #b7791f;
    }

    .sc-dial-max {
        font-size: 1.25rem;
        color: #767676;
    }

    .sc-scale {
        margin-bottom: 1.75rem;
    }

    .sc-scale-track {
        width: 100%;
        height: 0.75rem;
        background-color: #ececec;
        border-radius: 1rem;
        position: relative;
    }

    .sc-scale-value {
        height: 100%;
        background-color: var(--primary);
        border-radius: 1rem;
        transition: width 0.6s ease;
    }

    .sc-scale-value.sc-band-red {
        background-color: #c0392b;
    }

    .sc-scale-value.sc-band-amber {
        background-color: #b7791f;
    }

    .sc-scale-target {
        position: absolute;
        top: -0.25rem;
        bottom: -0.25rem;
        width: 2px;
        background-color: var(--headerColor);
    }

    .sc-scale-legend {
        margin-top: 0.5rem;
        display: flex;
        justify-content: space-between;
        font-size: 0.8125rem;
        color: #767676;
    }

    .sc-scale-target-label {
        font-weight: 700;
        color: var(--headerColor);
    }

    .sc-summary {
        margin-bottom: 1.75rem;
    }

    .sc-weakest {
        padding: 1.25rem 1.5rem;
        background-color: #f7f7f7;
        border-left: 4px solid var(--primary);
        border-radius: 0 0.625rem 0.625rem 0;
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }

    .sc-weakest-label {
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        font-weight: 700;
        color: #767676;
    }

    .sc-weakest-name {
        font-size: 1.375rem;
        font-family: 'Playfair Display', serif;
        color: var(--headerColor);
    }

    .sc-weakest-hint {
        font-size: 0.9375rem;
        line-height: 1.5em;
        color: var(--bodyTextColor);
    }

    /* -- email gate ---------------------------------------------------- */

    .sc-gate {
        margin-top: 2rem;
        padding-top: 2rem;
        border-top: 1px solid #e5e5e5;
    }

    .sc-gate-title {
        font-size: clamp(1.25rem, 3vw, 1.75rem);
        font-family: 'Playfair Display', serif;
        font-weight: 700;
        line-height: 1.2em;
        color: var(--headerColor);
        margin: 0 0 0.75rem;
    }

    .sc-gate-text {
        font-size: 1rem;
        line-height: 1.5em;
        color: var(--bodyTextColor);
        margin: 0 0 1.5rem;
    }

    .sc-form {
        display: flex;
        flex-direction: column;
        gap: 0.875rem;
    }

    .sc-label {
        font-size: 0.9375rem;
        font-weight: 700;
        color: var(--headerColor);
        display: flex;
        flex-direction: column;
        gap: 0.375rem;
    }

    .sc-input {
        font-size: 1rem;
        font-family: inherit;
        width: 100%;
        height: 3.25rem;
        padding: 0 1.125rem;
        box-sizing: border-box;
        font-weight: 400;
        color: var(--headerColor);
        background-color: #f7f7f7;
        border: 1px solid transparent;
        border-radius: 0.5rem;
    }

    .sc-input:focus {
        outline: none;
        border-color: var(--primary);
        background-color: #fff;
    }

    /* Off-screen rather than display:none -- bots skip hidden fields. */
    .sc-honey {
        position: absolute;
        left: -9999px;
        width: 1px;
        height: 1px;
        overflow: hidden;
    }

    .sc-submit {
        font-size: 1rem;
        line-height: 3.5rem;
        font-family: inherit;
        text-decoration: none;
        font-weight: 700;
        overflow: hidden;
        margin-top: 0.5rem;
        color: #fff;
        padding: 0 2.5rem;
        border: none;
        border-radius: 1.875rem;
        background-color: var(--primary);
        display: inline-block;
        position: relative;
        z-index: 1;
        cursor: pointer;
        transition: color 0.3s;
    }

    .sc-submit:before {
        content: "";
        position: absolute;
        display: block;
        height: 100%;
        width: 0%;
        background: #1a1a1a;
        top: 0;
        left: 0;
        z-index: -1;
        transition: width 0.3s;
    }

    .sc-submit:hover:before {
        width: 100%;
    }

    .sc-submit:disabled {
        opacity: 0.6;
        cursor: default;
    }

    .sc-form-error {
        font-size: 0.9375rem;
        color: #c0392b;
        margin: 0;
    }

    /* -- full report --------------------------------------------------- */

    .sc-bars {
        margin: 2rem 0;
        display: flex;
        flex-direction: column;
        gap: 1.125rem;
    }

    .sc-bar-head {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        margin-bottom: 0.375rem;
        gap: 1rem;
    }

    .sc-bar-label {
        font-size: 1rem;
        font-weight: 700;
        color: var(--headerColor);
    }

    .sc-bar-score {
        font-size: 0.9375rem;
        font-weight: 700;
        color: #767676;
        flex: none;
    }

    .sc-bar-track {
        width: 100%;
        height: 0.625rem;
        background-color: #ececec;
        border-radius: 1rem;
        overflow: hidden;
    }

    .sc-bar-fill {
        height: 100%;
        border-radius: 1rem;
        background-color: var(--primary);
        transition: width 0.6s ease;
    }

    .sc-bar-fill.sc-band-red {
        background-color: #c0392b;
    }

    .sc-bar-fill.sc-band-amber {
        background-color: #b7791f;
    }

    .sc-section-title {
        font-size: 1.25rem;
        font-family: 'Playfair Display', serif;
        font-weight: 700;
        color: var(--headerColor);
        margin: 0 0 0.75rem;
    }

    .sc-narrative {
        margin: 2rem 0;
        padding: 1.5rem;
        background-color: #f7f7f7;
        border-radius: 0.75rem;
    }

    .sc-detail {
        margin: 1.5rem 0;
        padding-left: 1.25rem;
        border-left: 4px solid #ececec;
    }

    .sc-detail.sc-band-edge-red {
        border-left-color: #c0392b;
    }

    .sc-detail.sc-band-edge-amber {
        border-left-color: #b7791f;
    }

    .sc-detail.sc-band-edge-green {
        border-left-color: var(--primary);
    }

    .sc-detail-title {
        font-size: 1.125rem;
        font-weight: 700;
        color: var(--headerColor);
        margin: 0 0 0.5rem;
    }

    .sc-routing {
        margin: 2.5rem 0 0;
        padding: 1.75rem;
        background-color: var(--primary);
        border-radius: 0.75rem;
    }

    .sc-routing-title {
        font-size: 1.25rem;
        font-family: 'Playfair Display', serif;
        font-weight: 700;
        line-height: 1.3em;
        color: #fff;
        margin: 0 0 0.75rem;
    }

    .sc-routing-text {
        font-size: 1rem;
        line-height: 1.5em;
        color: rgba(255, 255, 255, 0.9);
        margin: 0 0 1.5rem;
    }

    .sc-routing .cs-button-solid {
        font-size: 1rem;
        line-height: 3.25rem;
        text-decoration: none;
        font-weight: 700;
        color: var(--primary);
        padding: 0 2.25rem;
        border-radius: 1.875rem;
        background-color: #fff;
        display: inline-block;
        transition: transform 0.2s;
    }

    .sc-routing .cs-button-solid:hover {
        transform: translateY(-2px);
    }

    .sc-share {
        margin-top: 2.5rem;
        padding-top: 2rem;
        border-top: 1px solid #e5e5e5;
    }

    .sc-share .sc-routing-text {
        color: var(--bodyTextColor);
    }

    .sc-share-row {
        display: flex;
        flex-direction: column;
        gap: 0.625rem;
    }

    .sc-share-input {
        font-size: 0.875rem;
        color: #767676;
    }

    .sc-copy {
        font-size: 0.9375rem;
        font-family: inherit;
        font-weight: 700;
        height: 3.25rem;
        padding: 0 1.5rem;
        color: var(--primary);
        background-color: #fff;
        border: 2px solid var(--primary);
        border-radius: 0.5rem;
        cursor: pointer;
        flex: none;
        transition: background-color 0.2s, color 0.2s;
    }

    .sc-copy:hover {
        color: #fff;
        background-color: var(--primary);
    }
}

/* Tablet - 768px */
@media only screen and (min-width: 48rem) {
    .sc-form {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .sc-form .sc-submit,
    .sc-form .sc-fineprint,
    .sc-form .sc-form-error {
        grid-column: 1 / -1;
    }

    .sc-submit {
        justify-self: start;
    }

    .sc-share-row {
        flex-direction: row;
    }
}

/* Dark Mode */
@media only screen and (min-width: 0rem) {
    body.dark-mode #scorecard {
        background-color: var(--dark);
    }

    body.dark-mode .sc-panel {
        background-color: var(--medium);
        border-color: rgba(255, 255, 255, 0.1);
    }

    body.dark-mode .sc-panel .cs-title,
    body.dark-mode .sc-question-text,
    body.dark-mode .sc-gate-title,
    body.dark-mode .sc-section-title,
    body.dark-mode .sc-detail-title,
    body.dark-mode .sc-dims-title,
    body.dark-mode .sc-bar-label,
    body.dark-mode .sc-weakest-name,
    body.dark-mode .sc-label,
    body.dark-mode .sc-dim-list strong,
    body.dark-mode .sc-scale-target-label {
        color: var(--bodyTextColorWhite);
    }

    body.dark-mode .sc-panel .cs-text,
    body.dark-mode .sc-gate-text,
    body.dark-mode .sc-dim-list li,
    body.dark-mode .sc-weakest-hint,
    body.dark-mode .sc-share .sc-routing-text {
        color: rgba(250, 251, 252, 0.85);
    }

    body.dark-mode .sc-fineprint,
    body.dark-mode .sc-help,
    body.dark-mode .sc-progress-text,
    body.dark-mode .sc-bar-score,
    body.dark-mode .sc-dial-max,
    body.dark-mode .sc-scale-legend,
    body.dark-mode .sc-weakest-label,
    body.dark-mode .sc-back {
        color: rgba(250, 251, 252, 0.6);
    }

    body.dark-mode .sc-panel .cs-topper,
    body.dark-mode .sc-tag {
        color: var(--primaryLight);
    }

    body.dark-mode .sc-dims,
    body.dark-mode .sc-weakest,
    body.dark-mode .sc-narrative {
        background-color: rgba(255, 255, 255, 0.06);
    }

    body.dark-mode .sc-weakest {
        border-left-color: var(--primaryLight);
    }

    body.dark-mode .sc-option {
        color: var(--bodyTextColorWhite);
        background-color: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.15);
    }

    body.dark-mode .sc-option:hover,
    body.dark-mode .sc-option.sc-selected {
        border-color: var(--primaryLight);
        background-color: rgba(55, 184, 134, 0.12);
    }

    body.dark-mode .sc-option.sc-selected {
        box-shadow: inset 0 0 0 1px var(--primaryLight);
    }

    body.dark-mode .sc-option-key {
        color: rgba(250, 251, 252, 0.7);
        background-color: rgba(255, 255, 255, 0.1);
    }

    body.dark-mode .sc-option:hover .sc-option-key,
    body.dark-mode .sc-option.sc-selected .sc-option-key {
        color: #1a1a1a;
        background-color: var(--primaryLight);
    }

    body.dark-mode .sc-progress-bar,
    body.dark-mode .sc-scale-track,
    body.dark-mode .sc-bar-track {
        background-color: rgba(255, 255, 255, 0.12);
    }

    body.dark-mode .sc-progress-fill,
    body.dark-mode .sc-scale-value,
    body.dark-mode .sc-bar-fill {
        background-color: var(--primaryLight);
    }

    body.dark-mode .sc-scale-value.sc-band-red,
    body.dark-mode .sc-bar-fill.sc-band-red {
        background-color: #e74c3c;
    }

    body.dark-mode .sc-scale-value.sc-band-amber,
    body.dark-mode .sc-bar-fill.sc-band-amber {
        background-color: #e0a53c;
    }

    body.dark-mode .sc-scale-target {
        background-color: #fff;
    }

    body.dark-mode .sc-dial-score {
        color: var(--primaryLight);
    }

    body.dark-mode .sc-dial.sc-band-red .sc-dial-score {
        color: #e74c3c;
    }

    body.dark-mode .sc-dial.sc-band-amber .sc-dial-score {
        color: #e0a53c;
    }

    body.dark-mode .sc-meta strong {
        color: var(--primaryLight);
    }

    body.dark-mode .sc-meta span {
        color: rgba(250, 251, 252, 0.6);
    }

    body.dark-mode .sc-input {
        color: #fff;
        background-color: rgba(255, 255, 255, 0.1);
    }

    body.dark-mode .sc-input:focus {
        border-color: var(--primaryLight);
        background-color: rgba(255, 255, 255, 0.15);
    }

    body.dark-mode .sc-gate,
    body.dark-mode .sc-share {
        border-top-color: rgba(255, 255, 255, 0.12);
    }

    /* Match the brighter reds and ambers used by the bars on a dark ground. */
    body.dark-mode .sc-detail.sc-band-edge-red {
        border-left-color: #e74c3c;
    }

    body.dark-mode .sc-detail.sc-band-edge-amber {
        border-left-color: #e0a53c;
    }

    body.dark-mode .sc-detail.sc-band-edge-green {
        border-left-color: var(--primaryLight);
    }

    body.dark-mode .sc-routing {
        background-color: rgba(55, 184, 134, 0.15);
        border: 1px solid var(--primaryLight);
    }

    body.dark-mode .sc-routing-title {
        color: var(--bodyTextColorWhite);
    }

    body.dark-mode .sc-routing .sc-routing-text {
        color: rgba(250, 251, 252, 0.85);
    }

    body.dark-mode .sc-routing .cs-button-solid {
        color: #1a1a1a;
        background-color: var(--primaryLight);
    }

    body.dark-mode .sc-copy {
        color: var(--primaryLight);
        background-color: transparent;
        border-color: var(--primaryLight);
    }

    body.dark-mode .sc-copy:hover {
        color: #1a1a1a;
        background-color: var(--primaryLight);
    }

    body.dark-mode .sc-spinner {
        border-color: rgba(255, 255, 255, 0.15);
        border-top-color: var(--primaryLight);
    }

    body.dark-mode .sc-start-button {
        color: #1a1a1a;
        background-color: var(--primaryLight);
    }

    body.dark-mode .sc-start-button:before,
    body.dark-mode .sc-submit:before {
        background: #fff;
    }

    body.dark-mode .sc-submit {
        color: #1a1a1a;
        background-color: var(--primaryLight);
    }
}
