/* Chicago Screen Index: labelled blue panels on plain paper, set in IBM Plex Mono.
   Colours are tokens; dark.css redefines the tokens and nothing else. */

@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/fonts/ibm-plex-mono-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/fonts/ibm-plex-mono-600.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("/static/fonts/ibm-plex-mono-700.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --accent: #2457d6;   /* rules, labels, links, times */
  --ink: #13203f;      /* text */
  --paper: #f4f6fa;    /* background */
  --hair: #e1e7f5;     /* row dividers, hover fill */
  --soft: #a9bbe8;     /* secondary borders */
  --muted: #5a6789;    /* metadata, status */
  --tint: #2457d612;   /* today, row hover */
  --shadow: #a9bbe8;   /* offset shadow on popovers */
  --still-caption: "Fargo (1996)";
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  color: var(--ink);
  background: var(--paper);
  font: 13.5px/1.4 var(--mono);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); }
a { color: inherit; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
button, select, input { font: inherit; color: inherit; }
button, summary, select { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

.page { display: grid; gap: 24px; max-width: 1490px; margin: 0 auto; padding: 18px clamp(16px, 3vw, 44px) 60px; }

/* ---- Labelled panel: the name sits in the top border, an optional reading on the right ---- */
.panel { position: relative; min-width: 0; border: 1.5px solid var(--accent); background: var(--paper); }
.panel::before, .panel[data-reading]::after {
  position: absolute; top: -.75em; padding: 0 6px; background: var(--paper); color: var(--accent);
  font-size: .76rem; font-weight: 700; line-height: 1.4; letter-spacing: .04em; text-transform: uppercase;
}
.panel::before { content: attr(data-label); left: 12px; }
.panel[data-reading]::after { content: attr(data-reading); right: 12px; font-weight: 400; }

/* ---- Top bar ---- */
.topbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px 20px; padding: 7px 0; border-block: 1.5px solid var(--accent); color: var(--accent); font-weight: 600; }
.brand { font-weight: 700; letter-spacing: .02em; text-decoration: none; }
.brand:hover { text-decoration: underline; }
.site-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 18px; }
.seg { display: flex; margin: 0; }
.seg > a, .seg > button { position: relative; margin-left: -1px; padding: 1px 8px; border: 1px solid var(--soft); background: transparent; color: var(--accent); font-weight: 600; text-decoration: none; }
.seg > a:hover, .seg > button:hover { z-index: 1; border-color: var(--accent); }
.seg > [aria-current="page"], .seg > [aria-pressed="true"] { z-index: 1; color: var(--paper); background: var(--accent); border-color: var(--accent); }
.logout { margin: 0; }
.logout button { padding: 0; border: 0; background: none; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.logout button:hover { color: var(--accent); }

/* ---- Header still ---- */
.still { position: relative; margin: 0; border: 1.5px solid var(--accent); }
.still img { display: block; width: 100%; height: auto; }
.still figcaption::after { content: var(--still-caption); }
.still figcaption { position: absolute; bottom: -.75em; left: 12px; padding: 0 6px; background: var(--paper); color: var(--accent); font-size: .76rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }

/* ---- Next 7 days ---- */
.week { padding-top: 6px; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.week-day { display: flex; flex-direction: column; min-width: 0; padding: 10px 9px 10px; border-right: 1px solid var(--soft); }
.week-day:last-child { border-right: 0; }
.week-day.today { background: var(--tint); }
.week-day-heading { display: flex; justify-content: space-between; gap: 6px; margin: 0 -9px 8px; padding: 0 9px 8px; border-bottom: 1px solid var(--soft); color: var(--accent); font-weight: 700; text-decoration: none; text-transform: uppercase; }
.week-day-heading:hover { text-decoration: underline; }
.week-films { display: grid; align-content: start; gap: 5px; flex: 1; }
/* Hourly showtime cells, 10am to midnight, darker for busier hours. */
.week-timeline { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 2px; margin-top: 12px; }
.week-timeline i { height: 7px; background: color-mix(in srgb, var(--soft) 40%, transparent); }
.week-timeline .level-1 { background: color-mix(in srgb, var(--accent) 30%, var(--paper)); }
.week-timeline .level-2 { background: color-mix(in srgb, var(--accent) 55%, var(--paper)); }
.week-timeline .level-3 { background: color-mix(in srgb, var(--accent) 80%, var(--paper)); }
.week-timeline .level-4 { background: var(--accent); }
.week-film { position: relative; display: grid; grid-template-columns: 7ch minmax(0, 1fr) auto; gap: 6px; min-width: 0; font-size: .8rem; text-decoration: none; }
.week-film-time { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.week-film-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.week-film-more { color: var(--muted); font-size: .9em; white-space: nowrap; }
.week-film:hover .week-film-title, .week-film:focus-visible .week-film-title { text-decoration: underline; }
.week-more { position: relative; color: var(--accent); font-size: .8rem; font-weight: 600; }
.week-empty { color: var(--muted); }
/* The popover starts right at the bottom of its link; the link's padding draws the visual gap,
   so the pointer never leaves the hover target on the way into the popover. A short delay
   before hiding forgives a slightly slow pointer. */
.week-film, .week-more { padding-bottom: 4px; margin-bottom: -4px; }
.week-popover {
  position: absolute; top: 100%; left: 0; z-index: 10; visibility: hidden; opacity: 0;
  transition: opacity .1s .15s, visibility 0s .25s;
  width: max-content; min-width: 220px; max-width: min(320px, 75vw); max-height: 240px; overflow: auto;
  padding: 9px 11px; border: 1.5px solid var(--accent); background: var(--paper); box-shadow: 4px 4px 0 var(--shadow);
  color: var(--ink); font-size: .85rem; font-weight: 400; line-height: 1.4; white-space: normal;
}
.week-popover strong { display: block; margin-bottom: 4px; color: var(--accent); }
.week-popover > span { display: block; }
.week-film:hover .week-popover, .week-film:focus-visible .week-popover,
.week-more:hover .week-popover, .week-more:focus-visible .week-popover { visibility: visible; opacity: 1; transition: opacity .1s, visibility 0s; }
.week-day:nth-last-child(-n+2) .week-popover { left: auto; right: 0; }
.week-extra-film { display: block; padding: 5px 0; border-top: 1px solid var(--hair); }
.week-extra-film b, .week-extra-film small { display: block; font-size: inherit; }
.week-extra-film small { color: var(--muted); }

/* ---- Filters ---- */
/* Segmented filter bar: one boxed strip, a cell per filter showing its current value. */
.filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) auto; border: 1.5px solid var(--accent); background: var(--paper); }
.filter-menu { position: relative; min-width: 0; border-right: 1px solid var(--soft); }
.filter-menu > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 8px; height: 100%; padding: 5px 10px; list-style: none; white-space: nowrap; }
.filter-menu > summary::-webkit-details-marker { display: none; }
.filter-menu > summary:hover, .filter-menu[open] > summary { background: var(--tint); }
.filter-menu > summary::after { content: ""; grid-column: 2; grid-row: 1 / 3; width: 5px; height: 5px; border-right: 1.5px solid var(--accent); border-bottom: 1.5px solid var(--accent); transform: translateY(-2px) rotate(45deg); }
.filter-menu[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
.filter-name { color: var(--muted); font-size: .7rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.filter-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.filter-menu.set .filter-value { color: var(--accent); font-weight: 600; }
.filter-options, .date-panel { position: absolute; top: 100%; left: -1.5px; z-index: 6; margin-top: 1.5px; border: 1.5px solid var(--accent); background: var(--paper); box-shadow: 4px 4px 0 var(--shadow); }
.filter-options { min-width: max(100%, 220px); max-height: 300px; overflow: auto; padding: 8px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; padding: 4px 2px; white-space: nowrap; cursor: pointer; }
.checkbox-row input { margin: 0; accent-color: var(--accent); }
.filter-actions { display: flex; align-items: stretch; }
.filter-actions a { display: flex; align-items: center; padding: 0 12px; color: var(--muted); }
.filter-actions .filter-apply { padding: 0 14px; border: 0; }
.auto-apply .filter-apply { display: none; }
.button, .filter-actions button, .date-actions button[type="submit"] { padding: 3px 11px; border: 1.5px solid var(--accent); background: var(--accent); color: var(--paper); font-weight: 700; }
.button:hover, .filter-actions button:hover, .date-actions button[type="submit"]:hover { background: transparent; color: var(--accent); }

.date-panel { width: min(300px, calc(100vw - 48px)); padding: 12px; }
.date-panel button { padding: 4px 6px; border: 0; background: none; color: var(--accent); }
.date-presets, .date-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.date-presets { padding-bottom: 10px; border-bottom: 1px solid var(--soft); }
.date-presets button { text-decoration: underline; text-underline-offset: 3px; }
.date-fields { display: grid; gap: 8px; margin-top: 10px; }
.date-fields label { display: grid; gap: 3px; color: var(--muted); }
.date-fields input { width: 100%; padding: 4px 6px; border: 1px solid var(--soft); border-radius: 0; background: var(--paper); }
.calendar-nav { display: flex; justify-content: space-between; align-items: center; margin: 10px 0 6px; font-weight: 700; }
.calendar-nav button { font-size: 1.2rem; line-height: 1; }
.calendar-nav button:disabled { opacity: .35; cursor: default; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.calendar-weekdays { color: var(--muted); font-size: .74rem; }
.date-panel .calendar-day { padding: 7px 0; color: var(--ink); font-variant-numeric: tabular-nums; }
.date-panel .calendar-day:hover:not(:disabled) { background: var(--hair); }
.date-panel .calendar-day:disabled { color: var(--soft); cursor: default; }
.date-panel .calendar-day[aria-current="date"] { box-shadow: inset 0 0 0 1px var(--accent); }
.date-panel .calendar-day.in-range { background: var(--hair); }
.date-panel .calendar-day.selected { color: var(--paper); background: var(--accent); }
.date-actions { margin-top: 10px; }
.date-actions [data-date-clear] { color: var(--muted); }

/* ---- Listing tables (showtimes and titles): one line per venue ---- */
.listing { padding: 8px 12px 6px; }
.listing table { width: 100%; border-collapse: collapse; }
.listing thead th {
  position: sticky; top: 0; z-index: 4; height: 26px; padding: 4px 8px; background: var(--paper);
  border-bottom: 1px solid var(--accent); color: var(--muted); font-size: .72rem; font-weight: 600;
  letter-spacing: .04em; text-align: left; text-transform: uppercase; white-space: nowrap;
}
.listing .day-row th { position: sticky; top: 26px; z-index: 3; padding: 14px 8px 5px; background: var(--paper); color: var(--accent); font-weight: 700; text-align: left; text-transform: uppercase; }
.day-row span { display: flex; align-items: center; gap: 10px; }
.day-row span::after { content: ""; flex: 1; height: 5px; background: repeating-linear-gradient(180deg, var(--accent) 0 1px, transparent 1px 4px); }
.listing td { padding: 3px 8px; vertical-align: baseline; }
.listing tbody.film td { border-top: 1px solid var(--hair); }
.listing tbody.film tr + tr td { border-top: 0; }
.listing tbody.film:hover td { background: var(--tint); }
.c-title { width: 32%; font-weight: 600; }
.c-title a { text-decoration-color: var(--soft); text-decoration-thickness: 1px; }
.c-title small { display: block; color: var(--muted); font-size: .78rem; font-weight: 400; }
.c-year { width: 4em; color: var(--muted); font-variant-numeric: tabular-nums; }
.year-inline { display: none; color: var(--muted); font-weight: 400; }
.c-venue { width: 24%; }
.c-venue a { text-decoration-color: var(--soft); }
.c-format, .c-muted { color: var(--muted); font-size: .85em; white-space: nowrap; }
.c-format { width: 5em; }
.c-when { white-space: nowrap; font-variant-numeric: tabular-nums; }
.times { display: flex; flex-wrap: wrap; gap: 4px; }
.time { padding: 0 5px; border: 1px solid var(--soft); color: var(--accent); font-weight: 600; text-decoration: none; font-variant-numeric: tabular-nums; white-space: nowrap; scroll-margin-top: 80px; }
a.time:hover { border-color: var(--accent); background: var(--accent); color: var(--paper); }
span.time { color: var(--muted); }
.time:target { outline: 2px solid var(--accent); outline-offset: 1px; }
.c-status { width: 9rem; text-align: right; }
.c-status form { margin: 0; }
.c-status select { max-width: 100%; padding: 0 2px; border: 1px solid transparent; border-radius: 0; background: transparent; color: var(--muted); font-size: .8rem; }
.c-status select:hover, .c-status select:focus-visible { border-color: var(--soft); }
.format-inline { display: none; }
.empty { margin: 14px 8px; }

@media (max-width: 850px) {
  .week-grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; }
  .week-day { flex: 0 0 176px; scroll-snap-align: start; }
  .week-popover { display: none; position: static; width: 100%; min-width: 0; max-height: none; margin-top: 4px; grid-column: 1 / -1; box-shadow: none; visibility: visible; opacity: 1; transition: none; }
  .week-film:hover .week-popover, .week-film:focus-visible .week-popover,
  .week-more:hover .week-popover, .week-more:focus-visible .week-popover { display: block; }
  .c-format, .listing thead .h-format { display: none; }
  .format-inline { display: inline; color: var(--muted); font-size: .85em; }
}
@media (max-width: 620px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-menu { border-bottom: 1px solid var(--soft); }
  .filter-menu:nth-child(even) { border-right: 0; }
  .filter-menu > summary { padding: 6px 10px; }
  .filter-actions { justify-content: flex-end; }
  .date-menu .date-panel { left: auto; right: 0; }
  .listing thead { display: none; }
  .listing .day-row th { top: 0; }
  .listing table, .listing tbody, .listing .day-row, .listing .day-row th { display: block; }
  .listing tbody.film { display: block; padding: 6px 0; border-top: 1px solid var(--hair); }
  .listing tbody.film tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; }
  .listing tbody.film td { display: block; width: auto; padding: 1px 2px; border: 0; }
  .listing tbody.film td:empty, .listing tbody.film td.c-format, .listing tbody.film td.c-year { display: none; }
  .year-inline { display: inline; }
  .c-title { grid-column: 1 / -1; }
  .c-venue, .c-when { grid-column: 1; font-size: .9em; }
  .c-times { grid-column: 1 / -1; }
  .c-status { grid-column: 2; grid-row: 2; }
}

/* ---- Sign-in page ---- */
.login-page { width: min(360px, 100%); margin: 40px auto; padding: 20px 16px 16px; }
.login-page form { display: grid; gap: 6px; }
.login-page label { color: var(--muted); }
.login-page input:not([type="hidden"]) { width: 100%; margin-bottom: 8px; padding: 6px 8px; border: 1px solid var(--soft); border-radius: 0; background: var(--paper); }
.login-page input:focus-visible { border-color: var(--accent); }
.login-page [role="alert"] { margin: 0 0 12px; padding: 6px 8px; border: 1px solid var(--accent); color: var(--accent); }
.login-page .button { justify-self: start; margin-top: 4px; }
