/* Timeline Creator: shared styles. Black on white, red accents; AMOLED dark theme. */
.tlc-vars {
  --bg: #ffffff;
  --fg: #000000;
  --muted: #5f5f5f;
  --faint: #ececec;
  --line: #000000;
  --red: #e3000f;
  --on-red: #ffffff;
  --font: "Helvetica Neue", Helvetica, "Nimbus Sans", "Arial Nova", Arial, system-ui, sans-serif;
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
.tlc-vars[data-theme="dark"] {
  --bg: #000000;
  --fg: #ffffff;
  --muted: #a6a6a6;
  --faint: #1c1c1c;
  --line: #ffffff;
  --red: #ff2d2d;
  --on-red: #000000;
}
@media (prefers-color-scheme: dark) {
  .tlc-vars[data-theme="system"] {
    --bg: #000000;
    --fg: #ffffff;
    --muted: #a6a6a6;
    --faint: #1c1c1c;
    --line: #ffffff;
    --red: #ff2d2d;
    --on-red: #000000;
  }
}

.tlc {
  position: relative;
  background: var(--bg);
  padding: 28px clamp(16px, 4vw, 48px) 20px;
  line-height: 1.4;
  text-align: left;
}
.tlc *, .tlc-lens, .tlc-lens * { box-sizing: border-box; }

/* Guard against theme styles leaking into controls (WordPress) */
.tlc button, .tlc-lens button {
  font: inherit; color: inherit; background: none; border: 0; margin: 0; padding: 0;
  text-transform: none; letter-spacing: normal; box-shadow: none; border-radius: 0;
  min-height: 0; min-width: 0; line-height: 1.2; cursor: pointer; text-decoration: none;
}
.tlc button:focus-visible, .tlc-lens button:focus-visible, .tlc a:focus-visible, .tlc-lens a:focus-visible {
  outline: 2px solid var(--red); outline-offset: 2px;
}

/* Keep theme typography (WordPress) from overriding the widget */
.tlc h2, .tlc h3, .tlc p, .tlc label, .tlc li, .tlc span, .tlc-lens h3, .tlc-lens p {
  font-family: var(--font); text-transform: none; letter-spacing: normal;
}
.tlc p, .tlc-lens p { margin-left: 0; margin-right: 0; }

/* Header */
.tlc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px 32px; flex-wrap: wrap; }
.tlc-head-text { min-width: 0; flex: 1 1 420px; }
.tlc .tlc-title {
  margin: 0; font-size: clamp(28px, 4vw, 48px); line-height: 1; font-weight: 700;
  letter-spacing: -0.03em; max-width: 20ch; color: var(--fg);
}
.tlc .tlc-desc { margin: 12px 0 0; color: var(--muted); font-size: 15px; line-height: 1.45; max-width: 62ch; }
.tlc-actions { display: flex; gap: 8px; flex: none; }

.tlc .tlc-btn, .tlc-lens .tlc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border: 1.5px solid var(--fg); color: var(--fg);
  font-size: 14px; font-weight: 600; background: transparent; white-space: nowrap;
  transition: background-color .12s, color .12s, border-color .12s;
}
.tlc .tlc-btn:hover, .tlc-lens .tlc-btn:hover { background: var(--fg); color: var(--bg); }
.tlc .tlc-btn-red { background: var(--red); border-color: var(--red); color: var(--on-red); }
.tlc .tlc-btn-red:hover { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.tlc .tlc-btn-small, .tlc-lens .tlc-btn-small { height: 30px; padding: 0 10px; font-size: 13px; }
.tlc .tlc-btn-quiet { border-color: transparent; }
.tlc .tlc-btn-quiet:hover { border-color: var(--fg); }

/* Stage */
.tlc-stage {
  position: relative; height: clamp(420px, 62vh, 760px); margin-top: 24px; overflow: hidden;
  touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; outline: none;
}
.tlc-stage.is-dragging { cursor: grabbing; }
.tlc-stage:focus-visible { box-shadow: inset 0 0 0 2px var(--red); }
.tlc-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--faint); pointer-events: none; }
.tlc-tick span {
  position: absolute; bottom: 6px; left: 6px; font-size: 12px; color: var(--muted);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.tlc-axis { position: absolute; left: 0; right: 0; height: 2px; margin-top: -1px; background: var(--line); pointer-events: none; }
.tlc-axis-hl { position: absolute; height: 4px; margin-top: -2px; background: var(--red); display: none; pointer-events: none; }
.tlc-now { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px solid var(--red); margin-left: -1px; pointer-events: none; }
.tlc-now span { position: absolute; top: 4px; left: 6px; font-size: 12px; font-weight: 700; color: var(--red); }
.tlc-empty {
  position: absolute; inset: 0; display: flex; align-items: flex-start; justify-content: center; padding-top: 28%;
  color: var(--muted); font-size: 15px; pointer-events: none; text-align: center; padding: 0 24px;
}

.tlc-ev { position: absolute; width: 0; height: 0; }
.tlc-stem { position: absolute; z-index: 0; left: -0.5px; width: 1px; background: var(--line); }
.tlc .tlc-dot {
  position: absolute; z-index: 3; border-radius: 50%; border: 1.5px solid var(--line); background: var(--bg);
  overflow: hidden; display: grid; place-items: center; color: var(--fg);
  transition: border-color .15s, background-color .15s;
}
.tlc .tlc-dot.is-plain { background: var(--fg); }
.tlc .tlc-dot img, .tlc .tlc-list .th img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.tlc-dot svg { width: 62%; height: 62%; display: block; pointer-events: none; }
.tlc-label {
  position: absolute; z-index: 2; transform: translateY(-50%); background: var(--bg); padding: 1px 6px 1px 4px;
  white-space: nowrap; line-height: 1.2; cursor: pointer;
}
.tlc-label .t { display: block; font-weight: 700; font-size: 13px; max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.tlc-label .d { display: block; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tlc[data-labels="hover"] .tlc-label { display: none; }
.tlc-span { position: absolute; z-index: 1; height: 2px; background: var(--line); }
.tlc-span-end { position: absolute; z-index: 1; width: 2px; height: 12px; background: var(--line); }

.tlc-ev:hover .tlc-stem, .tlc-ev.is-active .tlc-stem,
.tlc-ev:hover .tlc-span, .tlc-ev.is-active .tlc-span,
.tlc-ev:hover .tlc-span-end, .tlc-ev.is-active .tlc-span-end { background: var(--red); }
.tlc .tlc-ev:hover .tlc-dot, .tlc .tlc-ev.is-active .tlc-dot { border-color: var(--red); }
.tlc .tlc-ev:hover .tlc-dot.is-plain, .tlc .tlc-ev.is-active .tlc-dot.is-plain { background: var(--red); }
.tlc-ev:hover .tlc-label .t, .tlc-ev.is-active .tlc-label .t { color: var(--red); }
.tlc-ev:hover, .tlc-ev.is-active { z-index: 5; }

/* Footer */
.tlc-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap;
  margin-top: 12px; font-size: 13px; color: var(--muted);
}
.tlc-range { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.tlc-zoom { display: flex; gap: 6px; align-items: center; }
.tlc .tlc-zoom .tlc-btn { min-width: 36px; padding: 0 10px; }

/* Drawer */
.tlc-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); z-index: 100001;
  background: var(--bg); color: var(--fg); border-left: 2px solid var(--fg);
  overflow-y: auto; overscroll-behavior: contain; padding: 22px 24px 40px;
  transform: translateX(100%); visibility: hidden; transition: transform .22s ease, visibility 0s .22s;
}
.tlc-drawer.is-open { transform: none; visibility: visible; transition: transform .22s ease; }
.tlc-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.tlc .tlc-drawer-head h2 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--fg); }
.tlc-sec { border-top: 1px solid var(--faint); padding: 18px 0; }
.tlc-sec:first-of-type { border-top: 0; }
.tlc .tlc-sec h3 { margin: 0 0 10px; font-size: 15px; font-weight: 700; color: var(--fg); }
.tlc-hint { margin: 8px 0 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
.tlc-seg { display: flex; border: 1.5px solid var(--fg); }
.tlc .tlc-seg button { flex: 1; height: 34px; font-size: 13px; font-weight: 600; padding: 0 6px; }
.tlc .tlc-seg button + button { border-left: 1.5px solid var(--fg); }
.tlc .tlc-seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.tlc .tlc-preset {
  display: block; width: 100%; text-align: left; padding: 12px 0; border-top: 1px solid var(--faint);
}
.tlc .tlc-preset:first-child { border-top: 0; }
.tlc-preset strong { display: block; font-size: 15px; font-weight: 700; }
.tlc-preset span { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); line-height: 1.35; }
.tlc .tlc-preset:hover strong { color: var(--red); }
.tlc-inline { display: flex; gap: 8px; margin-top: 8px; }
.tlc-stack { display: flex; flex-wrap: wrap; gap: 8px; }

.tlc-field { margin-top: 14px; }
.tlc-field > label, .tlc-field > .tlc-flabel { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--fg); }
.tlc input[type="text"], .tlc input[type="number"], .tlc input[type="url"], .tlc select, .tlc textarea {
  width: 100%; height: 38px; padding: 0 10px; font: inherit; font-size: 15px; color: var(--fg);
  background: var(--bg); border: 1.5px solid var(--fg); border-radius: 0; box-shadow: none; margin: 0;
}
.tlc textarea { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; line-height: 1.4; }
.tlc input:focus, .tlc select:focus, .tlc textarea:focus { outline: 2px solid var(--red); outline-offset: -1px; border-color: var(--red); }
.tlc-row { display: flex; gap: 8px; }
.tlc-row > * { min-width: 0; }
.tlc-row > input { flex: 1 1 45%; }
.tlc-row > select { flex: 1 1 55%; }
.tlc-check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; cursor: pointer; }
.tlc-check input { width: 16px; height: 16px; accent-color: var(--red); margin: 0; }
.tlc-err { color: var(--red); font-size: 13px; margin: 6px 0 0; font-weight: 600; }
.tlc-imgprev { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.tlc .tlc-imgprev img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 1.5px solid var(--fg); }
.tlc-formbar { display: flex; gap: 8px; margin-top: 22px; position: sticky; bottom: -40px; padding: 12px 0 16px; background: var(--bg); }

.tlc .tlc-list { list-style: none; margin: 12px 0 0; padding: 0; }
.tlc .tlc-list li { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--faint); }
.tlc-list .th { width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--fg); overflow: hidden; display: grid; place-items: center; }
.tlc-list .th.is-plain { width: 12px; height: 12px; background: var(--fg); justify-self: center; }
.tlc-list .th img { width: 100%; height: 100%; object-fit: cover; }
.tlc-list .th svg { width: 70%; height: 70%; }
.tlc-list .tx { min-width: 0; }
.tlc-list .tx strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tlc-list .tx span { display: block; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tlc-list .ac { display: flex; gap: 4px; }

/* Lens: the enlarged picture + card */
.tlc-lens {
  position: fixed; z-index: 100002; width: 272px; display: flex; flex-direction: column; align-items: center;
  opacity: 0; transform: scale(.21); pointer-events: none; line-height: 1.4; -webkit-touch-callout: none;
  transition: transform .24s cubic-bezier(.2, .8, .2, 1), opacity .14s;
}
.tlc-lens.is-open { opacity: 1; transform: none; pointer-events: auto; }
.tlc-lens.is-flipped { flex-direction: column-reverse; }
.tlc-lens[hidden] { display: none; }
.tlc-lens-disc {
  width: 168px; height: 168px; flex: none; border-radius: 50%; border: 2px solid var(--red);
  background: var(--bg); color: var(--fg); overflow: hidden; display: grid; place-items: center;
}
.tlc-lens .tlc-lens-disc img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tlc-lens-disc svg { width: 58%; height: 58%; display: block; }
.tlc-lens-body {
  width: 100%; margin-top: 12px; background: var(--bg); color: var(--fg);
  border: 1.5px solid var(--fg); border-top: 3px solid var(--red); padding: 14px 16px 16px;
}
.tlc-lens.is-flipped .tlc-lens-body { margin: 0 0 12px; }
.tlc-lens.no-disc .tlc-lens-body { margin: 0; }
.tlc-lens h3 { margin: 0 0 4px; font-size: 17px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; color: var(--fg); }
.tlc-lens .date { margin: 0; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tlc-lens .dur { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.tlc-lens .cap { margin: 10px 0 0; font-size: 14px; line-height: 1.45; }
.tlc-lens .src { margin: 10px 0 0; font-size: 12px; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }
.tlc-lens a { color: var(--red); text-decoration: underline; text-underline-offset: 2px; }
.tlc-lens .row { display: flex; gap: 8px; margin-top: 12px; }

.tlc-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100003;
  background: var(--fg); color: var(--bg); padding: 10px 14px; font-size: 14px; font-weight: 600;
  max-width: min(520px, calc(100vw - 32px)); opacity: 0; pointer-events: none; transition: opacity .2s;
}
.tlc-toast.is-on { opacity: 1; pointer-events: auto; }
.tlc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 600px) {
  .tlc-stage { height: clamp(420px, 70vh, 640px); }
  .tlc-hintline { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tlc-lens, .tlc-drawer, .tlc-dot, .tlc-toast { transition: none !important; }
}

/* First run: choose a timescale */
.tlc-start {
  position: absolute; inset: 0; z-index: 20; background: var(--bg); color: var(--fg);
  display: flex; align-items: flex-start; justify-content: center; overflow-y: auto;
  padding: clamp(16px, 4vw, 48px);
}
.tlc-start-box { width: min(560px, 100%); }
.tlc .tlc-start-title {
  margin: 0 0 8px; font-size: clamp(24px, 3.4vw, 38px); line-height: 1.05; font-weight: 700; letter-spacing: -0.03em;
}
.tlc-start-list { margin-top: 18px; border-top: 1px solid var(--faint); }
.tlc .tlc-start-opt {
  display: block; width: 100%; text-align: left; padding: 13px 44px 13px 0; border-bottom: 1px solid var(--faint);
  position: relative;
}
.tlc-start-opt strong { display: block; font-size: 16px; font-weight: 700; }
.tlc-start-opt span { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); }
.tlc .tlc-start-opt:hover strong, .tlc .tlc-start-opt:focus-visible strong { color: var(--red); }
.tlc .tlc-start-opt::after {
  content: ""; position: absolute; right: 12px; top: 50%; width: 10px; height: 10px; margin-top: -5px;
  border-right: 2px solid var(--fg); border-top: 2px solid var(--fg); transform: rotate(45deg);
}
.tlc .tlc-start-opt:hover::after { border-color: var(--red); }
.tlc .tlc-start-opt.is-default { border-left: 3px solid var(--red); padding-left: 12px; }
.tlc-start .tlc-row input[type="date"] { flex: 1 1 50%; }

/* Press and hold menu */
.tlc-menu {
  position: fixed; z-index: 100004; min-width: 200px; background: var(--bg); color: var(--fg);
  border: 1.5px solid var(--fg); border-top: 3px solid var(--red); padding: 6px 0;
  font-family: var(--font); box-shadow: none;
}
.tlc-menu-head {
  margin: 0; padding: 6px 14px 8px; font-size: 12px; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--faint);
}
.tlc-menu .tlc-menu-item {
  display: block; width: 100%; text-align: left; padding: 10px 14px; font-size: 14px; font-weight: 600;
  background: none; border: 0; color: inherit; cursor: pointer; font-family: var(--font);
}
.tlc-menu .tlc-menu-item:hover, .tlc-menu .tlc-menu-item:focus-visible { background: var(--fg); color: var(--bg); outline: none; }

/* Splash: shown once on load; the button click is the user gesture Fullscreen needs */
.tlc-splash {
  position: absolute; inset: 0; z-index: 40; background: var(--bg); color: var(--fg);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  text-align: center;
}
.tlc-splash-box { display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 380px; }
.tlc .tlc-splash-kicker {
  margin: 0 0 4px; font-size: 13px; font-weight: 700; color: var(--muted);
  max-width: 32ch; line-height: 1.3;
}
.tlc .tlc-splash-go { height: 52px; padding: 0 28px; font-size: 16px; }
.tlc .tlc-splash-skip { height: 34px; font-size: 13px; color: var(--muted); }
.tlc .tlc-splash-skip:hover { background: transparent; color: var(--fg); border-color: transparent; text-decoration: underline; }

/* When an element goes fullscreen, size it and its stage to the real screen */
.tlc:fullscreen, .tlc:-webkit-full-screen, .tlc:-ms-fullscreen {
  width: 100%; height: 100%; background: var(--bg);
  padding-top: max(28px, env(safe-area-inset-top, 0px));
  padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
}
.tlc:fullscreen .tlc-stage, .tlc:-webkit-full-screen .tlc-stage, .tlc:-ms-fullscreen .tlc-stage {
  height: clamp(420px, calc(100vh - 220px), 900px);
}

/* Inline-editable title */
.tlc-title-wrap { position: relative; }
.tlc .tlc-title.is-editable { cursor: pointer; }
.tlc .tlc-title.is-editable:hover, .tlc .tlc-title.is-editable:focus-visible {
  color: var(--red); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 8px;
}
.tlc .tlc-title-input {
  display: block; width: 100%; max-width: 640px; height: auto; margin: 0; padding: 0 0 4px;
  font-size: clamp(28px, 4vw, 48px); line-height: 1; font-weight: 700; letter-spacing: -0.03em;
  color: var(--fg); background: transparent; border: 0; border-bottom: 2px solid var(--red);
}
.tlc .tlc-title-input[hidden] { display: none; }
.tlc .tlc-title-input:focus { outline: none; }

/* Save dropdown items (shares .tlc-menu with the press-and-hold menu) */
.tlc-menu-label {
  margin: 6px 0 0; padding: 8px 14px 4px; font-size: 12px; font-weight: 700; color: var(--muted);
  border-top: 1px solid var(--faint);
}
.tlc-menu-note { margin: 4px 0 0; padding: 6px 14px 8px; font-size: 12px; color: var(--muted); line-height: 1.35; }

/* Drag affordances (editor mode only) */
.tlc-editor .tlc-dot { cursor: grab; }
.tlc-editor .tlc-stage.is-dragging .tlc-dot { cursor: grabbing; }
.tlc-editor .tlc-span-end { cursor: ew-resize; position: relative; }
.tlc-editor .tlc-span-end::before {
  content: ""; position: absolute; left: -7px; right: -7px; top: -8px; bottom: -8px;
}

/* Toast with an inline action, e.g. "Event deleted  Undo" */
.tlc-toast-action {
  margin-left: 8px; font-weight: 700; text-decoration: underline; text-underline-offset: 2px;
  background: none; border: 0; color: inherit; cursor: pointer; font: inherit; padding: 0;
}

/* Events list: a thin "Now" divider between past and upcoming events */
.tlc .tlc-list-divider { grid-template-columns: 1fr; padding: 6px 0; }
.tlc .tlc-list-divider .now-row {
  display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; color: var(--red);
}
.tlc .tlc-list-divider .now-row::before, .tlc .tlc-list-divider .now-row::after {
  content: ""; flex: 1; height: 1px; background: var(--red); opacity: .45;
}

/* Full-bleed embed: spans the viewport even inside a narrow theme column.
   The width and left offset are set in JS (measured, so no scrollbar overflow). */
.tlc.tlc-fullbleed {
  max-width: none;
  box-sizing: border-box;
  padding-left: clamp(16px, 4vw, 56px);
  padding-right: clamp(16px, 4vw, 56px);
}
.tlc.tlc-fullbleed .tlc-stage { height: clamp(440px, 68vh, 820px); }
