:root {
    --bg: #0d0d0d;
    --panel: #181818;
    --muted: #545454;
    --copy: #acacac;
    --accent: #f5bf01;
    --gap: 10px;
    color-scheme: dark;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
    margin: 0;
    background: var(--bg);
    color: var(--muted);
    font-family: "Satoshi Variable", "Helvetica Neue", Arial, sans-serif;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.05em;
    line-height: .9;
}

a { color: inherit; text-decoration: none; }
a:hover, a:focus-visible { color: var(--copy); }

.page-shell { padding: 10px; }

.masthead,
.toolbar,
.movie-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--gap);
}

.masthead {
    min-height: 40px;
    align-items: start;
    padding-bottom: 8px;
    border-bottom: 1px solid #202020;
}

.brand { display: flex; align-items: center; color: var(--accent); }
.brand-mark {
    display: grid;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    margin-right: 9px;
    place-items: center;
    border-radius: 3px;
    background: var(--accent);
    color: var(--bg);
}
.brand-mark::before {
    content: "";
    position: absolute;
    width: 25px;
    height: 15px;
    border-radius: 50%;
    background: var(--bg);
}
.brand-mark span { position: relative; z-index: 1; color: var(--accent); font: 20px/1 Arial; }
.brand h1 { margin: 0; font-size: 18px; line-height: .78; letter-spacing: -.055em; text-transform: uppercase; }
.intro { margin: 0; color: var(--copy); }
.warning { grid-column: 3 / span 2; margin: 0; }
.warning span { color: var(--accent); }

.toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: 34px;
    align-items: start;
    padding: 7px 0 8px;
    background: var(--bg);
    border-bottom: 1px solid #202020;
}
.counts, .control-group { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.control-group { grid-column: 2; }
.show-controls { grid-column: 3 / span 2; }
.control-group a { display: inline-flex; gap: 3px; align-items: center; white-space: nowrap; }

.ui-icon {
    display: inline-block;
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    margin-top: 3px;
    background: currentColor;
    -webkit-mask: var(--icon) center / contain no-repeat;
    mask: var(--icon) center / contain no-repeat;
}
.icon-radio-on { --icon: url("icons/radio-on.svg"); }
.icon-radio-off { --icon: url("icons/radio-off.svg"); }
.icon-arrow-up { --icon: url("icons/arrow-up.svg"); }
.icon-arrow-down { --icon: url("icons/arrow-down.svg"); }
.sort-arrow { display: none; }
.sort.is-active .sort-arrow { display: inline-block; }
.sort.is-active .sort-arrow:not(.icon-arrow-up):not(.icon-arrow-down) { display: none; }

.movie-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-top: 10px;
}
.movie {
    --movie-color: #e2e2e2;
    position: relative;
    height: 371px;
    overflow: hidden;
    border-radius: 4px;
    background: var(--panel);
    color: var(--movie-color);
    transition: opacity 220ms ease, filter 220ms ease;
}
.movie.is-watched {
    color: #7c7c7c;
    opacity: .3;
}
.movie.is-watched .movie-image { filter: grayscale(1); }
#movies.filter-not-watched .movie.is-watched,
#movies.filter-watched .movie:not(.is-watched) { display: none; }

.movie-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .3;
    transition: opacity 180ms ease, transform 500ms ease;
}
.movie::before,
.movie::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    opacity: .25;
    mix-blend-mode: soft-light;
    background-size: 180px 180px, cover;
}
.movie::before { background-image: url("assets/noise-1.png"); }
.movie::after { background-image: url("assets/noise-2.png"); transform: rotate(180deg); }
.movie:hover .movie-image { opacity: .38; transform: scale(1.015); }

.movie-link {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    padding: 5px;
    color: inherit;
}
.movie-link:hover { color: inherit; }
.movie-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) 26px;
    flex: 1 1 0;
    align-items: start;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: -.03em;
    line-height: 1;
    text-transform: uppercase;
}
.movie-meta .director { padding-right: 6px; }
.movie-meta > span { white-space: pre-line; }
.movie-meta .year, .movie-meta .length { text-align: right; }
.movie-meta .length { padding-left: 8px; }
.movie-title {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0;
    color: inherit;
    font-family: "Arial Narrow", "Helvetica Neue Condensed", Impact, sans-serif;
    font-size: clamp(42px, 6vw, 70px);
    font-stretch: condensed;
    font-weight: 700;
    letter-spacing: -.07em;
    line-height: .8;
    text-align: center;
    text-transform: uppercase;
}
.synopsis {
    display: flex;
    flex: 1 1 0;
    align-items: end;
    margin: 0;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: -.03em;
    line-height: 1;
    text-align: justify;
    text-transform: uppercase;
}
.watched {
    position: absolute;
    z-index: 4;
    top: 0;
    right: 0;
    display: grid;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 0;
    place-items: start end;
    background: transparent;
    color: inherit;
    cursor: pointer;
}
.watched::before {
    content: "";
    width: 22px;
    height: 12px;
    margin: 5px 5px 0 0;
    background: currentColor;
    -webkit-mask: url("icons/eyecon.svg") center / contain no-repeat;
    mask: url("icons/eyecon.svg") center / contain no-repeat;
    transition: opacity 160ms ease;
}
.watched:hover::before, .watched:focus-visible::before { opacity: .7; }

@media (max-width: 800px) {
    body { font-size: 16px; }
    .masthead, .toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .warning { grid-column: 1 / -1; }
    .control-group { grid-column: 1 / -1; }
    .show-controls { grid-column: 1 / -1; }
    .movie { grid-column: 1 / -1; }
    .movie-title { font-size: clamp(42px, 12vw, 78px); }
}

@media (min-width: 1601px) {
    .movie-grid { grid-template-columns: repeat(auto-fit, minmax(487px, 1fr)); }
}

@media (max-width: 480px) {
    .masthead { display: flex; flex-direction: column; gap: 12px; }
    .intro { max-width: none; }
    .movie { height: 52vh; min-height: 340px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}
