/* Shared controls for the DORA and Software Factory players. */
:root {
  --v8-font-family: var(--typeface);
  --v8-font-family-mono: Courier,"Courier New",monospace;
  --v8-font-size-2xs: .625rem;
  --v8-font-size-xs: .6563rem;
  --v8-font-size-sm: .7188rem;
  --v8-font-size-md: .75rem;
  --v8-font-size-base: .8125rem;
  --v8-font-size-lg: .9375rem;
  --v8-font-size-xl: 1.0625rem;
  --v8-font-size-2xl: 1.1875rem;
  --v8-font-size-3xl: 1.375rem;
  --v8-tracking-caps: .1em;
  --v8-tracking-tight: -.025em;
  --v8-color-fg: var(--ink);
  --v8-color-fg-muted: var(--muted);
  --v8-color-accent: var(--navy);
}

button,input,select { font: inherit; }

button,select { cursor: pointer; }

button {
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: 10px;
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  font-size: 14px;
}

button:hover,select:hover { background: var(--masthead); }

button:focus-visible,select:focus-visible,input:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; }

.chrome {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(1100px,calc(100% - 40px));
  padding: 8px 16px 9px;
  background: var(--canvas);
  border-radius: 16px;
  box-shadow: 0 3px 16px rgb(0 24 113 / .12);
  z-index: 3;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.transport,.options { display: flex; align-items: center; gap: 3px; }

.primary {
  background: var(--navy);
  color: white;
  font-size: 13px;
  font-weight: 600;
  min-width: 52px;
  box-shadow: 0 4px 12px -3px rgba(32,59,80,.45);
}

.primary:hover { background: var(--navy-hover); }

#clock {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  margin-left: 8px;
  color: #66758a;
  white-space: nowrap;
}

#chapters-toggle { font-size: 14px; max-width: 420px; justify-content: space-between; gap: 15px; }

#chapter-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chevron { color: #8792a5; }

select {
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 8px;
  color: #5e6b80;
  font-size: 14px;
}

button[aria-pressed=true] { background: var(--masthead); color: var(--navy); }

#fullscreen { font-size: 20px; }

#scrub {
  width: 100%;
  height: 3px;
  accent-color: var(--navy);
  cursor: pointer;
  margin: 4px 0 9px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(90deg,var(--navy) var(--pct,0%),var(--line-highlight) var(--pct,0%));
  border-radius: 3px;
}

#scrub::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--navy);
  box-shadow: 0 2px 6px rgb(0 24 113 / .3);
  border: 2px solid #fff;
}

#scrub::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--navy);
  border: 2px solid #fff;
}

#chapter-ticks {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 11px;
  height: 5px;
  pointer-events: none;
}

#chapter-ticks i { position: absolute; height: 5px; width: 1px; background: var(--line-highlight); }

.chapter-menu {
  position: absolute;
  bottom: 85px;
  left: 50%;
  transform: translateX(-50%);
  width: min(960px, calc(100vw - 40px));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line-highlight);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .8), 0 2px 4px rgb(30 45 80 / .05),
    0 24px 60px -12px rgb(40 50 110 / .24);
  max-height: 65dvh;
  overflow: auto;
  z-index: 4;
}

@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .chapter-menu {
    background: rgb(232 238 247 / .66);
    background: color-mix(in srgb, var(--masthead) 66%, transparent);
    -webkit-backdrop-filter: blur(14px) saturate(125%);
    backdrop-filter: blur(14px) saturate(125%);
  }
}

.chapter-menu[hidden] { display: none; }

.chapter-menu button {
  min-width: 0;
  min-height: 50px;
  height: auto;
  justify-content: flex-start;
  font-size: 1.3rem;
  line-height: 1.35;
  text-align: left;
  gap: 10px;
  padding: 8px 10px;
}

.chapter-menu button > .num + span {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.chapter-menu button[aria-current=true] {
  background: var(--masthead);
  background: color-mix(in srgb, var(--masthead) 90%, var(--navy));
  color: var(--navy);
}

.chapter-menu button :is(.num, .duration) {
  flex: none;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}


.drawer {
  position: absolute;
  right: 20px;
  top: 20px;
  bottom: 112px;
  width: min(400px,calc(100vw - 40px));
  background: var(--panel);
  border: 1px solid var(--line-highlight);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 2px 4px rgba(30,45,80,.05),0 24px 70px -14px rgba(40,50,110,.28);
  backdrop-filter: blur(25px);
  z-index: 5;
  overflow: auto;
}

.drawer[hidden] { display: none; }

.drawer h2 { font-size: 22px; font-weight: 600; margin: 0; color: var(--navy); }

.drawer p { font-size: 15px; line-height: 1.55; color: #5f7084; }

.drawer header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }

.drawer header button { font-size: 22px; }

@media (max-width: 900px) {
  .toolbar { gap: 3px; }
  .options button { font-size: 13px; padding: 0 7px; }
  #chapters-toggle { max-width: 270px; font-size: 13px; }
  .chrome { width: calc(100% - 20px); }
}

@media (max-width: 760px) {
  .chapter-menu { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 650px) {
  .chrome { bottom: 8px; padding: 8px; }
  .toolbar { flex-wrap: wrap; }
  .transport { flex: 1; }
  .options { gap: 0; }
  #chapters-toggle {
    order: 3;
    width: 100%;
    max-width: none;
    height: 29px;
    justify-content: center;
  }
  .options button { min-width: 27px; padding: 0 6px; }
  .chapter-menu { bottom: 120px; }
  .drawer { top: 50px; bottom: 130px; right: 10px; width: calc(100vw - 20px); }
  #clock { font-size: 12px; margin-left: 2px; }
  #speed { padding: 5px; }
  .toolbar button { min-width: 29px; }
}

@media (max-width: 650px) and (orientation: landscape) {
  .chrome { bottom: 3px; }
  .drawer { top: 10px; bottom: 85px; }
  .chapter-menu { bottom: 90px; }
}

button,.toolbar,#chapters-toggle { font-size: var(--v8-font-size-base); font-weight: 500; }

.primary { font-size: var(--v8-font-size-md); font-weight: 600; }

#clock { font-size: var(--v8-font-size-sm); color: var(--v8-color-fg-muted); }

select { font-size: var(--v8-font-size-md); color: var(--v8-color-fg-muted); }

.drawer h2 { font-size: var(--v8-font-size-2xl); font-weight: 600; letter-spacing: var(--v8-tracking-tight); }

.drawer p { font-size: var(--v8-font-size-base); color: var(--v8-color-fg-muted); }

#clock, #speed, .chapter-menu :is(.num,.duration) { font-family: var(--v8-font-family-mono); }

.chrome[hidden] { display: none; }
