/* chart-mode — the rules that only ever match inside this engine, moved out of
   core/styles.css so other pages don't download them. Loaded by core/app.js after
   core/styles.css (the ENGINES table's css). */

/* Minor events have no card, so their dot carries a small label just above the
   axis (tick labels sit below it, so the two never collide). */
.marker .minor-label {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: .03em;
  color: var(--text-dim);
  white-space: nowrap;
}

.tick-label {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}

/* Optional category accent: JS sets --cat on the card; a stripe rides the top. */
.event .card.has-cat { border-top: 3px solid var(--cat, var(--accent)); }

.event .card .card-body { padding: 14px 16px; }

/* Media banner (image), edge-to-edge above the body. */
.event .card .card-media {
  position: relative;      /* anchors the caption overlay */
  height: 130px;
  background: var(--bg-1) center/cover no-repeat;
  border-bottom: 1px solid var(--card-border);
}

/* Optional caption over the bottom of the image. */
.event .card .card-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 12px 10px 5px;
  font-size: 10px;
  letter-spacing: .03em;
  color: rgba(255, 255, 255, 0.85);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
}

.event .card .card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.event .card h3 .card-icon { margin-right: 6px; }

/* Category pill in the eyebrow line. */
.event .card .cat-pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: .08em;
  /* ink auto-chosen by JS (readableInk) so the label stays legible on any
     category colour — dark text on light fills, white on dark. */
  color: var(--cat-ink, #fff);
  background: var(--cat, var(--accent));
}

/* Row holding the optional actions (More info button + outbound link). */
.event .card .card-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* Optional outbound action (data: `link` / `linkText`). */
.event .card .card-link {
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--accent-soft);
  text-decoration: none;
}

.event .card .card-link:hover { text-decoration: underline; }

/* "More info" button — opens the details panel (data: `details`). */
.event .card .card-more {
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: .03em;
  color: var(--text);
  background: rgba(var(--accent-rgb), 0.14);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 5px 13px;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
}

.event .card .card-more:hover {
  background: rgba(var(--accent-rgb), 0.28);
  border-color: var(--accent-soft);
}

.event.focused .marker-ping {
  position: absolute;
  left: 0;
  width: 26px; height: 26px;
  margin-left: -13px; margin-top: -13px;
  border-radius: 50%;
  border: 2px solid var(--accent-soft);
  animation: ping 1.6s ease-out infinite;
}

.scrub-dot {
  position: relative;
  width: 9px;
  height: 9px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--text-dim);
  opacity: .5;
  cursor: pointer;
  transition: transform .15s ease, opacity .2s ease, background .2s ease;
}

/* The dot stays 9px; an invisible ::before makes a 25px tap target. */
.scrub-dot::before { content: ""; position: absolute; inset: -8px; border-radius: 50%; }

.scrub-dot:hover { opacity: 1; transform: scale(1.3); }

.scrub-dot.on {
  background: var(--accent);
  opacity: 1;
  transform: scale(1.35);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.7);
}

body.tl-touring #exportPdf {
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .3s ease, visibility 0s linear .3s;
}

.band .band-label {
  position: absolute;
  top: 8px;
  left: 12px;
  right: 12px;               /* bound to the band width so the text can wrap */
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: normal;       /* wrap instead of overflowing a narrow band */
  overflow-wrap: break-word;
  line-height: 1.25;
}

/* ---- Portrait (phones): the axis runs top to bottom -----------------------
   engines/timeline.js adds .tl-portrait to #timelineRoot at <=640px wide or <=500px
   tall and lays the world out as one column: the axis down the left (x = 22), and in
   `at` order the band headings, ticks (date lines), minor events and cards, which the
   visitor scrolls. These rules restyle the same nodes for that column. */
#stage { touch-action: none; }   /* drag / pinch are the timeline's own, not the page's */

.tl-portrait #axis {
  background: linear-gradient(180deg,
    transparent 0, var(--line) 1.5%, var(--line-glow) 50%, var(--line) 98.5%, transparent 100%);
}
/* A tick: a short cross-bar on the axis, its date to the right. */
.tl-portrait .tick {
  width: 14px; height: 2px; margin-left: -7px; margin-top: -1px;
  background: var(--line-glow); opacity: .8;
}
.tl-portrait .tick-label {
  top: 50%; left: 23px; transform: translateY(-50%);
  font-size: 12px; letter-spacing: .1em; line-height: 1.35;
  color: var(--accent-soft);
  white-space: normal;
}
/* A minor event: its dot on the axis, the label beside it (wraps). */
.tl-portrait .marker.minor { opacity: .85; }
.tl-portrait .marker .minor-label {
  bottom: auto; top: -6px; left: 19.5px; transform: none;
  font-size: 13px; line-height: 1.35; font-style: italic;
  white-space: normal;
}
/* A band: a full-width row behind its stretch of the column, heading at its top. */
.tl-portrait .band { border-left: 0; border-right: 0; border-top: 1px dashed var(--hairline); }
.tl-portrait .band .band-label { top: 10px; left: 38px; right: 12px; font-size: 12px; letter-spacing: .14em; }
/* A card: a short stem from the axis, a dot in the category colour where it meets it. */
.tl-portrait .event .connector {
  top: 21px; height: 2px; margin-left: 0;
  background: linear-gradient(90deg, var(--cat, var(--line-glow)), rgba(var(--glow-rgb), .3));
}
.tl-portrait .event .connector::before {
  content: ""; position: absolute; left: -5px; top: -4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--cat, var(--line-glow));
  box-shadow: 0 0 0 2px var(--bg-1);
}
.tl-portrait .event.focused .marker-ping { margin-top: -12px; }
.tl-portrait .event.dimmed { opacity: .32; }
.tl-portrait .event .card h3 { font-size: 17px; }
.tl-portrait .event .card p { font-size: 15px; line-height: 1.5; }
.tl-portrait .event .card .date { font-size: 12px; }
.tl-portrait .event .card .cat-pill { font-size: 12px; }
.tl-portrait .event .card .card-more,
.tl-portrait .event .card .card-link { font-size: 14px; min-height: 40px; padding: 8px 16px; }
.tl-portrait .event .card .card-link { display: inline-flex; align-items: center; padding: 0 4px; }

/* The HUD gets its own backdrop (the column scrolls under it); hint and zoom pill go
   (pinch still zooms; the column is life size). A soft scrim under the bottom buttons. */
#timelineRoot.tl-portrait #hud {
  top: 0; padding: 54px 12px 14px;
  background: linear-gradient(var(--bg-1) calc(100% - 18px), transparent);
}
#timelineRoot.tl-portrait #hint,
#timelineRoot.tl-portrait #zoomCtl { display: none; }
#timelineRoot.tl-portrait::after {
  content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: 120px;
  z-index: 5; pointer-events: none;
  background: linear-gradient(transparent, var(--bg-0) 75%);
}
#timelineRoot.tl-portrait #startBtn { bottom: max(36px, env(safe-area-inset-bottom)); }
#timelineRoot.tl-portrait #timelineCredit { z-index: 6; }

/* Sideways phone (<=500px tall): the HUD is one short row under the pills
   (core/styles.css); no dot rail or credit, so the column keeps the height. */
@media (max-height: 500px) {
  #timelineRoot.tl-portrait #hud { padding-top: 28px; }
  #timelineRoot.tl-portrait #scrubber { display: none; }
  #timelineRoot.tl-portrait #timelineCredit { display: none; }
}
