.content-items {
    gap: var(--index-gap);
}

.item-inactive {
    opacity: 0.72;
}

.block.item-draft {
    border: 3px dashed var(--text-color);
    opacity: 1;
}

.item-page {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 30px;
}

.item-page > .item-show {
    flex: 1 1 var(--item-content-width);
    min-width: min(100%, var(--item-content-width));
    margin-bottom: 0;
}

.item-side {
    flex: 0 1 260px;
    gap: 16px;
    min-width: min(100%, 260px);
}

.item-manage {
    margin-bottom: 0;
}

.item-admin-section {
    margin-top: 16px;
}

.item-admin-heading {
    font-weight: 700;
    color: var(--note-accent);
}

.item-admin-people {
    align-items: flex-start;
    gap: 6px;
    margin-top: 8px;
}

.item-admin-people .user-badge-tiny {
    max-width: 100%;
}

.item-admin-flag {
    margin-top: 10px;
}

.item-admin-flag-reason,
.item-admin-flag-comment {
    margin-top: 2px;
    font-size: 90%;
    overflow-wrap: anywhere;
}

.item-manage-title {
    margin-bottom: 18px;
    font-size: 120%;
    font-weight: 700;
}

/* Item page and list card: place and category with the rating button, actions on the bottom right. */

.item-show {
    align-items: stretch;
    gap: 18px;
}

.item-card {
    container: item-card / inline-size;
    align-items: stretch;
    gap: 24px;
    margin-bottom: 0;
    padding-top: 15px;
}

.item-header {
    width: 100%;
}

.item-header .item-tags {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.item-body {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    min-width: 0;
}

.item-footer {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 16px;
    width: 100%;
}

.item-title-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.item-title-row .item-card-title,
.item-title-row .item-show-title {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.item-upvote {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
    height: 40px;
    padding: 0 12px;
    border: 2px solid currentColor;
    border-radius: var(--button-border-radius);
    background: var(--block-bg-color);
    color: var(--brighter-text-color);
    font-family: inherit;
    font-size: 132%;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
}

.item-upvote-rating {
    font-weight: 800;
}

.item-upvote:is(.rating-positive, .rating-negative, .rating-zero) {
    border-color: var(--rating-color);
    color: var(--rating-color);
}

.item-upvote.rating-positive:hover:not(:disabled) {
    background: var(--rating-positive-hover-bg);
}

.item-upvote.rating-negative:hover:not(:disabled) {
    background: var(--rating-negative-hover-bg);
}

.item-upvote:is(.rating-positive, .rating-negative, .rating-zero).is-voted,
.item-upvote:is(.rating-positive, .rating-negative, .rating-zero).is-voted:hover:not(:disabled) {
    background: var(--rating-color);
    border-color: var(--rating-color);
    color: var(--rating-selected-color);
}

.item-upvote:disabled {
    cursor: default;
    opacity: 0.55;
}

.item-main {
    flex: 1;
    min-width: 0;
}

.item-thumb {
    display: block;
    flex: 0 0 auto;
    width: 150px;
    max-width: 150px;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: var(--highlight-bg);
}

.item-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 18px;
}

.item-gallery a {
    display: block;
    flex: 0 1 265px;
    width: min(100%, 265px);
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: var(--highlight-bg);
}

.item-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 4px;
    margin-bottom: 10px;
    font-size: 90%;
    font-weight: 700;
}

.item-tag,
.item-tag:visited {
    color: var(--text-color);
    text-decoration: none;
    opacity: 0.75;
}

.item-tag:hover {
    opacity: 1;
}

.item-tag-separator {
    opacity: 0.4;
    margin: 0 1px;
    font-size: 70%;
}

    .item-tag-separator-wide {
        margin: 6px;
    }

.item-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.item-badge {
    padding: 3px 10px;
    border: 1px solid currentColor;
    border-radius: var(--button-border-radius);
    font-size: 80%;
    font-weight: 600;
    opacity: 0.7;
}

.item-title-prefix {
    opacity: 0.7;
}

.item-card-title {
    display: block;
    margin: 0;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.item-card-title-normal {
    font-size: 180%;
    line-height: 1.4;
}

.item-card-title-medium {
    font-size: 140%;
    line-height: 1.3;
}

.item-card-description {
    margin-bottom: 16px;
    line-height: 1.5;
    opacity: 0.8;
    overflow-wrap: anywhere;
}

.item-moderator-comment {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    padding: 16px 18px;
    background: var(--promo-bg);
    border-radius: var(--block-border-radius);
    font-size: 120%;
    line-height: 1.35;
}

.item-moderator-comment-icon {
    flex: none;
    font-size: 2.2rem;
    line-height: 1;
}

.item-show-title {
    margin: 0;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.item-show-title-normal {
    font-size: 260%;
    line-height: 1.3;
}

.item-show-title-medium {
    font-size: 210%;
    line-height: 1.25;
}

.item-show-title-small {
    font-size: 170%;
    line-height: 1.2;
}

.item-show .item-title-row {
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.item-show .item-title-row .item-show-title {
    flex-basis: 16rem;
}

.item-show .item-title-row > [data-island] {
    margin-left: auto;
}

.item-show-description {
    margin-top: 1.5em;
    margin-bottom: 3em;
    overflow-wrap: anywhere;
}

.item-description-normal {
    font-size: 140%;
    line-height: 1.5;
}

.item-description-medium {
    font-size: 112%;
    font-weight: 400;
    line-height: 1.45;
}

.item-description-small {
    font-size: 110%;
    font-weight: 400;
    line-height: 1.42;
}

.item-description-more {
    display: inline-block;
    margin-top: 8px;
    font-weight: 700;
}

.item-show-description > :first-child {
    margin-top: 0;
}

.item-show-description img,
.item-show-description video,
.item-show-description iframe {
    max-width: 100%;
}

.item-byline {
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 24px;
}

.item-stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 10px;
    margin: 0;
    min-width: 0;
    font-size: 80%;
    color: var(--muted-color);
}

@media only screen and (max-width: 700px) {
    .item-gallery {
        flex-wrap: nowrap;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
    }

    .item-gallery a {
        flex: 0 0 100%;
        width: 100%;
        max-width: none;
        scroll-snap-align: start;
    }
}

@media only screen and (max-width: 600px) {
    .item-show {
        gap: 14px;
    }

    .item-thumb {
        width: min(150px, 42vw);
    }
}

@container item-card (max-width: 420px) {
    .item-body {
        flex-direction: column;
        align-items: stretch;
    }

    .item-thumb {
        width: 96px;
    }
}

/* Upvote button (frontend/src/islands/UpvoteButton.tsx) */

.upvote {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: var(--button-border);
    border-radius: var(--button-border-radius);
    background-color: var(--block-bg-color);
    color: var(--text-color);
    font-family: inherit;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.1s ease-out, background-color 0.1s ease-out, opacity 0.1s ease-out;
}

.upvote-block {
    flex-direction: column;
    gap: 0;
    width: 42px;
    height: 42px;
    padding: 2px;
    font-size: 13px;
    line-height: 1;
}

.upvote-block .upvote-arrow {
    font-size: 11px;
}

.upvote-inline {
    padding: 6px 14px;
    font-size: 90%;
}

.upvote-tiny {
    gap: 4px;
    padding: 2px 8px;
    border-width: 1px;
    font-size: 85%;
}

.upvote:hover:not(:disabled),
.upvote-voted {
    background-color: var(--button-bg-color);
    color: var(--button-color);
}

.upvote-voted:hover:not(:disabled) {
    opacity: 0.85;
}

.upvote:disabled {
    cursor: default;
    opacity: 0.5;
}

.upvote-arrow {
    font-size: 80%;
}

.item-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
}

.item-action {
    justify-content: center;
    gap: 4px;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    box-shadow: none;
    font-size: 90%;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
}

.item-action:hover,
.item-action[data-copied] {
    --inline-block-bg: var(--inline-block-hover-bg);
    color: var(--text-color);
}

.item-action:disabled {
    cursor: default;
    opacity: 0.6;
}

.item-action-icon {
    width: 32px;
    padding: 0;
}

.item-action[data-copied] .fa-share-alt::before {
    content: "\f00c";
}

.flag-popup-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.45);
}

.flag-popup {
    width: min(420px, 100%);
    margin-bottom: 0;
    padding: 24px;
    box-shadow: var(--block-shadow-hover);
}

.flag-popup-title {
    font-size: 130%;
    font-weight: 700;
}

.flag-popup-reasons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 16px 0;
}

.flag-popup-reason {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    cursor: pointer;
}

.flag-popup-reason input {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}

.flag-popup-comment {
    min-height: 90px;
}

.flag-popup-error {
    margin-top: 8px;
    color: var(--danger-color);
    font-size: 90%;
}

.flag-popup-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.item-bookmark-remove {
    margin: 0;
}

.subscriptions {
    display: flex;
    flex-direction: column;
    padding: 8px 20px;
}

.subscription-row {
    justify-content: space-between;
    gap: 16px;
    padding: 10px 4px;
}

.subscription-row + .subscription-row {
    border-top: 1px solid var(--separator-color);
}

.subscription-label {
    min-width: 0;
    font-weight: 600;
    color: inherit;
    text-decoration: none;
}

.subscription-label:hover span {
    text-decoration: underline;
}

.subscription-label i {
    flex-shrink: 0;
    opacity: 0.7;
}

.subscription-remove {
    margin: 0;
    flex-shrink: 0;
}

.item-ai-text {
    width: 100%;
    height: 250px;
    font-size: 120%;
    padding: 20px 25px;
}

.item-ai-recommendation {
    font-size: 120%;
}

.item-ai-loader {
    font-size: 130%;
    margin-top: 40px;
    text-align: center;
}

.item-ai-loader i {
    margin-right: 8px;
}

.item-title-input {
    display: flex;
    align-items: stretch;
    overflow: hidden;
    background: var(--input-bg-color);
    box-shadow: var(--input-shadow);
    border-radius: var(--input-border-radius);
}

.item-title-input:focus-within {
    box-shadow: var(--input-shadow-focus);
}

.item-title-input select,
.item-title-input input[type=text] {
    box-shadow: none;
    background-color: transparent;
    border-radius: 0;
}

.item-title-input select:focus,
.item-title-input input[type=text]:focus {
    box-shadow: none;
}

.item-title-input select {
    flex: 0 0 auto;
    width: 4.4rem;
    padding: 14px 1.7rem 14px 0.7rem;
    background-color: var(--inline-block-bg-default);
    background-position: right 0.65rem center;
    color: rgba(51, 51, 51, 0.45);
    font-size: 200%;
    font-weight: 700;
}

.item-title-input select option {
    color: var(--select-color);
    font-size: 16px;
    font-weight: 500;
}

.item-title-input:has(option[value="ask"]:checked) select {
    width: auto;
}

.item-form-title input[type=text] {
    flex: 1;
    min-width: 0;
    font-size: 200%;
    font-weight: 700;
    padding: 14px 20px 14px 8px;
}

.item-form .form-section .item-form-expires {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.item-form .item-form-expires label {
    white-space: nowrap;
}

.item-form .item-form-expires select {
    width: auto;
    min-width: 10rem;
}

.item-form .form-actions {
    align-items: center;
    justify-content: space-between;
}

.item-form .form-actions-end {
    display: flex;
    gap: 15px;
    margin-left: auto;
}

.item-form .form-actions .button-big {
    margin: 0;
}

@media only screen and (max-width: 600px) {
    .item-form .form-actions-end {
        flex-direction: column;
        width: 100%;
        margin-left: 0;
    }

    .item-form .form-actions > .button,
    .item-form .form-actions-end > .button {
        width: 100%;
    }
}

.tone-photos .image-list {
    border-color: color-mix(in srgb, var(--photos-text) 45%, transparent);
    background: color-mix(in srgb, var(--photos-bg) 82%, #000);
    color: var(--photos-text);
}

.tone-photos .image-list-hint {
    color: var(--photos-text);
}

/* RecordList island: one row of fields plus a remove button */

.record-list-row {
    display: grid;
    grid-template-columns: minmax(150px, 0.8fr) minmax(160px, 1.5fr) minmax(120px, 1fr) 42px;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.record-list-comment {
    opacity: 0.7;
}

.record-list-comment:focus {
    opacity: 1;
}

.record-list-add {
    align-self: flex-start;
    margin-top: 4px;
}

.record-list-remove {
    font-size: 140%;
    line-height: 1;
}

@media only screen and (max-width: 720px) {
    .record-list-row {
        grid-template-columns: 1fr 42px;
    }

    .record-list-type,
    .record-list-text,
    .record-list-comment {
        grid-column: 1 / -1;
    }

    .record-list-remove {
        grid-column: 2;
        grid-row: 1;
    }

    .record-list-type {
        grid-column: 1;
        grid-row: 1;
    }
}

/* Contacts on the item page */

.item-contacts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.item-contact {
    max-width: 100%;
    white-space: normal;
    text-align: left;
    overflow-wrap: anywhere;
}

a.item-contact:hover {
    --inline-block-bg: color-mix(in srgb, var(--contacts-bg) 78%, #000);
}

.item-contact-comment {
    opacity: 0.7;
    font-weight: 500;
}

.item-contact-static,
.item-contact-static:hover {
    --inline-block-bg: var(--contacts-bg);
    cursor: default;
}

.item-location {
    display: flex;
    align-items: center;
    width: fit-content;
    margin-top: 18px;
    font-size: 115%;
    line-height: 1.5;
    font-weight: 500;
}

.item-location-icon {
    flex-shrink: 0;
}

.item-location-text {
    min-width: 0;
    overflow-wrap: anywhere;
}

.item-location-text p {
    margin: 0;
}

/* ImageList island */

.image-list {
    position: relative;
    width: 100%;
    min-height: 140px;
    padding: 12px;
    border: 2px dashed var(--text-color);
    border-radius: var(--block-border-radius);
    background: rgba(0, 0, 0, 0.02);
    cursor: pointer;
    box-sizing: border-box;
}

.image-list-over {
    background: rgba(255, 196, 85, 0.35);
}

.image-list input[type=file] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    pointer-events: none;
}

.image-list:not(:has(.image-list-item)) {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.image-list-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    min-height: 116px;
    padding: 20px;
    text-align: center;
    font-size: 110%;
    line-height: 1.4;
}

.image-list-hint-note {
    opacity: 0.72;
    font-size: 90%;
}

.image-list-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.image-list-item {
    position: relative;
    width: 96px;
    height: 96px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--highlight-bg);
    cursor: grab;
    touch-action: none;
}

.image-list-item img {
    pointer-events: none;
}

.image-list-status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.55);
    font-weight: 700;
}

.image-list-remove {
    display: none;
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--button-bg-color);
    color: var(--button-color);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.image-list-item:hover .image-list-remove,
.image-list-remove:focus {
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (hover: none) {
    .image-list-remove {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

.item-promo {
    display: flex;
    align-items: center;
    width: fit-content;
    margin-top: 18px;
    cursor: pointer;
}

.item-promo-text {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.item-promo-expired .item-promo-text,
.item-promo-expired .inline-block-secure-source {
    text-decoration: line-through;
}

.item-promo .fa-copy {
    opacity: 0.65;
}

.item-promo[data-copied] .fa-copy::before {
    content: "\f00c";
    font-weight: 900;
}
