/* research feature styles: research, shipyard, defense and the tech tree. Build on the classes and variables in app.css. */

/* ---------- Shared bits ---------- */

/* A cost list with resource icons (game/research/_cost.html.twig). */
.cost--icons .cost__item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.cost__icon {
    width: 1rem;
    height: 1rem;
    object-fit: cover;
    border-radius: 2px;
}

.requirement-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 0.7rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.requirement-list::before {
    content: "Requires";
    width: 100%;
    font: 700 0.64rem/1.5 var(--font-body);
    font-stretch: 78%;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--paper-faint);
}

.requirement-list__item a {
    color: inherit;
    text-decoration: none;
}

.requirement-list__item a:hover {
    text-decoration: underline;
}

.requirement-list__item:not(.is-met) {
    color: var(--bad);
}

/* ---------- Research ---------- */

.research-queue__count {
    float: right;
    font-size: 0.9rem;
    color: var(--paper-dim);
}

.research-lab,
.research-queue__empty {
    margin: 0 0 0.6rem;
    font-size: 0.9rem;
    color: var(--paper-dim);
}

.research-queue__image,
.shipyard-queue__image {
    width: 2rem;
    height: 2rem;
    object-fit: cover;
    border-radius: var(--radius);
}

.research-queue__where {
    font-size: 0.85rem;
    color: var(--paper-dim);
}

.research-queue__cancel {
    padding: 0.15rem 0.6rem;
    font-size: 0.8rem;
}

.research-group {
    margin-bottom: calc(var(--gap) * 1.5);
}

.research-group__title {
    margin: 0 0 0.8rem;
    padding-bottom: 0.45rem;
    font-size: 1.3rem;
    color: var(--paper);
    background: var(--rule-paper) left bottom / 120px 6px repeat-x;
}

/* "Level N | cost" and "Time | duration" as label and value, like the building cards. */
.research-card__next {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.3rem 0.7rem;
    align-items: baseline;
    padding: 0.5rem 0 0.2rem;
    border-top: var(--dash);
}

.research-card__next::after {
    content: "Time";
    order: 1;
    font: 700 0.64rem/1.5 var(--font-body);
    font-stretch: 78%;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--paper-faint);
}

.research-card__next .research-card__time {
    order: 2;
}

.research-card__label {
    font: 700 0.64rem/1.5 var(--font-body);
    font-stretch: 78%;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--paper-faint);
}

.research-card__time,
.unit-card__time,
.unit-card__room {
    font-size: 0.85rem;
    color: var(--paper-dim);
}

/* Shipyard cards label their cost like the other cards. */
.unit-card .cost--icons::before {
    content: "Cost";
    align-self: center;
    margin-right: -0.2rem;
    font: 700 0.64rem/1.5 var(--font-body);
    font-stretch: 78%;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--paper-faint);
}

.unit-card__label {
    margin-right: 0.3rem;
    font: 700 0.64rem/1.5 var(--font-body);
    font-stretch: 78%;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--paper-faint);
}

/* ---------- Shipyard and defense ---------- */

.shipyard-queue__end {
    float: right;
    font: 0.9rem var(--font-body);
    color: var(--paper-dim);
}

.shipyard-queue__count {
    min-width: 6rem;
}

.shipyard-queue__unit {
    font-size: 0.85rem;
    color: var(--paper-dim);
}

.shipyard-queue__note {
    margin: 0.6rem 0 0;
    font-size: 0.8rem;
    color: var(--paper-faint);
}

.unit-card__order {
    align-items: center;
}

.unit-card__max {
    padding: 0;
    font: 0.85rem var(--font-body);
    color: var(--mustard);
    background: none;
    border: 0;
    text-decoration: underline;
    cursor: pointer;
}

/* ---------- Tech tree ---------- */

.techtree-note {
    font-size: 0.85rem;
    color: var(--paper-faint);
}

.techtree {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(26rem, 1fr));
    gap: var(--gap);
}

.techtree-item {
    display: grid;
    grid-template-columns: 5rem minmax(0, 1fr);
    gap: 0.9rem;
    padding: 0.8rem;
    background: var(--ink-800) var(--grain);
    border: var(--line);
    border-left: 4px solid var(--coral);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    scroll-margin-top: calc(var(--topbar-h) + 1rem);
}

.techtree-item.is-available {
    border-left-color: var(--good);
}

.techtree-item:target {
    outline: 2px solid var(--mustard);
}

.techtree-item__image {
    width: 5rem;
    height: 5rem;
    object-fit: cover;
    border-radius: var(--radius);
    box-shadow: 0 0 0 1px var(--keyline), 2px 2px 0 1px var(--keyline);
}

.techtree-item.is-locked .techtree-item__image {
    filter: saturate(0.25) brightness(0.6);
}

.techtree-item__name {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
    margin: 0;
    font-size: 1.12rem;
}

.techtree-item__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    font-family: var(--font-body);
}

/* Only the state is a stamp; category and restrictions are small print. */
.techtree-item__category,
.techtree-item__where,
.techtree-item__class {
    padding: 0;
    color: var(--paper-faint);
    border: 0;
}

.techtree-item__tags .tag + .tag::before {
    content: none;
}

.techtree-item__category,
.techtree-item__where {
    color: var(--paper-faint);
}

.techtree-item.is-available .techtree-item__state {
    color: var(--good);
}

.techtree-item.is-locked .techtree-item__state {
    color: var(--bad);
}

.techtree-item__level {
    font-size: 0.85rem;
    color: var(--mustard);
}

.techtree-item__columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    margin-top: 0.4rem;
}

.techtree-item__heading {
    margin: 0 0 0.2rem;
    font: 700 0.64rem/1.5 var(--font-body);
    font-stretch: 78%;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--paper-faint);
}

.techtree-item__none {
    margin: 0;
    font-size: 0.85rem;
    color: var(--paper-faint);
}

.techtree-list {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.85rem;
}

.techtree-list__item {
    display: flex;
    justify-content: space-between;
    gap: 0.4rem;
}

.techtree-list__item .num {
    white-space: nowrap;
}

.techtree-list__item a {
    color: var(--paper);
    text-decoration: none;
}

.techtree-list__item a:hover {
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.techtree-list__item.is-met a,
.techtree-list__item.is-met .num {
    color: var(--good);
}

.techtree-list__item.is-missing a,
.techtree-list__item.is-missing .num {
    color: var(--bad);
}

/* ---------- Research queue report ---------- */

.research-report {
    display: grid;
    grid-template-columns: 4rem minmax(0, 1fr);
    gap: 0.8rem;
}

.research-report__image {
    width: 4rem;
    height: 4rem;
    object-fit: cover;
    border-radius: var(--radius);
}

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

    .techtree-item__columns {
        grid-template-columns: 1fr;
    }
}

/* A locked unit has no order form: its requirements close the card, level with its neighbours. */
.unit-card .requirement-list {
    margin-top: auto;
    padding-top: 0.45rem;
    border-top: var(--dash);
}

.unit-card__order .input {
    flex: 1 1 4rem;
    min-width: 4rem;
}
