/* The Balcony — main stylesheet
 *
 * Two palettes are defined below. To swap, change which one is active in :root.
 * The HTML / templates don't need to change — they reference the variables only.
 *
 * Palette A — neutral white-and-charcoal  (currently active)
 * Palette B — peony (commented out below; uncomment to try)
 */

:root {
  /* ── Palette A: NEUTRAL (active) ────────────────────────── */
  --bg:        #FFFFFF;
  --ink:       #1a1a1a;
  --ink-soft:  #333333;
  --muted:     #888888;
  --muted-2:   #b5b5b5;
  --rule:      #e5e5e5;
  --rule-soft: #f0f0f0;
  --hover-bg:  #f7f7f5;
  --tag-bg:    #f1f1ed;
  --accent:    #1a1a1a;   /* same as ink for now — no accent color */
  --accent-2:  #1a1a1a;

  /* ── Palette B: PEONY (mockup palette — to enable, copy values up to A) ──
  --bg:        #FFFFFC;
  --ink:       #1D2508;
  --ink-soft:  #2a3210;
  --muted:     #7a6f66;
  --muted-2:   #b5ada4;
  --rule:      #CED1C6;
  --rule-soft: #e8e8df;
  --hover-bg:  #F1F2E0;
  --tag-bg:    #F1F2E0;
  --accent:    #93AE40;
  --accent-2:  #7B3F5C;
  */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Libre Franklin', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--ink);
  text-decoration: none;
  transition: color .12s ease;
}
a:hover { color: var(--muted); }

/* ─── Layout container ─────────────────────────────────────── */

.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ─── Header / masthead ────────────────────────────────────── */

header {
  padding: 40px 0 16px;
  border-bottom: 1px solid var(--ink);
  background: #f4f6f5;     /* soft tint above the line; body stays pure white below */
}

.header-nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
}

header h1 {
  /* Baseline (kept as reference): font-size: 28px; font-weight: 700; letter-spacing: -0.02em; */
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 0.02em;  /* positive tracking — better for all-caps "BALKON" */
  margin: 0;
  line-height: 1.1;
}

/* When the wordmark is the textured masthead image (replaces the plain
   "BALKON" text). Sized for the header's available width. */
.balkon-mark {
  display: block;
  max-width: 384px;
  width: 100%;
  height: auto;
}
@media (max-width: 640px) {
  .balkon-mark { max-width: 288px; }
}
header h1 a { color: inherit; }

.subtitle {
  display: none;          /* hidden for now — masthead image speaks for itself.
                             Reveal by removing this line. */
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 6px 0 0;
  font-weight: 500;
  text-align: center;
  max-width: 320px;
}
@media (max-width: 640px) {
  .subtitle { max-width: 240px; }
}

.header-nav > div:last-child {
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.header-nav > div:last-child a {
  color: var(--ink-soft);
}
.header-nav > div:last-child a:hover { color: var(--ink); }

/* ─── Main content ─────────────────────────────────────────── */

main.container { padding-top: 24px; padding-bottom: 80px; }

/* ─── Filters / search / chips ─────────────────────────────── */

.filters { margin-bottom: 28px; }

.search-form { margin-bottom: 16px; }

.search-input {
  width: 100%;
  padding: 12px 16px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
  transition: border-color .12s ease;
}
.search-input:focus {
  outline: none;
  border-color: var(--ink);
}
.search-input::placeholder { color: var(--muted-2); }

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 6px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule-soft);
}
.filter-group:last-of-type { border-bottom: none; }

.city-filter {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}

.filter-btn {
  display: inline-block;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
  transition: all .12s ease;
}
.filter-btn:hover {
  color: var(--ink);
  border-color: var(--ink);
  text-decoration: none;
}
.filter-btn.active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

.date-select {
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
  cursor: pointer;
}
.date-select:focus { outline: none; border-color: var(--ink); }

/* ─── Filter bar (collapsible Theaters / Format popovers) ──── */

.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-pop {
  position: relative;
}
.filter-pop[open] .filter-pop-caret { transform: rotate(180deg); }

.filter-pop-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: border-color .12s ease;
}
.filter-pop-btn::-webkit-details-marker { display: none; }
.filter-pop-btn:hover { border-color: var(--ink); }
.filter-pop[open] .filter-pop-btn {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

.filter-pop-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  background: var(--ink);
  color: var(--bg);
  border-radius: 999px;
}
.filter-pop[open] .filter-pop-count {
  background: var(--bg);
  color: var(--ink);
}
.filter-pop-caret {
  font-size: 10px;
  transition: transform .15s ease;
}

.filter-pop-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  min-width: 320px;
  max-width: 540px;
  max-height: 400px;
  overflow-y: auto;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.10);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ─── Active filter chips (shown when selections exist) ────── */

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -4px 0 20px;
}
.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--bg);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 999px;
  text-decoration: none;
  transition: background .12s ease;
}
.active-filter-chip:hover {
  background: var(--ink-soft);
  color: var(--bg);
  text-decoration: none;
}
.active-filter-x {
  font-size: 14px;
  line-height: 1;
  font-weight: 500;
  opacity: 0.7;
}

/* ─── Date strip (horizontal scrollable date picker) ───────── */

.date-strip-wrap {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 16px;
}

.date-strip-nav {
  flex: 0 0 auto;
  width: 28px;
  align-self: center;
  height: 44px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  font-weight: 400;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all .12s ease;
}
.date-strip-nav:hover {
  color: var(--bg);
  background: var(--ink);
  border-color: var(--ink);
}

.date-strip {
  flex: 1 1 0;
  min-width: 0;            /* allow shrinking inside flex parent */
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  /* Hide scrollbar visually but keep it functional */
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
.date-strip::-webkit-scrollbar { height: 6px; }
.date-strip::-webkit-scrollbar-track { background: transparent; }
.date-strip::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }

.date-cell {
  flex: 0 0 auto;
  scroll-snap-align: start;
  /* Compute cell width so EXACTLY 7 cells fill the visible strip width.
     The 48px subtracted accounts for the 6 gaps between 7 cells (6×8). */
  min-width: calc((100% - 48px) / 7);
  padding: 8px 10px 10px;
  text-align: center;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 6px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
  transition: all .12s ease;
  line-height: 1.1;
}
.date-cell:hover {
  color: var(--ink);
  border-color: var(--ink);
  text-decoration: none;
}
.date-cell.active {
  color: var(--bg);
  background: var(--ink);
  border-color: var(--ink);
}

/* "All dates" sits outside the scrollable area entirely (flex sibling
   of the strip). Stays in place visually as the strip scrolls. */
.date-cell-pin {
  flex: 0 0 auto;
  align-self: center;
  /* Same width as a date cell. The wrap has: pin + 2 arrows + strip + 3 gaps.
     Strip contains 7 cells with 6 internal gaps. For pin = cell, solve:
       wrap = 8*cell + 56 (arrows) + 24 (3 wrap gaps) + 48 (6 strip gaps) = 8*cell + 128
       cell = (wrap - 128) / 8
     100% here = wrap container width. */
  min-width: calc((100% - 128px) / 8);
  background: var(--bg);
}
.date-cell-pin.active {
  background: var(--ink);
}
.date-cell-day {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: inherit;
  opacity: 0.7;
  font-weight: 600;
}
.date-cell-label {
  font-size: 14px;
  font-weight: 700;
  color: inherit;
  font-variant-numeric: tabular-nums;
}
.date-cell-sub {
  font-size: 11px;
  color: inherit;
  opacity: 0.6;
  font-weight: 500;
  margin-top: 1px;
}

/* ─── Film detail hero (poster + meta) ─────────────────────── */

.film-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 36px;
  align-items: start;
  padding: 16px 0 36px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 24px;
}
.film-hero-poster {
  flex: 0 0 auto;
  width: 180px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--rule-soft);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.film-hero-poster img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}
.film-hero-body {
  padding-top: 4px;
}
.film-hero-eyebrow {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.film-hero-title {
  font-size: 32px;
  font-weight: 500;
  margin: 4px 0 8px;
  letter-spacing: -0.015em;
  line-height: 1.15;
}
.film-hero-year {
  color: var(--muted);
  font-weight: 400;
}
.film-hero-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 14px;
}
.film-hero-overview {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.65;
  margin: 12px 0 16px;
  max-width: 560px;
}
.film-hero-counts {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-top: 1px solid var(--rule-soft);
  padding-top: 12px;
  margin-top: 8px;
}

/* Mobile: stack poster on top, smaller */
@media (max-width: 640px) {
  .film-hero { grid-template-columns: 1fr; gap: 20px; padding-bottom: 24px; }
  .film-hero-poster { width: 160px; }
  .film-hero-title { font-size: 26px; }
}

/* ─── Screening list ───────────────────────────────────────── */

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

.screening-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 24px;
  align-items: start;
}
.screening-item:first-child { padding-top: 0; }

/* Date dividers — used when viewing "All dates" to group the listing by day.
   Display as a quiet sectional header, not a regular list item. */
.date-divider {
  padding: 40px 0 12px;
  border-bottom: none;
  list-style: none;
}
.date-divider:first-child { padding-top: 16px; }
.date-divider span {
  display: block;
  font-family: 'Barlow Condensed', 'Helvetica Neue Condensed', sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #064e23;                      /* deep forest green */
  padding-bottom: 12px;
  border-bottom: 3px solid #064e23;
}

/* Per-theater grouped variant — used on /film/<id> and /director/<name>
   where one card shows a theater header and multiple dates underneath.
   Overrides the home-page two-column layout to stack everything vertically. */
.screening-item-grouped {
  display: block;
}
.screening-item-grouped .screening-main {
  margin-bottom: 4px;
}
.screening-item-grouped .screening-meta {
  grid-column: auto;
}
.screening-item-grouped .showtimes {
  grid-column: auto;
  grid-row: auto;
  justify-content: flex-start;
  max-width: none;
}

.screening-main {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.screening-title {
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.005em;
  line-height: 1.3;
}
.screening-title:hover { color: var(--muted); text-decoration: none; }

.theater-name {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* On the film detail page, the "title" of each grouped block is the
   theater name. Bold it there so it reads as a heading for the dates
   underneath, with extra top spacing so it feels like a section break. */
.screening-item-grouped {
  padding-top: 32px;
}
.screening-item-grouped:first-child {
  padding-top: 12px;       /* first theater doesn't need the big gap */
}
.screening-item-grouped .screening-title {
  font-weight: 700;
}

.screening-meta {
  grid-column: 1;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.screening-meta .dot { color: var(--muted-2); }

.tag {
  display: inline-block;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: var(--tag-bg);
  border-radius: 3px;
}

/* Special-event tags (Q&A, live music, shadow cast, intro, etc.) — purpose
   is to flag screenings where something more than a normal showing is
   happening. Distinct from the format tag (35mm/IMAX) which is projection. */
.tag-event {
  background: #fdf2e0;
  color: #6b3a00;
}

.series-name {
  font-style: italic;
  color: var(--muted);
}

.showtimes {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  flex-wrap: nowrap;        /* all showtimes stay on one line; heart sits at the end */
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.showtime {
  display: inline-block;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
  transition: all .12s ease;
}
.showtime:hover {
  color: var(--bg);
  background: var(--ink);
  border-color: var(--ink);
  text-decoration: none;
}
.showtime.sold-out {
  color: var(--muted-2);
  background: var(--rule-soft);
  border-color: var(--rule);
  text-decoration: line-through;
  pointer-events: none;
}

/* ─── Bookmark / save button ───────────────────────────────── */

.bookmark-btn {
  width: 32px;
  height: 32px;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
  transition: all .12s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.bookmark-btn:hover {
  color: var(--ink);
  border-color: var(--ink);
}
.bookmark-btn.saved {
  color: var(--bg);
  background: var(--accent-2);
  border-color: var(--accent-2);
}

/* ─── City row (NYC / LA scope toggle — sits above tabs) ───── */

.city-row {
  display: flex;
  gap: 6px;
  margin: 0 0 16px;
}

/* ─── View tabs (All / Special Events) ─────────────────────── */

.view-tabs {
  display: flex;
  gap: 0;
  margin: 0 0 20px;
  border-bottom: 1px solid var(--rule);
}
.view-tab {
  padding: 12px 20px;
  font-family: 'Barlow Condensed', 'Helvetica Neue Condensed', sans-serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .12s ease, border-color .12s ease;
}
.view-tab:hover {
  color: var(--ink);
  text-decoration: none;
}
.view-tab.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
  font-weight: 700;
}
.view-tab .count {
  color: var(--muted-2);
  font-weight: 400;
  margin-left: 4px;
}

/* Showtime button with a special event — subtle accent so users can
   spot the Q&A times when a film has mixed showings (some with Q&A,
   some regular). Hover state still applies. */
.showtime-special {
  border-color: var(--ink) !important;
  font-weight: 700;
}

/* ─── Empty state ──────────────────────────────────────────── */

.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 16px;
  font-size: 14px;
}

/* ─── Footer ───────────────────────────────────────────────── */

footer {
  border-top: 1px solid var(--rule);
  padding: 32px 0 48px;
  margin-top: 64px;
}
footer p {
  margin: 0;
  font-size: 11px;
  color: var(--muted-2);
  letter-spacing: 0.04em;
  line-height: 1.8;
}

/* ─── Responsive ───────────────────────────────────────────── */

@media (max-width: 640px) {
  .container { padding: 0 20px; }
  header { padding: 28px 0 12px; }
  header h1 { font-size: 24px; }
  main.container { padding-top: 24px; padding-bottom: 64px; }
  .screening-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .showtimes {
    grid-column: 1;
    grid-row: auto;
    justify-content: flex-start;
  }
  .filter-group { gap: 6px; }
  .filter-btn { padding: 5px 10px; font-size: 12px; }
}
