/* Kino Berlin: one small stylesheet, mobile first. Colours are variables, so dark mode only swaps them. */

:root {
  --bg: #fbfaf8;
  --fg: #1c1b1a;
  --muted: #6b6762;
  --line: #e4e0da;
  --card: #ffffff;
  --accent: #b4232c;
  --focus: #1d5fd0;
  --warn-bg: #fff4d6;
  --warn-fg: #6b4a00;
  --v-df: #e9e6e1;
  --v-df-fg: #3a3835;
  --v-omu: #d8ecdf;
  --v-omu-fg: #1d5a34;
  --v-ov: #dbe6f7;
  --v-ov-fg: #1e477f;
  --v-other: #efe3f5;
  --v-other-fg: #5b2a73;
  --radius: 10px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --fg: #ecebe8;
    --muted: #a19c95;
    --line: #2d2c2a;
    --card: #1d1c1b;
    --accent: #ff6b6b;
    --focus: #7aa7ff;
    --warn-bg: #3a2e10;
    --warn-fg: #f3d58a;
    --v-df: #34322f;
    --v-df-fg: #d9d6d1;
    --v-omu: #183826;
    --v-omu-fg: #9fe0b5;
    --v-ov: #192c47;
    --v-ov-fg: #a9c8f5;
    --v-other: #34203f;
    --v-other-fg: #dcb6ee;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0 auto;
  max-width: 46rem;
  padding: 0 1rem 3rem;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-wrap: anywhere;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* --- Header --- */

.top {
  padding: 1rem 0 .5rem;
}

.top h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -.01em;
}

.top h1 a {
  text-decoration: none;
}

.window {
  margin: .15rem 0 0;
  color: var(--muted);
}

/* When the data was loaded; highlighted while new data is being loaded. */
.asof-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .2rem .75rem;
  margin: .1rem 0 .5rem;
}

#refresh {
  min-height: 44px;
  padding: 0 .9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--fg);
  font: inherit;
  font-size: .9rem;
  cursor: pointer;
}

/* An author style for `display` would beat the hidden attribute. */
#refresh[hidden] {
  display: none;
}

#refresh:disabled {
  opacity: .5;
  cursor: default;
}

.asof {
  color: var(--muted);
  font-size: .9rem;
}

.asof.loading {
  display: inline-block;
  padding: .15rem .6rem;
  border-radius: 10px;
  background: var(--warn-bg);
  color: var(--warn-fg);
}

/* --- Filters: two columns on a phone, four on wider screens --- */

.filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem .6rem;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-width: 0;
  font-size: .8rem;
  color: var(--muted);
}

/* 16px text keeps iOS from zooming into a field; 44px is the smallest comfortable tap target. */
.filters select,
.filters input[type="search"] {
  width: 100%;
  min-height: 44px;
  padding: .45rem .5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 1rem;
}

.filters .toggle {
  flex-direction: row;
  align-items: center;
  gap: .5rem;
  align-self: end;
  min-height: 44px;
  font-size: 1rem;
  color: var(--fg);
  cursor: pointer;
}

.filters .toggle input {
  width: 1.4rem;
  height: 1.4rem;
  margin: 0;
  accent-color: var(--accent);
}

.filters .search {
  grid-column: 1 / -1;
}

@media (min-width: 40rem) {
  .filters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .filters .search {
    grid-column: span 2;
  }
}

/* --- Login (only when WEB_PASSWORD is set) --- */

.login {
  grid-template-columns: minmax(0, 1fr);
}

.logout {
  float: right;
  margin-top: -2.4rem;
  padding: .75rem 0 .75rem 1rem; /* a 44px tap area around the small text */
  color: var(--muted);
  font-size: .9rem;
}

.login .button {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.login button,
.login .button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.filters input[type="password"] {
  width: 100%;
  min-height: 44px;
  padding: .45rem .5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 1rem;
}

/* --- Status line and messages --- */

.status {
  margin: 1rem 0 .25rem;
  color: var(--muted);
}

.status.problem {
  padding: .75rem;
  border-radius: var(--radius);
  background: var(--warn-bg);
  color: var(--warn-fg);
}

.status button {
  margin-left: .5rem;
  min-height: 36px;
  padding: .2rem .8rem;
  border: 1px solid currentColor;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

/* --- Showtimes in half-hour blocks --- */

.results[aria-busy="true"] {
  opacity: .6;
}

.block {
  margin: 0;
}

/* Sticky block headings: while scrolling, you always see which half hour you are in. */
.block h2 {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0;
  padding: .55rem 0 .35rem;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-size: .9rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.block ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.show {
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1fr);
  gap: .1rem .6rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--line);
}

.show time {
  grid-row: span 2;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.film {
  font-weight: 600;
}

.film a {
  text-decoration: none;
}

.film a:hover,
.film a:focus-visible {
  text-decoration: underline;
}

.where {
  color: var(--muted);
  font-size: .9rem;
}

/* --- Badges --- */

.badge {
  display: inline-block;
  margin-left: .35rem;
  padding: .05rem .45rem;
  border-radius: 999px;
  background: var(--v-df);
  color: var(--v-df-fg);
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.5;
  vertical-align: .1em;
  white-space: nowrap;
}

.badge.v-omu,
.badge.v-omeu {
  background: var(--v-omu);
  color: var(--v-omu-fg);
}

.badge.v-ov {
  background: var(--v-ov);
  color: var(--v-ov-fg);
}

.badge.v-dfmeu,
.badge.v-dub,
.badge.v-unknown,
.badge.three-d {
  background: var(--v-other);
  color: var(--v-other-fg);
}

.badge.doubt {
  background: var(--warn-bg);
  color: var(--warn-fg);
}

.via {
  margin-left: .35rem;
  font-size: .8rem;
}

/* --- Footer notes --- */

.notes {
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: .9rem;
}

.notes p {
  margin: .35rem 0;
}

.notes .problem {
  color: var(--warn-fg);
}

.notes details {
  margin: .5rem 0;
  padding: .5rem .75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.notes summary {
  min-height: 32px;
  padding: .2rem 0;
  color: var(--fg);
  cursor: pointer;
}

.notes ul {
  margin: .4rem 0 .2rem;
  padding-left: 1.1rem;
}

.notes li {
  margin: .2rem 0;
}
