/* ==========================================================================
   Reader bar — the same controls a visitor had on their reader track (the
   track chip and the Auto / Light / Dark pill), shown on articles only when a
   skin is active. js/reader-bar.js builds it.

   Laptop: a slim bar under the navigation.
   Phone: docked at the bottom, in thumb reach, like the tracks' docked bars.
   Built from theme tokens only, so it matches every skin in light and dark.
   ========================================================================== */

/* On a skinned article the track's pill replaces the header switch, so there is
   one theme control, the same one the visitor used on their track. */
html[data-skin] .nav-container .appearance { display: none; }

.reader-bar {
  position: relative;
  z-index: 15;
  max-width: 1120px;
  margin: 12px auto 0;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.875rem;
}

.reader-track { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.reader-track a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1.5px solid var(--card-border);
  border-radius: var(--card-radius);
  color: var(--text-primary);
  background: var(--card-bg);
  text-decoration: none;
  font-weight: 600;
}
.reader-track a::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.reader-track .reader-change { border: 0; background: none; padding: 0 4px; min-height: 40px; color: var(--accent); font-weight: 500; }
.reader-track .reader-change::before { display: none; }

.reader-theme { display: inline-flex; border: 1.5px solid var(--card-border); border-radius: 999px; overflow: hidden; background: var(--card-bg); }
.reader-theme button {
  font: inherit;
  font-weight: 600;
  font-size: 0.8125rem;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}
.reader-theme button[aria-pressed="true"] { background: var(--text-primary); color: var(--bg-primary); }
.reader-theme button[hidden] { display: none; }
.reader-bar :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Phone: dock both controls at the bottom; keep the article's end clear of it */
@media (max-width: 680px) {
  .reader-bar {
    position: fixed;
    inset: auto 0 0 0;
    margin: 0;
    max-width: none;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--nav-bg);
    border-top: 1.5px solid var(--card-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
  }
  .reader-track .reader-change { display: none; }
  .reader-track a, .reader-theme button { min-height: 44px; }
  html[data-skin] body { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}

@media print { .reader-bar { display: none !important; } }
