/* D88 (24 Sep 2026): Data Dare's own colour, and the rebuilt pages.
   Theme = the site's ivory/white, like the top bar. Plum only where something
   is selected or clickable: active tabs and capsules, codes, links, the current
   item, solution pills. Gold stays the main button. Loaded after the other
   Data Dare stylesheets on every Data Dare page. */

.fi-dd-page {
    --dd-plum: #5e2a84;
    --dd-plum-deep: #45195f;
    --dd-plum-tint: #f3ecf8;
    --dd-plum-line: #ddcbea;
    --dd-line: #eae4da;
    --dd-muted: #6f6a62;
    --dd-ink: #161310;
    --dd-body: #2b2620;
}

/* Plum on what is selected or clickable */
.fi-dd-page .fi-dd-dataset-card__code,
.fi-dd-page .fi-dd-question-hero__dataset,
.fi-dd-page .fi-dd-discussion-qref,
.fi-dd-page .dd-q__code,
.fi-dd-page .dd-ds__code,
.fi-dd-page .dd-feed__code {
    color: var(--dd-plum);
}

.fi-dd-page .fi-dd-discussion-filter.is-active,
.fi-dd-page .fi-dd-question-filters .fd-chip.is-active {
    background: var(--dd-plum);
    border-color: var(--dd-plum);
    color: #fff;
}

.fi-dd-page .fi-dd-discussion-filter:not(.is-active):hover {
    border-color: var(--dd-plum-line);
    color: var(--dd-plum);
}

.fd-badge--plum {
    background: var(--dd-plum, #5e2a84);
    color: #fff;
    border-color: var(--dd-plum, #5e2a84);
}

/* ── Arena ─────────────────────────────────────────────── */
.dd-arena__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}

.dd-arena__search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 260px;
    min-width: 0;
    padding: 0 0.9rem;
    min-height: 44px;
    border: 1px solid #d9d2c6;
    border-radius: 999px;
    background: #fff;
    color: var(--dd-muted);
}

.dd-arena__search input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 0.95rem;
    color: var(--dd-ink);
    outline: none;
}

.dd-arena__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.dd-arena__tab {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 0.95rem;
    border-radius: 999px;
    border: 1px solid #d9d2c6;
    background: #fff;
    color: var(--dd-ink);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
}

.dd-arena__tab:hover {
    border-color: var(--dd-plum-line);
    color: var(--dd-plum);
}

.dd-arena__tab.is-active {
    background: var(--dd-plum);
    border-color: var(--dd-plum);
    color: #fff;
}

.dd-arena__request {
    text-align: center;
    color: var(--dd-muted);
    font-size: 0.9rem;
    margin: 1.5rem 0 0;
}

.dd-arena__request a {
    color: var(--dd-plum);
    font-weight: 600;
}

/* Cards: the sticker is the link; two across on a phone */
.fi-dd-page a.fi-dd-dataset-card__media {
    display: block;
    text-decoration: none;
}

.fi-dd-dataset-card__foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.35rem;
    font-size: 0.8125rem;
    color: var(--dd-muted);
}

.fi-dd-dataset-card__quick {
    background: none;
    border: 0;
    padding: 0.25rem 0;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--dd-plum);
    cursor: pointer;
}

@media (max-width: 639px) {
    .fi-dd-page .fi-dd-dataset-grid,
    .fi-dd-page .fi-dd-arena .fi-dd-dataset-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .fi-dd-page .fi-dd-dataset-card__title {
        font-size: 0.9rem;
        line-height: 1.3;
    }

    .fi-dd-page .fi-dd-dataset-card__overlay {
        display: none;
    }
}

/* ── Dataset page ──────────────────────────────────────── */
.dd-ds {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dd-ds__head {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    padding: 1.25rem;
}

.dd-ds__sticker {
    width: 200px;
    height: 200px;
    flex: 0 0 200px;
    border-radius: 14px;
    object-fit: cover;
    background: #f5eedc;
}

.dd-ds__head-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.dd-ds__code,
.dd-q__code {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.dd-ds__title {
    margin: 0;
}

.dd-ds__decide {
    margin: 0;
    font-size: 1rem;
    line-height: 1.55;
    color: var(--dd-body);
    max-width: 68ch;
}

.dd-ds__chips {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.dd-ds__chips li {
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    background: #f3efe7;
    color: var(--dd-muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.dd-ds__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.25rem;
}

.dd-ds__share {
    display: flex;
    gap: 0.35rem;
    margin-left: auto;
}

.dd-ds__files,
.dd-ds__questions {
    padding: 1.25rem;
    scroll-margin-top: 5rem;
}

.dd-ds__section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0.6rem;
}

.dd-ds__section-head h2 {
    margin: 0;
}

.dd-ds__section-note {
    font-size: 0.8125rem;
    color: var(--dd-muted);
}

.dd-ds__section-note a {
    color: var(--dd-plum);
    font-weight: 600;
    margin-left: 0.25rem;
}

.dd-ds__section-note a.is-active {
    text-decoration: underline;
}

.dd-ds__gate {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.9rem 1rem;
    margin-bottom: 0.75rem;
    border-radius: 12px;
    background: var(--dd-plum-tint);
    border: 1px solid var(--dd-plum-line);
}

.dd-ds__gate-text {
    margin: 0;
    font-weight: 600;
    color: var(--dd-ink);
    font-size: 0.95rem;
}

.dd-ds__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.dd-ds__tab {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 0.8rem;
    border-radius: 999px;
    border: 1px solid #d9d2c6;
    background: #fff;
    color: var(--dd-ink);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
}

.dd-ds__tab.is-active {
    background: var(--dd-plum);
    border-color: var(--dd-plum);
    color: #fff;
}

.dd-ds__list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--dd-line);
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
}

.dd-ds__row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 46px;
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid var(--dd-line);
    text-decoration: none;
    color: var(--dd-ink);
}

.dd-ds__list li:last-child .dd-ds__row {
    border-bottom: 0;
}

.dd-ds__row:hover {
    background: var(--dd-plum-tint);
}

.dd-ds__row-code {
    flex: 0 0 2.4rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.75rem;
    color: var(--dd-muted);
}

.dd-ds__row-diff {
    flex: 0 0 auto;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    background: #f3efe7;
    color: var(--dd-muted);
}

.dd-ds__row-diff--easy { background: #e3f3e9; color: #1f6b3f; }
.dd-ds__row-diff--medium { background: #fbefd2; color: #7a4e00; }
.dd-ds__row-diff--hard { background: #fbe4dc; color: #a3321a; }
.dd-ds__row-diff--very_hard { background: #f7dee2; color: #6e1b2a; }

.dd-ds__row-title {
    flex: 1;
    min-width: 0;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.3;
}

.dd-ds__row-count {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--dd-plum);
}

@media (max-width: 639px) {
    .dd-ds__head {
        gap: 0.85rem;
        padding: 1rem;
    }

    .dd-ds__sticker {
        width: 104px;
        height: 104px;
        flex-basis: 104px;
        border-radius: 12px;
    }

    .dd-ds__title {
        font-size: 1.25rem;
        line-height: 1.2;
    }

    .dd-ds__decide {
        font-size: 0.9375rem;
    }

    .dd-ds__share {
        margin-left: 0;
        width: 100%;
    }

    .dd-ds__files,
    .dd-ds__questions {
        padding: 1rem;
    }

    .dd-ds__row-diff {
        display: none;
    }
}

/* ── Question page ─────────────────────────────────────── */
.dd-q {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.dd-q__dataset {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    text-decoration: none;
    color: var(--dd-ink);
}

.dd-q__dataset img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    flex: 0 0 40px;
}

.dd-q__dataset-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.dd-q__dataset-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--dd-plum);
}

.dd-q__dataset-title {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dd-q__dataset-cta {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--dd-plum);
    white-space: nowrap;
}

.dd-q__card {
    padding: 1.25rem;
}

.dd-q__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.dd-q__title {
    margin: 0 0 0.6rem;
}

.dd-q__text {
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--dd-body);
}

.dd-q__facts {
    margin: 1rem 0 0;
    padding-top: 0.85rem;
    border-top: 1px solid var(--dd-line);
    display: grid;
    gap: 0.5rem;
}

.dd-q__facts > div {
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr);
    gap: 0.5rem;
    align-items: baseline;
    font-size: 0.9rem;
}

.dd-q__facts dt {
    color: var(--dd-muted);
    font-weight: 600;
}

.dd-q__facts dd {
    margin: 0;
    color: var(--dd-body);
}

.dd-q__format,
.dd-q__more {
    color: var(--dd-muted);
}

.dd-q__tables summary {
    cursor: pointer;
    color: var(--dd-plum);
    font-weight: 600;
}

.dd-q__tables-body {
    margin-top: 0.5rem;
    display: grid;
    gap: 0.4rem;
}

.dd-q__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.dd-q__nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.dd-q__nav-pos {
    font-size: 0.8125rem;
    color: var(--dd-muted);
}

@media (max-width: 639px) {
    .dd-q__card {
        padding: 1rem;
    }

    .dd-q__title {
        font-size: 1.4rem;
        line-height: 1.2;
    }

    .dd-q__facts > div {
        grid-template-columns: 4.5rem minmax(0, 1fr);
    }
}

/* ── Feed ──────────────────────────────────────────────── */
.dd-feed {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dd-feed__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem 1rem;
}

.dd-feed__head h1,
.dd-feed__head p {
    margin: 0;
    flex-basis: 100%;
}

.dd-feed__actions {
    margin-left: auto;
}

.dd-feed__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}

.dd-feed__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.dd-feed__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 38px;
    padding: 0 0.85rem;
    border-radius: 999px;
    border: 1px solid #d9d2c6;
    background: #fff;
    color: var(--dd-ink);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
}

.dd-feed__chip span {
    color: var(--dd-muted);
    font-weight: 500;
}

.dd-feed__chip.is-active {
    background: var(--dd-plum);
    border-color: var(--dd-plum);
    color: #fff;
}

.dd-feed__chip.is-active span {
    color: rgba(255, 255, 255, 0.8);
}

.dd-feed__list {
    list-style: none;
    margin: 0;
    padding: 0.25rem 1.25rem;
}

.dd-feed__item {
    padding: 0.9rem 0;
    border-top: 1px solid var(--dd-line);
}

.dd-feed__item:first-child {
    border-top: 0;
}

.dd-feed__item-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.dd-feed__code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
}

.dd-feed__title {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.3;
}

.dd-feed__title a {
    color: var(--dd-ink);
    text-decoration: none;
}

.dd-feed__title a:hover {
    color: var(--dd-plum);
}

.dd-feed__excerpt {
    margin: 0.3rem 0 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--dd-body);
}

.dd-feed__meta {
    margin: 0.35rem 0 0;
    font-size: 0.8125rem;
    color: var(--dd-muted);
}

.dd-feed__empty {
    padding: 1.25rem;
    color: var(--dd-muted);
}

/* Request a dataset — plum capsule with a gold "?" */
.dd-req {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 1.75rem 0 0.5rem;
}

.dd-req__capsule {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 1.25rem;
    border-radius: 999px;
    background: var(--dd-plum);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
}

.dd-req__capsule:hover {
    background: var(--dd-plum-deep);
    color: #fff;
}

.dd-req__why {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 0;
    background: #d6a01c;
    color: #1d1606;
    font: inherit;
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(168, 106, 0, 0.18);
}

.dd-req__why:hover {
    background: #f5be3d;
}

.dd-req__modal[hidden] {
    display: none;
}

.dd-req__modal .fd-modal__panel {
    max-width: 34rem;
}

/* Capsule beside Browse challenges */
.fi-dd-intro__ctas {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.dd-req--inline {
    margin: 0;
    justify-content: flex-start;
}

/* Files: one-line rows, big buttons above */
.dd-files__big {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 0.25rem 0 0.9rem;
}

.dd-files__size {
    font-weight: 500;
    opacity: 0.8;
}

.dd-files__list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--dd-line);
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
}

.dd-files__row {
    display: grid;
    grid-template-columns: 11rem minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.75rem;
    min-height: 48px;
    padding: 0.45rem 0.85rem;
    border-bottom: 1px solid var(--dd-line);
}

.dd-files__row:last-child {
    border-bottom: 0;
}

.dd-files__cat {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--dd-plum);
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dd-files__name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dd-ink);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dd-files__meta {
    font-size: 0.8125rem;
    color: var(--dd-muted);
    white-space: nowrap;
}

.fd-btn--sm {
    min-height: 34px;
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
    font-size: 0.8125rem;
}

@media (max-width: 767px) {
    .dd-files__row {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "cat action" "name action" "meta action";
        row-gap: 0.1rem;
    }

    .dd-files__cat { grid-area: cat; }
    .dd-files__name { grid-area: name; white-space: normal; }
    .dd-files__meta { grid-area: meta; }
    .dd-files__action { grid-area: action; }

    .dd-files__big .fd-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Hero: Browse challenges and the request capsule on one baseline */
.fi-dd-intro__ctas {
    margin-top: var(--fd-space-4, 16px);
}

.fi-dd-intro__ctas .fi-dd-intro__cta {
    margin-top: 0;
}

.fi-dd-intro__ctas .dd-req__capsule,
.fi-dd-intro__ctas .fi-dd-intro__cta {
    min-height: 48px;
    box-sizing: border-box;
}

.fi-dd-intro__ctas .dd-req__why {
    width: 48px;
    height: 48px;
}

/* Filter bar: one line, dropdowns submit on change, Clear at the far right.
   From tablet up it pins under the site header while the arena scrolls; the
   surface goes opaque for that, since it sits over the cards. On phones it
   wraps to three rows, so it stays in flow. */
.dd-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .dd-bar {
        position: sticky;
        top: calc(var(--fd-header-offset, 64px) + 0.5rem);
        z-index: 30;
        background: var(--fd-surface-solid, #fffdf9);
    }

    /* The discussion column is itself pinned under the header; with the bar
       pinned above it, it has to start below the bar or the bar sits on its
       heading for the whole scroll. 62px = the bar's one-line height. */
    .fi-dd-page .fi-dd-discussion {
        top: calc(var(--fd-header-offset, 64px) + 0.5rem + 62px + 0.75rem);
        max-height: calc(100vh - var(--fd-header-offset, 64px) - 62px - 2rem);
    }
}

.dd-bar__mode {
    display: inline-flex;
    padding: 3px;
    border-radius: 999px;
    background: #f3efe7;
}

.dd-bar__mode-btn {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 0.85rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--dd-ink);
    text-decoration: none;
}

.dd-bar__mode-btn.is-active {
    background: var(--dd-plum);
    color: #fff;
}

.dd-bar__search {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1 1 200px;
    min-width: 160px;
    max-width: 320px;
    min-height: 40px;
    padding: 0 0.75rem;
    border: 1px solid #d9d2c6;
    border-radius: 999px;
    background: #fff;
    color: var(--dd-muted);
}

.dd-bar__search input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 0.9rem;
    color: var(--dd-ink);
    outline: none;
}

.dd-bar__select {
    position: relative;
    display: inline-flex;
}

.dd-bar__select select {
    appearance: none;
    -webkit-appearance: none;
    min-height: 40px;
    padding: 0 2rem 0 0.85rem;
    border: 1px solid #d9d2c6;
    border-radius: 999px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f6a62' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 0.7rem center / 14px no-repeat;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--dd-ink);
    cursor: pointer;
    max-width: 12rem;
}

.dd-bar__select.is-set select {
    background-color: var(--dd-plum);
    border-color: var(--dd-plum);
    color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.dd-bar__select--sort {
    margin-left: auto;
}

.dd-bar__clear {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--dd-plum-line);
    color: var(--dd-plum);
    font-size: 0.8125rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.dd-bar__clear.is-quiet {
    border-color: transparent;
    color: var(--dd-muted);
}

@media (max-width: 767px) {
    .dd-bar__search {
        flex-basis: 100%;
        max-width: none;
    }

    .dd-bar__select select {
        max-width: 9rem;
    }

    .dd-bar__select--sort {
        margin-left: 0;
    }

    .dd-bar__clear {
        margin-left: auto;
    }
}
