/* The Daily Diary feed — evokes the actual NARA form: ruled columns
   In | Out | P/R | Activity, typewriter-adjacent density, one red accent. */

#wordmark a { color: #fff; text-decoration: none; }
#wordmark .wm-sec { color: #999; font-weight: 400; font-size: 12px; }
#jump {
  margin-left: auto; background: #111; color: #fff; border: 1px solid #333;
  padding: 4px 8px; font: inherit; font-size: 12px; border-radius: 0;
  font-variant-numeric: tabular-nums;
}

#feed-wrap { position: relative; max-width: 860px; margin: 0 auto; padding: 18px 16px 80px; }
#feed { position: relative; }

/* Selectric skin: each day is a sheet of the actual NARA form — typewriter
   face, aged bond paper, double-rule under the letterhead, ruled columns. */
.day {
  position: absolute; top: 0; left: 0; right: 0;
  background: #faf7ef;
  border: 1px solid #d8d2c2;
  box-shadow: 0 1px 2px rgba(35, 24, 13, 0.08);
  font-family: "Courier New", Courier, "Nimbus Mono PS", monospace;
  color: #1d1a14;
}
.d-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 16px 6px; border-bottom: 3px double #1d1a14;
}
.d-date { font-weight: 700; font-size: 13px; letter-spacing: 0.06em; }
.d-place { color: #5a5344; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }

.d-cols, .d-row {
  display: grid; grid-template-columns: 64px 64px 34px 1fr; gap: 10px;
  padding: 3px 16px; align-items: baseline;
}
.d-cols {
  color: #5a5344; font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
  border-bottom: 1px solid #1d1a14; padding-top: 7px; padding-bottom: 4px;
  font-weight: 700;
}
.d-row { border-bottom: 1px dotted #d8d2c2; font-size: 12px; line-height: 1.5; }
.d-row:last-child { border-bottom: 0; }
/* faint vertical rules between columns, like the printed form */
.r-in, .r-out, .r-ph { border-right: 1px solid #e5dfd0; padding-right: 8px; }
.r-in, .r-out { font-variant-numeric: tabular-nums; color: #2a251c; white-space: nowrap; }
.r-ph { color: #5a5344; font-weight: 700; }
.r-act { color: #1d1a14; }

.d-row.taped { background: #fdf0ec; }
.d-pdf { font-family: inherit; }
.r-play {
  margin-left: 8px; background: none; border: 1px solid var(--accent); color: var(--accent);
  font: inherit; font-size: 10.5px; padding: 0 6px; cursor: pointer; border-radius: 0;
  font-variant-numeric: tabular-nums; vertical-align: 1px;
}
.r-play:hover { background: var(--accent); color: #fff; }

.d-loading { padding: 14px; color: var(--faint); }

@media (max-width: 620px) {
  .d-cols, .d-row { grid-template-columns: 48px 48px 24px 1fr; gap: 6px; }
}

/* ── date rail: port of ubu #year-rail (geometry + states identical) ── */
html.date-rail-active { scrollbar-width: none; }
html.date-rail-active::-webkit-scrollbar,
html.date-rail-active body::-webkit-scrollbar { width: 0; height: 0; background: transparent; }

#date-rail {
  position: fixed; top: 41px; right: 0; bottom: 0; width: 20px;
  z-index: 40; pointer-events: none; opacity: 0;
  transition: opacity 120ms ease, width 120ms ease; touch-action: none;
}
#date-rail.active { pointer-events: auto; opacity: 1; }
#date-rail.hovering, #date-rail.dragging { width: 60px; }
#date-rail-track {
  position: absolute; top: 0; right: 0; bottom: 0; width: 100%;
  pointer-events: auto; cursor: pointer; touch-action: none;
}
#date-rail-notches { position: absolute; top: 0; right: 8px; bottom: 0; width: 8px; pointer-events: none; }
.date-band {
  position: absolute; right: 0; width: 8px; min-height: 1px;
  background: rgba(17,17,17,0.08);
  border-left: 1px solid rgba(17,17,17,0.04);
  border-right: 1px solid rgba(255,255,255,0.18);
  box-sizing: border-box; transition: background-color 100ms ease;
}
.date-band.alt { background: rgba(17,17,17,0.16); }
#date-rail.hovering .date-band, #date-rail.dragging .date-band { background: rgba(17,17,17,0.14); }
#date-rail.hovering .date-band.alt, #date-rail.dragging .date-band.alt { background: rgba(17,17,17,0.24); }

#date-current-marker {
  position: absolute; top: 0; right: 8px; width: 8px; height: 20px; min-height: 20px;
  border-radius: 1px; background: rgba(17,17,17,0.62); transform: translateY(0);
  pointer-events: none; box-shadow: 0 0 0 1px rgba(17,17,17,0.08);
}
#date-rail.hovering #date-current-marker, #date-rail.dragging #date-current-marker { background: rgba(17,17,17,0.78); }
#date-hover-marker {
  position: absolute; right: 7px; width: 10px; height: 0;
  border-top: 1px solid var(--accent); transform: translateY(0);
  pointer-events: none; opacity: 0;
}
#date-rail.hovering #date-hover-marker, #date-rail.dragging #date-hover-marker { opacity: 1; }

.date-label {
  position: absolute; right: 28px; transform: translateY(-50%);
  white-space: nowrap; pointer-events: none; font-weight: 500;
  font-variant-numeric: tabular-nums; will-change: transform;
}
.date-label::after {
  content: ""; position: absolute; top: 50%; right: -5px; width: 0; height: 0;
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transform: translateY(-50%);
}
#date-current-label {
  padding: 2px 6px; border-radius: 4px; color: #fff; background: #111;
  border: 1px solid #000; box-shadow: 0 1px 2px rgba(0,0,0,0.16);
  font-size: 11px; line-height: 1.15; opacity: 0; transition: opacity 160ms ease-out;
}
#date-current-label::after { border-left: 5px solid #111; }
#date-rail.hovering #date-current-label, #date-rail.dragging #date-current-label { opacity: 1; }
#date-hover-label {
  right: 30px; padding: 6px 10px; border-radius: 6px; color: var(--fg);
  background: #fff; border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0,0,0,0.18); font-size: 11px; line-height: 1.15; opacity: 0;
}
#date-hover-label::after { border-left: 5px solid #fff; }
#date-rail.hovering #date-hover-label, #date-rail.dragging #date-hover-label { opacity: 1; }

.d-head-right { display: flex; align-items: baseline; gap: 10px; }
.d-pdf { color: var(--faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; }
.d-pdf:hover { color: var(--accent); text-decoration: none; }

/* ── docked player: on wide screens the transcript viewer opens as a RIGHT
   panel; the diary stays live on the left (no scrim, page keeps scrolling) ── */
@media (min-width: 1100px) {
  body.diary.lb-open { overflow: auto; }              /* diary keeps scrolling */
  body.diary #lb { pointer-events: none; }            /* clicks pass to diary */
  body.diary #lb-scrim { display: none; }
  body.diary #lb-panel {
    pointer-events: auto;
    inset: 41px 0 0 auto;                             /* below topbar, right edge */
    width: min(680px, 46vw);
    max-width: none;
    border: 0; border-left: 1px solid #000;
    box-shadow: -12px 0 32px rgba(0, 0, 0, 0.12);
  }
  /* shift the diary column left so it stays fully visible beside the panel */
  body.diary.lb-open #feed-wrap {
    margin-right: calc(min(680px, 46vw) + 24px);
    max-width: none;
    padding-left: 24px;
  }
  /* the date rail lives under the panel — hide while docked */
  body.diary.lb-open #date-rail { display: none; }
}

/* ── media column: per-day photo groups in the scroll flow. Each .mgroup is
   absolutely positioned at its day's Y (same coordinate space as day cards,
   hanging into #feed-wrap's right margin); .mstick pins credits-style. ── */
.mgroup {
  position: absolute; right: -264px; width: 216px;
  pointer-events: none;   /* wrapper spans days; only the stack is interactive */
}
.mstick {
  position: sticky; top: 52px;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: auto;
  overflow-y: auto;                 /* long days scroll inside the stack */
  overscroll-behavior: contain;     /* don't chain-scroll the diary */
  scrollbar-width: thin;
  padding-right: 2px;
}
.mstick::-webkit-scrollbar { width: 4px; }
.mstick::-webkit-scrollbar-thumb { background: #d8d2c2; }
.mg-date { position: sticky; top: 0; background: var(--bg); z-index: 1; }
.mg-date {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
  border-bottom: 2px solid var(--fg); padding-bottom: 4px;
  font-family: "Courier New", Courier, monospace;
}
.mr-item { position: relative; display: block; border: 1px solid var(--line); background: #fff; }
.mr-item img { width: 100%; display: block; filter: saturate(0.92); }
.mr-item:hover { border-color: var(--fg); }
.mr-play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 26px; background: rgba(0,0,0,0.28);
}

/* column needs room: wide screens only; step aside for the docked player */
@media (max-width: 1319px) { .mgroup { display: none; } }
@media (min-width: 1320px) {
  #feed-wrap { margin-right: 292px; margin-left: auto; }
  body.diary.lb-open .mgroup { display: none; }
}

/* ── tape excerpt cards in the media column: narrow typewritten snippets ── */
.mr-tx {
  border: 1px solid #d8d2c2; background: #faf7ef; cursor: pointer;
  padding: 8px 10px; font-family: "Courier New", Courier, monospace;
}
.mr-tx:hover { border-color: var(--accent); }
.tx-head { display: flex; align-items: baseline; gap: 6px; margin-bottom: 5px; }
.tx-play { color: var(--accent); font-size: 10px; }
.tx-title { font-weight: 700; font-size: 10.5px; line-height: 1.3; letter-spacing: 0.02em; }
.tx-lines p { margin: 0 0 3px; font-size: 10px; line-height: 1.45; color: #2a251c; }
.tx-lines b { color: #5a5344; font-weight: 700; }
.tx-more { color: var(--accent) !important; font-size: 9.5px !important; margin-top: 4px !important; }

/* anchored media: items pinned at their diary row's Y */
.mgroup.anchored { }
.manchor { position: absolute; left: 0; right: 0; }
.mg-date-a { position: relative; }

/* ── Xanadu beams: row ↔ media connector curves, marching dashes ── */
.mlink {
  fill: none; stroke: #d9b8ae; stroke-width: 1.5;
  stroke-dasharray: 5 4;
  animation: mlink-flow 1.1s linear infinite;
}
.mlink.hot { stroke: var(--accent); stroke-width: 2; }
@keyframes mlink-flow { to { stroke-dashoffset: -9; } }
.d-row.linked { background: #fdeae4; }
.d-row.linked .r-act { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .mlink { animation: none; } }

/* instant focus circuit: hover a card or its row -> beam + both ends flare */
.mlink { transition: none; }
.mlink.hot {
  stroke: var(--accent); stroke-width: 2.5;
  stroke-dasharray: 6 3; animation-duration: 0.35s;
}
.manchor { cursor: pointer; }
.manchor.hot .mr-item, .manchor.hot .mr-tx {
  border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent);
}
.d-row.linked { background: #fdeae4; transition: none; }
