:root {
  --bg: #d8d6d1;
  --fg: #000000;
  --muted: #4f4d4a;
  --card: #c7c5c0;
  --line: #a3a19c;
  --accent: #f0d839; /* highlighter yellow, after Cahiers du Cinéma covers */
  --masthead: #e2e0db; /* banner band, a step lighter than the page */
}

* { box-sizing: border-box; }

/* stop iOS from inflating text in landscape orientation */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

::selection { background: var(--accent); color: var(--fg); }

body {
  margin: 0;
  font-family: "EB Garamond", Garamond, Georgia, "Times New Roman", serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}

/* Condensed grotesque display type, after the Cahiers du Cinéma masthead. */
h1, h2 {
  font-family: Oswald, "Arial Narrow", "Helvetica Neue Condensed", sans-serif;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Highlighter sweep under the page heading, like the cover's yellow marks. */
h1 {
  display: inline-block;
  font-size: 2.2rem;
  margin: 0.5rem 0 1rem;
  background: linear-gradient(transparent 62%, var(--accent) 62%);
}

h2 { font-size: 1.5rem; }

.site-header {
  padding: 0 2rem;
  border-bottom: 1px solid var(--fg);
}

/* banner band, after the Cahiers du Cinéma covers */
.masthead {
  margin: 0 -2rem;
  padding: 1.5rem 2rem 1.25rem;
  background: var(--masthead);
  text-align: center;
}

.site-title {
  color: var(--fg);
  font-family: "Playfair Display", Didot, "Bodoni MT", "Times New Roman", serif;
  font-size: 2.4rem;
  line-height: 1;
  text-decoration: none;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* yellow rule between title and subtitle, like the cover's yellow marks */
.masthead-rule {
  width: 4.5rem;
  height: 4px;
  background: var(--accent);
  margin: 0.7rem auto 0;
}

/* subtitle line under the masthead, like the cover's issue strip */
.site-subtitle {
  margin: 0.5rem 0 0;
  font-family: "EB Garamond", Garamond, Georgia, serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--fg);
}

.tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; padding-bottom: 0; }

.tab {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-family: Oswald, "Arial Narrow", "Helvetica Neue Condensed", sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tab.active { background: var(--accent); color: var(--fg); }
.tab.active:hover { text-decoration: underline; }
.tab:hover { background: var(--fg); color: #ffffff; }

main { max-width: 62rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

.day-list { list-style: none; padding: 0; }
.day-list li { margin: 0.25rem 0; }
.day-list a { color: var(--fg); text-decoration: none; }
.day-list a:hover { text-decoration: underline; }

/* Day grid: screening times as rows, cinemas as columns. */
.grid-wrap {
  overflow-x: auto;
  margin-top: 1rem;
  /* keep horizontal swipes inside the grid instead of scrolling the page */
  overscroll-behavior-x: contain;
}

table.grid {
  width: 100%;
  /* collapse-mode borders slide out from under sticky cells */
  border-collapse: separate;
  border-spacing: 0;
}

table.grid th {
  font-family: Oswald, "Arial Narrow", "Helvetica Neue Condensed", sans-serif;
  color: var(--fg);
  font-size: 0.85rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 2px solid var(--fg);
}

table.grid td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  min-width: 9rem;
}

table.grid td.empty { background: transparent; }

/* cinema names in the header row link to the cinemas' websites */
table.grid thead th a { color: inherit; text-decoration: none; }
table.grid thead th a:hover { text-decoration: underline; }
table.grid tbody th.time-col,
table.grid thead th.time-col {
  font-family: "EB Garamond", Garamond, Georgia, serif;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  width: 1%;
  background: var(--accent);
  position: sticky;
  left: 0;
  z-index: 1;
  border-right: 1px solid var(--line);
}

/* the empty top-left corner cell stays paper-coloured */
table.grid thead th.time-col { background: var(--bg); }

/* Stripe entire rows, not just filled cells; the sticky time column needs
   its own opaque override to match the row it sits in. */
table.grid tbody tr:nth-child(odd) td,
table.grid tbody tr:nth-child(odd) th.time-col { background: var(--card); }
table.grid tbody tr:nth-child(odd) th.time-col { background: var(--accent); }

/* Larger tap target for the title link inside dense grid cells. */
.film a { color: var(--fg); text-decoration: none; padding: 0.15rem 0; }
.film a:hover { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }

/* "older films" filter: build-time class on 2010+ films, toggled by filter.js;
   films without a known release year stay visible */
body.only-old .film.film-new { display: none; }

/* "only evening" filter: build-time class on 18:00+ rows, toggled by filter.js */
body.only-evening table.grid tbody tr:not(.row-evening) { display: none; }

.film-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 0.25rem;
}

.filter-btn {
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--fg);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.filter-btn:hover { color: var(--fg); }
.filter-btn[aria-pressed="true"] { background: var(--fg); color: var(--bg); }

.film-meta {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1rem 0 2rem;
}

/* Phones: tighten spacing and lower the cinema-column floor so the grid
   needs less horizontal scrolling; the sticky time column keeps rows
   readable while swiping. */
@media (max-width: 640px) {
  .site-header { padding: 0 1rem; }
  .masthead { margin: 0 -1rem; padding: 1.1rem 1rem 1rem; }
  .site-title { font-size: 1.9rem; }
  .site-subtitle { font-size: 0.65rem; letter-spacing: 0.18em; }
  main { padding: 1rem 0.5rem 2.5rem; }

  /* single scrollable tab strip instead of several wrapped rows; the mask
     fades both edges out to hint that the strip continues */
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    padding-bottom: 0.25rem;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 32px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 32px), transparent 100%);
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 0.55rem 0.9rem; white-space: nowrap; }

  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.25rem; }

  table.grid th { padding: 0.45rem 0.5rem; font-size: 0.75rem; letter-spacing: 0.04em; }
  table.grid td { padding: 0.4rem 0.5rem; min-width: 7rem; }

  .film { font-size: 0.9rem; }
  .film a { padding: 0.3rem 0; }
  .film-meta { font-size: 0.72rem; }

  .film-filter { gap: 0.4rem; }
  .filter-btn { padding: 0.55rem 0.9rem; }
}
