/* WP Read It — player styles. Colors are CSS variables so every theme (and the accent picker) is just a set of values. */

.wp-readit-bar {
  --ri-bg: #faf8f4;
  --ri-fg: #221f1f;
  --ri-line: #e7e0d3;
  --ri-accent: #b4976f;
  --ri-on-accent: #221f1f;
  --ri-radius: 3px;
  --ri-shadow: 0 1px 0 rgba(34,31,31,.04), 0 10px 28px -14px rgba(34,31,31,.28);

  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 1.5em 0;
  padding: 16px 18px;
  background: var(--ri-bg);
  color: var(--ri-fg);
  border: 1px solid var(--ri-line);
  border-radius: var(--ri-radius);
  box-shadow: var(--ri-shadow);
  font-size: 15px;
  line-height: 1.4;
  text-align: left;
  color-scheme: light;
}
.wp-readit-bar[hidden], .wp-readit-panel[hidden] { display: none; }
.wp-readit-bar *, .wp-readit-bar *::before, .wp-readit-bar *::after { box-sizing: border-box; }

/* ---------- Themes ---------- */
.wp-readit-theme-light {
  --ri-bg: #f6f6f5; --ri-line: #e2e1df; --ri-radius: 8px;
  --ri-shadow: 0 2px 10px rgba(0,0,0,.07);
}
.wp-readit-theme-dark {
  --ri-bg: #221f1f; --ri-fg: #f3efe7; --ri-line: #3b3836; --ri-accent: #c6aa7e; --ri-on-accent: #221f1f;
  --ri-shadow: 0 12px 30px -14px rgba(0,0,0,.6);
  color-scheme: dark;
}
.wp-readit-theme-minimal {
  --ri-bg: transparent; --ri-shadow: none; --ri-radius: 0;
  color: inherit; border-width: 1px 0; padding: 14px 0;
}
.wp-readit-theme-compact {
  --ri-radius: 999px; padding: 10px 16px 12px; gap: 6px; font-size: 14px;
}
.wp-readit-theme-glass {
  --ri-bg: rgba(255,255,255,.72); --ri-line: rgba(255,255,255,.55); --ri-radius: 14px;
  --ri-shadow: 0 8px 32px rgba(34,31,31,.14);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
}

/* ---------- Header row ---------- */
.wp-readit-main { display: flex; align-items: center; gap: 14px; }
.wp-readit-info { display: flex; align-items: center; gap: 14px; flex: 1 1 auto; min-width: 0; }
.wp-readit-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.wp-readit-title {
  display: block;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 1.15em; letter-spacing: .01em; line-height: 1.2; color: inherit;
}
/* The slanted bar from the logo, kept at the logo's real proportions (about 1:8.8). */
.wp-readit-mark {
  --ri-mark-w: 5px; --ri-mark-h: 44px;
  flex: 0 0 auto; width: var(--ri-mark-w); height: var(--ri-mark-h); background: var(--ri-accent);
  clip-path: polygon(0 12.6%, 95% 0, 100% 85.6%, 16% 100%);
}
/* Where there is no room for the full height we crop it (the lower half, with its angled foot)
   instead of squashing it, so the proportions and the cut stay true to the logo. */
.wp-readit-theme-compact .wp-readit-mark {
  --ri-mark-h: 22px;
  clip-path: polygon(6.8% 0, 97.9% 0, 100% 71.2%, 16% 100%);
}
.wp-readit-meta {
  min-height: 1.2em; font-size: .72em; letter-spacing: .12em; text-transform: uppercase;
  opacity: .68; font-variant-numeric: tabular-nums;
}
.wp-readit-meta:empty { display: none; }
.wp-readit-theme-compact .wp-readit-meta { display: none; }

.wp-readit-actions { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }

/* ---------- Buttons (reset hard: themes love to restyle <button>) ---------- */
.wp-readit-bar .wp-readit-btn,
.wp-readit-bar .wp-readit-speed {
  appearance: none; -webkit-appearance: none; margin: 0; padding: 0;
  font: inherit; letter-spacing: normal; text-transform: none; text-decoration: none;
  box-shadow: none; text-shadow: none; cursor: pointer;
  transition: background-color .18s, filter .18s, transform .12s, opacity .18s;
}
.wp-readit-bar .wp-readit-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 50px; height: 50px; border: 0; border-radius: 50%;
  background: var(--ri-accent); color: var(--ri-on-accent); line-height: 1;
}
.wp-readit-bar .wp-readit-btn:hover { filter: brightness(.93); }
.wp-readit-bar .wp-readit-btn:active { transform: scale(.94); }
.wp-readit-btn svg { display: block; fill: currentColor; }

.wp-readit-bar .wp-readit-ghost {
  width: 38px; height: 38px; background: transparent; color: inherit; border-radius: 50%;
}
.wp-readit-bar .wp-readit-ghost:hover { background: rgba(127,127,127,.16); filter: none; }
.wp-readit-bar .wp-readit-ghost[aria-expanded="true"] { background: rgba(127,127,127,.2); }

.wp-readit-bar .wp-readit-speed {
  min-width: 46px; height: 30px; margin: 0 4px; padding: 0 10px;
  background: transparent; color: inherit; border: 1px solid var(--ri-line); border-radius: 999px;
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1;
}
.wp-readit-bar .wp-readit-speed:hover { border-color: var(--ri-accent); }

.wp-readit-bar button:focus-visible,
.wp-readit-bar select:focus-visible,
.wp-readit-seek:focus-visible { outline: 2px solid var(--ri-accent); outline-offset: 2px; }
.wp-readit-bar button:disabled { opacity: .4; cursor: not-allowed; }

/* Calm idle state: only show what is useful before playback starts */
.wp-readit-bar[data-state="idle"] .wp-readit-back,
.wp-readit-bar[data-state="idle"] .wp-readit-forward,
.wp-readit-bar[data-state="idle"] .wp-readit-stop { display: none; }

/* ---------- Seek bar ---------- */
.wp-readit-timeline { display: block; }
.wp-readit-seek {
  position: relative; height: 30px; cursor: pointer; touch-action: none; border-radius: 4px;
  -webkit-tap-highlight-color: transparent;
}
.wp-readit-track {
  position: absolute; left: 0; right: 0; top: 50%; height: 3px; margin-top: -1.5px;
  background: var(--ri-line); border-radius: 2px; overflow: hidden;
}
.wp-readit-theme-dark .wp-readit-track { background: #3b3836; }
.wp-readit-fill { width: 0; height: 100%; background: var(--ri-accent); }
.wp-readit-thumb {
  position: absolute; top: 50%; left: 0; width: 3.5px; height: 30px; margin: -15px 0 0 -1.75px;
  background: var(--ri-accent); pointer-events: none;
  clip-path: polygon(0 12.6%, 95% 0, 100% 85.6%, 16% 100%);
  transition: transform .15s;
}
.wp-readit-seek:hover .wp-readit-thumb { transform: scaleX(1.6); }
.wp-readit-bar[data-state="idle"] .wp-readit-thumb { opacity: .55; }

/* ---------- Voice panel ---------- */
.wp-readit-panel {
  display: flex; align-items: center; gap: 12px;
  padding-top: 12px; border-top: 1px solid var(--ri-line);
}
.wp-readit-panel-label {
  font-size: .72em; letter-spacing: .12em; text-transform: uppercase; opacity: .68; flex: 0 0 auto;
}
.wp-readit-bar .wp-readit-voice {
  flex: 1 1 auto; min-width: 0; max-width: 100%; margin: 0; height: auto;
  padding: 8px 10px; font: inherit; font-size: 14px; line-height: 1.3;
  color: inherit; background: transparent; border: 1px solid var(--ri-line); border-radius: 3px;
}
.wp-readit-theme-dark .wp-readit-voice { background: rgba(255,255,255,.05); }

/* Visually hidden live region for screen readers */
.wp-readit-sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  .wp-readit-bar { padding: 14px; }
  .wp-readit-main { flex-wrap: wrap; row-gap: 8px; }
  .wp-readit-info { flex-basis: calc(100% - 66px); }
  .wp-readit-actions { width: 100%; justify-content: space-between; }
  .wp-readit-bar .wp-readit-btn:not(.wp-readit-ghost) { width: 46px; height: 46px; }
  .wp-readit-panel { flex-direction: column; align-items: stretch; gap: 6px; }
  .wp-readit-theme-compact { border-radius: 24px; }
}

/* ---------- Docked (sticky) mini-player ---------- */
.wp-readit-placeholder { display: block; }
.wp-readit-bar.wp-readit-docked {
  position: fixed; left: 0; right: 0; margin: 0 auto;
  width: min(720px, calc(100% - 24px));
  z-index: var(--wp-readit-z, 9990);
  padding: 8px 12px 13px; gap: 0;
  box-shadow: 0 10px 30px -8px rgba(34,31,31,.35), 0 0 0 1px var(--ri-line);
}
.wp-readit-bar.wp-readit-dock-top {
  top: calc(var(--ri-dock-top, 0px) + 8px);
  animation: wp-readit-in-top .22s ease-out;
}
.wp-readit-bar.wp-readit-dock-bottom {
  top: auto; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  animation: wp-readit-in-bottom .22s ease-out;
}
@keyframes wp-readit-in-top    { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes wp-readit-in-bottom { from { opacity: 0; transform: translateY(8px); }  to { opacity: 1; transform: none; } }

/* Transparent themes need a surface once they float over the article */
.wp-readit-theme-minimal.wp-readit-docked { --ri-bg: #fff; color: #221f1f; border-radius: 3px; }
.wp-readit-theme-glass.wp-readit-docked { --ri-bg: rgba(255,255,255,.88); }
.wp-readit-theme-compact.wp-readit-docked { border-radius: 14px; }

.wp-readit-docked .wp-readit-main { flex-wrap: nowrap; gap: 10px; row-gap: 0; }
.wp-readit-bar.wp-readit-docked .wp-readit-btn:not(.wp-readit-ghost) { width: 40px; height: 40px; }
.wp-readit-bar.wp-readit-docked .wp-readit-ghost { width: 34px; height: 34px; }
.wp-readit-docked .wp-readit-info { flex: 1 1 auto; flex-basis: auto; gap: 10px; }
.wp-readit-docked .wp-readit-actions { width: auto; justify-content: flex-end; }
.wp-readit-docked .wp-readit-mark { --ri-mark-w: 4px; --ri-mark-h: 34px; clip-path: polygon(0 12.6%, 95% 0, 100% 85.6%, 16% 100%); }
.wp-readit-docked .wp-readit-title { font-size: 1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wp-readit-docked .wp-readit-meta { display: block; }
.wp-readit-docked .wp-readit-gear,
.wp-readit-docked .wp-readit-panel { display: none; }

/* The seek bar becomes a slim strip on the edge nearest the page */
.wp-readit-docked .wp-readit-timeline { position: absolute; left: 0; right: 0; bottom: 0; }
.wp-readit-docked .wp-readit-seek { height: 12px; }
.wp-readit-docked .wp-readit-track { top: auto; bottom: 0; margin: 0; height: 3px; border-radius: 0; }
.wp-readit-docked .wp-readit-thumb { display: none; }
.wp-readit-dock-bottom .wp-readit-timeline { top: 0; bottom: auto; }
.wp-readit-dock-bottom .wp-readit-track { top: 0; bottom: auto; }

@media (max-width: 560px) {
  .wp-readit-bar.wp-readit-docked { width: calc(100% - 16px); padding: 7px 10px 12px; }
  .wp-readit-docked .wp-readit-back,
  .wp-readit-docked .wp-readit-forward { display: none; }
  .wp-readit-bar.wp-readit-docked .wp-readit-info { flex-basis: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .wp-readit-bar, .wp-readit-bar * { transition: none !important; animation: none !important; }
}
@media print { .wp-readit-bar { display: none; } }
