/* timeline.css: Timetable frame: hour ruler, 劇場 corner button, rows, theater name column and its menu, idle / festival chips, row drag, bands. */
/* ---------- timeline ---------- */
.timeline { position: relative; overflow-x: auto; background: var(--surface);
  border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
@media (min-width: 900px) {
  .timeline { margin: 0 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); }
}
.grid { position: relative; }
/* The hour ruler lives outside the scrolling timeline so it can stick under the header;
   its horizontal position follows the timeline's scroll. */
/* Stuck 1px up so its top line and the header's bottom line become one. */
.ruler { position: sticky; top: calc(var(--top-h, 1px) - 1px); z-index: 6; transition: top .22s var(--ease); height: 27px; overflow: hidden; background: var(--surface);
  border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); }
.ruler::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; z-index: 1; width: var(--label-w);
  background: var(--surface); border-right: 1px solid var(--line); }
.ruler-in { position: relative; height: 100%; will-change: transform; }
/* The axis, kept to one row: hour numbers on a faint wash of the time of day (morning gold to
   late-night violet, scrolling with them), and along its bottom edge a hairline scrollbar for the
   whole day that thickens under a finger, with dots for the picked shows. */
/* Tall enough for the two-line theaters button in its corner. */
.ruler { height: 40px; }
.ruler .hours { height: 100%; }
/* The time of day as one continuous line along the top edge of the hours, scrolling with them:
   morning gold, daytime sky, evening orange, night indigo. */
.ruler .hours::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--tod-line); }
/* The theaters button is the whole corner cell, flat like the ruler next to it: what it does, then the current state. */
.sort-btn { position: absolute; left: 0; top: 0; bottom: 0; z-index: 2; width: var(--label-w); padding: 0 6px 0 38px;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 3px;
  border: 0; background: none; color: var(--ink); font-family: var(--font-ja); text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; }
.sort-btn .do { display: flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 700; line-height: 1.1; }
.sort-btn .do svg { width: 12px; height: 12px; flex: none; margin-left: 2px; translate: 0 1px; opacity: .7; }
/* The icon stands beside both lines, in the middle, so the icon and the two lines read as one button. */
.sort-btn .do svg.lead { position: absolute; left: 11px; top: 50%; translate: 0 -50%; width: 20px; height: 20px; margin: 0; opacity: 1; }
/* The count lines up under "劇場", not under the icon, so the two lines read as one label beside it. */
.sort-btn .st { font-size: 10.5px; color: var(--muted); line-height: 1.1; }
.sort-btn .st b { color: var(--accent); font-weight: 700; }
/* Hover only where there is one: on phones a tapped button would keep the tint after its menu closes. */
@media (hover: hover) { .sort-btn:hover { background: var(--surface-2); } }
.sort-btn:active { background: var(--surface-2); }
@media (max-width: 600px) { .sort-btn { padding: 0 6px 0 36px; gap: 4px; } .sort-btn .do svg.lead { left: 9px; } .sort-btn .do { font-size: 13px; } .sort-btn .st { font-size: 11.5px; } }
.sort-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.label-menu button[aria-checked="true"] { font-weight: 700; }
.label-menu button[aria-checked="true"]::after { content: "✓"; margin-left: auto; color: var(--accent); }
.daymap { position: absolute; left: var(--label-w); right: 0; bottom: 0; z-index: 2; height: 12px; padding: 0 8px;
  display: flex; align-items: flex-end; cursor: ew-resize; touch-action: none; }
.daymap:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.daymap-track { position: relative; display: block; width: 100%; height: 2px; margin-bottom: 2px; border-radius: 2px;
  background: color-mix(in srgb, var(--ink) 12%, transparent); transition: height .15s var(--ease); }
.daymap:hover .daymap-track, .daymap.active .daymap-track, .daymap:focus-visible .daymap-track { height: 5px; }
.daymap-track .win { position: absolute; top: 0; bottom: 0; border-radius: 2px; background: var(--ink); opacity: .55; }
.daymap-track .pick { position: absolute; top: 50%; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 1.5px var(--surface); }
:root { --tod-morning: #e5b53c; --tod-day: #6fb3d6; --tod-evening: #e2814a; --tod-night: #3d4a8c; --tod-late: #2a2140; }
:root[data-theme="dark"] { --tod-morning: #d9a92e; --tod-day: #4f93b8; --tod-evening: #d0703a; --tod-night: #5867b8; --tod-late: #6c5a9c; }
/* Before data: the ruler keeps its place with a placeholder line (see the skeleton rules), its controls hidden. */
.ruler:has(.hours:empty) .sort-btn, .ruler:has(.hours:empty) .daymap { visibility: hidden; }
/* The ruler sits outside the timeline's scroller: a sideways swipe on it is handed to the timeline (js/boot.js). */
.ruler { touch-action: pan-y; }
.timeline { border-top: 0; }
@media (min-width: 900px) {
  .ruler { margin: 0 16px; border: 1px solid var(--line-strong); border-bottom-color: var(--line); border-radius: var(--radius) var(--radius) 0 0; }
  .timeline { border-top: 0; border-radius: 0 0 var(--radius) var(--radius); }
}
.hours { position: relative; height: 26px; margin-left: var(--label-w); }
.hours span { position: absolute; top: 6px; font-size: 11px; color: var(--muted); transform: translateX(-50%); }
.row { position: relative; height: var(--row-h); border-top: 1px solid var(--line); }
/* Rows off screen skip layout and paint until scrolled near (their height is fixed, so nothing jumps). */
.grid > .row { content-visibility: auto; contain-intrinsic-size: auto var(--row-h); }
.row:first-child { border-top: 0; }
.label { position: sticky; left: 0; z-index: 3; width: var(--label-w); height: 100%;
  background: var(--surface); border-right: 1px solid var(--line); padding: 6px 10px 6px 14px;
  font-family: var(--font-ja); font-size: 12px; font-weight: var(--label-weight); line-height: 1.35;
  display: flex; flex-direction: column; justify-content: center;
  /* Names wrap only at the zero-width spaces the scrapers put in short_name. */
  word-break: keep-all; overflow-wrap: anywhere; }
.label small { font-weight: var(--ja-light); color: var(--muted); font-size: 10.5px; }
/* Phones: a narrower name column. The short name (with its zero-width-space breaks) fits it in two lines;
   compact rows use the abbr (イメフォ, ヴェーラ…) instead. The menu still shows the full name. */
.label .abbr { display: none; }
@media (max-width: 600px) {
  :root { --label-w: 80px; }
  .label { padding: 6px 6px 6px 12px; }
  /* Normal rows fit the full name in two lines; compact rows are too short, so they use the abbr. */
  :root[data-density="compact"] .label .full { display: none; }
  :root[data-density="compact"] .label .abbr { display: block; word-break: keep-all; overflow-wrap: normal; }
}
/* A theater's name opens its own menu (この館だけ / 隠す / 公式サイト). */
.label[data-label] { cursor: pointer; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.label[data-label]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (hover: hover) { .label[data-label]:hover { background: var(--surface-2); } }
.label-menu { position: fixed; z-index: 45; min-width: 200px; padding: 6px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, .16);
  font-family: var(--font-ja); font-size: 13px; }
.label-menu[hidden] { display: none; }
.label-menu b { display: block; padding: 6px 10px 8px; font-size: 12px; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.label-menu button, .label-menu a { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius);
  background: none; color: inherit; font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.label-menu button:hover, .label-menu a:hover, .label-menu :focus-visible { background: var(--surface-2); outline: none; }
.label-menu svg { width: 15px; height: 15px; color: var(--muted); }
.label::before { content: ""; position: absolute; left: 6px; top: 50%; width: 5px; height: 5px; border-radius: 50%;
  background: var(--tc); transform: translateY(-50%); }
.row.idle { height: 36px; }
/* Theaters with nothing on the day, below the rows: chips on two lines, pinned to the visible width. */
/* Above the timeline, one line that scrolls sideways; its height is kept even before data arrives
   or when every theater has shows, so the timeline never jumps. */
.idle-group { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px 8px; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; font-family: var(--font-ja); white-space: nowrap; }
.idle-group::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .idle-group { padding-inline: 18px; } }
/* Like the date strip: fade the edge that has more chips beyond it, so on a phone it reads as "scroll". */
.idle-group.more-r { -webkit-mask: linear-gradient(90deg, #000 calc(100% - 56px), transparent); mask: linear-gradient(90deg, #000 calc(100% - 56px), transparent); }
.idle-group.more-l:not(.more-r) { -webkit-mask: linear-gradient(90deg, transparent, #000 40px); mask: linear-gradient(90deg, transparent, #000 40px); }
.idle-wrap { position: relative; }
.idle-next { position: absolute; right: 6px; top: 2px; width: 28px; height: 28px; display: none; place-items: center; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--bg); color: var(--ink); cursor: pointer; }
.idle-next svg { width: 14px; height: 14px; rotate: -90deg; }
.idle-wrap:has(.idle-group.more-r) .idle-next { display: grid; }
.idle-group.more-l.more-r { -webkit-mask: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 56px), transparent); mask: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 56px), transparent); }
.idle-line { display: flex; align-items: center; gap: 6px; flex: none; }
.idle-line + .idle-line { margin-left: 10px; padding-left: 12px; border-left: 1px solid var(--line); }
.idle-what { flex: none; font-size: 11px; color: var(--muted); }
.idle-chip { display: inline-flex; flex: none; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border: 1px solid var(--line);
  border-radius: 13px; background: var(--surface); color: var(--ink); font: inherit; font-size: 12px; cursor: pointer; }
.idle-chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--tc); flex: none; }
/* A festival on now: a warmer chip than the idle ones, leading the line. */
.fest-chip { display: inline-flex; flex: none; align-items: center; gap: 6px; height: 28px; padding: 0 8px 0 10px; border: 1px solid var(--tc);
  border-radius: 999px; background: color-mix(in srgb, var(--tc) 14%, var(--surface)); color: var(--ink); font-family: var(--font-ja);
  font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.fest-chip b { color: var(--tc); font-weight: 700; }
.fest-chip small { color: var(--muted); font-size: 11px; }
.fest-chip svg { width: 12px; height: 12px; rotate: -90deg; opacity: .7; }
.prog-chip { --tc: var(--accent); color: var(--ink); text-decoration: none; }
.idle-line.fest + .idle-line { margin-left: 10px; padding-left: 12px; border-left: 1px solid var(--line); }
.idle-chip small { color: var(--muted); font-size: 11px; }
.idle-chip:hover { background: var(--surface-2); border-color: var(--line-strong); }
.idle-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Not published yet: dashed, since it will fill in later. */
.idle-line.later .idle-chip { border-style: dashed; color: var(--muted); }
/* Drag a theater's rows straight from the timeline. The grip takes the place of the colour dot. */
.row { transition: translate .18s var(--ease); }
.row.lifting { z-index: 5; transition: none; box-shadow: 0 10px 28px rgba(0, 0, 0, .18); }
.lgrip { position: absolute; left: 0; top: 50%; translate: 0 -50%; width: 13px; height: 30px; display: grid; place-items: center;
  color: var(--tc); cursor: grab; touch-action: none; opacity: 0; transition: opacity .12s var(--ease); }
.lgrip svg { width: 12px; height: 14px; }
@media (hover: hover) {
  .label:hover .lgrip { opacity: 1; }
  .label.has-grip:hover::before { opacity: 0; }
}
@media (hover: none) {
  .lgrip { opacity: 1; }
  .label.has-grip::before { display: none; }
}
.row.lifting .lgrip { cursor: grabbing; opacity: 1; }
.grid.reordering .ladder-wrap { opacity: 0; }
.row.idle .label { flex-direction: row; align-items: center; gap: 10px; width: max-content; border-right: 0; white-space: nowrap; }
.track { position: absolute; top: 0; bottom: 0; left: var(--label-w); }
.vline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); opacity: .6; }
.now { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--accent); z-index: 2; }
.now::before { content: ""; position: absolute; top: 0; left: -3px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

.row.has-band { height: calc(var(--row-h) + 20px); }
.row.has-band .show { top: 26px; }
.band { position: absolute; top: 6px; height: 16px; display: flex; align-items: center; gap: 6px;
  font-family: var(--font-ja); font-weight: var(--ja-light); font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; }
.band::before { content: ""; flex: none; width: 8px; height: 1px; background: var(--tc); }
.band::after { content: ""; flex: 1; height: 1px; background: color-mix(in srgb, var(--tc) 40%, transparent); min-width: 8px; }
.band span { overflow: hidden; text-overflow: ellipsis; }

