:root {
    color-scheme: light dark;
    font-family: system-ui, sans-serif;
    line-height: 1.5;
}

body {
    max-width: 60rem;
    margin: 0 auto;
    padding: 0 1rem;
}

header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid color-mix(in srgb, currentColor 20%, transparent);
}

header nav a:first-child {
    font-weight: bold;
}

footer {
    margin-top: 3rem;
    padding: 1rem 0;
    font-size: 0.8rem;
    opacity: 0.7;
}

header nav {
    align-items: center;
}

header nav .spacer {
    flex: 1;
}

header nav form {
    margin: 0;
}

form:not(.inline) {
    display: grid;
    gap: 0.75rem;
    max-width: 24rem;
}

form:not(.inline) label {
    display: grid;
    gap: 0.25rem;
}

form.inline {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.5rem;
    margin: 0;
}

form.inline label {
    display: grid;
    gap: 0.25rem;
}

input, select, button {
    font: inherit;
    padding: 0.3rem 0.5rem;
}

.error {
    color: #c0392b;
}

.notice {
    color: #1e8449;
}

.hint {
    font-size: 0.85rem;
    opacity: 0.7;
}

button.danger {
    color: #c0392b;
}

section {
    margin: 2rem 0;
}

table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.9rem;
}

th, td {
    text-align: left;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid color-mix(in srgb, currentColor 15%, transparent);
    vertical-align: middle;
}

td.actions {
    white-space: nowrap;
}

.one-time-link {
    margin: 1rem 0;
    padding: 0.75rem;
    border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
}

.one-time-link input {
    width: 100%;
    font-family: monospace;
}

.qr svg {
    width: 200px;
    height: 200px;
    background: white;
}

ul.codes {
    columns: 2;
    font-family: monospace;
    font-size: 1.1rem;
    max-width: 24rem;
}

form.search-form {
    max-width: none;
    margin-bottom: 1rem;
}

.modes {
    display: flex;
    gap: 0.25rem;
}

.modes label {
    display: flex !important;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.75rem;
    border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
    border-radius: 999px;
    cursor: pointer;
}

.modes label:has(input:checked) {
    background: color-mix(in srgb, currentColor 12%, transparent);
    font-weight: 600;
}

.search-box {
    display: flex;
    gap: 0.5rem;
}

.search-box input {
    flex: 1;
}

details.filters summary {
    cursor: pointer;
    font-size: 0.9rem;
}

.filter-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
    margin-top: 0.5rem;
}

.filter-fields label {
    display: grid;
    gap: 0.25rem;
    font-size: 0.85rem;
}

.filter-fields input[type=number] {
    width: 6rem;
}

.person-header {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.person-header h2 {
    margin: 0;
}

nav.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 0.75rem 0;
    font-size: 0.9rem;
}

p.meta.mine {
    opacity: 1;
}

article.result, article.entry {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid color-mix(in srgb, currentColor 15%, transparent);
}

article.result .poster, article.entry .poster {
    flex: 0 0 55px;
}

article.result img, article.entry img {
    display: block;
    border-radius: 2px;
}

article .body {
    flex: 1;
    min-width: 0;
}

article h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
}

.year, .meta {
    opacity: 0.7;
}

p.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

.stars {
    color: #e0a100;
    letter-spacing: 0.05em;
}

article.entry .actions, article.result .actions {
    display: flex;
    gap: 0.5rem;
    align-items: start;
}

p.note {
    white-space: pre-wrap;
    margin: 0.25rem 0;
}

.log-slot {
    margin-top: 0.5rem;
}

.log-slot:empty {
    margin: 0;
}

form.entry-form {
    max-width: 32rem;
    grid-template-columns: 1fr 1fr;
}

form.entry-form label.note, form.entry-form .buttons, form.entry-form .error,
form.entry-form label.checkbox {
    grid-column: 1 / -1;
}

label.checkbox {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
}

form.entry-form .buttons {
    display: flex;
    gap: 0.5rem;
}

textarea {
    font: inherit;
    padding: 0.3rem 0.5rem;
}

article.film {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

article.film .poster img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

article.film .body {
    flex: 1 1 20rem;
}

p.links {
    display: flex;
    gap: 1rem;
}

nav.pages {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
}

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

article.card h3 {
    margin: 0.5rem 0 0.25rem;
    font-size: 0.95rem;
}

article.card img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
}

.no-poster {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 2 / 3;
    padding: 0.5rem;
    text-align: center;
    background: color-mix(in srgb, currentColor 8%, transparent);
    border-radius: 4px;
}

p.reason {
    font-size: 0.85rem;
    opacity: 0.75;
    margin: 0.25rem 0;
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.4rem;
}

.card-actions button, form.quick-rate button, form.quick-rate select {
    font-size: 0.8rem;
    padding: 0.2rem 0.4rem;
}

form.quick-rate {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.4rem;
}

article.card form.entry-form {
    grid-template-columns: 1fr;
}

ol.similar {
    columns: 2;
    padding-left: 1.25rem;
}

.badge {
    font-size: 0.75rem;
    padding: 0 0.4rem;
    border: 1px solid currentColor;
    border-radius: 3px;
}

form.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    max-width: none;
    align-items: end;
    margin-bottom: 1rem;
}

form.filters label {
    display: grid;
    gap: 0.25rem;
    font-size: 0.85rem;
}

fieldset {
    border: 1px solid color-mix(in srgb, currentColor 20%, transparent);
    display: grid;
    gap: 0.4rem;
}

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

.histogram {
    display: flex;
    gap: 3px;
    align-items: end;
    height: 3rem;
    max-width: 16rem;
    margin: 0.5rem 0 1rem;
}

.histogram .bar {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: end;
}

.histogram .bar span {
    display: block;
    width: 100%;
    min-height: 1px;
    background: #e0a100;
}

footer a.tmdb img {
    display: block;
    margin-bottom: 0.5rem;
}

/* Buttons, and links that act as buttons, share one look. */
button, a.button {
    display: inline-block;
    font: inherit;
    line-height: normal;
    padding: 0.3rem 0.6rem;
    border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
    border-radius: 4px;
    background: color-mix(in srgb, currentColor 14%, transparent);
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

button:hover, a.button:hover {
    background: color-mix(in srgb, currentColor 24%, transparent);
}

.film-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.film-actions p {
    margin: 0;
}

.card-actions a.button {
    font-size: 0.8rem;
    padding: 0.2rem 0.4rem;
}

/* Feed and profiles: one user's entries from one day as a poster grid. */
.poster-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.5rem;
}

.poster-grid .tile {
    width: 70px;
    display: grid;
    gap: 0.15rem;
    justify-items: center;
}

.poster-grid a {
    position: relative;
    display: block;
    width: 70px;
    height: 105px;
}

.poster-grid img {
    width: 70px;
    height: 105px;
    object-fit: cover;
}

.poster-grid .no-poster {
    height: 100%;
    box-sizing: border-box;
    font-size: 0.65rem;
    overflow: hidden;
    color: inherit;
}

.poster-grid .stars {
    font-size: 0.7rem;
    line-height: 1;
}

/* The hover hint: name and year above the poster, centred on it. The first
   and last posters line it up with their outer edge instead, so it stays on
   the page. Browsers with anchor positioning do better below. Hidden hints
   take no space, so long ones can't widen the page. */
.poster-grid .tip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    width: max-content;
    max-width: min(24rem, 100vw - 2rem);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: CanvasText;
    color: Canvas;
    font-size: 0.8rem;
    text-align: center;
    pointer-events: none;
    display: none;
}

.poster-grid .tile:first-child .tip {
    left: 0;
    transform: none;
}

.poster-grid .tile:last-child:not(:first-child) .tip {
    left: auto;
    right: 0;
    transform: none;
}

.poster-grid a:hover .tip, .poster-grid a:focus-visible .tip {
    display: block;
}

/* With anchor positioning, the hint is fixed to its poster and kept on the
   screen wherever the poster is in the grid: centred hints shift sideways
   instead of running off the edge. */
@supports (position-area: top) {
    .poster-grid .tip {
        position: fixed;
        inset: auto;
        transform: none;
        margin: 0 0.5rem 6px;
        position-area: top;
    }

    .poster-grid .tile:first-child .tip {
        inset: auto;
        margin-inline: 0;
        position-area: top span-right;
    }

    .poster-grid .tile:last-child:not(:first-child) .tip {
        inset: auto;
        margin-inline: 0;
        position-area: top span-left;
    }
}

/* Suggestions: the ⓘ after a card's reason, and the dialog it opens. */
a.why {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15em;
    height: 1.15em;
    border: 1px solid currentColor;
    border-radius: 50%;
    font: italic bold 0.8em/1 Georgia, serif;
    color: inherit;
    text-decoration: none;
    vertical-align: 0.05em;
}

a.why:hover, a.why:focus-visible {
    background: color-mix(in srgb, currentColor 18%, transparent);
}

dialog.why {
    width: min(36rem, calc(100vw - 2rem));
    padding: 0;
    border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
    border-radius: 8px;
}

dialog.why::backdrop {
    background: rgb(0 0 0 / 0.55);
}

/* Padding sits on the body, so a click on the dialog element itself is a
   click on the backdrop. */
.why-body {
    padding: 1rem 1.25rem 1.25rem;
}

.why-head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 1rem;
}

.why-head h2 {
    margin: 0;
    font-size: 1.25rem;
}

.why-head form {
    margin: 0;
}

.why-head button.close {
    padding: 0.1rem 0.5rem;
}

.why-body h3 {
    margin: 1.1rem 0 0.3rem;
    font-size: 1rem;
}

.why-body h4 {
    margin: 0.7rem 0 0.15rem;
    font-size: 0.95rem;
}

.why-body p, .why-body ul {
    margin: 0.25rem 0;
}

.why-body ul {
    padding-left: 1.25rem;
}
